diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index ece5a6580de..68354d1961f 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; @@ -374,6 +375,7 @@ $paymentstatic=new Paiement($db); $paymentsupplierstatic=new PaiementFourn($db); $paymentvatstatic=new TVA($db); $paymentsalstatic=new PaymentSalary($db); +$paymentvariousstatic=new PaymentVarious($db); $donstatic=new Don($db); $paymentexpensereportstatic=new PaymentExpenseReport($db); $bankstatic=new Account($db); @@ -1153,13 +1155,13 @@ if ($resql) if ($links[$key]['type']=='payment') { $paymentstatic->id=$links[$key]['url_id']; - $paymentstatic->ref=$links[$key]['url_id']; + $paymentstatic->ref=$links[$key]['url_id']; // FIXME This is id, not ref of payment print ' '.$paymentstatic->getNomUrl(2); } elseif ($links[$key]['type']=='payment_supplier') { $paymentsupplierstatic->id=$links[$key]['url_id']; - $paymentsupplierstatic->ref=$links[$key]['url_id']; + $paymentsupplierstatic->ref=$links[$key]['url_id']; // FIXME This is id, not ref of payment print ' '.$paymentsupplierstatic->getNomUrl(2); } elseif ($links[$key]['type']=='payment_sc') @@ -1199,6 +1201,12 @@ if ($resql) $paymentexpensereportstatic->ref=$links[$key]['url_id']; print ' '.$paymentexpensereportstatic->getNomUrl(2); } + elseif ($links[$key]['type']=='payment_various') + { + $paymentvariousstatic->id=$links[$key]['url_id']; + $paymentvariousstatic->ref=$links[$key]['url_id']; + print ' '.$paymentvariousstatic->getNomUrl(2); + } elseif ($links[$key]['type']=='banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 13b04854b9c..8b4bb12006b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1180,7 +1180,7 @@ class Paiement extends CommonObject $result=''; $label = ''.$langs->trans("ShowPayment").'
'; $label.= ''.$langs->trans("Ref").': '.$this->ref; - $label.= '
'.$langs->trans("Date").': '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour'); + if ($this->datepaye ? $this->datepaye : $this->date) $label.= '
'.$langs->trans("Date").': '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour'); if ($mode == 'withlistofinvoices') { $arraybill = $this->getBillsArray(); diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index b1f99275c93..55a94d685cc 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -694,16 +694,16 @@ class Tva extends CommonObject if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips $result=''; - $label=$langs->trans("ShowVatPayment").': '.$this->ref; + + $label = '' . $langs->trans("ShowVatPayment") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; $url = DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id; $linkclose=''; if (empty($notooltip)) { - - - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label=$langs->trans("ShowMyObject"); diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index a5016822c66..45ad69f6c64 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -585,7 +585,7 @@ class PaiementFourn extends Paiement $label = ''.$langs->trans("ShowPayment").'
'; $label.= ''.$langs->trans("Ref").': '.$text; - $label.= '
'.$langs->trans("Date").': '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour'); + if ($this->datepaye ? $this->datepaye : $this->date) $label.= '
'.$langs->trans("Date").': '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour'); $linkstart = ''; $linkend = ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 8ffb6b38831..dc737e8968c 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2012-2016 Juanjo Menent - * Copyright (C) 2015-2018 Alexandre Spangaro + * Copyright (C) 2015-2019 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Josep Lluís Amador * @@ -419,7 +419,7 @@ $listofreferent=array( 'name'=>"SocialContribution", 'title'=>"ListSocialContributionAssociatedProject", 'class'=>'ChargeSociales', - 'margin'=>'add', + 'margin'=>'minus', 'table'=>'chargesociales', 'datefieldname'=>'date_ech', 'disableamount'=>0, @@ -470,7 +470,7 @@ $listofreferent=array( 'datefieldname'=>'datev', 'margin'=>'minus', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id.'&socid='.$socid, + 'urlnew'=>DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&projectid='.$id, 'lang'=>'banks', 'buttonnew'=>'AddVariousPayment', 'testnew'=>$user->rights->banque->modifier, @@ -600,11 +600,23 @@ foreach ($listofreferent as $key => $value) $element->fetch($idofelement); if ($idofelementuser) $elementuser->fetch($idofelementuser); - // Special cases + // Define if record must be used for total or not + $qualifiedfortotal=true; + if ($key == 'invoice') + { + if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total + } + if ($key == 'propal') + { + if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal=false; // Refused proposal must not be included in total + } + if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty(); - if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount; + + // Define $total_ht_by_line + if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ht_by_line=$element->amount; + elseif ($tablename == 'fichinter') $total_ht_by_line=$element->getAmount(); elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty); - elseif($tablename == 'fichinter') $total_ht_by_line=$element->getAmount(); elseif ($tablename == 'projet_task') { if ($idofelementuser) @@ -620,20 +632,9 @@ foreach ($listofreferent as $key => $value) } else $total_ht_by_line=$element->total_ht; - $qualifiedfortotal=true; - if ($key == 'invoice') - { - if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total - } - if ($key == 'propal') - { - if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal=false; // Refused proposal must not be included in total - } - - if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line; - - if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount; - elseif($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount(); + // Define $total_ttc_by_line + if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ttc_by_line=$element->amount; + elseif ($tablename == 'fichinter') $total_ttc_by_line=$element->getAmount(); elseif ($tablename == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty); elseif ($tablename == 'projet_task') { @@ -642,7 +643,22 @@ foreach ($listofreferent as $key => $value) } else $total_ttc_by_line=$element->total_ttc; - if ($qualifiedfortotal) $total_ttc = $total_ttc + $total_ttc_by_line; + // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases + if ($tablename == 'payment_various') + { + if ($element->sens == 1) + { + $total_ht_by_line = -$total_ht_by_line; + $total_ttc_by_line = -$total_ttc_by_line; + } + } + + // Add total if we have to + if ($qualifiedfortotal) + { + $total_ht = $total_ht + $total_ht_by_line; + $total_ttc = $total_ttc + $total_ttc_by_line; + } } // Each element with at least one line is output @@ -653,23 +669,14 @@ foreach ($listofreferent as $key => $value) // Calculate margin if ($qualifiedforfinalprofit) { - if ($margin=="add") - { - $balance_ht+= $total_ht; - $balance_ttc+= $total_ttc; - } - else - { - $balance_ht-= $total_ht; - $balance_ttc-= $total_ttc; - } - - // Show $total_ht & $total_ttc -- add a minus when necessary - if ($margin!="add") + if ($margin != "add") { $total_ht = -$total_ht; $total_ttc = -$total_ttc; } + + $balance_ht += $total_ht; + $balance_ttc += $total_ttc; } print ''; @@ -851,8 +858,7 @@ foreach ($listofreferent as $key => $value) $expensereport->fetch($element->fk_expensereport); } - //print 'xxx'.$tablename; - //print $classname; + //print 'xxx'.$tablename.'yyy'.$classname; if ($breakline && $saved_third_id != $element->thirdparty->id) { @@ -1027,6 +1033,16 @@ foreach ($listofreferent as $key => $value) { $total_ht_by_line=$element->total_ht; } + + // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases + if ($tablename == 'payment_various') + { + if ($element->sens == 0) + { + $total_ht_by_line = -$total_ht_by_line; + } + } + print ''; if ($othermessage) print $othermessage; if (isset($total_ht_by_line)) @@ -1064,6 +1080,16 @@ foreach ($listofreferent as $key => $value) { $total_ttc_by_line=$element->total_ttc; } + + // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases + if ($tablename == 'payment_various') + { + if ($element->sens == 0) + { + $total_ttc_by_line = -$total_ttc_by_line; + } + } + print ''; if ($othermessage) print $othermessage; if (isset($total_ttc_by_line))