Fix calculation of vat paid
This commit is contained in:
parent
d52305cef8
commit
7099068f05
@ -105,14 +105,15 @@ function pt ($db, $sql, $date)
|
|||||||
|
|
||||||
$amountclaimed = 0;
|
$amountclaimed = 0;
|
||||||
$amountpaid = 0;
|
$amountpaid = 0;
|
||||||
|
$previousmonth = '';
|
||||||
$previousmode = '';
|
$previousmode = '';
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
//print $obj->dm.' '.$obj->mode.' '.$previousmonth.' '.$previousmode;
|
||||||
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
print '<td class="nowrap">'.$previousmonth."</td>\n";
|
||||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -129,7 +130,7 @@ function pt ($db, $sql, $date)
|
|||||||
if ($obj->mode == 'paid')
|
if ($obj->mode == 'paid')
|
||||||
{
|
{
|
||||||
$amountpaid = $obj->mm;
|
$amountpaid = $obj->mm;
|
||||||
$totalpaid = $totalpaid + $amountpaied;
|
$totalpaid = $totalpaid + $amountpaid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->mode == 'paid')
|
if ($obj->mode == 'paid')
|
||||||
@ -142,10 +143,12 @@ function pt ($db, $sql, $date)
|
|||||||
$amountclaimed = 0;
|
$amountclaimed = 0;
|
||||||
$amountpaid = 0;
|
$amountpaid = 0;
|
||||||
$previousmode = '';
|
$previousmode = '';
|
||||||
|
$previousmonth = '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$previousmode = $obj->mode;
|
$previousmode = $obj->mode;
|
||||||
|
$previousmonth = $obj->dm;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -154,7 +157,7 @@ function pt ($db, $sql, $date)
|
|||||||
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
print '<td class="nowrap">'.$previousmonth."</td>\n";
|
||||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -534,7 +537,7 @@ $sql.= " WHERE f.entity = ".$conf->entity;
|
|||||||
$sql.= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->idate($date_end)."')";
|
$sql.= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->idate($date_end)."')";
|
||||||
$sql.= " GROUP BY dm";
|
$sql.= " GROUP BY dm";
|
||||||
|
|
||||||
$sql.= " ORDER BY dm ASC";
|
$sql.= " ORDER BY dm ASC, mode ASC";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
pt($db, $sql, $langs->trans("Month"));
|
pt($db, $sql, $langs->trans("Month"));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user