From 346b3023c14233416a014af43f3de82a9318b43a Mon Sep 17 00:00:00 2001 From: marc_ocebo Date: Sun, 1 May 2005 01:06:35 +0000 Subject: [PATCH] =?UTF-8?q?Colonne=20suppl=E9mentaire=20pour=20saisir=20le?= =?UTF-8?q?=20prix=20unitaire=20TTC=20au=20lieu=20de=20HT=20sur=20facture?= =?UTF-8?q?=20fournisseur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/fourn/facture/fiche.php | 37 ++++++++++++++++++++++++++++------ htdocs/langs/en_US/main.lang | 1 + htdocs/langs/fr_FR/main.lang | 1 + 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index f2e12615293..e4d0b1fc1f4 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -134,14 +134,21 @@ if ($_POST["action"] == 'add' && $user->rights->fournisseur->facture->creer) { $label = "label$i"; $amount = "amount$i"; + $amountttc = "amountttc$i"; $tauxtva = "tauxtva$i"; $qty = "qty$i"; - if (strlen($_POST["$label"]) > 0 && $_POST["$amount"] > 0) + if (strlen($_POST[$label]) > 0 && !empty($_POST[$amount])) { $atleastoneline=1; $facfou->addline($_POST["$label"], $_POST["$amount"], $_POST["$tauxtva"], $_POST["$qty"], 1); } + else if (strlen($_POST[$label]) > 0 && empty($_POST[$amount])) + { + $ht = $_POST[$amountttc] / (1 + ($_POST[$tauxtva] / 100)); + $atleastoneline=1; + $facfou->addline($_POST[$label], $ht, $_POST[$tauxtva], $_POST[$qty], 1); + } } $db->commit(); @@ -173,8 +180,13 @@ if ($_GET["action"] == 'add_ligne') { $facfou = new FactureFournisseur($db,"", $_GET["facid"]); - $facfou->addline($_POST["label"], $_POST["amount"], $_POST["tauxtva"], $_POST["qty"]); - + if (strlen($_POST["label"]) > 0 && $_POST["amount"] > 0) + $facfou->addline($_POST["label"], $_POST["amount"], $_POST["tauxtva"], $_POST["qty"]); + else + { + $ht = $_POST['amountttc'] / (1 + ($_POST['tauxtva'] / 100)); + $facfou->addline($_POST["label"], $ht, $_POST["tauxtva"], $_POST["qty"]); + } $_GET["action"] = "edit"; } @@ -264,7 +276,13 @@ if ($_GET["action"] == 'create' or $_GET["action"] == 'copy') print "
"; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; for ($i = 1 ; $i < 9 ; $i++) { @@ -281,9 +299,11 @@ if ($_GET["action"] == 'create' or $_GET["action"] == 'copy') print ''; print ''; print ''; - print ''; + print ''; + print ''; + print ''; } print "
 '.$langs->trans("Label").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("VATRate").'
 '.$langs->trans("Label").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("VATRate").''.$langs->trans("PriceUTTC").'
'.$i.''; + print ''; $html->select_tva("tauxtva".$i); - print '
"; @@ -372,6 +392,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -381,6 +402,7 @@ else { print "".'"; print '"; + print '"; print '"; print '"; print '"; @@ -400,6 +422,9 @@ else print ''; print ''; print ''; + print ''; print ''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 73f6e621a37..c75a4df5370 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -129,6 +129,7 @@ Price=Price UnitPrice=Unit price PriceU=U.P. PriceUHT=U.P. HT +PriceUTTC=U.P. w/ tax Amount=Amount AmountHT=Amount HT AmountTTC=Amount TTC diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 49e56c80dfc..2289ddc7846 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -129,6 +129,7 @@ Price=Prix UnitPrice=Prix unitaire PriceU=P.U. PriceUHT=P.U. HT +PriceUTTC=P.U. TTC Amount=Montant AmountHT=Montant HT AmountTTC=Montant TTC
'.$langs->trans("Label").''.$langs->trans("PriceUHT").''.$langs->trans("PriceUTTC").''.$langs->trans("Qty").''.$langs->trans("TotalHT").''.$langs->trans("VATRate").'
'.$fac->lignes[$i][0]."'.price($fac->lignes[$i][1])."'.price($fac->lignes[$i][1] * (1+($fac->lignes[$i][2]/100)))."'.$fac->lignes[$i][3]."'.price($fac->lignes[$i][4])."'.$fac->lignes[$i][2]."'; + print ''; + print ''; print ''; print '-