From 79825e219375817ec23a9a0b3726e6af2238e902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 26 Oct 2019 14:42:25 +0200 Subject: [PATCH] start clean indent in compta directory --- dev/setup/codesniffer/ruleset.xml | 4 +- htdocs/compta/bank/annuel.php | 4 +- htdocs/compta/bank/bankentries_list.php | 44 +- htdocs/compta/bank/treso.php | 2 +- htdocs/compta/bank/various_payment/card.php | 25 +- .../compta/bank/various_payment/document.php | 25 +- htdocs/compta/bank/various_payment/info.php | 25 +- htdocs/compta/deplacement/card.php | 6 +- .../deplacement/class/deplacement.class.php | 40 +- htdocs/compta/localtax/quadri_detail.php | 563 +++++++++--------- htdocs/compta/paiement_charge.php | 24 +- 11 files changed, 380 insertions(+), 382 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 015733ed95f..8c01eea6d99 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -186,7 +186,7 @@ - + diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index b82cee983f9..7f96d9e28e7 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -306,7 +306,7 @@ else $log="graph.php: min=".$min." max=".$max; dol_syslog($log); -// CRED PART + // CRED PART // Chargement du tableau des années $tblyear[0] = array(); $tblyear[1] = array(); @@ -393,7 +393,7 @@ else unset($tblyear[1]); unset($tblyear[2]); -// DEDBT PART + // DEDBT PART // Chargement du tableau des années $tblyear[0] = array(); $tblyear[1] = array(); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 71eb5faa6c9..457e311d01c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1315,33 +1315,33 @@ if ($resql) // Date ope if (! empty($arrayfields['b.dateo']['checked'])) { - print ''; - print ''.dol_print_date($db->jdate($objp->do), "day").""; - print ' '; - print ''; - print ''; - print img_edit_remove() . " "; - print ''; - print img_edit_add() .""; - print ''; - print "\n"; + print ''; + print ''.dol_print_date($db->jdate($objp->do), "day").""; + print ' '; + print ''; + print ''; + print img_edit_remove() . " "; + print ''; + print img_edit_add() .""; + print ''; + print "\n"; if (! $i) $totalarray['nbfield']++; } // Date value if (! empty($arrayfields['b.datev']['checked'])) { - print ''; - print ''.dol_print_date($db->jdate($objp->dv), "day").""; - print ' '; - print ''; - print ''; - print img_edit_remove() . " "; - print ''; - print img_edit_add() .""; - print ''; - print "\n"; - if (! $i) $totalarray['nbfield']++; + print ''; + print ''.dol_print_date($db->jdate($objp->dv), "day").""; + print ' '; + print ''; + print ''; + print img_edit_remove() . " "; + print ''; + print img_edit_add() .""; + print ''; + print "\n"; + if (! $i) $totalarray['nbfield']++; } // Payment type @@ -1352,7 +1352,7 @@ if ($resql) if ($labeltype == 'SOLD') print ' '; //$langs->trans("InitialBankBalance"); else print $labeltype; print "\n"; - if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['nbfield']++; } // Num cheque diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index eeea2b72ce5..cec68cf2c3a 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -322,7 +322,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) print ''; print ""; - print ""; + print ""; } else { diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 9260ee3f1f9..5cb9d3c9558 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -427,19 +427,20 @@ if ($id) $morehtmlref.=$langs->trans('Project') . ' '; if ($user->rights->banque->modifier) { - if ($action != 'classify') + if ($action != 'classify') { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index a196540d484..21598990aba 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -92,19 +92,20 @@ if ($object->id) $morehtmlref.=$langs->trans('Project') . ' : '; if ($user->rights->banque->modifier && 0) { - if ($action != 'classify') + if ($action != 'classify') { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index 4cc64bb830e..7d55703802e 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -61,19 +61,20 @@ if (! empty($conf->projet->enabled)) $morehtmlref.=$langs->trans('Project') . ' : '; if ($user->rights->banque->modifier && 0) { - if ($action != 'classify') + if ($action != 'classify') { $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index adb5a74425c..6a320970396 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -415,9 +415,9 @@ elseif ($id) } else { - /* - * Confirm delete trip - */ + /* + * Confirm delete trip + */ if ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete"); diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index de32cb9c3eb..1b70641a6bc 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -89,11 +89,11 @@ class Deplacement extends CommonObject public $statuts=array(); public $statuts_short=array(); - /** - * Constructor - * - * @param DoliDB $db Database handler - */ + /** + * Constructor + * + * @param DoliDB $db Database handler + */ public function __construct($db) { $this->db = $db; @@ -249,13 +249,13 @@ class Deplacement extends CommonObject } } - /** - * Load an object from database - * - * @param int $id Id of record to load - * @param string $ref Ref of record - * @return int <0 if KO, >0 if OK - */ + /** + * Load an object from database + * + * @param int $id Id of record to load + * @param string $ref Ref of record + * @return int <0 if KO, >0 if OK + */ public function fetch($id, $ref = '') { $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams"; @@ -293,12 +293,12 @@ class Deplacement extends CommonObject } } - /** - * Delete record - * - * @param int $id Id of record to delete - * @return int <0 if KO, >0 if OK - */ + /** + * Delete record + * + * @param int $id Id of record to delete + * @return int <0 if KO, >0 if OK + */ public function delete($id) { $this->db->begin(); @@ -413,9 +413,9 @@ class Deplacement extends CommonObject */ public function listOfTypes($active = 1) { - global $langs; + global $langs; - $ret=array(); + $ret=array(); $sql = "SELECT id, code, label"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_fees"; diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 5e89f68e8ba..0251173a863 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -320,323 +320,318 @@ else $span=$columns; if ($modetax != 1) $span+=2; - //if ($modetax == 0 || $modetax == 2) - //{ - // Customers invoices - print ''; - print ''.$elementcust.''; - print ''.$productcust.''; - if ($modetax != 2) print ''.$amountcust.''; - if ($modetax != 1) print ''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'; - print ''.$langs->trans("BI").''; - print ''.$vatcust.''; - print ''; + // Customers invoices + print ''; + print ''.$elementcust.''; + print ''.$productcust.''; + if ($modetax != 2) print ''.$amountcust.''; + if ($modetax != 1) print ''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'; + print ''.$langs->trans("BI").''; + print ''.$vatcust.''; + print ''; - $LT=0; - $sameLT=false; - foreach(array_keys($x_coll) as $rate) + $LT=0; + $sameLT=false; + foreach(array_keys($x_coll) as $rate) + { + $subtot_coll_total_ht = 0; + $subtot_coll_vat = 0; + + if (is_array($x_both[$rate]['coll']['detail'])) { - $subtot_coll_total_ht = 0; - $subtot_coll_vat = 0; - - if (is_array($x_both[$rate]['coll']['detail'])) + // VAT Rate + if($rate!=0){ + print ""; + print ''.$langs->trans("Rate").': '.vatrate($rate).'%'; + print ''."\n"; + } + foreach($x_both[$rate]['coll']['detail'] as $index => $fields) { - // VAT Rate - if($rate!=0){ - print ""; - print ''.$langs->trans("Rate").': '.vatrate($rate).'%'; - print ''."\n"; - } - foreach($x_both[$rate]['coll']['detail'] as $index => $fields) + if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0)) { - if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0)) + // Define type + $type=($fields['dtype']?$fields['dtype']:$fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (! empty($fields['ddate_start'])) $type=1; + if (! empty($fields['ddate_end'])) $type=1; + + + print ''; + + // Ref + print ''.$fields['link'].''; + + // Description + print ''; + if ($fields['pid']) { - // Define type - $type=($fields['dtype']?$fields['dtype']:$fields['ptype']); - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (! empty($fields['ddate_start'])) $type=1; - if (! empty($fields['ddate_end'])) $type=1; - - - print ''; - - // Ref - print ''.$fields['link'].''; - - // Description - print ''; - if ($fields['pid']) - { - $product_static->id=$fields['pid']; - $product_static->ref=$fields['pref']; - $product_static->type=$fields['ptype']; - print $product_static->getNomUrl(1); - if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); - } - else - { - if ($type) $text = img_object($langs->trans('Service'), 'service'); - else $text = img_object($langs->trans('Product'), 'product'); - if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) - { - if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); - elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); - else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); - } - print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); - - // Show range - print_date_range($fields['ddate_start'], $fields['ddate_end']); - } - print ''; - - // Total HT - if ($modetax != 2) - { - print ''; - print price($fields['totalht']); - if (price2num($fields['ftotal_ttc'])) - { - $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - } - print ''; - } - - // Payment - $ratiopaymentinvoice=1; - if ($modetax != 1) - { - if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); - print ''; - if ($fields['payment_amount'] && $fields['ftotal_ttc']) - { - $payment_static->id=$fields['payment_id']; - print $payment_static->getNomUrl(2); - } - if ($type == 0) - { - print $langs->trans("NotUsedForGoods"); - } - else { - print price($fields['payment_amount']); - if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100, 2).'%)'; - } - print ''; - } - - // Total collected - print ''; - $temp_ht=$fields['totalht']; - if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice; - print price(price2num($temp_ht, 'MT')); - print ''; - - // Localtax - print ''; - $temp_vat= $local==1?$fields['localtax1']:$fields['localtax2']; - print price(price2num($temp_vat, 'MT')); - //print price($fields['vat']); - print ''; - print ''; - - $subtot_coll_total_ht += $temp_ht; - $subtot_coll_vat += $temp_vat; - $x_coll_sum += $temp_vat; + $product_static->id=$fields['pid']; + $product_static->ref=$fields['pref']; + $product_static->type=$fields['ptype']; + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); } + else + { + if ($type) $text = img_object($langs->trans('Service'), 'service'); + else $text = img_object($langs->trans('Product'), 'product'); + if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) + { + if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); + elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); + else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); + } + print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); + + // Show range + print_date_range($fields['ddate_start'], $fields['ddate_end']); + } + print ''; + + // Total HT + if ($modetax != 2) + { + print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) + { + $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); + } + print ''; + } + + // Payment + $ratiopaymentinvoice=1; + if ($modetax != 1) + { + if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); + print ''; + if ($fields['payment_amount'] && $fields['ftotal_ttc']) + { + $payment_static->id=$fields['payment_id']; + print $payment_static->getNomUrl(2); + } + if ($type == 0) + { + print $langs->trans("NotUsedForGoods"); + } + else { + print price($fields['payment_amount']); + if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100, 2).'%)'; + } + print ''; + } + + // Total collected + print ''; + $temp_ht=$fields['totalht']; + if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice; + print price(price2num($temp_ht, 'MT')); + print ''; + + // Localtax + print ''; + $temp_vat= $local==1?$fields['localtax1']:$fields['localtax2']; + print price(price2num($temp_vat, 'MT')); + //print price($fields['vat']); + print ''; + print ''; + + $subtot_coll_total_ht += $temp_ht; + $subtot_coll_vat += $temp_vat; + $x_coll_sum += $temp_vat; } } - - // Total customers for this vat rate - print ''; - print ''; - print ''.$langs->trans("Total").':'; - if ($modetax != 1) - { - print ' '; - print ' '; - } - print ''.price(price2num($subtot_coll_total_ht, 'MT')).''; - print ''.price(price2num($subtot_coll_vat, 'MT')).''; - print ''; } - if (count($x_coll) == 0) // Show a total ine if nothing shown + // Total customers for this vat rate + print ''; + print ''; + print ''.$langs->trans("Total").':'; + if ($modetax != 1) { - print ''; - print ' '; - print ''.$langs->trans("Total").':'; - if ($modetax == 0) - { - print ' '; - print ' '; - } - print ''.price(price2num(0, 'MT')).''; - print ''.price(price2num(0, 'MT')).''; - print ''; + print ' '; + print ' '; } + print ''.price(price2num($subtot_coll_total_ht, 'MT')).''; + print ''.price(price2num($subtot_coll_vat, 'MT')).''; + print ''; + } - // Blank line - print ' '; - print ''; - $diff=$x_coll_sum; - //} + if (count($x_coll) == 0) // Show a total ine if nothing shown + { + print ''; + print ' '; + print ''.$langs->trans("Total").':'; + if ($modetax == 0) + { + print ' '; + print ' '; + } + print ''.price(price2num(0, 'MT')).''; + print ''.price(price2num(0, 'MT')).''; + print ''; + } - //if($conf->global->$calc ==0 || $conf->global->$calc == 1){ - echo ''; - //print table headers for this quadri - expenses now - print ''; - print ''; - print ''; - if ($modetax != 1) + // Blank line + print ''; + print '
'.$elementsup.''.$productsup.'
 
