diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php
index 5d17688fc68..6286bfaa4e4 100644
--- a/htdocs/compta/localtax/index.php
+++ b/htdocs/compta/localtax/index.php
@@ -45,14 +45,14 @@ if ($year == 0)
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
-if ($user->societe_id)
+if ($user->societe_id)
$socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
// Define modetax (0 or 1)
// 0=normal, 1=option vat for services is on debit
$modetax = $conf->global->TAX_MODE;
-if (isset($_GET["modetax"]))
+if (isset($_GET["modetax"]))
$modetax=$_GET["modetax"];
/**
@@ -81,7 +81,7 @@ function pt ($db, $sql, $date)
$var=True;
while ($i < $num) {
$obj = $db->fetch_object($result);
-
+
print '
';
print '| '.$obj->dm." | \n";
$total = $total + $obj->mm;
@@ -166,16 +166,16 @@ $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);
-
+ $coll_listsell = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m);
+ $coll_listbuy = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'buy', $m);
+
$action = "tva";
$object = array(&$coll_listsell, &$coll_listbuy);
$parameters["mode"] = $modetax;
$parameters["year"] = $y;
$parameters["month"] = $m;
$parameters["type"] = 'localtax'.$localTaxType;
-
+
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('externalbalance'));
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@@ -190,7 +190,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
break;
}
-
+
print '
';
print '| '.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").' | ';
if($CalcLT==0) {
@@ -221,7 +221,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
}
$subtotalcoll = $subtotalcoll + $x_coll;
print "".price($x_coll)." | | ";
-
+
}
if($CalcLT==0) {
@@ -231,7 +231,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
} elseif($CalcLT==2) {
$diff= $x_coll;
}
-
+
$total = $total + $diff;
$subtotal = $subtotal + $diff;
diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php
index acbcc86e07d..1ac38a93c96 100644
--- a/htdocs/compta/tva/index.php
+++ b/htdocs/compta/tva/index.php
@@ -144,8 +144,8 @@ $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);
+ $coll_listsell = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m);
+ $coll_listbuy = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'buy', $m);
$action = "tva";
$object = array(&$coll_listsell, &$coll_listbuy);
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index d4ccbf98804..5a05ef5974f 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -224,8 +224,8 @@ $total = 0;
$i=0;
// Load arrays of datas
-$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
-$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy');
+$x_coll = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'sell');
+$x_paye = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'buy');
if (! is_array($x_coll) || ! is_array($x_paye))
{
diff --git a/htdocs/compta/tva/quarter_report.php b/htdocs/compta/tva/quarter_report.php
index 4c054923837..dd058c6ebc2 100644
--- a/htdocs/compta/tva/quarter_report.php
+++ b/htdocs/compta/tva/quarter_report.php
@@ -260,8 +260,8 @@ $i=0;
$columns = 6;
// Load arrays of datas
-$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
-$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy');
+$x_coll = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'sell');
+$x_paye = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'buy');
if (!is_array($x_coll) || !is_array($x_paye)) {
$langs->load("errors");
diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php
index 400ed453004..a0825cf6518 100644
--- a/htdocs/core/lib/tax.lib.php
+++ b/htdocs/core/lib/tax.lib.php
@@ -32,7 +32,7 @@
* Prepare array with list of tabs
*
* @param ChargeSociales $object Object related to tabs
- * @return array Array of tabs to show
+ * @return array Array of tabs to show
*/
function tax_prepare_head(ChargeSociales $object)
{
@@ -184,7 +184,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
* Gets Tax to collect for the given year (and given quarter or month)
* The function gets the Tax in split results, as the Tax declaration asks
* to report the amounts for different Tax rates as different lines.
- * This function also accounts recurrent invoices.
*
* @param string $type Tax type, either 'vat', 'localtax1' or 'localtax2'
* @param DoliDB $db Database handler object
@@ -236,7 +235,7 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$total_localtax1='total_localtax1';
$total_localtax2='total_localtax2';
-
+
// CAS DES BIENS
// Define sql request
@@ -318,7 +317,7 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($sql == 'TODO') return -2;
if ($sql != 'TODO')
{
- dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
+ dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
@@ -414,7 +413,7 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
$sql.= " AND (d.product_type = 1"; // Limit to services
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
- $sql.= " ORDER BY d.rowid, d.".$fk_facture;
+ $sql.= " ORDER BY d.rowid, d.".$fk_facture;
}
else // Option vat on delivery for goods (payments) and payments for services
{
@@ -458,13 +457,13 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if (! $sql)
{
- dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR);
+ dol_syslog("Tax.lib.php::tax_by_date no accountancy module enabled".$sql,LOG_ERR);
return -1; // -1 = Not accountancy module enabled
}
if ($sql == 'TODO') return -2; // -2 = Feature not yet available
if ($sql != 'TODO')
{
- dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
+ dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
@@ -550,19 +549,19 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
}
if ($q) $sql.= " AND (date_format(p.datep,'%m') > ".(($q-1)*3)." AND date_format(p.datep,'%m') <= ".($q*3).")";
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
- $sql.= " AND (d.product_type = -1";
+ $sql.= " AND (d.product_type = -1";
$sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
$sql.= " ORDER BY e.rowid";
if (! $sql)
{
- dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR);
+ dol_syslog("Tax.lib.php::tax_by_date no accountancy module enabled".$sql,LOG_ERR);
return -1; // -1 = Not accountancy module enabled
}
if ($sql == 'TODO') return -2; // -2 = Feature not yet available
if ($sql != 'TODO')
{
- dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
+ dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
@@ -624,24 +623,3 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
return $list;
}
-/**
- * Gets VAT to collect for the given year (and given quarter or month)
- * The function gets the VAT in split results, as the VAT declaration asks
- * to report the amounts for different VAT rates as different lines.
- * This function also accounts recurrent invoices.
- *
- * @param DoliDB $db Database handler object
- * @param int $y Year
- * @param int $q Quarter
- * @param string $date_start Start date
- * @param string $date_end End date
- * @param int $modetax 0 or 1 (option vat on debit)
- * @param int $direction 'sell' (customer invoice) or 'buy' (supplier invoices)
- * @param int $m Month
- * @return array List of quarters with vat
- */
-function vat_by_date ($db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
-{
- return tax_by_date('vat', $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m);
-}
-