NEW monthly VAT report show "Claimed for the period" + "Paid during this
period"
This commit is contained in:
parent
1bf56e58b3
commit
c9cca57b0f
@ -103,26 +103,66 @@ function pt ($db, $sql, $date)
|
||||
print '<td align="right">'.$langs->trans("PaidDuringThisPeriod").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
$previousmode = '';
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
if ($obj->mode == 'claimed') $amountclaimed = $obj->mm;
|
||||
if ($obj->mode == 'paid') $amountpaid = $obj->mm;
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
}
|
||||
|
||||
$totalclaimed = $totalclaimed + $amountclaimed;
|
||||
$totalpaid = $totalpaid + $amountpaied;
|
||||
if ($obj->mode == 'claimed')
|
||||
{
|
||||
$amountclaimed = $obj->mm;
|
||||
$totalclaimed = $totalclaimed + $amountclaimed;
|
||||
}
|
||||
if ($obj->mode == 'paid')
|
||||
{
|
||||
$amountpaid = $obj->mm;
|
||||
$totalpaid = $totalpaid + $amountpaied;
|
||||
}
|
||||
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
if ($obj->mode == 'paid')
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
$previousmode = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$previousmode = $obj->mode;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="right">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($totalclaimed).'</td>';
|
||||
@ -529,7 +569,8 @@ $sql.= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->id
|
||||
$sql.= " AND localtaxtype=".$localTaxType;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
$sql.= " ORDER BY dm ASC";
|
||||
$sql.= " ORDER BY dm ASC, mode ASC";
|
||||
//print $sql;
|
||||
|
||||
pt($db, $sql, $langs->trans("Month"));
|
||||
|
||||
|
||||
@ -51,10 +51,10 @@ if ($user->rights->tax->charges->creer)
|
||||
|
||||
print load_fiche_titre($langs->transcountry($ltt==2?"LT2Payments":"LT1Payments",$mysoc->country_code), $newcardbutton);
|
||||
|
||||
$sql = "SELECT rowid, amount, label, f.datev as dm";
|
||||
$sql = "SELECT rowid, amount, label, f.datev, f.datep";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."localtax as f ";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity." AND localtaxtype=".$db->escape($ltt);
|
||||
$sql.= " ORDER BY dm DESC";
|
||||
$sql.= " ORDER BY datev DESC";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -67,6 +67,7 @@ if ($result)
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="nowrap" align="left">'.$langs->trans("Ref").'</td>';
|
||||
print "<td>".$langs->trans("Label")."</td>";
|
||||
print "<td>".$langs->trans("PeriodEndDate")."</td>";
|
||||
print '<td class="nowrap" align="left">'.$langs->trans("DatePayment").'</td>';
|
||||
print "<td align=\"right\">".$langs->trans("PayedByThisPayment")."</td>";
|
||||
print "</tr>\n";
|
||||
@ -81,7 +82,8 @@ if ($result)
|
||||
$localtax_static->ref=$obj->rowid;
|
||||
print "<td>".$localtax_static->getNomUrl(1)."</td>\n";
|
||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->datev),'day')."</td>\n";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
|
||||
$total = $total + $obj->amount;
|
||||
|
||||
print "<td align=\"right\">".price($obj->amount)."</td>";
|
||||
@ -89,8 +91,8 @@ if ($result)
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total").'</td>';
|
||||
print "<td align=\"right\"><b>".price($total)."</b></td></tr>";
|
||||
print '<tr class="liste_total"><td colspan="4">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total).'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
$db->free($result);
|
||||
|
||||
@ -103,26 +103,66 @@ function pt ($db, $sql, $date)
|
||||
print '<td align="right">'.$langs->trans("PaidDuringThisPeriod").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
$previousmode = '';
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
if ($obj->mode == 'claimed') $amountclaimed = $obj->mm;
|
||||
if ($obj->mode == 'paid') $amountpaid = $obj->mm;
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
}
|
||||
|
||||
$totalclaimed = $totalclaimed + $amountclaimed;
|
||||
$totalpaid = $totalpaid + $amountpaied;
|
||||
if ($obj->mode == 'claimed')
|
||||
{
|
||||
$amountclaimed = $obj->mm;
|
||||
$totalclaimed = $totalclaimed + $amountclaimed;
|
||||
}
|
||||
if ($obj->mode == 'paid')
|
||||
{
|
||||
$amountpaid = $obj->mm;
|
||||
$totalpaid = $totalpaid + $amountpaied;
|
||||
}
|
||||
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
if ($obj->mode == 'paid')
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
$previousmode = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$previousmode = $obj->mode;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($obj->mode == 'claimed' && ! empty($previousmode))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$obj->dm."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
|
||||
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$amountclaimed = 0;
|
||||
$amountpaid = 0;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="right">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="nowrap" align="right">'.price($totalclaimed).'</td>';
|
||||
|
||||
@ -173,7 +173,7 @@ if ($result)
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
|
||||
$syear = $year;
|
||||
$formother->select_year($syear?$syear:-1,'year',1, 20, 5);
|
||||
@ -266,7 +266,7 @@ if ($result)
|
||||
$colspan=5;
|
||||
if (! empty($conf->banque->enabled)) $colspan++;
|
||||
print '<tr class="liste_total"><td colspan="'.$colspan.'">'.$langs->trans("Total").'</td>';
|
||||
print "<td align=\"right\"><b>".price($total)."</b></td>";
|
||||
print '<td align="right">'.price($total).'</td>';
|
||||
print "<td> </td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user