mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-14 08:54:21 +01:00
Merge pull request #6820 from atm-alexis/NEW_get_amout_base_on_thm_ficheinter
NEW get amount base on user thm ficheinter
This commit is contained in:
@@ -326,7 +326,7 @@ class Fichinter extends CommonObject
|
||||
function fetch($rowid,$ref='')
|
||||
{
|
||||
$sql = "SELECT f.rowid, f.ref, f.description, f.fk_soc, f.fk_statut,";
|
||||
$sql.= " f.datec, f.dateo, f.datee, f.datet,";
|
||||
$sql.= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
|
||||
$sql.= " f.date_valid as datev,";
|
||||
$sql.= " f.tms as datem,";
|
||||
$sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat";
|
||||
@@ -360,6 +360,8 @@ class Fichinter extends CommonObject
|
||||
$this->modelpdf = $obj->model_pdf;
|
||||
$this->fk_contrat = $obj->fk_contrat;
|
||||
|
||||
$this->user_creation= $obj->fk_user_author;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
@@ -537,7 +539,30 @@ class Fichinter extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns amount based on user thm
|
||||
*
|
||||
* @return float amount
|
||||
*/
|
||||
function getAmount() {
|
||||
global $db;
|
||||
|
||||
$amount = 0;
|
||||
|
||||
$this->author = new User($db);
|
||||
$this->author->fetch($this->user_creation);
|
||||
|
||||
$thm = $this->author->thm;
|
||||
|
||||
foreach($this->lines as &$line) {
|
||||
|
||||
$amount+=$line->qty * $thm;
|
||||
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label status
|
||||
*
|
||||
|
||||
@@ -333,7 +333,8 @@ $listofreferent=array(
|
||||
'class'=>'Fichinter',
|
||||
'table'=>'fichinter',
|
||||
'datefieldname'=>'date_valid',
|
||||
'disableamount'=>1,
|
||||
'disableamount'=>0,
|
||||
'margin'=>'minus',
|
||||
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
||||
'lang'=>'interventions',
|
||||
'buttonnew'=>'AddIntervention',
|
||||
@@ -559,6 +560,7 @@ foreach ($listofreferent as $key => $value)
|
||||
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
|
||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
|
||||
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
|
||||
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
|
||||
elseif ($tablename == 'projet_task')
|
||||
{
|
||||
if ($idofelementuser)
|
||||
@@ -583,6 +585,7 @@ foreach ($listofreferent as $key => $value)
|
||||
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
|
||||
|
||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
|
||||
else if($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')
|
||||
{
|
||||
@@ -948,6 +951,7 @@ foreach ($listofreferent as $key => $value)
|
||||
$total_ht_by_line=null;
|
||||
$othermessage='';
|
||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
|
||||
else if($tablename == 'fichinter') $total_ht_by_line=$element->getAmount();
|
||||
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
|
||||
elseif (in_array($tablename, array('projet_task')))
|
||||
{
|
||||
@@ -988,6 +992,7 @@ foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$total_ttc_by_line=null;
|
||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
|
||||
else if($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')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user