'; + $diff=$x_coll_sum; + + echo ''; + //print table headers for this quadri - expenses now + print ''; + print ''; + print ''; + if ($modetax != 1) + { + print ''; + print ''; + } + print ''; + print ''; + print ''."\n"; + + foreach(array_keys($x_paye) as $rate) + { + $subtot_paye_total_ht = 0; + $subtot_paye_vat = 0; + + if (is_array($x_both[$rate]['paye']['detail'])) { - print ''; - print ''; - } - print ''; - print ''; - print ''."\n"; - - foreach(array_keys($x_paye) as $rate) - { - $subtot_paye_total_ht = 0; - $subtot_paye_vat = 0; - - if (is_array($x_both[$rate]['paye']['detail'])) + if($rate!=0){ + print ""; + print ''; + print ''."\n"; + } + foreach($x_both[$rate]['paye']['detail'] as $index=>$fields) { - if($rate!=0){ - print ""; - print ''; - print ''."\n"; - } - foreach($x_both[$rate]['paye']['detail'] as $index=>$fields) + if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0)) { - if(($local==1 && $fields['localtax1']!=0) || ($local==2 && $fields['localtax2']!=0)) + // Define type + $type=($fields['dtype']?$fields['dtype']:$fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (! empty($fields['ddate_start'])) $type=1; + if (! empty($fields['ddate_end'])) $type=1; + + + print ''; + + // Ref + print ''; + + // Description + print ''; - print ''; - - // Ref - print ''; - - // Description - print ''; + } + + // Payment + $ratiopaymentinvoice=1; + if ($modetax != 1) + { + print ''; - - // Total HT - if ($modetax != 2) - { - print ''; - } - - // Payment - $ratiopaymentinvoice=1; - if ($modetax != 1) - { - print ''; - } - - // VAT paid - print ''; - - // Localtax - print ''; - print ''; - - $subtot_paye_total_ht += $temp_ht; - $subtot_paye_vat += $temp_vat; - $x_paye_sum += $temp_vat; } + + // VAT paid + print ''; + + // Localtax + print ''; + print ''; + + $subtot_paye_total_ht += $temp_ht; + $subtot_paye_vat += $temp_vat; + $x_paye_sum += $temp_vat; } } - - // Total suppliers for this vat rate - print ''; - print ''; - print ''; - if ($modetax != 1) - { - print ''; - print ''; - } - print ''; - print ''; - print ''; } - if (count($x_paye) == 0) { // Show a total line if nothing shown - print ''; - print ''; - print ''; - if ($modetax != 1) { - print ''; - print ''; - } - print ''; - print ''; - print ''; - } + // Total suppliers for this vat rate + print ''; + print ''; + print ''; + if ($modetax != 1) + { + print ''; + print ''; + } + print ''; + print ''; + print ''; + } - print '
'.$elementsup.''.$productsup.''.$amountsup.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("BI").''.$vatsup.'
'.$amountsup.''.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')'.$langs->trans("BI").''.$vatsup.'
'.$langs->trans("Rate").': '.vatrate($rate).'%
'.$langs->trans("Rate").': '.vatrate($rate).'%
'.$fields['link'].''; + if ($fields['pid']) { - // Define type - $type=($fields['dtype']?$fields['dtype']:$fields['ptype']); - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (! empty($fields['ddate_start'])) $type=1; - if (! empty($fields['ddate_end'])) $type=1; + $product_static->id=$fields['pid']; + $product_static->ref=$fields['pref']; + $product_static->type=$fields['ptype']; + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); + } + else + { + if ($type) $text = img_object($langs->trans('Service'), 'service'); + else $text = img_object($langs->trans('Product'), 'product'); + print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); + // Show range + print_date_range($fields['ddate_start'], $fields['ddate_end']); + } + print '
'.$fields['link'].''; - if ($fields['pid']) + // Total HT + if ($modetax != 2) + { + print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) { - $product_static->id=$fields['pid']; - $product_static->ref=$fields['pref']; - $product_static->type=$fields['ptype']; - print $product_static->getNomUrl(1); - if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); + //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; + $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); + //print ' ('.round($ratiolineinvoice*100,2).'%)'; + } + print ''; + if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); + if ($fields['payment_amount'] && $fields['ftotal_ttc']) + { + $paymentfourn_static->id=$fields['payment_id']; + print $paymentfourn_static->getNomUrl(2); + } + if ($type == 0) + { + print $langs->trans("NA"); } else { - if ($type) $text = img_object($langs->trans('Service'), 'service'); - else $text = img_object($langs->trans('Product'), 'product'); - print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); - - // Show range - print_date_range($fields['ddate_start'], $fields['ddate_end']); + print price(price2num($fields['payment_amount'], 'MT')); + if (isset($fields['payment_amount'])) { + print ' ('.round($ratiopaymentinvoice*100, 2).'%)'; + } } print ''; - print price($fields['totalht']); - if (price2num($fields['ftotal_ttc'])) - { - //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - //print ' ('.round($ratiolineinvoice*100,2).'%)'; - } - print ''; - if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); - if ($fields['payment_amount'] && $fields['ftotal_ttc']) - { - $paymentfourn_static->id=$fields['payment_id']; - print $paymentfourn_static->getNomUrl(2); - } - if ($type == 0) - { - print $langs->trans("NA"); - } - else - { - print price(price2num($fields['payment_amount'], 'MT')); - if (isset($fields['payment_amount'])) { - print ' ('.round($ratiopaymentinvoice*100, 2).'%)'; - } - } - print ''; - $temp_ht=$fields['totalht']*$ratiopaymentinvoice; - print price(price2num($temp_ht, 'MT'), 1); - print ''; - $temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice; - print price(price2num($temp_vat, 'MT'), 1); - //print price($fields['vat']); - print '
'; + $temp_ht=$fields['totalht']*$ratiopaymentinvoice; + print price(price2num($temp_ht, 'MT'), 1); + print ''; + $temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice; + print price(price2num($temp_vat, 'MT'), 1); + //print price($fields['vat']); + print '
 '.$langs->trans("Total").':  '.price(price2num($subtot_paye_total_ht, 'MT')).''.price(price2num($subtot_paye_vat, 'MT')).'
 '.$langs->trans("Total").':  '.price(price2num(0, 'MT')).''.price(price2num(0, 'MT')).'
 '.$langs->trans("Total").':  '.price(price2num($subtot_paye_total_ht, 'MT')).''.price(price2num($subtot_paye_vat, 'MT')).'
'; - //} + if (count($x_paye) == 0) { // Show a total line if nothing shown + print ''; + print ' '; + print ''.$langs->trans("Total").':'; + if ($modetax != 1) { + print ' '; + print ' '; + } + print ''.price(price2num(0, 'MT')).''; + print ''.price(price2num(0, 'MT')).''; + print ''; + } + + print ''; // Total to pay print '

'; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 91000f2a822..def454f2ca5 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -168,20 +168,20 @@ if ($action == 'create') $charge->paiementtype=$charge->mode_reglement_id?$charge->mode_reglement_id:$charge->paiementtype; $total = $charge->amount; - if (! empty($conf->use_javascript_ajax)) - { - print "\n".''."\n"; - } + print ' '."\n"; + } print load_fiche_titre($langs->trans("DoPayment")); print "
\n";