Currency : insert operation with currency in VEN and ACH

This commit is contained in:
Dany De Bontridder 2018-05-07 21:47:06 +02:00
parent 1683eff248
commit d6d0b3fa30
15 changed files with 749 additions and 87 deletions

View file

@ -46,7 +46,10 @@ class Acc_Operation
var $amount; /*!< amount of the operatoin */
var $grpt; /*!< the group id */
var $date_paid;
var $jr_optype; /*!< type of operation :NOR,CLO,EXT,OPE
var $jr_optype; /*!< type of operation :NOR,CLO,EXT,OPE */
var $currency_rate; /*< currency rate used */
var $currency_id; /*< currency id */
var $currency_rate_ref; /*< currency rate in the table currency*/
/*!
* \brief constructor set automatically the attributes user and periode
* \param $p_cn the databse connection
@ -60,6 +63,9 @@ class Acc_Operation
$this->periode=$g_user->get_periode();
$this->jr_id=0;
$this->jr_optype="NOR";
$this->currency_rate=1;
$this->currency_rate_ref=1;
$this->currency_id=NULL;
}
/**
*@brief retrieve the grpt_id from jrn for a jr_id
@ -181,7 +187,7 @@ class Acc_Operation
$this->type=($this->type=='d')?'c':'d';
}
if ( DEBUG ) {
echo "insert_jrn = {$this->amount} <br>";
echo "insert_jrnx = {$this->amount} type {$this->type}<br>";
}
$this->amount=abs($this->amount);
$debit=($this->type=='c')?'false':'true';
@ -199,7 +205,7 @@ class Acc_Operation
$this->periode, //$8
$this->qcode, // $9
$this->desc)); //$10
if ( $Res===false) return $Res;
if ( $Res===FALSE) return FALSE;
$this->jrnx_id=$this->db->get_current_seq('s_jrn_op');
return $this->jrnx_id;
@ -293,13 +299,17 @@ class Acc_Operation
// if amount == -1then the triggers will throw an error
//
$Res=$this->db->exec_sql("insert into jrn (jr_def_id,jr_montant,jr_comment,".
"jr_date,jr_ech,jr_grpt_id,jr_tech_per,jr_mt,jr_optype) values (".
"jr_date,jr_ech,jr_grpt_id,jr_tech_per,jr_mt,jr_optype,currency_id,currency_rate,currency_rate_ref) values (".
"$1,$2,$3,".
"to_date($4,'DD.MM.YYYY'),to_date($5,'DD.MM.YYYY'),$6,$7,$8,$9)",
"to_date($4,'DD.MM.YYYY'),to_date($5,'DD.MM.YYYY'),$6,$7,$8,$9,$10,$11,$12)",
array ($this->jrn, $this->amount,$p_comment,
$this->date,$echeance,$this->grpt,$this->periode,$this->mt,$this->jr_optype)
$this->date,$echeance,$this->grpt,$this->periode,$this->mt,$this->jr_optype,
$this->currency_id,$this->currency_rate,$this->currency_rate_ref)
);
if ( $Res == false) return false;
if ($Res==FALSE)
{
return FALSE;
}
$this->jr_id=$this->db->get_current_seq('s_jrn');
return $this->jr_id;
}