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

@@ -755,7 +755,7 @@ if ($mysoc->useLocalTax(1)) {
$opcions = array($langs->trans("CalcLocaltax1").' '.$langs->trans("CalcLocaltax1Desc"), $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"), $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"));
print '<br><label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
print $form->selectarray("clt1", $opcions, getDolGlobalString('MAIN_INFO_LOCALTAX_CALC1'));
print "</div>";
print "</td></tr>\n";
@@ -796,7 +796,7 @@ if ($mysoc->useLocalTax(2)) {
$formcompany->select_localtax(2, $conf->global->MAIN_INFO_VALUE_LOCALTAX2, "lt2");
}
print '<br><label for="clt2">'.$langs->trans("CalcLocaltax").'</label>: ';
print $form->selectarray("clt2", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC2);
print $form->selectarray("clt2", $opcions, getDolGlobalString('MAIN_INFO_LOCALTAX_CALC2'));
print "</div>";
print "</td></tr>\n";

View File

@@ -59,7 +59,7 @@ $action = GETPOST('action', 'aZ09');
// Product On delivery On delivery
// Service On invoice On invoice
$tax_mode = empty($conf->global->TAX_MODE) ? 0 : $conf->global->TAX_MODE;
$tax_mode = getDolGlobalString('TAX_MODE') ? 0 : getDolGlobalInt('TAX_MODE');
if ($action == 'update') {
$error = 0;
@@ -220,7 +220,7 @@ if (empty($mysoc->tva_assuj)) {
// Products
print '<tr class="oddeven"><td>'.$langs->trans("Product").'</td>';
print '<td>';
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment') {
if (getDolGlobalString('TAX_MODE_BUY_PRODUCT') == 'payment') {
print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} else {
@@ -229,7 +229,7 @@ if (empty($mysoc->tva_assuj)) {
}
print '</td>';
print '<td>';
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') {
if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment') {
print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} else {
@@ -241,7 +241,7 @@ if (empty($mysoc->tva_assuj)) {
// Services
print '<tr class="oddeven"><td>'.$langs->trans("Services").'</td>';
print '<td>';
if ($conf->global->TAX_MODE_BUY_SERVICE == 'payment') {
if (getDolGlobalString('TAX_MODE_BUY_SERVICE') == 'payment') {
print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} else {
@@ -250,7 +250,7 @@ if (empty($mysoc->tva_assuj)) {
}
print '</td>';
print '<td>';
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} else {

View File

@@ -91,7 +91,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 = $conf->global->TAX_MODE;
$modetax = getDolGlobalString('TAX_MODE');
if (GETPOSTISSET("modetax")) {
$modetax = GETPOST("modetax", 'int');
}
@@ -140,8 +140,9 @@ $fsearch .= '<input type="hidden" name="localTaxType" value="'.$local.'">';
$fsearch .= $langs->trans("SalesTurnoverMinimum").': ';
$fsearch .= '<input type="text" name="min" id="min" value="'.$min.'" size="6">';
$calc = $conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
$calc = getDolGlobalString('MAIN_INFO_LOCALTAX_CALC').$local;
// Affiche en-tete du rapport
$description='';
if ($calc == 0 || $calc == 1) { // Calculate on invoice for goods and services
$calcmode = $calc == 0 ? $langs->trans("CalcModeLT".$local) : $langs->trans("CalcModeLT".$local."Rec");
$calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRulesLT", DOL_URL_ROOT.'/admin/company.php').')</span>';
@@ -178,8 +179,11 @@ if ($calc == 2) { // Invoice for goods, payment for services
$productsup = $langs->trans("Description");
$amountsup = $langs->trans("AmountHT");
}
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
$periodlink = '';
$exportlink = '';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
$vatcust = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_code);
$vatsup = $langs->transcountry($local == 1 ? "LT1" : "LT2", $mysoc->country_code);

View File

@@ -80,7 +80,7 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e
// Define modetax (0 or 1)
// 0=normal, 1=option vat for services is on debit, 2=option on payments for products
$modetax = $conf->global->TAX_MODE;
$modetax = getDolGlobalString('TAX_MODE');
if (GETPOSTISSET("modetax")) {
$modetax = GETPOST("modetax", 'int');
}
@@ -223,14 +223,14 @@ if ($localTaxType == 1) {
$LTPaid = 'LT1Paid';
$LTCustomer = 'LT1Customer';
$LTSupplier = 'LT1Supplier';
$CalcLT = $conf->global->MAIN_INFO_LOCALTAX_CALC1;
$CalcLT = getDolGlobalString('MAIN_INFO_LOCALTAX_CALC1');
} else {
$LT = 'LT2';
$LTSummary = 'LT2Summary';
$LTPaid = 'LT2Paid';
$LTCustomer = 'LT2Customer';
$LTSupplier = 'LT2Supplier';
$CalcLT = $conf->global->MAIN_INFO_LOCALTAX_CALC2;
$CalcLT = getDolGlobalString('MAIN_INFO_LOCALTAX_CALC2');
}
$fsearch = '<!-- hidden fields for form -->';
@@ -471,8 +471,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
$type = 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')) {
//print $langs->trans("NA");
} else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
@@ -511,8 +511,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $
$type = 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')) {
//print $langs->trans("NA");
} else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {

View File

@@ -102,8 +102,8 @@ 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 = $conf->global->TAX_MODE;
$calc = $conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
$modetax = $conf->global->$calc;
$calc = getDolGlobalString('MAIN_INFO_LOCALTAX_CALC').$local;
$modetax = getDolGlobalInt('TAX_MODE');
if (GETPOSTISSET("modetax")) {
$modetax = GETPOST("modetax", 'int');
}
@@ -169,6 +169,7 @@ $calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToMod
// Set period
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$prevyear = $year_start;
$q=0;
$prevquarter = $q;
if ($prevquarter > 1) {
$prevquarter--;
@@ -184,13 +185,13 @@ if ($nextquarter < 4) {
$nextquarter = 1;
$nextyear++;
}
$description .= $fsearch;
$description = $fsearch;
$builddate = dol_now();
/*if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts");
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts");
if ($conf->global->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_PRODUCT') == 'invoice') $description.=$langs->trans("RulesVATDueProducts");
if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment') $description.=$langs->trans("RulesVATInProducts");
if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') $description.='<br>'.$langs->trans("RulesVATDueServices");
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");
}
@@ -222,6 +223,8 @@ if ($mysoc->tva_assuj) {
$vatsup .= ' ('.$langs->trans("ToGetBack").')';
}
$periodlink = '';
$exportlink = '';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);

View File

@@ -210,16 +210,16 @@ $builddate = dol_now();
if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) {
$description .= '<br>'.$langs->trans("ThisIsAnEstimatedValue");
}
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') {
if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'invoice') {
$description .= '<br>'.$langs->trans("RulesVATDueProducts");
}
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') {
if (getDolGlobalString('TAX_MODE_SELL_PRODUCT') == 'payment') {
$description .= '<br>'.$langs->trans("RulesVATInProducts");
}
if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') {
if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') {
$description .= '<br>'.$langs->trans("RulesVATDueServices");
}
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
$description .= '<br>'.$langs->trans("RulesVATInServices");
}
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {

View File

@@ -53,7 +53,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");
}
@@ -122,6 +122,7 @@ $calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToMod
// Set period
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$prevyear = $date_start_year;
$q=0;
$prevquarter = $q;
if ($prevquarter > 1) {
$prevquarter--;
@@ -139,16 +140,16 @@ if ($nextquarter < 4) {
}
$builddate = dol_now();
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') {
$description .= $langs->trans("RulesVATDueProducts");
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') {
if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') {
$description .= '<br>'.$langs->trans("RulesVATDueServices");
}
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
$description .= '<br>'.$langs->trans("RulesVATInServices");
}
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
@@ -180,14 +181,17 @@ $productcust = $langs->trans("Description");
$namerate = $langs->trans("VATRate");
$amountcust = $langs->trans("AmountHT");
if ($mysoc->tva_assuj) {
$vatcust .= ' ('.$langs->trans("StatusToPay").')';
$vatcust = ' ('.$langs->trans("StatusToPay").')';
}
$elementsup = $langs->trans("SuppliersInvoices");
$productsup = $langs->trans("Description");
$amountsup = $langs->trans("AmountHT");
if ($mysoc->tva_assuj) {
$vatsup .= ' ('.$langs->trans("ToGetBack").')';
$vatsup = ' ('.$langs->trans("ToGetBack").')';
}
$periodlink = '';
$exportlink = '';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array(), $calcmode);
$vatcust = $langs->trans("VATReceived");
@@ -240,7 +244,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$company_static->name = $x_coll[$my_coll_thirdpartyid]['company_name'][$id];
$company_static->name_alias = $x_coll[$my_coll_thirdpartyid]['company_alias'][$id];
$company_static->email = $x_coll[$my_coll_thirdpartyid]['company_email'][$id];
$company_static->tva_intra = $x_coll[$my_coll_thirdpartyid]['tva_intra'][$id];
$company_static->tva_intra = isset($x_coll[$my_coll_thirdpartyid]['tva_intra'][$id])?$x_coll[$my_coll_thirdpartyid]['tva_intra'][$id]:0;
$company_static->client = $x_coll[$my_coll_thirdpartyid]['company_client'][$id];
$company_static->fournisseur = $x_coll[$my_coll_thirdpartyid]['company_fournisseur'][$id];
$company_static->status = $x_coll[$my_coll_thirdpartyid]['company_status'][$id];
@@ -254,7 +258,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
'descr' =>$x_coll[$my_coll_thirdpartyid]['descr'][$id],
'pid' =>$x_coll[$my_coll_thirdpartyid]['pid'][$id],
'pref' =>$x_coll[$my_coll_thirdpartyid]['pref'][$id],
'pref' =>isset($x_coll[$my_coll_thirdpartyid]['pref'][$id])?$x_coll[$my_coll_thirdpartyid]['pref'][$id]:'',
'ptype' =>$x_coll[$my_coll_thirdpartyid]['ptype'][$id],
'pstatus' =>$x_paye[$my_coll_thirdpartyid]['pstatus'][$id],
'pstatusbuy'=>$x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id],
@@ -386,12 +390,12 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
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') {
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="right">'.$namerate.'</td>';
print '<td class="right"></td>';
print '<td class="left">'.$productcust.'</td>';
if ($modetax != 1) {
print '<td class="right">'.$amountcust.'</td>';
@@ -454,7 +458,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') {
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>';
@@ -520,8 +524,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$payment_static->ref = $fields['payment_ref'];
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'])) {
@@ -589,12 +593,12 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
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') {
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"></td>';
print '<td class="left">'.$productsup.'</td>';
if ($modetax != 1) {
print '<td class="right">'.$amountsup.'</td>';
@@ -646,7 +650,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>';
@@ -711,8 +715,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
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']) {

View File

@@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/localtax/class/localtax.class.php';
// Load translation files required by the page
$langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "product", "trips", "admin"));
$now = dol_now();
$refresh = GETPOSTISSET('submit') ? true : false;
$year_current = GETPOSTISSET('year') ? GETPOST('year', 'int') : dol_print_date($now, '%Y', 'tzserver');
$year_start = $year_current;
@@ -49,7 +51,7 @@ include DOL_DOCUMENT_ROOT.'/compta/tva/initdatesforvat.inc.php';
// Define modetax (0 or 1)
// 0=normal, 1=option vat for services is on debit, 2=option on payments for products
$modetax = $conf->global->TAX_MODE;
$modetax = getDolGlobalString('TAX_MODE');
if (GETPOSTISSET("modetax")) {
$modetax = GETPOST("modetax", 'int');
}
@@ -196,16 +198,16 @@ if ($modetax == 2) {
$calcmode .= ' <span class="opacitymedium">('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')</span>';
$description .= $langs->trans("VATSummary").'<br>';
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') {
if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'invoice') {
$description .= '<br>'.$langs->trans("RulesVATDueServices");
}
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') {
if (getDolGlobalString('TAX_MODE_SELL_SERVICE') == 'payment') {
$description .= '<br>'.$langs->trans("RulesVATInServices");
}
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
@@ -417,8 +419,8 @@ if ($refresh === true) {
$type = 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')) {
//print $langs->trans("NA");
} else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
@@ -457,8 +459,8 @@ if ($refresh === true) {
$type = 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')) {
//print $langs->trans("NA");
} else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {

View File

@@ -24,17 +24,17 @@
/**
* \file htdocs/compta/tva/payments.php
* \ingroup compta
* \brief Page to list payments of special expenses
* \brief Page to list payments of special expenses
*/
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.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/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('compta', 'bills'));
@@ -47,7 +47,7 @@ if (!$year && $mode != 'tvaonly') {
$year = date("Y", time());
}
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -90,39 +90,76 @@ $title = $langs->trans("VATPayments");
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.$contextpage;
$param .= '&contextpage=' . $contextpage;
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.$limit;
$param .= '&limit=' . $limit;
}
if ($sortfield) {
$param .= '&sortfield='.$sortfield;
$param .= '&sortfield=' . $sortfield;
}
if ($sortorder) {
$param .= '&sortorder='.$sortorder;
$param .= '&sortorder=' . $sortorder;
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$center = '';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit);
if ($year) {
$param .= '&year='.$year;
$param .= '&year=' . $year;
}
if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
$sql = "SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
$sql .= ", tva.datev";
$sql .= ", tva.amount as total,";
$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
$sql .= " pct.code as payment_code";
$sql .= " FROM " . MAIN_DB_PREFIX . "tva as tva,";
$sql .= " " . MAIN_DB_PREFIX . "payment_vat as ptva";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank as b ON (b.rowid = ptva.fk_bank)";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_account as bank ON (bank.rowid = b.fk_account)";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_paiement as pct ON ptva.fk_typepaiement = pct.id";
$sql .= " WHERE ptva.fk_tva = tva.rowid";
$sql .= " AND tva.entity = " . $conf->entity;
if ($year > 0) {
$sql .= " AND (";
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql .= " (tva.datev IS NOT NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')";
$sql .= " OR (tva.datev IS NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')";
$sql .= ")";
}
if (preg_match('/^cs\./', $sortfield)
|| preg_match('/^tva\./', $sortfield)
|| preg_match('/^ptva\./', $sortfield)
|| preg_match('/^pct\./', $sortfield)
|| preg_match('/^bank\./', $sortfield)) {
$sql .= $db->order($sortfield, $sortorder);
}
//$sql.= $db->plimit($limit+1,$offset);
//print $sql;
dol_syslog("compta/tva/payments.php: select payment", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
} else {
setEventMessages($db->lasterror, null, 'errors');
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $num, 'title_accountancy', 0, '', '', $limit);
if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
}
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
print '<input type="hidden" name="page" value="' . $page . '">';
print '<input type="hidden" name="mode" value="' . $mode . '">';
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
@@ -147,19 +184,19 @@ if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
$sql .= ", tva.amount as total,";
$sql .= " ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
$sql .= " pct.code as payment_code";
$sql .= " FROM ".MAIN_DB_PREFIX."tva as tva,";
$sql .= " ".MAIN_DB_PREFIX."payment_vat as ptva";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON (b.rowid = ptva.fk_bank)";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank_account as bank ON (bank.rowid = b.fk_account)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON ptva.fk_typepaiement = pct.id";
$sql .= " FROM " . MAIN_DB_PREFIX . "tva as tva,";
$sql .= " " . MAIN_DB_PREFIX . "payment_vat as ptva";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank as b ON (b.rowid = ptva.fk_bank)";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_account as bank ON (bank.rowid = b.fk_account)";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_paiement as pct ON ptva.fk_typepaiement = pct.id";
$sql .= " WHERE ptva.fk_tva = tva.rowid";
$sql .= " AND tva.entity = ".$conf->entity;
$sql .= " AND tva.entity = " . $conf->entity;
if ($year > 0) {
$sql .= " AND (";
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
// ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
$sql .= " (tva.datev IS NOT NULL AND tva.datev between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= " OR (tva.datev IS NULL AND tva.datev between '".$db->idate(dol_get_first_day($year))."' AND '".$db->idate(dol_get_last_day($year))."')";
$sql .= " (tva.datev IS NOT NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')";
$sql .= " OR (tva.datev IS NULL AND tva.datev between '" . $db->idate(dol_get_first_day($year)) . "' AND '" . $db->idate(dol_get_last_day($year)) . "')";
$sql .= ")";
}
if (preg_match('/^cs\./', $sortfield)
@@ -169,12 +206,8 @@ if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
|| preg_match('/^bank\./', $sortfield)) {
$sql .= $db->order($sortfield, $sortorder);
}
//$sql.= $db->plimit($limit+1,$offset);
//print $sql;
dol_syslog("compta/tva/payments.php: select payment", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
if ($num) {
$num = $db->num_rows($resql);
$i = 0;
$total = 0;
@@ -194,7 +227,7 @@ if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
print '<tr class="oddeven">';
// Ref payment
print '<td>'.$payment_vat_static->getNomUrl(1)."</td>\n";
print '<td>' . $payment_vat_static->getNomUrl(1) . "</td>\n";
// VAT
print '<td>';
@@ -202,28 +235,28 @@ if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
print '</td>';
// Label
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).'">'.dol_escape_htmltag($obj->label).'</td>';
print '<td class="tdoverflowmax150" title="' . dol_escape_htmltag($obj->label) . '">' . dol_escape_htmltag($obj->label) . '</td>';
// Date
$date = $db->jdate($obj->datev);
print '<td class="center nowraponall">'.dol_print_date($date, 'day').'</td>';
print '<td class="center nowraponall">' . dol_print_date($date, 'day') . '</td>';
// Date payment
$datep = $db->jdate($obj->datep);
print '<td class="center nowraponalls">'.dol_print_date($datep, 'day').'</td>';
print '<td class="center nowraponalls">' . dol_print_date($datep, 'day') . '</td>';
// Type payment
$labelpaymenttype = '';
if ($obj->payment_code) {
$labelpaymenttype = $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
$labelpaymenttype = $langs->trans("PaymentTypeShort" . $obj->payment_code) . ' ';
}
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelpaymenttype).'">';
print '<td class="tdoverflowmax100" title="' . dol_escape_htmltag($labelpaymenttype) . '">';
print dol_escape_htmltag($labelpaymenttype);
print '</td>';
// Chq number
print '<td>'.dol_escape_htmltag($obj->num_payment).'</td>';
print '<td>' . dol_escape_htmltag($obj->num_payment) . '</td>';
if (isModEnabled("banque")) {
// Bank transaction
@@ -241,7 +274,7 @@ if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
}
// Expected to pay
print '<td class="right"><span class="amount">'.price($obj->total).'</span></td>';
print '<td class="right"><span class="amount">' . price($obj->total) . '</span></td>';
// Paid
print '<td class="right"><span class="amount">';
@@ -258,7 +291,7 @@ if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
}
// Total
print '<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans("Total").'</td>';
print '<tr class="liste_total"><td colspan="3" class="liste_total">' . $langs->trans("Total") . '</td>';
print '<td class="liste_total right"></td>'; // A total here has no sense
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
@@ -268,16 +301,14 @@ if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
}
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td align="center" class="liste_total">&nbsp;</td>';
print '<td class="liste_total right">'.price($totalpaid)."</td>";
print '<td class="liste_total right">' . price($totalpaid) . "</td>";
print "</tr>";
} else {
dol_print_error($db);
}
print '</table>';
print '</div>';
}
print '</form>';
print '</form>';
}
// End of page
llxFooter();

