2
0
forked from Wavyzz/dolibarr
This commit is contained in:
Florian HENRY
2023-06-10 14:22:34 +02:00
parent d1c8e5ec00
commit 2ba114bed4
11 changed files with 322 additions and 273 deletions

View File

@@ -155,8 +155,8 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
// Define sql request
$sql = '';
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')) {
if (($direction == 'sell' && getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice')
|| ($direction == 'buy' && getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice')) {
// Count on delivery date (use invoice date as delivery is unknown)
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
@@ -168,6 +168,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$sql .= " s.status as company_status, s.tva_intra as company_tva_intra,";
$sql .= " p.rowid as pid, p.ref as pref, p.fk_product_type as ptype, p.tosell as pstatus, p.tobuy as pstatusbuy,";
$sql .= " 0 as payment_id, '' as payment_ref, 0 as payment_amount";
$sql .= " ,'' as datep";
$sql .= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,";
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
$sql .= " ".MAIN_DB_PREFIX.$invoicedettable." as d";
@@ -303,6 +304,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$list[$assoc['company_id']]['localtax1'] += $assoc['total_localtax1'];
$list[$assoc['company_id']]['localtax2'] += $assoc['total_localtax2'];
}
$list[$assoc['company_id']]['dtotal_ttc'][] = $assoc['total_ttc'];
$list[$assoc['company_id']]['dtype'][] = $assoc['dtype'];
$list[$assoc['company_id']]['datef'][] = $db->jdate($assoc['datef']);
@@ -356,8 +358,8 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
// Define sql request
$sql = '';
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) {
if (($direction == 'sell' && getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice')
|| ($direction == 'buy' && getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice')) {
// Count on invoice date
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
@@ -743,8 +745,8 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
// Define sql request
$sql = '';
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')) {
if (($direction == 'sell' && getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice')
|| ($direction == 'buy' && getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice')) {
// Count on delivery date (use invoice date as delivery is unknown)
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
@@ -944,8 +946,8 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
// Define sql request
$sql = '';
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) {
if (($direction == 'sell' && getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice')
|| ($direction == 'buy' && getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice')) {
// Count on invoice date
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";