Fixing style errors.

This commit is contained in:
stickler-ci 2021-03-03 13:11:01 +00:00
parent 59a2fb8ed5
commit e1159f422a
2 changed files with 308 additions and 314 deletions

View File

@ -343,8 +343,7 @@ if ($refresh === true) {
$i = 0; $i = 0;
$mcursor = 0; $mcursor = 0;
while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mcursor is to avoid too large loop while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $mcursor is to avoid too large loop
{
//$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12); //$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12);
if ($m == 13) $y++; if ($m == 13) $y++;
if ($m > 12) $m -= 12; if ($m > 12) $m -= 12;

View File

@ -71,7 +71,7 @@ if ($refresh === false) {
$date_start=dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); $date_start=dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"));
$date_end=dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); $date_end=dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear"));
// Quarter // Quarter
if (empty($date_start) || empty($date_end)){ // We define date_start and date_end if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
$q=GETPOST("q", "int"); $q=GETPOST("q", "int");
if (empty($q)) { if (empty($q)) {
if (GETPOST("month", "int")) { if (GETPOST("month", "int")) {
@ -446,204 +446,199 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$type = 1; $type = 1;
} }
// Payment // Payment
$ratiopaymentinvoice=1; $ratiopaymentinvoice=1;
if ($modetax != 1) if ($modetax != 1) {
{ if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) {
|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) } else {
{ if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
} else { $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) { }
$ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); }
} }
}
}
// Total collected // Total collected
$temp_ht=$fields['totalht']*$ratiopaymentinvoice; $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
// VAT // VAT
$temp_vat=$fields['vat']*$ratiopaymentinvoice; $temp_vat=$fields['vat']*$ratiopaymentinvoice;
$subtot_coll_total_ht += $temp_ht; $subtot_coll_total_ht += $temp_ht;
$subtot_coll_vat += $temp_vat; $subtot_coll_vat += $temp_vat;
$x_coll_sum += $temp_vat; $x_coll_sum += $temp_vat;
} }
} }
if ($invoice_type == 'customer' && $vat_rate_show == $rate) { if ($invoice_type == 'customer' && $vat_rate_show == $rate) {
if (is_array($x_both[$rate]['coll']['detail'])) { if (is_array($x_both[$rate]['coll']['detail'])) {
foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) { foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) {
// Define type // Define type
// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
$type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']); $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type // Try to enhance type detection using date_start and date_end for free lines where type
// was not saved. // was not saved.
if (!empty($fields['ddate_start'])) { if (!empty($fields['ddate_start'])) {
$type = 1; $type = 1;
} }
if (!empty($fields['ddate_end'])) { if (!empty($fields['ddate_end'])) {
$type = 1; $type = 1;
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
print '<td class="nowrap left">' . $fields['link'] . '</td>'; print '<td class="nowrap left">' . $fields['link'] . '</td>';
// Invoice date // Invoice date
print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>'; print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
// Payment date // 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 ($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>';
else print '<td></td>'; else print '<td></td>';
// Company name // Company name
print '<td class="left">' . $fields['company_link'] . '</td>'; print '<td class="left">' . $fields['company_link'] . '</td>';
// Description // Description
print '<td class="left">'; print '<td class="left">';
if ($fields['pid']) { if ($fields['pid']) {
$product_static->id = $fields['pid']; $product_static->id = $fields['pid'];
$product_static->ref = $fields['pref']; $product_static->ref = $fields['pref'];
$product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered $product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);
if (dol_string_nohtmltag($fields['descr'])) { if (dol_string_nohtmltag($fields['descr'])) {
print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24);
} }
} else { } else {
if ($type) { if ($type) {
$text = img_object($langs->trans('Service'), 'service'); $text = img_object($langs->trans('Service'), 'service');
} else { } else {
$text = img_object($langs->trans('Product'), 'product'); $text = img_object($langs->trans('Product'), 'product');
} }
if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) { if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) {
if ($reg[1] == 'DEPOSIT') { if ($reg[1] == 'DEPOSIT') {
$fields['descr'] = $langs->transnoentitiesnoconv('Deposit'); $fields['descr'] = $langs->transnoentitiesnoconv('Deposit');
} elseif ($reg[1] == 'CREDIT_NOTE') { } elseif ($reg[1] == 'CREDIT_NOTE') {
$fields['descr'] = $langs->transnoentitiesnoconv('CreditNote'); $fields['descr'] = $langs->transnoentitiesnoconv('CreditNote');
} else { } else {
$fields['descr'] = $langs->transnoentitiesnoconv($reg[1]); $fields['descr'] = $langs->transnoentitiesnoconv($reg[1]);
} }
} }
print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24);
// Show range // Show range
print_date_range($fields['ddate_start'], $fields['ddate_end']); print_date_range($fields['ddate_start'], $fields['ddate_end']);
} }
print '</td>'; print '</td>';
// Total HT // Total HT
if ($modetax != 1) { if ($modetax != 1) {
print '<td class="nowrap right">'; print '<td class="nowrap right">';
print price($fields['totalht']); print price($fields['totalht']);
if (price2num($fields['ftotal_ttc'])) { if (price2num($fields['ftotal_ttc'])) {
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
$ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']);
//print ' ('.round($ratiolineinvoice*100,2).'%)'; //print ' ('.round($ratiolineinvoice*100,2).'%)';
} }
print '</td>'; print '</td>';
} }
// Payment // Payment
$ratiopaymentinvoice = 1; $ratiopaymentinvoice = 1;
if ($modetax != 1) { if ($modetax != 1) {
print '<td class="nowrap right">'; print '<td class="nowrap right">';
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
if ($fields['payment_amount'] && $fields['ftotal_ttc']) { if ($fields['payment_amount'] && $fields['ftotal_ttc']) {
$payment_static->id = $fields['payment_id']; $payment_static->id = $fields['payment_id'];
print $payment_static->getNomUrl(2); print $payment_static->getNomUrl(2);
} }
if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) { || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) {
print $langs->trans("NA"); print $langs->trans("NA");
} else { } else {
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) { if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
} }
print price(price2num($fields['payment_amount'], 'MT')); print price(price2num($fields['payment_amount'], 'MT'));
if (isset($fields['payment_amount'])) { if (isset($fields['payment_amount'])) {
print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)'; print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)';
} }
} }
print '</td>'; print '</td>';
} }
// Total collected // Total collected
print '<td class="nowrap right">'; print '<td class="nowrap right">';
$temp_ht = $fields['totalht'] * $ratiopaymentinvoice; $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
print price(price2num($temp_ht, 'MT'), 1); print price(price2num($temp_ht, 'MT'), 1);
print '</td>'; print '</td>';
// VAT // VAT
print '<td class="nowrap right">'; print '<td class="nowrap right">';
$temp_vat = $fields['vat'] * $ratiopaymentinvoice; $temp_vat = $fields['vat'] * $ratiopaymentinvoice;
print price(price2num($temp_vat, 'MT'), 1); print price(price2num($temp_vat, 'MT'), 1);
//print price($fields['vat']); //print price($fields['vat']);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
//$subtot_coll_total_ht += $temp_ht; //$subtot_coll_total_ht += $temp_ht;
//$subtot_coll_vat += $temp_vat; //$subtot_coll_vat += $temp_vat;
//$x_coll_sum += $temp_vat; //$x_coll_sum += $temp_vat;
} }
} }
} }
// Total customers for this vat rate // Total customers for this vat rate
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="4"></td>'; print '<td colspan="4"></td>';
print '<td class="right">'.$langs->trans("Total").':</td>'; print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax != 1) { if ($modetax != 1) {
print '<td class="nowrap right">&nbsp;</td>'; print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
} }
print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>'; print '<td class="right">'.price(price2num($subtot_coll_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>'; print '<td class="nowrap right">'.price(price2num($subtot_coll_vat, 'MT')).'</td>';
print '</tr>'; print '</tr>';
} }
if (count($x_coll) == 0) // Show a total line if nothing shown if (count($x_coll) == 0) { // Show a total line if nothing shown
{ print '<tr class="liste_total">';
print '<tr class="liste_total">'; print '<td colspan="4"></td>';
print '<td colspan="4"></td>'; print '<td class="right">'.$langs->trans("Total").':</td>';
print '<td class="right">'.$langs->trans("Total").':</td>'; if ($modetax != 1) {
if ($modetax != 1) { print '<td class="nowrap right">&nbsp;</td>';
print '<td class="nowrap right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>'; }
} print '<td class="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 '<td class="nowrap right">'.price(price2num(0, 'MT')).'</td>'; print '</tr>';
print '</tr>'; }
}
// Blank line // 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 now // Print table headers for this quadri - expenses now
print '<tr class="liste_titre liste_titre_topborder">'; print '<tr class="liste_titre liste_titre_topborder">';
print '<td class="left">'.$elementsup.'</td>'; print '<td class="left">'.$elementsup.'</td>';
print '<td class="left">'.$langs->trans("DateInvoice").'</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>'; if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td class="left">'.$langs->trans("DatePayment").'</td>';
else print '<td></td>'; else print '<td></td>';
print '<td class="left">'.$namesup.'</td>'; print '<td class="left">'.$namesup.'</td>';
print '<td class="left">'.$productsup.'</td>'; print '<td class="left">'.$productsup.'</td>';
if ($modetax != 1) { if ($modetax != 1) {
print '<td class="right">'.$amountsup.'</td>'; print '<td class="right">'.$amountsup.'</td>';
print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>'; print '<td class="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
} }
print '<td class="right">'.$langs->trans("AmountHTVATRealPaid").'</td>'; print '<td class="right">'.$langs->trans("AmountHTVATRealPaid").'</td>';
print '<td class="right">'.$vatsup.'</td>'; print '<td class="right">'.$vatsup.'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
foreach (array_keys($x_paye) as $rate) foreach (array_keys($x_paye) as $rate) {
{ $subtot_paye_total_ht = 0;
$subtot_paye_total_ht = 0; $subtot_paye_vat = 0;
$subtot_paye_vat = 0;
if (is_array($x_both[$rate]['paye']['detail'])) if (is_array($x_both[$rate]['paye']['detail'])) {
{
print "<tr>"; 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 $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
@ -664,163 +659,163 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$type = 1; $type = 1;
} }
// Payment // Payment
$ratiopaymentinvoice = 1; $ratiopaymentinvoice = 1;
if ($modetax != 1) { if ($modetax != 1) {
if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice') if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')
|| ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) { || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) {
} else { } else {
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
} }
} }
} }
// VAT paid // VAT paid
$temp_ht = $fields['totalht'] * $ratiopaymentinvoice; $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
// VAT // VAT
$temp_vat = $fields['vat'] * $ratiopaymentinvoice; $temp_vat = $fields['vat'] * $ratiopaymentinvoice;
$subtot_paye_total_ht += $temp_ht; $subtot_paye_total_ht += $temp_ht;
$subtot_paye_vat += $temp_vat; $subtot_paye_vat += $temp_vat;
$x_paye_sum += $temp_vat; $x_paye_sum += $temp_vat;
} }
if ($invoice_type == 'supplier' && $vat_rate_show == $rate) { if ($invoice_type == 'supplier' && $vat_rate_show == $rate) {
foreach ($x_both[$rate]['paye']['detail'] as $index => $fields) { foreach ($x_both[$rate]['paye']['detail'] as $index => $fields) {
// Define type // Define type
// We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown.
$type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']); $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']);
// Try to enhance type detection using date_start and date_end for free lines where type // Try to enhance type detection using date_start and date_end for free lines where type
// was not saved. // was not saved.
if (!empty($fields['ddate_start'])) { if (!empty($fields['ddate_start'])) {
$type = 1; $type = 1;
} }
if (!empty($fields['ddate_end'])) { if (!empty($fields['ddate_end'])) {
$type = 1; $type = 1;
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Ref // Ref
print '<td class="nowrap left">' . $fields['link'] . '</td>'; print '<td class="nowrap left">' . $fields['link'] . '</td>';
// Invoice date // Invoice date
print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>'; print '<td class="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
// Payment date // Payment date
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') { if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') {
print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>'; print '<td class="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
} else { } else {
print '<td></td>'; print '<td></td>';
} }
// Company name // Company name
print '<td class="left">' . $fields['company_link'] . '</td>'; print '<td class="left">' . $fields['company_link'] . '</td>';
// Description // Description
print '<td class="left">'; print '<td class="left">';
if ($fields['pid']) { if ($fields['pid']) {
$product_static->id = $fields['pid']; $product_static->id = $fields['pid'];
$product_static->ref = $fields['pref']; $product_static->ref = $fields['pref'];
$product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered $product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);
if (dol_string_nohtmltag($fields['descr'])) { if (dol_string_nohtmltag($fields['descr'])) {
print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24);
} }
} else { } else {
if ($type) { if ($type) {
$text = img_object($langs->trans('Service'), 'service'); $text = img_object($langs->trans('Service'), 'service');
} else { } else {
$text = img_object($langs->trans('Product'), 'product'); $text = img_object($langs->trans('Product'), 'product');
} }
if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) { if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) {
if ($reg[1] == 'DEPOSIT') { if ($reg[1] == 'DEPOSIT') {
$fields['descr'] = $langs->transnoentitiesnoconv('Deposit'); $fields['descr'] = $langs->transnoentitiesnoconv('Deposit');
} elseif ($reg[1] == 'CREDIT_NOTE') { } elseif ($reg[1] == 'CREDIT_NOTE') {
$fields['descr'] = $langs->transnoentitiesnoconv('CreditNote'); $fields['descr'] = $langs->transnoentitiesnoconv('CreditNote');
} else { } else {
$fields['descr'] = $langs->transnoentitiesnoconv($reg[1]); $fields['descr'] = $langs->transnoentitiesnoconv($reg[1]);
} }
} }
print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24);
// Show range // Show range
print_date_range($fields['ddate_start'], $fields['ddate_end']); print_date_range($fields['ddate_start'], $fields['ddate_end']);
} }
print '</td>'; print '</td>';
// Total HT // Total HT
if ($modetax != 1) { if ($modetax != 1) {
print '<td class="nowrap right">'; print '<td class="nowrap right">';
print price($fields['totalht']); print price($fields['totalht']);
if (price2num($fields['ftotal_ttc'])) { if (price2num($fields['ftotal_ttc'])) {
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
$ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']);
//print ' ('.round($ratiolineinvoice*100,2).'%)'; //print ' ('.round($ratiolineinvoice*100,2).'%)';
} }
print '</td>'; print '</td>';
} }
// Payment // Payment
$ratiopaymentinvoice = 1; $ratiopaymentinvoice = 1;
if ($modetax != 1) { if ($modetax != 1) {
print '<td class="nowrap right">'; print '<td class="nowrap right">';
if ($fields['payment_amount'] && $fields['ftotal_ttc']) { if ($fields['payment_amount'] && $fields['ftotal_ttc']) {
$paymentfourn_static->id = $fields['payment_id']; $paymentfourn_static->id = $fields['payment_id'];
print $paymentfourn_static->getNomUrl(2); print $paymentfourn_static->getNomUrl(2);
} }
if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice') if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')
|| ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) { || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) {
print $langs->trans("NA"); print $langs->trans("NA");
} else { } else {
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
$ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']);
} }
print price(price2num($fields['payment_amount'], 'MT')); print price(price2num($fields['payment_amount'], 'MT'));
if (isset($fields['payment_amount'])) { if (isset($fields['payment_amount'])) {
print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)'; print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)';
} }
} }
print '</td>'; print '</td>';
} }
// VAT paid // VAT paid
print '<td class="nowrap right">'; print '<td class="nowrap right">';
$temp_ht = $fields['totalht'] * $ratiopaymentinvoice; $temp_ht = $fields['totalht'] * $ratiopaymentinvoice;
print price(price2num($temp_ht, 'MT'), 1); print price(price2num($temp_ht, 'MT'), 1);
print '</td>'; print '</td>';
// VAT // VAT
print '<td class="nowrap right">'; print '<td class="nowrap right">';
$temp_vat = $fields['vat'] * $ratiopaymentinvoice; $temp_vat = $fields['vat'] * $ratiopaymentinvoice;
print price(price2num($temp_vat, 'MT'), 1); print price(price2num($temp_vat, 'MT'), 1);
//print price($fields['vat']); //print price($fields['vat']);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
//$subtot_paye_total_ht += $temp_ht; //$subtot_paye_total_ht += $temp_ht;
//$subtot_paye_vat += $temp_vat; //$subtot_paye_vat += $temp_vat;
//$x_paye_sum += $temp_vat; //$x_paye_sum += $temp_vat;
} }
} }
} }
// Total suppliers for this vat rate // Total suppliers for this vat rate
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="4"></td>'; print '<td colspan="4"></td>';
print '<td class="right">'.$langs->trans("Total").':</td>'; print '<td class="right">'.$langs->trans("Total").':</td>';
if ($modetax != 1) { if ($modetax != 1) {
print '<td class="nowrap right">&nbsp;</td>'; print '<td class="nowrap right">&nbsp;</td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
} }
print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>'; print '<td class="right">'.price(price2num($subtot_paye_total_ht, 'MT')).'</td>';
print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>'; print '<td class="nowrap right">'.price(price2num($subtot_paye_vat, 'MT')).'</td>';
print '</tr>'; print '</tr>';
} }
if (count($x_paye) == 0) { // Show a total line if nothing shown if (count($x_paye) == 0) { // Show a total line if nothing shown
print '<tr class="liste_total">'; print '<tr class="liste_total">';