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:
commit
d855f4b202
@ -326,7 +326,7 @@ class Fichinter extends CommonObject
|
|||||||
function fetch($rowid,$ref='')
|
function fetch($rowid,$ref='')
|
||||||
{
|
{
|
||||||
$sql = "SELECT f.rowid, f.ref, f.description, f.fk_soc, f.fk_statut,";
|
$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.date_valid as datev,";
|
||||||
$sql.= " f.tms as datem,";
|
$sql.= " f.tms as datem,";
|
||||||
$sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat";
|
$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->modelpdf = $obj->model_pdf;
|
||||||
$this->fk_contrat = $obj->fk_contrat;
|
$this->fk_contrat = $obj->fk_contrat;
|
||||||
|
|
||||||
|
$this->user_creation= $obj->fk_user_author;
|
||||||
|
|
||||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||||
|
|
||||||
if ($this->statut == 0) $this->brouillon = 1;
|
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
|
* Returns the label status
|
||||||
*
|
*
|
||||||
|
|||||||
@ -333,7 +333,8 @@ $listofreferent=array(
|
|||||||
'class'=>'Fichinter',
|
'class'=>'Fichinter',
|
||||||
'table'=>'fichinter',
|
'table'=>'fichinter',
|
||||||
'datefieldname'=>'date_valid',
|
'datefieldname'=>'date_valid',
|
||||||
'disableamount'=>1,
|
'disableamount'=>0,
|
||||||
|
'margin'=>'minus',
|
||||||
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
'urlnew'=>DOL_URL_ROOT.'/fichinter/card.php?action=create&origin=project&originid='.$id.'&socid='.$socid,
|
||||||
'lang'=>'interventions',
|
'lang'=>'interventions',
|
||||||
'buttonnew'=>'AddIntervention',
|
'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 != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
|
||||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
|
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
|
||||||
elseif ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
|
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')
|
elseif ($tablename == 'projet_task')
|
||||||
{
|
{
|
||||||
if ($idofelementuser)
|
if ($idofelementuser)
|
||||||
@ -583,6 +585,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
|
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
|
||||||
|
|
||||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
|
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 == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
|
||||||
elseif ($tablename == 'projet_task')
|
elseif ($tablename == 'projet_task')
|
||||||
{
|
{
|
||||||
@ -948,6 +951,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
$total_ht_by_line=null;
|
$total_ht_by_line=null;
|
||||||
$othermessage='';
|
$othermessage='';
|
||||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ht_by_line=$element->amount;
|
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 ($tablename == 'stock_mouvement') $total_ht_by_line=$element->price*abs($element->qty);
|
||||||
elseif (in_array($tablename, array('projet_task')))
|
elseif (in_array($tablename, array('projet_task')))
|
||||||
{
|
{
|
||||||
@ -988,6 +992,7 @@ foreach ($listofreferent as $key => $value)
|
|||||||
{
|
{
|
||||||
$total_ttc_by_line=null;
|
$total_ttc_by_line=null;
|
||||||
if ($tablename == 'don' || $tablename == 'chargesociales') $total_ttc_by_line=$element->amount;
|
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 == 'stock_mouvement') $total_ttc_by_line=$element->price*abs($element->qty);
|
||||||
elseif ($tablename == 'projet_task')
|
elseif ($tablename == 'projet_task')
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user