Currency : meaning 1 EUR is worth x currency for Sales
This commit is contained in:
parent
5c40f5f5f0
commit
3d45f187a6
4 changed files with 11 additions and 10 deletions
|
|
@ -115,7 +115,7 @@ function CurrencyCompute(p_rate,p_update)
|
|||
console.log("rate is nan" + rate);
|
||||
rate=1;
|
||||
}
|
||||
var tot=tvac*rate;
|
||||
var tot=tvac/rate;
|
||||
tot=Math.round(tot*100)/100;
|
||||
$(p_update).innerHTML=tot;
|
||||
|
||||
|
|
@ -148,11 +148,11 @@ function CurrencyComputeMisc(p_rate,p_update)
|
|||
console.log("rate is nan" + rate);
|
||||
rate=1;
|
||||
}
|
||||
var totDeb=debAmount*rate;
|
||||
var totDeb=debAmount/rate;
|
||||
totDeb=Math.round(totDeb*100)/100;
|
||||
$('default_currency_deb').innerHTML=totDeb;
|
||||
|
||||
var totCred=credAmount*rate;
|
||||
var totCred=credAmount/rate;
|
||||
totCred=Math.round(totCred*100)/100;
|
||||
$('default_currency_cred').innerHTML=totCred;
|
||||
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$amount_currency = bcmul(${'e_march' . $i . '_price'}, ${'e_quant' . $i});
|
||||
|
||||
// convert amount to currency
|
||||
$amount=bcmul($amount_currency,$p_currency_rate);
|
||||
$amount=bcdiv($amount_currency,$p_currency_rate);
|
||||
|
||||
$tot_amount = bcadd($tot_amount, $amount);
|
||||
$tot_amount = round($tot_amount, 2);
|
||||
|
|
@ -363,7 +363,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$l->load();
|
||||
$tva_item_currency = bcmul($amount, $l->get_parameter('rate'));
|
||||
}
|
||||
$tva_item=bcmul($tva_item_currency,$p_currency_rate);
|
||||
$tva_item=bcdiv($tva_item_currency,$p_currency_rate);
|
||||
$tva_item=round($tva_item,2);
|
||||
if (isset($tva[$idx_tva]))
|
||||
{
|
||||
|
|
@ -413,7 +413,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
$op->save_form_plan($_POST, $i, $j_id);
|
||||
}
|
||||
|
||||
$price_euro=bcmul(${'e_march'.$i.'_price'}, $p_currency_rate);
|
||||
$price_euro=bcdiv(${'e_march'.$i.'_price'}, $p_currency_rate);
|
||||
if ($g_parameter->MY_TVA_USE == 'Y') {
|
||||
/* save into quant_sold */
|
||||
$r = $this->db->exec_sql("select insert_quant_sold ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", array(null, /* 1 */
|
||||
|
|
@ -942,12 +942,13 @@ class Acc_Ledger_Sold extends Acc_Ledger {
|
|||
// Add the sum
|
||||
$decalage=($g_parameter->MY_TVA_USE == 'Y')?'<td></td><td></td><td></td><td></td>':'<td></td>';
|
||||
$tot = bcadd($tot_amount, $tot_tva, 2);
|
||||
$tot_eur=round(bcmul($tot, $p_currency_rate),2);
|
||||
$tot_eur=round(bcdiv($tot, $p_currency_rate),2);
|
||||
$tot=nbm($tot);
|
||||
$str_tot=_('Totaux');
|
||||
|
||||
// Get currency code
|
||||
$str_code='EUR';
|
||||
$default_currency=new Acc_Currency($this->db,0);
|
||||
$str_code=$default_currency->get_code();
|
||||
if ( $p_currency_code != 0 ) {
|
||||
$acc_currency=new Acc_Currency($this->db);
|
||||
$acc_currency->set_id($p_currency_code);
|
||||
|
|
|
|||
|
|
@ -799,7 +799,7 @@ class Anc_Operation
|
|||
$op->oa_group=$this->oa_group;
|
||||
$op->j_id=$p_j_id;
|
||||
// convert oa_amount to EUR
|
||||
$op->oa_amount=bcmul($val[$p_item][$row],$this->currency_rate);
|
||||
$op->oa_amount=bcdiv($val[$p_item][$row],$this->currency_rate);
|
||||
$op->oa_debit=$this->oa_debit;
|
||||
$op->oa_date=$this->oa_date;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
<td>
|
||||
<?=$currency_select->input()?>
|
||||
<?=$currency_input->change('CurrencyCompute(\'p_currency_rate\',\'p_currency_euro\');')?>
|
||||
<?=$currency->get_code();?>
|
||||
<?=$currency->get_code();?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue