Merge pull request #7309 from simnandez/6.0

NEW Add detail of all tax rates into pdf column tax sale.
This commit is contained in:
Laurent Destailleur 2017-08-30 16:47:42 +02:00 committed by GitHub
commit b65db49868
4 changed files with 86 additions and 11 deletions

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2105 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -74,7 +74,11 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["_MAIN_PDF_MAIN_HIDE_THIRD_TAX"],'chaine',0,'',$conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
}
@ -249,6 +253,40 @@ if ($action == 'edit') // Edit
print '<br>';
// Localtaxes
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$locales ='';
$text='';
if ($mysoc->useLocalTax(1))
{
$locales = $langs->transcountry("LT1",$mysoc->country_code);
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
$text .= '</td></tr>';
}
if ($mysoc->useLocalTax(2))
{
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
$text.= '</td></tr>';
}
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text;
print '</table>';
print '<br>';
}
// Other
print load_fiche_titre($langs->trans("Other"),'','').'<br>';
$var=true;
@ -444,6 +482,40 @@ else // Show
print '<br>';
// Localtaxes
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$locales ='';
$text='';
if ($mysoc->useLocalTax(1))
{
$locales = $langs->transcountry("LT1",$mysoc->country_code);
$text ='<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT1",$mysoc->country_code)) . '</td><td>';
$text .= yn($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX,1);
$text .= '</td></tr>';
}
if ($mysoc->useLocalTax(2))
{
$locales.=($locales?' & ':'').$langs->transcountry("LT2",$mysoc->country_code);
$text.= '<tr class="oddeven"><td>' . $langs->trans("HideLocalTaxOnPDF",$langs->transcountry("LT2",$mysoc->country_code)) . '</td><td>';
$text.= yn($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX,1);
$text.= '</td></tr>';
}
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text;
print '</table>';
print '<br>';
}
// Other
print load_fiche_titre($langs->trans("Other"),'','');
$var=true;

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
@ -1492,18 +1492,18 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
$tmpresult='';
$tmpresult.=vatrate($object->lines[$i]->tva_tx, 1, $object->lines[$i]->info_bits, 1);
if (empty($conf->PDF_MAIN_HIDE_SECOND_TAX))
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX))
{
if ($object->lines[$i]->localtax1_tx != 0)
if ($object->lines[$i]->total_localtax1 != 0)
{
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
else $tmpresult='';
$tmpresult.=vatrate(abs($object->lines[$i]->localtax1_tx),1);
}
}
if (empty($conf->PDF_MAIN_HIDE_THIRD_TAX))
if (empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX))
{
if ($object->lines[$i]->localtax2_tx != 0)
if ($object->lines[$i]->total_localtax2 != 0)
{
if (preg_replace('/[\s0%]/','',$tmpresult)) $tmpresult.='/';
else $tmpresult='';

View File

@ -5,6 +5,7 @@
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -145,8 +146,8 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
//var_dump($line);
$positiverates='';
if (price2num($line->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx);
if (price2num($line->localtax1_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx);
if (price2num($line->localtax2_tx)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx);
if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx);
if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx);
if (empty($positiverates)) $positiverates='0';
echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits);
//echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits);

View File

@ -356,6 +356,8 @@ PDF=PDF
PDFDesc=You can set each global options related to the PDF generation
PDFAddressForging=Rules to forge address boxes
HideAnyVATInformationOnPDF=Hide all information related to VAT on generated PDF
PDFLocaltax=Rules for %s
HideLocalTaxOnPDF=Hide %s rate into pdf column tax sale
HideDescOnPDF=Hide products description on generated PDF
HideRefOnPDF=Hide products ref. on generated PDF
HideDetailsOnPDF=Hide product lines details on generated PDF
@ -1642,7 +1644,7 @@ UnicodeCurrency=Enter here between braces, list of byte number that represent th
ColorFormat=The RGB color is in HEX format, eg: FF0000
PositionIntoComboList=Position of line into combo lists
SellTaxRate=Sale tax rate
RecuperableOnly=Yes for VAT "Non Perçue Récupérable" dedicated for some state in France. Keep value to "No" in all other cases.
RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases.
UrlTrackingDesc=If the provider or transport service offer a page or web site to check status of your shipping, you can enter it here. You can use the key {TRACKID} into URL parameters so the system will replace it with value of tracking number user entered into shipment card.
OpportunityPercent=When you create an opportunity, you will defined an estimated amount of project/lead. According to status of opportunity, this amount may be multiplicated by this rate to evaluate global amount all your opportunities may generate. Value is percent (between 0 and 100).
TemplateForElement=This template record is dedicated to which element