diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php
index 04fa4438a96..08c4197ef2a 100644
--- a/htdocs/compta/localtax/index.php
+++ b/htdocs/compta/localtax/index.php
@@ -81,10 +81,10 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
/**
* print function
*
- * @param DoliDB $db Database handler
- * @param string $sql SQL Request
- * @param string $date Date
- * @return void
+ * @param DoliDB $db Database handler
+ * @param string $sql SQL Request
+ * @param string $date Date
+ * @return void
*/
function pt ($db, $sql, $date)
{
@@ -98,8 +98,9 @@ function pt ($db, $sql, $date)
print '
';
print '';
- print '| '.$date.' | ';
- print ''.$langs->trans("Amount").' | ';
+ print ''.$date.' | ';
+ print ''.$langs->trans("ClaimedForThisPeriod").' | ';
+ print ''.$langs->trans("PaidDuringThisPeriod").' | ';
print "
\n";
while ($i < $num) {
@@ -107,14 +108,26 @@ function pt ($db, $sql, $date)
print '';
print '| '.$obj->dm." | \n";
- $total = $total + $obj->mm;
- print ''.price($obj->mm)." | \n";
+ $amountclaimed = 0;
+ $amountpaid = 0;
+ if ($obj->mode == 'claimed') $amountclaimed = $obj->mm;
+ if ($obj->mode == 'paid') $amountpaid = $obj->mm;
+
+ $totalclaimed = $totalclaimed + $amountclaimed;
+ $totalpaid = $totalpaid + $amountpaied;
+
+ print ''.price($amountclaimed)." | \n";
+ print ''.price($amountpaid)." | \n";
print "
\n";
$i++;
}
- print '| '.$langs->trans("Total")." : | ".price($total)." |
";
+ print '';
+ print '| '.$langs->trans("Total").' | ';
+ print ''.price($totalclaimed).' | ';
+ print ''.price($totalpaid).' | ';
+ print "
";
print "
";
$db->free($result);
@@ -498,20 +511,29 @@ print '';
print load_fiche_titre($langs->transcountry($LTPaid,$mysoc->country_code), '', '');
-$sql = "SELECT SUM(amount) as mm, date_format(f.datev,'%Y-%m') as dm";
+$sql='';
+
+$sql.= "SELECT SUM(amount) as mm, date_format(f.datev,'%Y-%m') as dm, 'claimed' as mode";
$sql.= " FROM ".MAIN_DB_PREFIX."localtax as f";
$sql.= " WHERE f.entity = ".$conf->entity;
-$sql.= " AND f.datev >= '".$db->idate($date_start)."'";
-$sql.= " AND f.datev <= '".$db->idate($date_end)."'";
+$sql.= " AND (f.datev >= '".$db->idate($date_start)."' AND f.datev <= '".$db->idate($date_end)."')";
$sql.= " AND localtaxtype=".$localTaxType;
$sql.= " GROUP BY dm";
+
+$sql.= " UNION ";
+
+$sql.= "SELECT SUM(amount) as mm, date_format(f.datep,'%Y-%m') as dm, 'paid' as mode";
+$sql.= " FROM ".MAIN_DB_PREFIX."localtax as f";
+$sql.= " WHERE f.entity = ".$conf->entity;
+$sql.= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->idate($date_end)."')";
+$sql.= " AND localtaxtype=".$localTaxType;
+$sql.= " GROUP BY dm";
+
$sql.= " ORDER BY dm ASC";
-pt($db, $sql,$langs->trans("Month"));
+pt($db, $sql, $langs->trans("Month"));
-print '
';
-
print '
';
llxFooter();
diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php
index cafb965e354..425dae6853c 100644
--- a/htdocs/compta/tva/index.php
+++ b/htdocs/compta/tva/index.php
@@ -81,10 +81,10 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
/**
* print function
*
- * @param DoliDB $db Database handler
- * @param string $sql SQL Request
- * @param string $date Date
- * @return void
+ * @param DoliDB $db Database handler
+ * @param string $sql SQL Request
+ * @param string $date Date
+ * @return void
*/
function pt ($db, $sql, $date)
{
@@ -98,8 +98,9 @@ function pt ($db, $sql, $date)
print '';
print '';
- print '| '.$date.' | ';
- print ''.$langs->trans("Amount").' | ';
+ print ''.$date.' | ';
+ print ''.$langs->trans("ClaimedForThisPeriod").' | ';
+ print ''.$langs->trans("PaidDuringThisPeriod").' | ';
print "
\n";
while ($i < $num) {
@@ -107,14 +108,26 @@ function pt ($db, $sql, $date)
print '';
print '| '.$obj->dm." | \n";
- $total = $total + $obj->mm;
- print ''.price($obj->mm)." | mode == 'claimed') $amountclaimed = $obj->mm;
+ if ($obj->mode == 'paid') $amountpaid = $obj->mm;
+
+ $totalclaimed = $totalclaimed + $amountclaimed;
+ $totalpaid = $totalpaid + $amountpaied;
+
+ print ''.price($amountclaimed)." | \n";
+ print ''.price($amountpaid)." | \n";
print "
\n";
$i++;
}
- print '| '.$langs->trans("Total")." : | ".price($total)." |
";
+ print '';
+ print '| '.$langs->trans("Total").' | ';
+ print ''.price($totalclaimed).' | ';
+ print ''.price($totalpaid).' | ';
+ print "
";
print "
";
$db->free($result);
@@ -465,23 +478,33 @@ print '';
print load_fiche_titre($langs->trans("VATPaid"), '', '');
-$sql = "SELECT SUM(amount) as mm, date_format(f.datep,'%Y-%m') as dm";
+$sql='';
+
+$sql.= "SELECT SUM(amount) as mm, date_format(f.datev,'%Y-%m') as dm, 'claimed' as mode";
$sql.= " FROM ".MAIN_DB_PREFIX."tva as f";
$sql.= " WHERE f.entity = ".$conf->entity;
-$sql.= " AND f.datep >= '".$db->idate($date_start)."'";
-$sql.= " AND f.datep <= '".$db->idate($date_end)."'";
+$sql.= " AND (f.datev >= '".$db->idate($date_start)."' AND f.datev <= '".$db->idate($date_end)."')";
$sql.= " GROUP BY dm";
+
+$sql.= " UNION ";
+
+$sql.= "SELECT SUM(amount) as mm, date_format(f.datep,'%Y-%m') as dm, 'paid' as mode";
+$sql.= " FROM ".MAIN_DB_PREFIX."tva as f";
+$sql.= " WHERE f.entity = ".$conf->entity;
+$sql.= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->idate($date_end)."')";
+$sql.= " GROUP BY dm";
+
$sql.= " ORDER BY dm ASC";
+//print $sql;
pt($db, $sql, $langs->trans("Month"));
-print '
';
-
-
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
{
- /*
+ print '
';
+
+ /*
* Recap
*/
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index fcae17f10b2..ee768598ba0 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -244,4 +244,6 @@ FiscalPeriod=Accounting period
ListSocialContributionAssociatedProject=List of social contributions associated with the project
DeleteFromCat=Remove from accounting group
AccountingAffectation=Accounting assignement
-LastDayTaxIsRelatedTo=Last day of period the tax is related to
\ No newline at end of file
+LastDayTaxIsRelatedTo=Last day of period the tax is related to
+ClaimedForThisPeriod=Claimed for the period
+PaidDuringThisPeriod=Paid during this period
\ No newline at end of file