';
print "";
print "";
print "| ".$langs->trans("Year")." $y | ";
print "".$langs->transcountry("LT2Customer",$mysoc->country_code)." | ";
print "".$langs->transcountry("LT2Supplier",$mysoc->country_code)." | ";
print "".$langs->trans("TotalToPay")." | ";
print " | \n";
print " \n";
$y = $year_current ;
$var=True;
$total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
$i=0;
for ($m = 1 ; $m < 13 ; $m++ )
{
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
if (! is_array($coll_listbuy) && $coll_listbuy == -1)
{
$langs->load("errors");
print '| '.$langs->trans("ErrorNoAccountancyModuleLoaded").' | ';
break;
}
if (! is_array($coll_listbuy) && $coll_listbuy == -2)
{
print '| '.$langs->trans("FeatureNotYetAvailable").' | ';
break;
}
$var=!$var;
print "";
print '| '.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").' | ';
$x_coll = 0;
foreach($coll_listsell as $vatrate=>$val)
{
$x_coll+=$val['localtax2'];
}
$subtotalcoll = $subtotalcoll + $x_coll;
print "".price($x_coll)." | ";
$x_paye = 0;
foreach($coll_listbuy as $vatrate=>$val)
{
$x_paye+=$val['localtax2'];
}
$subtotalpaye = $subtotalpaye + $x_paye;
print "".price($x_paye)." | ";
$diff = $x_coll - $x_paye;
$total = $total + $diff;
$subtotal = $subtotal + $diff;
print "".price($diff)." | \n";
print " | \n";
print " \n";
$i++;
if ($i > 2) {
print '';
print '| '.$langs->trans("SubTotal").': | ';
print ''.price($subtotalcoll).' | ';
print ''.price($subtotalpaye).' | ';
print ''.price($subtotalpaye).' | ';
print ' | ';
$i = 0;
$subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
}
}
print '| '.$langs->trans("TotalToPay").': | '.price($total).' | ';
print " | \n";
print ' ';
print ' ';
print ' | | ';
/*
* Payed
*/
$sql = "SELECT SUM(amount) as mm, date_format(f.datev,'%Y-%m') as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."localtax as f";
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= " AND f.datev >= '".$db->idate(dol_get_first_day($y,1,false))."'";
$sql.= " AND f.datev <= '".$db->idate(dol_get_last_day($y,12,false))."'";
$sql.= " GROUP BY dm ASC";
pt($db, $sql,$langs->trans("Year")." $y");
print " |