From 3bfaadc05412155d153745b09ade7983d42dfcc5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Sep 2013 18:08:50 +0200 Subject: [PATCH] Work on feature to change rule for vat calculation rounding --- htdocs/core/class/html.form.class.php | 6 ++-- htdocs/fourn/facture/fiche.php | 51 ++++++++++++++++----------- htdocs/langs/en_US/compta.lang | 5 +++ htdocs/langs/fr_FR/compta.lang | 5 +++ htdocs/theme/eldy/style.css.php | 6 ---- 5 files changed, 44 insertions(+), 29 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ff31407b5b8..be4257bd174 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -345,9 +345,9 @@ class Form * * @param string $text Text to show * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. - * @param int $tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2 - * @param int $direction -1=Le picto est avant, 0=pas de picto, 1=le picto est apres - * @param string $img Code img du picto (use img_xxx() function to get it) + * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip sur les 2 + * @param int $direction -1=image is before, 0=no image, 1=image is after + * @param string $img Html code for image (use img_xxx() function to get it) * @param string $extracss Add a CSS style to td tags * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span * @param string $incbefore Include code before the text diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index ebcb324f557..f886a714b92 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1521,13 +1521,11 @@ else /* * List of payments */ - $nbrows=7; $nbcols=2; + $nbrows=9; $nbcols=2; if (! empty($conf->projet->enabled)) $nbrows++; if (! empty($conf->banque->enabled)) $nbcols++; // Local taxes - // TODO I use here $societe->localtax1_assuj. Before it was $mysoc->localtax1_assuj, but this is a supplier invoice, so made by supplier, so depends on supplier properties - if ($mysoc->country_code=='ES') { if($mysoc->localtax1_assuj=="1") $nbrows++; @@ -1683,8 +1681,21 @@ else $alreadypaid=$object->getSommePaiement(); print ''.$langs->trans('Status').''.$object->getLibStatut(4,$alreadypaid).''; - print ''.$langs->trans('AmountHT').''.price($object->total_ht).''.$langs->trans('Currency'.$conf->currency).''; - print ''.$langs->trans('AmountVAT').''.price($object->total_tva).''.$langs->trans('Currency'.$conf->currency).''; + print ''.$langs->trans('AmountHT').''.price($object->total_ht,1,$langs,0,-1,-1,$conf->currency).' '; + print ''.$langs->trans('AmountVAT').''.price($object->total_tva,1,$langs,0,-1,-1,$conf->currency).''; + if (! empty($conf->global->MAIN_FEATURES_LEVEL)) + { + if (GETPOST('calculationrule')) $calculationrule=GETPOST('calculationrule','alpha'); + else $calculationrule=(empty($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)?'totalofround':'roundoftotal'); + if ($calculationrule == 'totalofround') $calculationrulenum=1; + else $calculationrulenum=2; + $s=$langs->trans("ReCalculate").' '; + $s.=''.$langs->trans("Mode1").''; + $s.=' / '; + $s.=''.$langs->trans("Mode2").''; + print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc",$calculationrulenum).'
'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('','help')); + } + print ''; // Amount Local Taxes //TODO: Place into a function to control showing by country or study better option @@ -1693,14 +1704,14 @@ else if ($mysoc->localtax1_assuj=="1") //Localtax1 RE { print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; - print ''.price($object->total_localtax1).''; - print ''.$langs->trans("Currency".$conf->currency).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ' '; } if ($societe->localtax2_assuj=="1") //Localtax2 IRPF { print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; - print ''.price($object->total_localtax2).''; - print ''.$langs->trans("Currency".$conf->currency).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ' '; } } else @@ -1708,17 +1719,17 @@ else if ($societe->localtax1_assuj=="1") //Localtax1 RE { print ''.$langs->transcountry("AmountLT1",$societe->country_code).''; - print ''.price($object->total_localtax1).''; - print ''.$langs->trans("Currency".$conf->currency).''; + print ''.price($object->total_localtax1,1,$langs,0,-1,-1,$conf->currency).''; + print ' '; } if ($societe->localtax2_assuj=="1") //Localtax2 IRPF { print ''.$langs->transcountry("AmountLT2",$societe->country_code).''; - print ''.price($object->total_localtax2).''; - print ''.$langs->trans("Currency".$conf->currency).''; + print ''.price($object->total_localtax2,1,$langs,0,-1,-1,$conf->currency).''; + print ' '; } } - print ''.$langs->trans('AmountTTC').''.price($object->total_ttc).''.$langs->trans('Currency'.$conf->currency).''; + print ''.$langs->trans('AmountTTC').''.price($object->total_ttc,1,$langs,0,-1,-1,$conf->currency).' '; // Project if (! empty($conf->projet->enabled)) @@ -2132,13 +2143,13 @@ else } - //Make payments + // Make payments if ($action != 'edit' && $object->statut == 1 && $object->paye == 0 && $user->societe_id == 0) { - print ''.$langs->trans('DoPayment').''; + print ''.$langs->trans('DoPayment').''; } - //Classify paid + // Classify paid if ($action != 'edit' && $object->statut == 1 && $object->paye == 0 && $user->societe_id == 0) { print ''.$langs->trans('ClassifyPaid').''; } - //Validate + // Validate if ($action != 'edit' && $object->statut == 0) { if (count($object->lines)) @@ -2165,13 +2176,13 @@ else } } - //Clone + // Clone if ($action != 'edit' && $user->rights->fournisseur->facture->creer) { print 'socid.'">'.$langs->trans('ToClone').''; } - //Delete + // Delete if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer) { print ''.$langs->trans('Delete').''; diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index fe41e11d08b..d7157286902 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -157,4 +157,9 @@ ByProductsAndServices=By products and services RefExt=External ref ToCreateAPredefinedInvoice=To create a predefined invoice, create a standard invoice then, without validating it, click onto button "Convert to predefined invoice". LinkedOrder=linked to command +ReCalculate=Recalculate +Mode1=Methode 1 +Mode2=Method 2 +CalculationRuleDesc=To calculate total VAT, there is two methods:
Method 1 is rounding vat on each line, then summing them.
Method 2 is summing all vat on each line, then rounding result.
Final result may differs from few cents. Default mode is mode %s. +CalculationRuleDescSupplier=according to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier. diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 362d38ffc8b..6a752b69e10 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -157,4 +157,9 @@ ByProductsAndServices=Par produits et services RefExt=Référence externe ToCreateAPredefinedInvoice=Pour créer une facture prédéfinie, créer une facture standard puis sans la valider, cliquer sur le bouton "Convertir en facture prédéfine". LinkedOrder=Lier à une commande +ReCalculate=Recalculer +Mode1=Mode 1 +Mode2=Mode 2 +CalculationRuleDesc=Pour calculer le total de TVA, il existe 2 modes:
Le mode 1 consiste à arrondir la tva de chaque ligne et à sommer cet arrondi.
Le mode 2 consiste à sommer la tva de chaque ligne puis à l'arrondir.
Les résultats peuvent différer de quelques centimes. Le mode par défaut est le mode %s. +CalculationRuleDescSupplier=Selon le mode utilisé par le fournisseur, choisissez le mode adéquant afin d'appliquer la même règle et obtenir un résultat identique au mode appliqué par votre fournisseur. diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f71c472f0cd..c01d2995db5 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1880,12 +1880,6 @@ div.tabBar .noborder { border: 1px solid #AAA; text-align: center; border-radius: 5px; - background-image: linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); - background-image: -o-linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(255,255,255,.3) 0%, rgba(164,164,164,.3) 100%); - background-image: -webkit-gradient( linear, left bottom, left top, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(164,164,164,.3)) ); } .boxtable {