diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index f20925d7c12..d70ed77d645 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'; @@ -367,6 +368,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); @@ -1146,13 +1148,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') @@ -1192,6 +1194,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 c3126aecee0..d335c2c3773 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->date, 'dayhour'); + if ($this->date) $label.= '
'.$langs->trans("Date").': '.dol_print_date($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 33d48de8bfc..21b2667d1a6 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 ee92374149b..663605292b6 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -583,7 +583,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 2bd414e4414..23ee7fd8e2d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -579,7 +579,7 @@ foreach ($listofreferent as $key => $value) $qualified=$value['test']; $margin = $value['margin']; $project_field = $value['project_field']; - if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'plus') + if ($qualified && isset($margin)) // If this element must be included into profit calculation ($margin is 'minus' or 'plus' or 'auto') { $element = new $classname($db); @@ -600,6 +600,7 @@ foreach ($listofreferent as $key => $value) $element->fetch($idofelement); if ($idofelementuser) $elementuser->fetch($idofelementuser); + // Define if record must be used for total or not $qualifiedfortotal=true; if ($key == 'invoice') { @@ -642,6 +643,16 @@ foreach ($listofreferent as $key => $value) } else $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 == 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) { @@ -658,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 ''; @@ -856,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) { @@ -1032,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)) @@ -1069,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))