22require_once NOALYSS_INCLUDE.
"/database/v_currency_last_value_sql.class.php";
47 return "Acc_Currency [".$this->currency->__toString().
"]";
56 $p_iso=trim(strtoupper($p_iso));
57 $id=$this->
cn->get_value(
"select currency_id from v_currency_last_value where cr_code_iso=$1", [$p_iso]);
60 $this->currency->setp(
"currency_id",
$id);
61 $this->currency->load();
71 $this->currency->setp(
"currency_id",
$p_id);
72 $this->currency->load();
79 if ($this->currency->currency_id==-1)
90 return $this->currency->getp(
"ch_value");
98 return $this->currency->getp(
"cr_code_iso");
107 return $this->currency->getp(
"currency_id");
117 $a_currency=$this->
cn->make_array(
"select currency_id,cr_code_iso from v_currency_last_value order by cr_code_iso");
119 $select->selected=$this->currency->cr_code_iso;
129 select sum(round(oc_amount,2)) +
130 sum(round(oc_vat_amount,2))
131 from operation_currency
137 j_grpt in ( select jr_grpt_id from jrn where jr_id=$1))";
138 $sum=$this->
cn->get_value(
$sql, [$p_jr_id]);
148 if ( $this->
get_id() == 0 ) {
return 1;}
151 throw new Exception(_(
"Date invalide"));
154 $sql=
"select ch_value from currency_history
156 ch_from=(select max(ch_from) from currency_history where ch_from <= to_date($1,'DD.MM.YYYY') and currency_id=$2)
160 throw new Exception(_(
"Aucun taux à cette date , aller sur CFGCURRENCY"));
display currency , convert to euro , and save them if used.
get_code()
return the iso code of the currency
sum_amount($p_jr_id)
Return sum of the w/o VAT and VAT or an operation.
$currency
v_currency_last_value_sql
get_by_iso($p_iso)
Retrieve a V_Currency_Last_Value_SQL thanks its iso_code.
set_id($p_id)
Retrieve a V_Currency_Last_Value_SQL thanks its id.
get_rate()
return the rate of the currency
get_id()
return the id of the currency
get_rate_date($p_date)
Return the rate used at a certain date or -1 if date if not in the format DD.MM.YYYY or -2 if no valu...
__construct(Database $p_cn, $p_id=-1)
select_currency()
Create an object iselect to select the currency,.
is_found()
Check if the record is found.
contains the class for connecting to Noalyss
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
class_currency_history_sql.php