Fix regression

This commit is contained in:
Laurent Destailleur 2021-03-10 17:07:44 +01:00 committed by GitHub
parent b5c84bfc4f
commit c75fade649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -345,8 +345,12 @@ if ($refresh === true) {
while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $mcursor is to avoid too large loop
//$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12);
if ($m == 13) $y++;
if ($m > 12) $m -= 12;
if ($m == 13) {
$y++;
}
if ($m > 12) {
$m -= 12;
}
$mcursor++;
$x_coll = tax_by_rate('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m);
@ -622,46 +626,6 @@ if ($refresh === true) {
pt($db, $sql, $langs->trans("Month"));
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
print '<br>';
/*
* Recap
*/
print load_fiche_titre($langs->trans("VATBalance"), '', ''); // need to add translation
$sql1 = "SELECT SUM(amount) as mm";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "tva as f";
$sql1 .= " WHERE f.entity = " . $conf->entity;
$sql1 .= " AND f.datev >= '" . $db->idate($date_start) . "'";
$sql1 .= " AND f.datev <= '" . $db->idate($date_end) . "'";
$result = $db->query($sql1);
if ($result) {
$obj = $db->fetch_object($result);
print '<table class="noborder centpercent">';
print "<tr>";
print '<td class="right">' . $langs->trans("VATDue") . '</td>';
print '<td class="nowrap right">' . price(price2num($total, 'MT')) . '</td>';
print "</tr>\n";
print "<tr>";
print '<td class="right">' . $langs->trans("VATPaid") . '</td>';
print '<td class="nowrap right">' . price(price2num($obj->mm, 'MT')) . "</td>\n";
print "</tr>\n";
$restopay = $total - $obj->mm;
print "<tr>";
print '<td class="right">' . $langs->trans("RemainToPay") . '</td>';
print '<td class="nowrap right">' . price(price2num($restopay, 'MT')) . '</td>';
print "</tr>\n";
print '</table>';
}
}
print '</div></div>';
}