Merge remote-tracking branch 'origin/3.8' into 3.9

Conflicts:
	htdocs/compta/localtax/quadri_detail.php
This commit is contained in:
Laurent Destailleur 2016-04-21 02:42:43 +02:00
commit dd443fe7f5
3 changed files with 10 additions and 36 deletions

View File

@ -2362,7 +2362,7 @@ class Facture extends CommonInvoice
$this->line->date_start = $date_start; $this->line->date_start = $date_start;
$this->line->date_end = $date_end; $this->line->date_end = $date_end;
$this->line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative $this->line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva = $total_tva; $this->line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva);
$this->line->total_localtax1 = $total_localtax1; $this->line->total_localtax1 = $total_localtax1;
$this->line->total_localtax2 = $total_localtax2; $this->line->total_localtax2 = $total_localtax2;
$this->line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); $this->line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org> * Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2014 Rosana Romero <rromero@2byte.es> * Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -116,16 +116,11 @@ $product_static=new Product($db);
$payment_static=new Paiement($db); $payment_static=new Paiement($db);
$paymentfourn_static=new PaiementFourn($db); $paymentfourn_static=new PaiementFourn($db);
//print load_fiche_titre($langs->trans("VAT"),"");
//$fsearch.='<br>';
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">'; $fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">'; $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local; $calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
// Affiche en-tete du rapport
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
{ {
$nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode"); $nom=$langs->trans($local==1?"LT1ReportByQuartersInDueDebtMode":"LT2ReportByQuartersInDueDebtMode");
@ -138,14 +133,11 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
$nextyear=$year_start; $nextquarter=$q; $nextyear=$year_start; $nextquarter=$q;
if ($nextquarter < 4) $nextquarter++; if ($nextquarter < 4) $nextquarter++;
else { $nextquarter=1; $nextyear++; } else { $nextquarter=1; $nextyear++; }
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
else $description.='<br>'.$langs->trans("DepositsAreIncluded"); else $description.='<br>'.$langs->trans("DepositsAreIncluded");
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService"); $productcust=$langs->trans("ProductOrService");
@ -170,14 +162,10 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
$nextyear=$year_start; $nextquarter=$q; $nextyear=$year_start; $nextquarter=$q;
if ($nextquarter < 4) $nextquarter++; if ($nextquarter < 4) $nextquarter++;
else { $nextquarter=1; $nextyear++; } else { $nextquarter=1; $nextyear++; }
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
else $description.=' '.$langs->trans("DepositsAreIncluded"); else $description.=' '.$langs->trans("DepositsAreIncluded");
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
$description.=$fsearch; $description.=$fsearch;
$builddate=time(); $builddate=time();
//$exportlink=$langs->trans("NotYetAvailable");
$elementcust=$langs->trans("CustomersInvoices"); $elementcust=$langs->trans("CustomersInvoices");
$productcust=$langs->trans("ProductOrService"); $productcust=$langs->trans("ProductOrService");
@ -203,8 +191,6 @@ if($local==1){
// VAT Received and paid // VAT Received and paid
$y = $year_current; $y = $year_current;
$total = 0; $total = 0;
$i=0; $i=0;
@ -229,10 +215,10 @@ if (! is_array($x_coll) || ! is_array($x_paye))
else else
{ {
$x_both = array(); $x_both = array();
//now, from these two arrays, get another array with one rate per line //now, from these two arrays, get another array with one rate per line
foreach(array_keys($x_coll) as $my_coll_rate) foreach(array_keys($x_coll) as $my_coll_rate)
{ {
//foreach($x_coll[$my_coll_rate][localtax1_list]){
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht']; $x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
$x_both[$my_coll_rate]['coll']['localtax'.$local] = $x_coll[$my_coll_rate]['localtax'.$local]; $x_both[$my_coll_rate]['coll']['localtax'.$local] = $x_coll[$my_coll_rate]['localtax'.$local];
$x_both[$my_coll_rate]['paye']['totalht'] = 0; $x_both[$my_coll_rate]['paye']['totalht'] = 0;
@ -302,9 +288,6 @@ else
} }
//now we have an array (x_both) indexed by rates for coll and paye //now we have an array (x_both) indexed by rates for coll and paye
//print table headers for this quadri - incomes first
$x_coll_sum = 0; $x_coll_sum = 0;
$x_coll_ht = 0; $x_coll_ht = 0;
$x_paye_sum = 0; $x_paye_sum = 0;
@ -313,8 +296,6 @@ else
$span=3; $span=3;
if ($modetax == 0) $span+=2; if ($modetax == 0) $span+=2;
//print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
if($conf->global->$calc ==0 || $conf->global->$calc == 2){ if($conf->global->$calc ==0 || $conf->global->$calc == 2){
// Customers invoices // Customers invoices
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -344,8 +325,6 @@ else
if($rate!=0){ if($rate!=0){
print "<tr>"; print "<tr>";
//print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
/**/
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>'; print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
print '</tr>'."\n"; print '</tr>'."\n";
} }
@ -399,9 +378,7 @@ else
print price($fields['totalht']); print price($fields['totalht']);
if (price2num($fields['ftotal_ttc'])) if (price2num($fields['ftotal_ttc']))
{ {
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
//print ' ('.round($ratiolineinvoice*100,2).'%)';
} }
print '</td>'; print '</td>';
} }
@ -412,7 +389,6 @@ else
{ {
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
print '<td class="nowrap" align="right">'; print '<td class="nowrap" align="right">';
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
if ($fields['payment_amount'] && $fields['ftotal_ttc']) if ($fields['payment_amount'] && $fields['ftotal_ttc'])
{ {
$payment_static->id=$fields['payment_id']; $payment_static->id=$fields['payment_id'];
@ -423,7 +399,7 @@ else
print $langs->trans("NotUsedForGoods"); print $langs->trans("NotUsedForGoods");
} }
else { else {
print $fields['payment_amount']; print price($fields['payment_amount']);
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
} }
print '</td>'; print '</td>';
@ -490,7 +466,6 @@ else
if($conf->global->$calc ==0 || $conf->global->$calc == 1){ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
echo '<table class="noborder" width="100%">'; echo '<table class="noborder" width="100%">';
//print table headers for this quadri - expenses now //print table headers for this quadri - expenses now
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td align="left">'.$elementsup.'</td>'; print '<td align="left">'.$elementsup.'</td>';
print '<td align="left">'.$productsup.'</td>'; print '<td align="left">'.$productsup.'</td>';
@ -584,7 +559,7 @@ else
} }
else else
{ {
print $fields['payment_amount']; print price($fields['payment_amount']);
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)'; if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
} }
print '</td>'; print '</td>';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org> * Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
@ -178,7 +178,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
} }
} }
/** /**
* Gets VAT to collect for the given year (and given quarter or month) * Gets VAT to collect for the given year (and given quarter or month)
* The function gets the VAT in split results, as the VAT declaration asks * The function gets the VAT in split results, as the VAT declaration asks