|
@@ -23,25 +23,25 @@
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
- * \file htdocs/compta/tva/quadri_detail.php
|
|
|
- * \ingroup tax
|
|
|
- * \brief VAT by rate
|
|
|
+ * \file htdocs/compta/tva/quadri_detail.php
|
|
|
+ * \ingroup tax
|
|
|
+ * \brief VAT by rate
|
|
|
*/
|
|
|
|
|
|
// Load Dolibarr environment
|
|
|
require '../../main.inc.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
|
|
-require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/core/lib/tax.lib.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/compta/localtax/class/localtax.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
|
|
|
|
|
|
// Load translation files required by the page
|
|
|
$langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin"));
|
|
@@ -50,7 +50,7 @@ $refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTIS
|
|
|
$invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : '';
|
|
|
$vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1;
|
|
|
|
|
|
-include DOL_DOCUMENT_ROOT.'/compta/tva/initdatesforvat.inc.php';
|
|
|
+include DOL_DOCUMENT_ROOT . '/compta/tva/initdatesforvat.inc.php';
|
|
|
|
|
|
$min = price2num(GETPOST("min", "alpha"));
|
|
|
if (empty($min)) {
|
|
@@ -59,7 +59,7 @@ if (empty($min)) {
|
|
|
|
|
|
// Define modetax (0 or 1)
|
|
|
// 0=normal, 1=option vat for services is on debit, 2=option on payments for products
|
|
|
-$modetax = (empty($conf->global->TAX_MODE) ? 0 : $conf->global->TAX_MODE);
|
|
|
+$modetax = getDolGlobalInt('TAX_MODE');
|
|
|
if (GETPOSTISSET("modetax")) {
|
|
|
$modetax = GETPOSTINT("modetax");
|
|
|
}
|
|
@@ -95,11 +95,11 @@ $morequerystring = '';
|
|
|
$listofparams = array('date_startmonth', 'date_startyear', 'date_startday', 'date_endmonth', 'date_endyear', 'date_endday');
|
|
|
foreach ($listofparams as $param) {
|
|
|
if (GETPOST($param) != '') {
|
|
|
- $morequerystring .= ($morequerystring ? '&' : '').$param.'='.GETPOST($param);
|
|
|
+ $morequerystring .= ($morequerystring ? '&' : '') . $param . '=' . GETPOST($param);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-$title = $langs->trans("VATReport")." ".dol_print_date($date_start, '', 'tzserver')." -> ".dol_print_date($date_end, '', 'tzserver');
|
|
|
+$title = $langs->trans("VATReport") . " " . dol_print_date($date_start, '', 'tzserver') . " -> " . dol_print_date($date_end, '', 'tzserver');
|
|
|
llxHeader('', $title, '', '', 0, 0, '', '', $morequerystring);
|
|
|
|
|
|
|
|
@@ -107,8 +107,8 @@ llxHeader('', $title, '', '', 0, 0, '', '', $morequerystring);
|
|
|
|
|
|
//$fsearch.='<br>';
|
|
|
$fsearch = '<!-- hidden fields for form -->';
|
|
|
-$fsearch .= '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
-$fsearch .= '<input type="hidden" name="modetax" value="'.$modetax.'">';
|
|
|
+$fsearch .= '<input type="hidden" name="token" value="' . newToken() . '">';
|
|
|
+$fsearch .= '<input type="hidden" name="modetax" value="' . $modetax . '">';
|
|
|
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
|
|
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
|
|
|
|
|
@@ -125,7 +125,7 @@ if ($modetax == 1) {
|
|
|
if ($modetax == 2) {
|
|
|
$calcmode = $langs->trans('OptionPaymentForProductAndServices');
|
|
|
}
|
|
|
-$calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')</span>';
|
|
|
+$calcmode .= ' <span class="opacitymedium">(' . $langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT . '/admin/taxes.php') . ')</span>';
|
|
|
// Set period
|
|
|
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
|
|
|
$period .= ' - ';
|
|
@@ -146,29 +146,29 @@ if ($nextquarter < 4) {
|
|
|
$nextquarter = 1;
|
|
|
$nextyear++;
|
|
|
}
|
|
|
-$description .= $fsearch;
|
|
|
+$description = $fsearch;
|
|
|
$builddate = dol_now();
|
|
|
|
|
|
-if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') {
|
|
|
+if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') {
|
|
|
$description .= $langs->trans("RulesVATDueProducts");
|
|
|
}
|
|
|
-if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') {
|
|
|
+if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment') {
|
|
|
$description .= $langs->trans("RulesVATInProducts");
|
|
|
}
|
|
|
-if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') {
|
|
|
- $description .= '<br>'.$langs->trans("RulesVATDueServices");
|
|
|
+if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') {
|
|
|
+ $description .= '<br>' . $langs->trans("RulesVATDueServices");
|
|
|
}
|
|
|
-if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
|
|
|
- $description .= '<br>'.$langs->trans("RulesVATInServices");
|
|
|
+if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
|
|
|
+ $description .= '<br>' . $langs->trans("RulesVATInServices");
|
|
|
}
|
|
|
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|
|
- $description .= '<br>'.$langs->trans("DepositsAreNotIncluded");
|
|
|
+ $description .= '<br>' . $langs->trans("DepositsAreNotIncluded");
|
|
|
}
|
|
|
if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
|
|
$description .= $langs->trans("SupplierDepositsAreNotIncluded");
|
|
|
}
|
|
|
if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) {
|
|
|
- $description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue");
|
|
|
+ $description .= '<br>' . $langs->trans("ThisIsAnEstimatedValue");
|
|
|
}
|
|
|
|
|
|
// Customers invoices
|
|
@@ -178,7 +178,7 @@ $amountcust = $langs->trans("AmountHT");
|
|
|
$vatcust = $langs->trans("VATReceived");
|
|
|
$namecust = $langs->trans("Name");
|
|
|
if ($mysoc->tva_assuj) {
|
|
|
- $vatcust .= ' ('.$langs->trans("VATToPay").')';
|
|
|
+ $vatcust .= ' (' . $langs->trans("VATToPay") . ')';
|
|
|
}
|
|
|
|
|
|
// Suppliers invoices
|
|
@@ -188,10 +188,13 @@ $amountsup = $amountcust;
|
|
|
$vatsup = $langs->trans("VATPaid");
|
|
|
$namesup = $namecust;
|
|
|
if ($mysoc->tva_assuj) {
|
|
|
- $vatsup .= ' ('.$langs->trans("ToGetBack").')';
|
|
|
+ $vatsup .= ' (' . $langs->trans("ToGetBack") . ')';
|
|
|
}
|
|
|
|
|
|
$optioncss = GETPOST('optioncss', 'alpha');
|
|
|
+$periodlink = '';
|
|
|
+$exportlink = '';
|
|
|
+
|
|
|
if ($optioncss != "print") {
|
|
|
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
|
|
|
}
|
|
@@ -221,11 +224,11 @@ $x_paye = tax_by_rate('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'buy')
|
|
|
if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
$langs->load("errors");
|
|
|
if ($x_coll == -1) {
|
|
|
- print '<tr><td colspan="'.$columns.'">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
|
|
|
+ print '<tr><td colspan="' . $columns . '">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
|
|
|
} elseif ($x_coll == -2) {
|
|
|
- print '<tr><td colspan="'.$columns.'">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
|
|
+ print '<tr><td colspan="' . $columns . '">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
|
|
|
} else {
|
|
|
- print '<tr><td colspan="'.$columns.'">'.$langs->trans("Error").'</td></tr>';
|
|
|
+ print '<tr><td colspan="' . $columns . '">' . $langs->trans("Error") . '</td></tr>';
|
|
|
}
|
|
|
} else {
|
|
|
$x_both = array();
|
|
@@ -257,27 +260,27 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
$company_static->code_compta_fournisseur = $x_coll[$my_coll_rate]['company_supplier_accounting_code'][$id];
|
|
|
|
|
|
$x_both[$my_coll_rate]['coll']['detail'][] = array(
|
|
|
- 'id' =>$x_coll[$my_coll_rate]['facid'][$id],
|
|
|
- 'descr' =>$x_coll[$my_coll_rate]['descr'][$id],
|
|
|
- 'pid' =>$x_coll[$my_coll_rate]['pid'][$id],
|
|
|
- 'pref' =>$x_coll[$my_coll_rate]['pref'][$id],
|
|
|
- 'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id],
|
|
|
- 'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id],
|
|
|
- 'payment_ref'=>$x_coll[$my_coll_rate]['payment_ref'][$id],
|
|
|
- 'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id],
|
|
|
- 'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id],
|
|
|
- 'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id],
|
|
|
- 'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id],
|
|
|
- 'datef' =>$x_coll[$my_coll_rate]['datef'][$id],
|
|
|
- 'datep' =>$x_coll[$my_coll_rate]['datep'][$id],
|
|
|
-
|
|
|
- 'company_link'=>$company_static->getNomUrl(1, '', 20),
|
|
|
-
|
|
|
- 'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id],
|
|
|
- 'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id],
|
|
|
- 'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id],
|
|
|
- 'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id],
|
|
|
- 'link' =>$invoice_customer->getNomUrl(1, '', 12)
|
|
|
+ 'id' => $x_coll[$my_coll_rate]['facid'][$id],
|
|
|
+ 'descr' => $x_coll[$my_coll_rate]['descr'][$id],
|
|
|
+ 'pid' => $x_coll[$my_coll_rate]['pid'][$id],
|
|
|
+ 'pref' => $x_coll[$my_coll_rate]['pref'][$id],
|
|
|
+ 'ptype' => $x_coll[$my_coll_rate]['ptype'][$id],
|
|
|
+ 'payment_id' => $x_coll[$my_coll_rate]['payment_id'][$id],
|
|
|
+ 'payment_ref' => $x_coll[$my_coll_rate]['payment_ref'][$id],
|
|
|
+ 'payment_amount' => $x_coll[$my_coll_rate]['payment_amount'][$id],
|
|
|
+ 'ftotal_ttc' => $x_coll[$my_coll_rate]['ftotal_ttc'][$id],
|
|
|
+ 'dtotal_ttc' => $x_coll[$my_coll_rate]['dtotal_ttc'][$id],
|
|
|
+ 'dtype' => $x_coll[$my_coll_rate]['dtype'][$id],
|
|
|
+ 'datef' => $x_coll[$my_coll_rate]['datef'][$id],
|
|
|
+ 'datep' => $x_coll[$my_coll_rate]['datep'][$id],
|
|
|
+
|
|
|
+ 'company_link' => $company_static->getNomUrl(1, '', 20),
|
|
|
+
|
|
|
+ 'ddate_start' => $x_coll[$my_coll_rate]['ddate_start'][$id],
|
|
|
+ 'ddate_end' => $x_coll[$my_coll_rate]['ddate_end'][$id],
|
|
|
+ 'totalht' => $x_coll[$my_coll_rate]['totalht_list'][$id],
|
|
|
+ 'vat' => $x_coll[$my_coll_rate]['vat_list'][$id],
|
|
|
+ 'link' => $invoice_customer->getNomUrl(1, '', 12)
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -300,22 +303,22 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
$expensereport->type = $x_paye[$my_paye_rate]['type'][$id];
|
|
|
|
|
|
$x_both[$my_paye_rate]['paye']['detail'][] = array(
|
|
|
- 'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
|
|
- 'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
|
|
- 'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
|
|
- 'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
|
|
- 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
|
|
- 'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id],
|
|
|
- 'payment_ref' =>$x_paye[$my_paye_rate]['payment_ref'][$id],
|
|
|
- 'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
|
|
- 'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
|
|
- 'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
|
|
- 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
|
|
- 'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
|
|
- 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
|
|
- 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
|
|
- 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
|
|
- 'link' =>$expensereport->getNomUrl(1)
|
|
|
+ 'id' => $x_paye[$my_paye_rate]['facid'][$id],
|
|
|
+ 'descr' => $x_paye[$my_paye_rate]['descr'][$id],
|
|
|
+ 'pid' => $x_paye[$my_paye_rate]['pid'][$id],
|
|
|
+ 'pref' => $x_paye[$my_paye_rate]['pref'][$id],
|
|
|
+ 'ptype' => $x_paye[$my_paye_rate]['ptype'][$id],
|
|
|
+ 'payment_id' => $x_paye[$my_paye_rate]['payment_id'][$id],
|
|
|
+ 'payment_ref' => $x_paye[$my_paye_rate]['payment_ref'][$id],
|
|
|
+ 'payment_amount' => $x_paye[$my_paye_rate]['payment_amount'][$id],
|
|
|
+ 'ftotal_ttc' => price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
|
|
+ 'dtotal_ttc' => price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
|
|
+ 'dtype' => $x_paye[$my_paye_rate]['dtype'][$id],
|
|
|
+ 'ddate_start' => $x_paye[$my_paye_rate]['ddate_start'][$id],
|
|
|
+ 'ddate_end' => $x_paye[$my_paye_rate]['ddate_end'][$id],
|
|
|
+ 'totalht' => price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
|
|
+ 'vat' => $x_paye[$my_paye_rate]['vat_list'][$id],
|
|
|
+ 'link' => $expensereport->getNomUrl(1)
|
|
|
);
|
|
|
} else {
|
|
|
$invoice_supplier->id = $x_paye[$my_paye_rate]['facid'][$id];
|
|
@@ -336,27 +339,27 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
$company_static->code_compta_fournisseur = $x_paye[$my_paye_rate]['company_supplier_accounting_code'][$id];
|
|
|
|
|
|
$x_both[$my_paye_rate]['paye']['detail'][] = array(
|
|
|
- 'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
|
|
- 'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
|
|
- 'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
|
|
- 'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
|
|
- 'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
|
|
- 'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id],
|
|
|
- 'payment_ref'=>$x_paye[$my_paye_rate]['payment_ref'][$id],
|
|
|
- 'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
|
|
- 'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
|
|
- 'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
|
|
- 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
|
|
- 'datef' =>$x_paye[$my_paye_rate]['datef'][$id],
|
|
|
- 'datep' =>$x_paye[$my_paye_rate]['datep'][$id],
|
|
|
-
|
|
|
- 'company_link'=>$company_static->getNomUrl(1, '', 20),
|
|
|
-
|
|
|
- 'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
|
|
- 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
|
|
- 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
|
|
- 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
|
|
- 'link' =>$invoice_supplier->getNomUrl(1, '', 12)
|
|
|
+ 'id' => $x_paye[$my_paye_rate]['facid'][$id],
|
|
|
+ 'descr' => $x_paye[$my_paye_rate]['descr'][$id],
|
|
|
+ 'pid' => $x_paye[$my_paye_rate]['pid'][$id],
|
|
|
+ 'pref' => $x_paye[$my_paye_rate]['pref'][$id],
|
|
|
+ 'ptype' => $x_paye[$my_paye_rate]['ptype'][$id],
|
|
|
+ 'payment_id' => $x_paye[$my_paye_rate]['payment_id'][$id],
|
|
|
+ 'payment_ref' => $x_paye[$my_paye_rate]['payment_ref'][$id],
|
|
|
+ 'payment_amount' => $x_paye[$my_paye_rate]['payment_amount'][$id],
|
|
|
+ 'ftotal_ttc' => price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
|
|
+ 'dtotal_ttc' => price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
|
|
+ 'dtype' => $x_paye[$my_paye_rate]['dtype'][$id],
|
|
|
+ 'datef' => $x_paye[$my_paye_rate]['datef'][$id],
|
|
|
+ 'datep' => $x_paye[$my_paye_rate]['datep'][$id],
|
|
|
+
|
|
|
+ 'company_link' => $company_static->getNomUrl(1, '', 20),
|
|
|
+
|
|
|
+ 'ddate_start' => $x_paye[$my_paye_rate]['ddate_start'][$id],
|
|
|
+ 'ddate_end' => $x_paye[$my_paye_rate]['ddate_end'][$id],
|
|
|
+ 'totalht' => price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
|
|
+ 'vat' => $x_paye[$my_paye_rate]['vat_list'][$id],
|
|
|
+ 'link' => $invoice_supplier->getNomUrl(1, '', 12)
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -375,21 +378,21 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
|
|
|
// Customers invoices
|
|
|
print '<tr class="liste_titre">';
|
|
|
- print '<td class="left">'.$elementcust.'</td>';
|
|
|
- print '<td class="left">'.$langs->trans("DateInvoice").'</td>';
|
|
|
- if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
|
|
|
- print '<td class="left">'.$langs->trans("DatePayment").'</td>';
|
|
|
+ print '<td class="left">' . $elementcust . '</td>';
|
|
|
+ print '<td class="left">' . $langs->trans("DateInvoice") . '</td>';
|
|
|
+ if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment' || getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
|
|
|
+ print '<td class="left">' . $langs->trans("DatePayment") . '</td>';
|
|
|
} else {
|
|
|
print '<td></td>';
|
|
|
}
|
|
|
- print '<td class="left">'.$namecust.'</td>';
|
|
|
- print '<td class="left">'.$productcust.'</td>';
|
|
|
+ print '<td class="left">' . $namecust . '</td>';
|
|
|
+ print '<td class="left">' . $productcust . '</td>';
|
|
|
if ($modetax != 1) {
|
|
|
- print '<td class="right">'.$amountcust.'</td>';
|
|
|
- print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
|
|
+ print '<td class="right">' . $amountcust . '</td>';
|
|
|
+ print '<td class="right">' . $langs->trans("Payment") . ' (' . $langs->trans("PercentOfInvoice") . ')</td>';
|
|
|
}
|
|
|
- print '<td class="right">'.$langs->trans("AmountHTVATRealReceived").'</td>';
|
|
|
- print '<td class="right">'.$vatcust.'</td>';
|
|
|
+ print '<td class="right">' . $langs->trans("AmountHTVATRealReceived") . '</td>';
|
|
|
+ print '<td class="right">' . $vatcust . '</td>';
|
|
|
print '</tr>';
|
|
|
|
|
|
$action = "tvadetail";
|
|
@@ -410,15 +413,15 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
if (is_array($x_both[$rate]['coll']['detail'])) {
|
|
|
// VAT Rate
|
|
|
print "<tr>";
|
|
|
- print '<td class="tax_rate" colspan="' . ($span+1) . '">';
|
|
|
+ print '<td class="tax_rate" colspan="' . ($span + 1) . '">';
|
|
|
print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
|
|
|
- print ' - <a href="'.DOL_URL_ROOT.'/compta/tva/quadri_detail.php?invoice_type=customer';
|
|
|
+ print ' - <a href="' . DOL_URL_ROOT . '/compta/tva/quadri_detail.php?invoice_type=customer';
|
|
|
if ($invoice_type != 'customer' || !GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
|
|
- print '&vat_rate_show='.urlencode($rate);
|
|
|
+ print '&vat_rate_show=' . urlencode($rate);
|
|
|
}
|
|
|
- print '&date_startyear='.urlencode($date_start_year).'&date_startmonth='.urlencode($date_start_month).'&date_startday='.urlencode($date_start_day).'&date_endyear='.urlencode($date_end_year).'&date_endmonth='.urlencode($date_end_month).'&date_endday='.urlencode($date_end_day).'">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
|
|
|
+ print '&date_startyear=' . urlencode($date_start_year) . '&date_startmonth=' . urlencode($date_start_month) . '&date_startday=' . urlencode($date_start_day) . '&date_endyear=' . urlencode($date_end_year) . '&date_endmonth=' . urlencode($date_end_month) . '&date_endday=' . urlencode($date_end_day) . '">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
|
|
|
print '</td>';
|
|
|
- print '</tr>'."\n";
|
|
|
+ print '</tr>' . "\n";
|
|
|
|
|
|
foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) {
|
|
|
// Define type
|
|
@@ -434,26 +437,26 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
}
|
|
|
|
|
|
// Payment
|
|
|
- $ratiopaymentinvoice=1;
|
|
|
+ $ratiopaymentinvoice = 1;
|
|
|
if ($modetax != 1) {
|
|
|
- if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|
|
|
- || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) {
|
|
|
+ if (($type == 0 && getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice')
|
|
|
+ || ($type == 1 && getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice')) {
|
|
|
} else {
|
|
|
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
|
|
|
- $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
|
|
+ $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// Total collected
|
|
|
- $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
|
|
+ $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
|
|
|
|
|
|
// VAT
|
|
|
- $temp_vat=$fields['vat']*$ratiopaymentinvoice;
|
|
|
+ $temp_vat = $fields['vat'] * $ratiopaymentinvoice;
|
|
|
|
|
|
$subtot_coll_total_ht += $temp_ht;
|
|
|
- $subtot_coll_vat += $temp_vat;
|
|
|
- $x_coll_sum += $temp_vat;
|
|
|
+ $subtot_coll_vat += $temp_vat;
|
|
|
+ $x_coll_sum += $temp_vat;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -495,7 +498,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
|
|
|
|
|
// Payment date
|
|
|
- if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
|
|
+ if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment' || getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
|
|
else print '<td></td>';
|
|
|
|
|
|
// Company name
|
|
@@ -556,10 +559,10 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
if ($fields['payment_amount'] && $fields['ftotal_ttc']) {
|
|
|
$payment_static->id = $fields['payment_id'];
|
|
|
$payment_static->ref = $fields['payment_ref'];
|
|
|
- print $payment_static->getNomUrl(2, '', '', 0).' ';
|
|
|
+ print $payment_static->getNomUrl(2, '', '', 0) . ' ';
|
|
|
}
|
|
|
- if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|
|
|
- || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) {
|
|
|
+ if (($type == 0 && getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice')
|
|
|
+ || ($type == 1 && getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice')) {
|
|
|
print $langs->trans("NA");
|
|
|
} else {
|
|
|
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
|
|
@@ -596,47 +599,47 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
// Total customers for this vat rate
|
|
|
print '<tr class="liste_total">';
|
|
|
print '<td colspan="4"></td>';
|
|
|
- print '<td class="right">'.$langs->trans("Total").':</td>';
|
|
|
+ print '<td class="right">' . $langs->trans("Total") . ':</td>';
|
|
|
if ($modetax != 1) {
|
|
|
print '<td class="nowrap right"> </td>';
|
|
|
print '<td class="right"> </td>';
|
|
|
}
|
|
|
- print '<td class="right"><span class="amount">'.price(price2num($subtot_coll_total_ht, 'MT')).'</span></td>';
|
|
|
- print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_coll_vat, 'MT')).'</span></td>';
|
|
|
+ print '<td class="right"><span class="amount">' . price(price2num($subtot_coll_total_ht, 'MT')) . '</span></td>';
|
|
|
+ print '<td class="nowrap right"><span class="amount">' . price(price2num($subtot_coll_vat, 'MT')) . '</span></td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
|
|
|
|
if (count($x_coll) == 0) { // Show a total line if nothing shown
|
|
|
print '<tr class="liste_total">';
|
|
|
print '<td colspan="4"></td>';
|
|
|
- print '<td class="right">'.$langs->trans("Total").':</td>';
|
|
|
+ print '<td class="right">' . $langs->trans("Total") . ':</td>';
|
|
|
if ($modetax != 1) {
|
|
|
print '<td class="nowrap right"> </td>';
|
|
|
print '<td class="right"> </td>';
|
|
|
}
|
|
|
- print '<td class="right">'.price(price2num(0, 'MT')).'</td>';
|
|
|
- print '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>';
|
|
|
+ print '<td class="right">' . price(price2num(0, 'MT')) . '</td>';
|
|
|
+ print '<td class="nowrap right">' . price(price2num(0, 'MT')) . '</td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
|
|
|
|
// Blank line
|
|
|
- print '<tr><td colspan="'.($span+2).'"> </td></tr>';
|
|
|
+ print '<tr><td colspan="' . ($span + 2) . '"> </td></tr>';
|
|
|
|
|
|
// Print table headers for this quadri - expenses
|
|
|
print '<tr class="liste_titre liste_titre_topborder">';
|
|
|
- print '<td class="left">'.$elementsup.'</td>';
|
|
|
- print '<td class="left">'.$langs->trans("DateInvoice").'</td>';
|
|
|
- if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td class="left">'.$langs->trans("DatePayment").'</td>';
|
|
|
+ print '<td class="left">' . $elementsup . '</td>';
|
|
|
+ print '<td class="left">' . $langs->trans("DateInvoice") . '</td>';
|
|
|
+ if (getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'payment' || getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'payment') print '<td class="left">' . $langs->trans("DatePayment") . '</td>';
|
|
|
else print '<td></td>';
|
|
|
- print '<td class="left">'.$namesup.'</td>';
|
|
|
- print '<td class="left">'.$productsup.'</td>';
|
|
|
+ print '<td class="left">' . $namesup . '</td>';
|
|
|
+ print '<td class="left">' . $productsup . '</td>';
|
|
|
if ($modetax != 1) {
|
|
|
- print '<td class="right">'.$amountsup.'</td>';
|
|
|
- print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
|
|
+ print '<td class="right">' . $amountsup . '</td>';
|
|
|
+ print '<td class="right">' . $langs->trans("Payment") . ' (' . $langs->trans("PercentOfInvoice") . ')</td>';
|
|
|
}
|
|
|
- print '<td class="right">'.$langs->trans("AmountHTVATRealPaid").'</td>';
|
|
|
- print '<td class="right">'.$vatsup.'</td>';
|
|
|
- print '</tr>'."\n";
|
|
|
+ print '<td class="right">' . $langs->trans("AmountHTVATRealPaid") . '</td>';
|
|
|
+ print '<td class="right">' . $vatsup . '</td>';
|
|
|
+ print '</tr>' . "\n";
|
|
|
|
|
|
foreach (array_keys($x_paye) as $rate) {
|
|
|
$subtot_paye_total_ht = 0;
|
|
@@ -644,15 +647,15 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
|
|
|
if (is_array($x_both[$rate]['paye']['detail'])) {
|
|
|
print "<tr>";
|
|
|
- print '<td class="tax_rate" colspan="' . ($span+1) . '">';
|
|
|
+ print '<td class="tax_rate" colspan="' . ($span + 1) . '">';
|
|
|
print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
|
|
|
- print ' - <a href="'.DOL_URL_ROOT.'/compta/tva/quadri_detail.php?invoice_type=supplier';
|
|
|
+ print ' - <a href="' . DOL_URL_ROOT . '/compta/tva/quadri_detail.php?invoice_type=supplier';
|
|
|
if ($invoice_type != 'supplier' || !GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
|
|
- print '&vat_rate_show='.urlencode($rate);
|
|
|
+ print '&vat_rate_show=' . urlencode($rate);
|
|
|
}
|
|
|
- print '&date_startyear='.urlencode($date_start_year).'&date_startmonth='.urlencode($date_start_month).'&date_startday='.urlencode($date_start_day).'&date_endyear='.urlencode($date_end_year).'&date_endmonth='.urlencode($date_end_month).'&date_endday='.urlencode($date_end_day).'">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
|
|
|
+ print '&date_startyear=' . urlencode($date_start_year) . '&date_startmonth=' . urlencode($date_start_month) . '&date_startday=' . urlencode($date_start_day) . '&date_endyear=' . urlencode($date_end_year) . '&date_endmonth=' . urlencode($date_end_month) . '&date_endday=' . urlencode($date_end_day) . '">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
|
|
|
print '</td>';
|
|
|
- print '</tr>'."\n";
|
|
|
+ print '</tr>' . "\n";
|
|
|
|
|
|
foreach ($x_both[$rate]['paye']['detail'] as $index => $fields) {
|
|
|
// Define type
|
|
@@ -670,8 +673,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
// Payment
|
|
|
$ratiopaymentinvoice = 1;
|
|
|
if ($modetax != 1) {
|
|
|
- if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')
|
|
|
- || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) {
|
|
|
+ if (($type == 0 && getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice')
|
|
|
+ || ($type == 1 && getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice')) {
|
|
|
} else {
|
|
|
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
|
|
|
$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
|
|
@@ -727,7 +730,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
|
|
|
|
|
// Payment date
|
|
|
- if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') {
|
|
|
+ if (getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'payment' || getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'payment') {
|
|
|
print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
|
|
} else {
|
|
|
print '<td></td>';
|
|
@@ -790,11 +793,11 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
if ($fields['payment_amount'] && $fields['ftotal_ttc']) {
|
|
|
$paymentfourn_static->id = $fields['payment_id'];
|
|
|
$paymentfourn_static->ref = $fields['payment_ref'];
|
|
|
- print $paymentfourn_static->getNomUrl(2, '', '', 0).' ';
|
|
|
+ print $paymentfourn_static->getNomUrl(2, '', '', 0) . ' ';
|
|
|
}
|
|
|
|
|
|
- if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')
|
|
|
- || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) {
|
|
|
+ if (($type == 0 && getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'invoice')
|
|
|
+ || ($type == 1 && getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'invoice')) {
|
|
|
print $langs->trans("NA");
|
|
|
} else {
|
|
|
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
|
|
@@ -832,26 +835,26 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
// Total suppliers for this vat rate
|
|
|
print '<tr class="liste_total">';
|
|
|
print '<td colspan="4"></td>';
|
|
|
- print '<td class="right">'.$langs->trans("Total").':</td>';
|
|
|
+ print '<td class="right">' . $langs->trans("Total") . ':</td>';
|
|
|
if ($modetax != 1) {
|
|
|
print '<td class="nowrap right"> </td>';
|
|
|
print '<td class="right"> </td>';
|
|
|
}
|
|
|
- print '<td class="right"><span class="amount">'.price(price2num($subtot_paye_total_ht, 'MT')).'</span></td>';
|
|
|
- print '<td class="nowrap right"><span class="amount">'.price(price2num($subtot_paye_vat, 'MT')).'</span></td>';
|
|
|
+ print '<td class="right"><span class="amount">' . price(price2num($subtot_paye_total_ht, 'MT')) . '</span></td>';
|
|
|
+ print '<td class="nowrap right"><span class="amount">' . price(price2num($subtot_paye_vat, 'MT')) . '</span></td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
|
|
|
|
if (count($x_paye) == 0) { // Show a total line if nothing shown
|
|
|
print '<tr class="liste_total">';
|
|
|
print '<td colspan="4"></td>';
|
|
|
- print '<td class="right">'.$langs->trans("Total").':</td>';
|
|
|
+ print '<td class="right">' . $langs->trans("Total") . ':</td>';
|
|
|
if ($modetax != 1) {
|
|
|
print '<td class="nowrap right"> </td>';
|
|
|
print '<td class="right"> </td>';
|
|
|
}
|
|
|
- print '<td class="right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
|
|
|
- print '<td class="nowrap right"><span class="amount">'.price(price2num(0, 'MT')).'</span></td>';
|
|
|
+ print '<td class="right"><span class="amount">' . price(price2num(0, 'MT')) . '</span></td>';
|
|
|
+ print '<td class="nowrap right"><span class="amount">' . price(price2num(0, 'MT')) . '</span></td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
|
|
|
@@ -863,8 +866,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
|
|
print '<table class="noborder centpercent">';
|
|
|
$diff = $x_coll_sum - $x_paye_sum;
|
|
|
print '<tr class="liste_total">';
|
|
|
- print '<td class="liste_total" colspan="'.$span.'">'.$langs->trans("TotalToPay").($q ? ', '.$langs->trans("Quadri").' '.$q : '').'</td>';
|
|
|
- print '<td class="liste_total nowrap right"><b>'.price(price2num($diff, 'MT'))."</b></td>\n";
|
|
|
+ print '<td class="liste_total" colspan="' . $span . '">' . $langs->trans("TotalToPay") . ($q ? ', ' . $langs->trans("Quadri") . ' ' . $q : '') . '</td>';
|
|
|
+ print '<td class="liste_total nowrap right"><b>' . price(price2num($diff, 'MT')) . "</b></td>\n";
|
|
|
print "</tr>\n";
|
|
|
|
|
|
$i++;
|