2006-11-27 00:45:53 +01:00
< ? php
/* Copyright ( C ) 2001 - 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2010-01-12 00:25:54 +01:00
* Copyright ( C ) 2004 Eric Seigne < eric . seigne @ ryxeo . com >
2013-10-10 19:26:07 +02:00
* Copyright ( C ) 2004 - 2013 Laurent Destailleur < eldy @ users . sourceforge . net >
2006-11-27 00:45:53 +01:00
* Copyright ( C ) 2006 Yannick Warnier < ywarnier @ beeznest . org >
2014-03-28 18:31:43 +01:00
* Copyright ( C ) 2014 Ferran Marcet < fmarcet @ 2 byte . es >
2006-11-27 00:45:53 +01:00
*
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2006-11-27 00:45:53 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2011-08-03 02:45:22 +02:00
* along with this program . If not , see < http :// www . gnu . org / licenses />.
2006-11-27 00:45:53 +01:00
*/
/**
2010-01-12 00:25:54 +01:00
* \file htdocs / compta / tva / clients . php
* \ingroup tax
* \brief Page des societes
*/
2006-11-27 00:45:53 +01:00
2012-08-22 23:24:21 +02:00
require '../../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/tax.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php' ;
2008-02-16 18:50:25 +01:00
2008-02-17 21:44:20 +01:00
$langs -> load ( " bills " );
2008-02-16 18:50:25 +01:00
$langs -> load ( " compta " );
$langs -> load ( " companies " );
2008-02-17 21:44:20 +01:00
$langs -> load ( " products " );
2015-02-07 14:18:02 +01:00
$langs -> load ( " other " );
2006-11-27 00:45:53 +01:00
2010-01-12 00:25:54 +01:00
// Date range
2011-07-18 13:11:19 +02:00
$year = GETPOST ( " year " );
2010-01-12 00:25:54 +01:00
if ( empty ( $year ))
2006-11-27 00:45:53 +01:00
{
2010-01-12 00:25:54 +01:00
$year_current = strftime ( " %Y " , dol_now ());
$year_start = $year_current ;
2006-11-27 00:45:53 +01:00
} else {
2010-01-12 00:25:54 +01:00
$year_current = $year ;
$year_start = $year ;
}
2010-02-03 03:22:15 +01:00
$date_start = dol_mktime ( 0 , 0 , 0 , $_REQUEST [ " date_startmonth " ], $_REQUEST [ " date_startday " ], $_REQUEST [ " date_startyear " ]);
$date_end = dol_mktime ( 23 , 59 , 59 , $_REQUEST [ " date_endmonth " ], $_REQUEST [ " date_endday " ], $_REQUEST [ " date_endyear " ]);
2010-01-12 00:25:54 +01:00
// Quarter
if ( empty ( $date_start ) || empty ( $date_end )) // We define date_start and date_end
{
2011-07-18 13:11:19 +02:00
$q = GETPOST ( " q " );
if ( empty ( $q ))
2010-02-03 00:23:20 +01:00
{
2010-02-03 03:22:15 +01:00
if ( isset ( $_REQUEST [ " month " ])) { $date_start = dol_get_first_day ( $year_start , $_REQUEST [ " month " ], false ); $date_end = dol_get_last_day ( $year_start , $_REQUEST [ " month " ], false ); }
2011-07-18 13:11:19 +02:00
else
{
$month_current = strftime ( " %m " , dol_now ());
if ( $month_current >= 10 ) $q = 4 ;
elseif ( $month_current >= 7 ) $q = 3 ;
elseif ( $month_current >= 4 ) $q = 2 ;
else $q = 1 ;
}
2010-02-03 00:23:20 +01:00
}
2010-02-03 03:22:15 +01:00
if ( $q == 1 ) { $date_start = dol_get_first_day ( $year_start , 1 , false ); $date_end = dol_get_last_day ( $year_start , 3 , false ); }
if ( $q == 2 ) { $date_start = dol_get_first_day ( $year_start , 4 , false ); $date_end = dol_get_last_day ( $year_start , 6 , false ); }
if ( $q == 3 ) { $date_start = dol_get_first_day ( $year_start , 7 , false ); $date_end = dol_get_last_day ( $year_start , 9 , false ); }
if ( $q == 4 ) { $date_start = dol_get_first_day ( $year_start , 10 , false ); $date_end = dol_get_last_day ( $year_start , 12 , false ); }
2006-11-27 00:45:53 +01:00
}
2011-07-18 13:11:19 +02:00
$min = GETPOST ( " min " );
2010-01-12 00:25:54 +01:00
if ( empty ( $min )) $min = 0 ;
2008-02-18 05:23:08 +01:00
// Define modetax (0 or 1)
2008-11-04 18:26:33 +01:00
// 0=normal, 1=option vat for services is on debit
2008-02-18 05:23:08 +01:00
$modetax = $conf -> global -> TAX_MODE ;
2010-01-12 00:25:54 +01:00
if ( isset ( $_REQUEST [ " modetax " ])) $modetax = $_REQUEST [ " modetax " ];
2006-11-27 00:45:53 +01:00
2008-10-13 16:22:10 +02:00
// Security check
2012-02-27 22:26:22 +01:00
$socid = GETPOST ( 'socid' , 'int' );
2008-10-13 16:22:10 +02:00
if ( $user -> societe_id ) $socid = $user -> societe_id ;
$result = restrictedArea ( $user , 'tax' , '' , '' , 'charges' );
2006-11-27 00:45:53 +01:00
2008-02-16 18:50:25 +01:00
/*
2008-10-13 16:22:10 +02:00
* View
2006-11-27 00:45:53 +01:00
*/
2011-11-08 10:18:45 +01:00
$form = new Form ( $db );
2008-02-16 18:50:25 +01:00
$company_static = new Societe ( $db );
2006-11-27 00:45:53 +01:00
2011-01-19 11:37:59 +01:00
$morequerystring = '' ;
$listofparams = array ( 'date_startmonth' , 'date_startyear' , 'date_startday' , 'date_endmonth' , 'date_endyear' , 'date_endday' );
foreach ( $listofparams as $param )
{
if ( GETPOST ( $param ) != '' ) $morequerystring .= ( $morequerystring ? '&' : '' ) . $param . '=' . GETPOST ( $param );
}
llxHeader ( '' , '' , '' , '' , 0 , 0 , '' , '' , $morequerystring );
2006-11-27 00:45:53 +01:00
2010-01-12 11:02:02 +01:00
$fsearch .= '<br>' ;
$fsearch .= ' <input type="hidden" name="year" value="' . $year . '">' ;
2010-01-12 00:25:54 +01:00
$fsearch .= ' <input type="hidden" name="modetax" value="' . $modetax . '">' ;
2013-01-05 19:23:16 +01:00
$fsearch .= ' ' . $langs -> trans ( " SalesTurnoverMinimum " ) . ': ' ;
2011-07-18 13:11:19 +02:00
$fsearch .= ' <input type="text" name="min" id="min" value="' . $min . '" size="6">' ;
2006-11-27 00:45:53 +01:00
2009-07-29 18:13:33 +02:00
// Affiche en-tete du rapport
2008-03-16 15:52:31 +01:00
if ( $modetax == 1 ) // Calculate on invoice for goods and services
2008-02-16 18:50:25 +01:00
{
2014-10-04 17:20:17 +02:00
$name = $langs -> trans ( " VATReportByCustomersInDueDebtMode " );
2013-10-10 19:26:07 +02:00
$calcmode = $langs -> trans ( " CalcModeVATDebt " );
$calcmode .= '<br>(' . $langs -> trans ( " TaxModuleSetupToModifyRules " , DOL_URL_ROOT . '/admin/taxes.php' ) . ')' ;
2014-10-04 17:20:17 +02:00
//$name.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')';
2011-11-08 10:18:45 +01:00
$period = $form -> select_date ( $date_start , 'date_start' , 0 , 0 , 0 , '' , 1 , 0 , 1 ) . ' - ' . $form -> select_date ( $date_end , 'date_end' , 0 , 0 , 0 , '' , 1 , 0 , 1 );
2010-01-12 00:25:54 +01:00
//$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
2012-01-08 23:43:32 +01:00
$description = $langs -> trans ( " RulesVATDueServices " );
$description .= '<br>' ;
$description .= $langs -> trans ( " RulesVATDueProducts " );
2009-07-29 18:13:33 +02:00
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
2012-09-15 10:01:35 +02:00
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
2012-01-08 23:43:32 +01:00
if ( ! empty ( $conf -> global -> FACTURE_DEPOSITS_ARE_JUST_PAYMENTS )) $description .= '<br>' . $langs -> trans ( " DepositsAreNotIncluded " );
else $description .= '<br>' . $langs -> trans ( " DepositsAreIncluded " );
$description .= $fsearch ;
2010-01-12 11:02:02 +01:00
$builddate = time ();
2011-01-10 23:36:34 +01:00
//$exportlink=$langs->trans("NotYetAvailable");
2009-02-04 23:43:51 +01:00
2008-02-17 21:44:20 +01:00
$elementcust = $langs -> trans ( " CustomersInvoices " );
$productcust = $langs -> trans ( " Description " );
$amountcust = $langs -> trans ( " AmountHT " );
2009-07-29 18:13:33 +02:00
if ( $mysoc -> tva_assuj ) $vatcust .= ' (' . $langs -> trans ( " ToPay " ) . ')' ;
2008-02-17 21:44:20 +01:00
$elementsup = $langs -> trans ( " SuppliersInvoices " );
$productsup = $langs -> trans ( " Description " );
$amountsup = $langs -> trans ( " AmountHT " );
2009-07-29 18:13:33 +02:00
if ( $mysoc -> tva_assuj ) $vatsup .= ' (' . $langs -> trans ( " ToGetBack " ) . ')' ;
2006-11-27 00:45:53 +01:00
}
2008-02-18 05:23:08 +01:00
if ( $modetax == 0 ) // Invoice for goods, payment for services
{
2014-10-04 17:20:17 +02:00
$name = $langs -> trans ( " VATReportByCustomersInInputOutputMode " );
2013-10-10 19:26:07 +02:00
$calcmode = $langs -> trans ( " CalcModeVATEngagement " );
$calcmode .= '<br>(' . $langs -> trans ( " TaxModuleSetupToModifyRules " , DOL_URL_ROOT . '/admin/taxes.php' ) . ')' ;
2014-10-04 17:20:17 +02:00
//$name.='<br>('.$langs->trans("SeeVATReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=1">','</a>').')';
2011-11-08 10:18:45 +01:00
$period = $form -> select_date ( $date_start , 'date_start' , 0 , 0 , 0 , '' , 1 , 0 , 1 ) . ' - ' . $form -> select_date ( $date_end , 'date_end' , 0 , 0 , 0 , '' , 1 , 0 , 1 );
2010-01-12 00:25:54 +01:00
//$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
2012-01-08 23:43:32 +01:00
$description = $langs -> trans ( " RulesVATInServices " );
$description .= ' ' . $langs -> trans ( " DepositsAreIncluded " );
$description .= '<br>' ;
$description .= $langs -> trans ( " RulesVATInProducts " );
if ( ! empty ( $conf -> global -> FACTURE_DEPOSITS_ARE_JUST_PAYMENTS )) $description .= ' ' . $langs -> trans ( " DepositsAreNotIncluded " );
else $description .= ' ' . $langs -> trans ( " DepositsAreIncluded " );
2011-01-21 09:32:54 +01:00
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
2012-09-15 10:01:35 +02:00
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
2011-07-18 13:11:19 +02:00
$description .= $fsearch ;
$builddate = time ();
2011-01-10 23:36:34 +01:00
//$exportlink=$langs->trans("NotYetAvailable");
2009-02-04 23:43:51 +01:00
2008-02-17 21:44:20 +01:00
$elementcust = $langs -> trans ( " CustomersInvoices " );
$productcust = $langs -> trans ( " Description " );
$amountcust = $langs -> trans ( " AmountHT " );
2009-07-29 18:13:33 +02:00
if ( $mysoc -> tva_assuj ) $vatcust .= ' (' . $langs -> trans ( " ToPay " ) . ')' ;
2008-02-17 21:44:20 +01:00
$elementsup = $langs -> trans ( " SuppliersInvoices " );
$productsup = $langs -> trans ( " Description " );
$amountsup = $langs -> trans ( " AmountHT " );
2009-07-29 18:13:33 +02:00
if ( $mysoc -> tva_assuj ) $vatsup .= ' (' . $langs -> trans ( " ToGetBack " ) . ')' ;
2008-02-16 18:50:25 +01:00
}
2014-10-04 17:20:17 +02:00
report_header ( $name , $nomlink , $period , $periodlink , $description , $builddate , $exportlink , array (), $calcmode );
2006-11-27 00:45:53 +01:00
2010-02-02 22:23:23 +01:00
$vatcust = $langs -> trans ( " VATReceived " );
$vatsup = $langs -> trans ( " VATPaid " );
2006-11-27 00:45:53 +01:00
2008-02-16 18:50:25 +01:00
// VAT Received
2006-11-27 00:45:53 +01:00
2010-02-02 22:23:23 +01:00
//print "<br>";
//print_titre($vatcust);
2008-02-16 18:50:25 +01:00
print " <table class= \" noborder \" width= \" 100% \" > " ;
print " <tr class= \" liste_titre \" > " ;
print '<td align="left">' . $langs -> trans ( " Num " ) . " </td> " ;
2008-02-17 21:44:20 +01:00
print '<td align="left">' . $langs -> trans ( " Customer " ) . " </td> " ;
2008-02-16 18:50:25 +01:00
print " <td> " . $langs -> trans ( " VATIntra " ) . " </td> " ;
2011-07-18 13:11:19 +02:00
print " <td align= \" right \" > " . $langs -> trans ( " AmountHTVATRealReceived " ) . " </td> " ;
2008-02-17 21:44:20 +01:00
print " <td align= \" right \" > " . $vatcust . " </td> " ;
2008-02-16 18:50:25 +01:00
print " </tr> \n " ;
2010-01-12 00:25:54 +01:00
$coll_list = vat_by_thirdparty ( $db , 0 , $date_start , $date_end , $modetax , 'sell' );
2014-03-28 18:31:43 +01:00
$action = " tvaclient " ;
$object = & $coll_list ;
$parameters [ " mode " ] = $modetax ;
$parameters [ " start " ] = $date_start ;
$parameters [ " end " ] = $date_end ;
$parameters [ " direction " ] = 'sell' ;
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager -> initHooks ( array ( 'externalbalance' ));
$reshook = $hookmanager -> executeHooks ( 'addStatisticLine' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2008-02-16 18:50:25 +01:00
if ( is_array ( $coll_list ))
{
$var = true ;
2011-07-18 13:11:19 +02:00
$total = 0 ; $totalamount = 0 ;
2008-02-16 18:50:25 +01:00
$i = 1 ;
foreach ( $coll_list as $coll )
{
2011-03-09 11:31:38 +01:00
if ( $min == 0 or ( $min > 0 && $coll -> amount > $min ))
2008-02-16 18:50:25 +01:00
{
$var =! $var ;
2011-03-09 11:31:38 +01:00
$intra = str_replace ( $find , $replace , $coll -> tva_intra );
2008-02-16 18:50:25 +01:00
if ( empty ( $intra ))
{
2011-03-09 11:31:38 +01:00
if ( $coll -> assuj == '1' )
2008-02-16 18:50:25 +01:00
{
$intra = $langs -> trans ( 'Unknown' );
}
else
{
2011-07-18 13:11:19 +02:00
//$intra = $langs->trans('NotRegistered');
$intra = '' ;
2008-02-16 18:50:25 +01:00
}
}
2011-07-18 13:11:19 +02:00
print " <tr " . $bc [ $var ] . " > " ;
2013-07-19 14:23:42 +02:00
print '<td class="nowrap">' . $i . " </td> " ;
2011-03-09 11:31:38 +01:00
$company_static -> id = $coll -> socid ;
2014-10-04 17:20:17 +02:00
$company_static -> name = $coll -> name ;
2012-01-08 23:43:32 +01:00
$company_static -> client = 1 ;
2013-07-19 14:23:42 +02:00
print '<td class="nowrap">' . $company_static -> getNomUrl ( 1 , 'customer' ) . '</td>' ;
2008-02-16 18:50:25 +01:00
$find = array ( ' ' , '.' );
$replace = array ( '' , '' );
2013-07-19 14:23:42 +02:00
print '<td class="nowrap">' . $intra . " </td> " ;
print " <td class= \" nowrap \" align= \" right \" > " . price ( $coll -> amount ) . " </td> " ;
print " <td class= \" nowrap \" align= \" right \" > " . price ( $coll -> tva ) . " </td> " ;
2011-07-18 13:11:19 +02:00
$totalamount = $totalamount + $coll -> amount ;
2011-03-09 11:31:38 +01:00
$total = $total + $coll -> tva ;
2008-02-16 18:50:25 +01:00
print " </tr> \n " ;
$i ++ ;
}
}
2011-07-18 13:11:19 +02:00
$x_coll_sum = $total ;
2006-11-27 00:45:53 +01:00
2011-07-18 13:11:19 +02:00
print '<tr class="liste_total"><td align="right" colspan="3">' . $langs -> trans ( " Total " ) . ':</td>' ;
2013-07-19 14:23:42 +02:00
print '<td class="nowrap" align="right">' . price ( $totalamount ) . '</td>' ;
print '<td class="nowrap" align="right">' . price ( $total ) . '</td>' ;
2008-02-16 18:50:25 +01:00
print '</tr>' ;
}
else
{
2008-10-13 16:22:10 +02:00
$langs -> load ( " errors " );
2008-04-03 23:04:11 +02:00
if ( $coll_list == - 1 )
2008-10-13 16:22:10 +02:00
print '<tr><td colspan="5">' . $langs -> trans ( " ErrorNoAccountancyModuleLoaded " ) . '</td></tr>' ;
2008-04-03 23:04:11 +02:00
else if ( $coll_list == - 2 )
print '<tr><td colspan="5">' . $langs -> trans ( " FeatureNotYetAvailable " ) . '</td></tr>' ;
else
print '<tr><td colspan="5">' . $langs -> trans ( " Error " ) . '</td></tr>' ;
2008-02-16 18:50:25 +01:00
}
2006-11-27 00:45:53 +01:00
2010-02-02 22:23:23 +01:00
//print '</table>';
2006-11-27 00:45:53 +01:00
2009-08-19 19:16:47 +02:00
// VAT Paid
2006-11-27 00:45:53 +01:00
2010-02-02 22:23:23 +01:00
//print "<br>";
//print_titre($vatsup);
2006-11-27 00:45:53 +01:00
2010-02-02 22:23:23 +01:00
//print "<table class=\"noborder\" width=\"100%\">";
2006-11-27 00:45:53 +01:00
print " <tr class= \" liste_titre \" > " ;
2008-02-16 18:50:25 +01:00
print '<td align="left">' . $langs -> trans ( " Num " ) . " </td> " ;
2008-02-17 21:44:20 +01:00
print '<td align="left">' . $langs -> trans ( " Supplier " ) . " </td> " ;
2006-11-27 00:45:53 +01:00
print " <td> " . $langs -> trans ( " VATIntra " ) . " </td> " ;
2011-07-18 13:11:19 +02:00
print " <td align= \" right \" > " . $langs -> trans ( " AmountHTVATRealPaid " ) . " </td> " ;
2008-02-17 21:44:20 +01:00
print " <td align= \" right \" > " . $vatsup . " </td> " ;
2006-11-27 00:45:53 +01:00
print " </tr> \n " ;
2008-02-16 18:50:25 +01:00
$company_static = new Societe ( $db );
2010-01-12 00:25:54 +01:00
$coll_list = vat_by_thirdparty ( $db , 0 , $date_start , $date_end , $modetax , 'buy' );
2014-03-28 18:31:43 +01:00
$parameters [ " direction " ] = 'buy' ;
$reshook = $hookmanager -> executeHooks ( 'addStatisticLine' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2008-02-16 18:50:25 +01:00
if ( is_array ( $coll_list ))
2006-11-27 00:45:53 +01:00
{
2008-02-16 18:50:25 +01:00
$var = true ;
2011-07-18 13:11:19 +02:00
$total = 0 ; $totalamount = 0 ;
2006-11-27 00:45:53 +01:00
$i = 1 ;
2008-02-16 18:50:25 +01:00
foreach ( $coll_list as $coll )
{
2011-03-09 11:31:38 +01:00
if ( $min == 0 or ( $min > 0 && $coll -> amount > $min ))
2008-02-16 18:50:25 +01:00
{
2006-11-27 00:45:53 +01:00
$var =! $var ;
2011-03-09 11:31:38 +01:00
$intra = str_replace ( $find , $replace , $coll -> tva_intra );
2008-02-16 18:50:25 +01:00
if ( empty ( $intra ))
{
2011-03-09 11:31:38 +01:00
if ( $coll -> assuj == '1' )
2008-02-16 18:50:25 +01:00
{
2006-11-27 00:45:53 +01:00
$intra = $langs -> trans ( 'Unknown' );
2008-02-16 18:50:25 +01:00
}
else
{
2011-07-18 13:11:19 +02:00
//$intra = $langs->trans('NotRegistered');
$intra = '' ;
2006-11-27 00:45:53 +01:00
}
}
2013-06-20 09:18:12 +02:00
print " <tr " . $bc [ $var ] . " > " ;
2013-07-19 14:23:42 +02:00
print '<td class="nowrap">' . $i . " </td> " ;
2011-03-09 11:31:38 +01:00
$company_static -> id = $coll -> socid ;
2014-10-04 17:20:17 +02:00
$company_static -> name = $coll -> name ;
2012-01-08 23:43:32 +01:00
$company_static -> fournisseur = 1 ;
2013-07-19 14:23:42 +02:00
print '<td class="nowrap">' . $company_static -> getNomUrl ( 1 , 'supplier' ) . '</td>' ;
2006-11-27 00:45:53 +01:00
$find = array ( ' ' , '.' );
$replace = array ( '' , '' );
2013-07-19 14:23:42 +02:00
print '<td class="nowrap">' . $intra . " </td> " ;
print " <td class= \" nowrap \" align= \" right \" > " . price ( $coll -> amount ) . " </td> " ;
print " <td class= \" nowrap \" align= \" right \" > " . price ( $coll -> tva ) . " </td> " ;
2011-07-18 13:11:19 +02:00
$totalamount = $totalamount + $coll -> amount ;
2011-03-09 11:31:38 +01:00
$total = $total + $coll -> tva ;
2006-11-27 00:45:53 +01:00
print " </tr> \n " ;
$i ++ ;
}
}
2011-07-18 13:11:19 +02:00
$x_paye_sum = $total ;
2006-11-27 00:45:53 +01:00
2011-07-18 13:11:19 +02:00
print '<tr class="liste_total"><td align="right" colspan="3">' . $langs -> trans ( " Total " ) . ':</td>' ;
2013-07-19 14:23:42 +02:00
print '<td class="nowrap" align="right">' . price ( $totalamount ) . '</td>' ;
print '<td class="nowrap" align="right">' . price ( $total ) . '</td>' ;
2006-11-27 00:45:53 +01:00
print '</tr>' ;
2011-07-18 13:11:19 +02:00
print '</table>' ;
// Total to pay
print '<br><br>' ;
print '<table class="noborder" width="100%">' ;
$diff = $x_coll_sum - $x_paye_sum ;
print '<tr class="liste_total">' ;
print '<td class="liste_total" colspan="4">' . $langs -> trans ( " TotalToPay " ) . ( $q ? ', ' . $langs -> trans ( " Quadri " ) . ' ' . $q : '' ) . '</td>' ;
2013-04-25 01:13:13 +02:00
print '<td class="liste_total nowrap" align="right"><b>' . price ( price2num ( $diff , 'MT' )) . " </b></td> \n " ;
2011-07-18 13:11:19 +02:00
print " </tr> \n " ;
2006-11-27 00:45:53 +01:00
}
else
{
2008-10-13 16:22:10 +02:00
$langs -> load ( " errors " );
2008-04-03 23:04:11 +02:00
if ( $coll_list == - 1 )
2008-10-13 16:22:10 +02:00
print '<tr><td colspan="5">' . $langs -> trans ( " ErrorNoAccountancyModuleLoaded " ) . '</td></tr>' ;
2008-04-03 23:04:11 +02:00
else if ( $coll_list == - 2 )
print '<tr><td colspan="5">' . $langs -> trans ( " FeatureNotYetAvailable " ) . '</td></tr>' ;
else
print '<tr><td colspan="5">' . $langs -> trans ( " Error " ) . '</td></tr>' ;
2006-11-27 00:45:53 +01:00
}
print '</table>' ;
2009-02-04 23:43:51 +01:00
2008-02-16 18:50:25 +01:00
2011-08-27 16:24:16 +02:00
llxFooter ();
2012-01-08 23:43:32 +01:00
$db -> close ();