View File

@@ -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],
'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),
'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)
'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],
'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),
'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)
'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 '&amp;vat_rate_show='.urlencode($rate);
print '&amp;vat_rate_show=' . urlencode($rate);
}
print '&amp;date_startyear='.urlencode($date_start_year).'&amp;date_startmonth='.urlencode($date_start_month).'&amp;date_startday='.urlencode($date_start_day).'&amp;date_endyear='.urlencode($date_end_year).'&amp;date_endmonth='.urlencode($date_end_month).'&amp;date_endday='.urlencode($date_end_day).'">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
print '&amp;date_startyear=' . urlencode($date_start_year) . '&amp;date_startmonth=' . urlencode($date_start_month) . '&amp;date_startday=' . urlencode($date_start_day) . '&amp;date_endyear=' . urlencode($date_end_year) . '&amp;date_endmonth=' . urlencode($date_end_month) . '&amp;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">&nbsp;</td>';
print '<td class="right">&nbsp;</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">&nbsp;</td>';
print '<td class="right">&nbsp;</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).'">&nbsp;</td></tr>';
print '<tr><td colspan="' . ($span + 2) . '">&nbsp;</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 '&amp;vat_rate_show='.urlencode($rate);
print '&amp;vat_rate_show=' . urlencode($rate);
}
print '&amp;date_startyear='.urlencode($date_start_year).'&amp;date_startmonth='.urlencode($date_start_month).'&amp;date_startday='.urlencode($date_start_day).'&amp;date_endyear='.urlencode($date_end_year).'&amp;date_endmonth='.urlencode($date_end_month).'&amp;date_endday='.urlencode($date_end_day).'">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
print '&amp;date_startyear=' . urlencode($date_start_year) . '&amp;date_startmonth=' . urlencode($date_start_month) . '&amp;date_startday=' . urlencode($date_start_day) . '&amp;date_endyear=' . urlencode($date_end_year) . '&amp;date_endmonth=' . urlencode($date_end_month) . '&amp;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">&nbsp;</td>';
print '<td class="right">&nbsp;</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">&nbsp;</td>';
print '<td class="right">&nbsp;</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++;

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, ";