From 6d0bbf1994146a2b30dee21c500eb883170fd61b Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Mon, 31 Jan 2005 16:30:35 +0000 Subject: [PATCH] Gestion du mode de reglement lors de la creation de la facture --- htdocs/compta/facture.php | 64 ++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index fad30448e5d..66594f53c6b 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -96,7 +96,7 @@ if ($_POST["action"] == 'add') $facture->number = $_POST["facnumber"]; $facture->date = $datefacture; $facture->note = $_POST["note"]; - + if ($_POST["fac_rec"] > 0) { /* @@ -109,6 +109,7 @@ if ($_POST["action"] == 'add') { $facture->projetid = $_POST["projetid"]; $facture->cond_reglement = $_POST["condid"]; + $facture->mode_reglement = $_POST["mode_reglement"]; $facture->amount = $_POST["amount"]; $facture->remise = $_POST["remise"]; $facture->remise_percent = $_POST["remise_percent"]; @@ -459,12 +460,12 @@ if ($_GET["action"] == 'create') print_titre("Emettre une facture"); - if ($propalid) + if ($_GET["propalid"]) { $sql = "SELECT s.nom, s.prefix_comm, s.idp, p.price, p.remise, p.remise_percent, p.tva, p.total, p.ref, ".$db->pdate("p.datep")." as dp, c.id as statut, c.label as lst"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; - $sql .= " AND p.rowid = $propalid"; + $sql .= " AND p.rowid = ".$_GET["propalid"]; } else { @@ -490,7 +491,7 @@ if ($_GET["action"] == 'create') $soc = new Societe($db); $soc->fetch($obj->idp); - print '
'; + print ''; print ''; print '' ."\n"; print ''; @@ -502,7 +503,7 @@ if ($_GET["action"] == 'create') print ''.$langs->trans("Author").' :'.$user->fullname.''; - print ''; + print ''; print ''; print ''.$langs->trans("Date").' :'; @@ -532,15 +533,42 @@ if ($_GET["action"] == 'create') $html->select_array("condid",$conds); print ""; - if ($conf->projet->enabled) { - $langs->load("projects"); - print ''.$langs->trans("Project").' :'; - $proj = new Project($db); - $html->select_array("projetid",$proj->liste_array($socidp)); - print ""; - } else { - print " "; - } + /* Mode de réglement */ + + print "Mode de réglement :"; + $sql = "SELECT id, libelle FROM ".MAIN_DB_PREFIX."c_paiement ORDER BY libelle"; + $result = $db->query($sql); + $modesregl=array(); + if ($result) + { + $num = $db->num_rows(); + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object(); + $modesregl[$objp->id]=$objp->libelle; + $i++; + } + $db->free(); + } + + $html->select_array("mode_reglement",$modesregl); + print ""; + + /* -- */ + + if ($conf->projet->enabled) + { + $langs->load("projects"); + print ''.$langs->trans("Project").' :'; + $proj = new Project($db); + $html->select_array("projetid",$proj->liste_array($socidp)); + print ""; + } + else + { + print " "; + } if ($_GET["propalid"] > 0) { @@ -550,7 +578,7 @@ if ($_GET["action"] == 'create') print ''."\n"; print ''."\n"; print ''."\n"; - print ''; + print ''; print 'Proposition'.$obj->ref.''; print ''.$langs->trans("TotalHT").''.price($amount).''; @@ -674,7 +702,7 @@ if ($_GET["action"] == 'create') print ''.$langs->trans("Price").'RemiseQté.'; $sql = "SELECT pt.rowid, p.label as product, p.ref, pt.price, pt.qty, p.rowid as prodid, pt.remise_percent"; - $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt, ".MAIN_DB_PREFIX."product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propalid"; + $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt, ".MAIN_DB_PREFIX."product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = ".$_GET["propalid"]; $sql .= " ORDER BY pt.rowid ASC"; $result = $db->query($sql); if ($result) @@ -695,7 +723,9 @@ if ($_GET["action"] == 'create') } } $sql = "SELECT pt.rowid, pt.description as product, pt.price, pt.qty, pt.remise_percent"; - $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt WHERE pt.fk_propal = $propalid AND pt.fk_product = 0"; + $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt "; + $sql .= " WHERE pt.fk_propal = ".$_GET["propalid"]; + $sql .= " AND pt.fk_product = 0"; $sql .= " ORDER BY pt.rowid ASC"; if ($db->query($sql)) {