forked from Wavyzz/dolibarr
Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/compta/paiement/class/paiement.class.php htdocs/projet/element.php
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -1180,7 +1180,7 @@ class Paiement extends CommonObject
|
||||
$result='';
|
||||
$label = '<u>'.$langs->trans("ShowPayment").'</u><br>';
|
||||
$label.= '<strong>'.$langs->trans("Ref").':</strong> '.$this->ref;
|
||||
$label.= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour');
|
||||
if ($this->datepaye ? $this->datepaye : $this->date) $label.= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour');
|
||||
if ($mode == 'withlistofinvoices')
|
||||
{
|
||||
$arraybill = $this->getBillsArray();
|
||||
|
||||
@@ -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 = '<u>' . $langs->trans("ShowVatPayment") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $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");
|
||||
|
||||
@@ -585,7 +585,7 @@ class PaiementFourn extends Paiement
|
||||
|
||||
$label = '<u>'.$langs->trans("ShowPayment").'</u><br>';
|
||||
$label.= '<strong>'.$langs->trans("Ref").':</strong> '.$text;
|
||||
$label.= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour');
|
||||
if ($this->datepaye ? $this->datepaye : $this->date) $label.= '<br><strong>'.$langs->trans("Date").':</strong> '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour');
|
||||
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend = '</a>';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
*
|
||||
@@ -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 '<tr class="oddeven">';
|
||||
@@ -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 '<td class="right">';
|
||||
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 '<td class="right">';
|
||||
if ($othermessage) print $othermessage;
|
||||
if (isset($total_ttc_by_line))
|
||||
|
||||
Reference in New Issue
Block a user