Fix log and duplicate vat_by_date function
This commit is contained in:
parent
f9ee2930e2
commit
51cd793d80
@ -166,8 +166,8 @@ $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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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))
|
||||
{
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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
|
||||
@ -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)
|
||||
@ -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)
|
||||
{
|
||||
@ -556,13 +555,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)
|
||||
{
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user