Task #448 : add currency to card -> history + export CSV
This commit is contained in:
parent
1e36bda395
commit
c2c39f8517
5 changed files with 80 additions and 19 deletions
|
|
@ -780,7 +780,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
$tot_debit=bcadd($tot_debit, abs($cust_amount));
|
||||
}
|
||||
$let_client=$acc_operation->insert_jrnx();
|
||||
|
||||
|
||||
|
||||
if ( $g_parameter->MY_TVA_USE=='Y')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -447,7 +447,11 @@ class Lettering_Account extends Lettering
|
|||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(comptaproc.get_letter_jnt(j_id),-1) as letter,
|
||||
jr_pj_number
|
||||
jr_pj_number,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
|
@ -471,7 +475,11 @@ class Lettering_Account extends Lettering
|
|||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(let_diff.jl_id,-1) as letter,
|
||||
diff_letter1 as letter_diff
|
||||
diff_letter1 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
left join letter_jl using (j_id)
|
||||
left join let_diff using (jl_id)
|
||||
|
|
@ -495,7 +503,11 @@ class Lettering_Account extends Lettering
|
|||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
let_diff.jl_id as letter,
|
||||
diff_letter1 as letter_diff
|
||||
diff_letter1 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
join letter_jl using (j_id)
|
||||
left join let_diff using (jl_id)
|
||||
|
|
@ -518,7 +530,11 @@ class Lettering_Account extends Lettering
|
|||
select distinct j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
let_diff.jl_id as letter,
|
||||
diff_letter1 as letter_diff
|
||||
diff_letter1 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from
|
||||
jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
join letter_jl using (j_id)
|
||||
|
|
@ -540,7 +556,11 @@ class Lettering_Account extends Lettering
|
|||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
-1 as letter,
|
||||
0 as letter_diff
|
||||
0 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_poste = $1 and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
|
@ -611,7 +631,11 @@ class Lettering_Card extends Lettering
|
|||
select distinct j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(let_diff.jl_id,-1) as letter,
|
||||
diff_letter1 as letter_diff
|
||||
diff_letter1 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
left join letter_jl using (j_id)
|
||||
left join let_diff using (jl_id)
|
||||
|
|
@ -637,7 +661,11 @@ class Lettering_Card extends Lettering
|
|||
select DISTINCT j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
coalesce(let_diff.jl_id,-1) as letter,
|
||||
diff_letter1 as letter_diff
|
||||
diff_letter1 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
left join letter_jl using (j_id)
|
||||
left join let_diff using (jl_id)
|
||||
|
|
@ -654,7 +682,7 @@ class Lettering_Card extends Lettering
|
|||
public function get_letter()
|
||||
{
|
||||
$sql="
|
||||
with let_diff as (select jl_id,deb_amount-cred_amount as diff_letter1
|
||||
with let_diff as (select jl_id,deb_amount-cred_amount as diff_letter1
|
||||
from
|
||||
( select jl_id,coalesce(sum(j_montant),0) as cred_amount from letter_cred join jrnx using (j_id) group by jl_id) as CRED
|
||||
left join (select jl_id,coalesce(sum(j_montant),0) as deb_amount from letter_deb join jrnx using (j_id) group by jl_id) as DEB using (jl_id)) ,
|
||||
|
|
@ -662,7 +690,11 @@ class Lettering_Card extends Lettering
|
|||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
let_diff.jl_id as letter,
|
||||
diff_letter1 as letter_diff
|
||||
diff_letter1 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
join letter_jl using (j_id)
|
||||
left join let_diff using (jl_id)
|
||||
|
|
@ -682,7 +714,11 @@ class Lettering_Card extends Lettering
|
|||
select distinct j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
let_diff.jl_id as letter,
|
||||
diff_letter1 as letter_diff
|
||||
diff_letter1 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
left join letter_jl using (j_id)
|
||||
left join let_diff using (jl_id)
|
||||
|
|
@ -701,7 +737,11 @@ class Lettering_Card extends Lettering
|
|||
select j_id,j_date,to_char(j_date,'DD.MM.YYYY') as j_date_fmt,jr_pj_number,
|
||||
j_montant,j_debit,jr_comment,jr_internal,jr_id,jr_def_id,
|
||||
-1 as letter,
|
||||
0 as letter_diff
|
||||
0 as letter_diff,
|
||||
round(j_montant/currency_rate,4) as currency_amount,
|
||||
currency_rate,
|
||||
currency_rate_ref,
|
||||
(select cr_code_iso from currency where currency_id=currency.id) as cr_code_iso
|
||||
from jrnx join jrn on (j_grpt = jr_grpt_id)
|
||||
where j_qcode = upper($1) and j_date >= to_date($2,'DD.MM.YYYY') and j_date <= to_date ($3,'DD.MM.YYYY')
|
||||
and $this->sql_ledger
|
||||
|
|
|
|||
|
|
@ -160,6 +160,11 @@ else
|
|||
$export->add(_('D/C'));
|
||||
$export->add(_('Let.'));
|
||||
$export->add(_("Diff Let."));
|
||||
$export->add(_("Code Devise"));
|
||||
$export->add(_("Montant Devise"));
|
||||
$export->add(_("Taux"));
|
||||
$export->add(_("Taux de référence"));
|
||||
|
||||
$export->write();
|
||||
|
||||
$amount_deb = 0;
|
||||
|
|
@ -176,24 +181,33 @@ else
|
|||
if ($row['j_debit'] == 't')
|
||||
{
|
||||
$export->add($row['j_montant'],"number");
|
||||
$export->add("");
|
||||
$amount_deb=bcadd($amount_deb,$row['j_montant']);
|
||||
$prog = bcadd($prog, $row['j_montant']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$export->add("");
|
||||
$export->add($row['j_montant'],"number");
|
||||
$amount_cred=bcadd($amount_cred,$row['j_montant']);
|
||||
$prog = bcsub($prog, $row['j_montant']);
|
||||
}
|
||||
$export->add(abs($prog),"number");
|
||||
$export->add($fic->get_amount_side($prog),"number");
|
||||
$export->add($fic->get_amount_side($prog));
|
||||
if ($row['letter'] != -1)
|
||||
{
|
||||
$export->add(strtoupper(base_convert($row['letter'],10,36)));
|
||||
$export->add($row['letter_diff'],"number");
|
||||
}
|
||||
else
|
||||
$export->add("");
|
||||
{
|
||||
$export->add("");
|
||||
$export->add("");
|
||||
}
|
||||
$export->add($row['cr_code_iso']);
|
||||
$export->add($row['currency_amount'],"number");
|
||||
$export->add($row['currency_rate'],"number");
|
||||
$export->add($row['currency_rate_ref'],"number");
|
||||
$export->write();
|
||||
}
|
||||
if ($prog < 0 )
|
||||
|
|
@ -210,7 +224,8 @@ else
|
|||
$export->add($amount_deb,"number");
|
||||
$export->add($amount_cred,"number");
|
||||
$export->add(abs($prog),"number");
|
||||
$export->add($fic->get_amount_side($prog),"number");
|
||||
$export->add($fic->get_amount_side($prog));
|
||||
|
||||
$export->write();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,8 +517,10 @@ for ($e = 0; $e < count($afiche); $e++)
|
|||
echo th(_('ref'));
|
||||
echo th(_('Interne'));
|
||||
echo th(_('Comm'));
|
||||
echo th(_('Montant'), 'style="width:auto" colspan="2"');
|
||||
echo th(_('Prog.'));
|
||||
echo th(_('Code Devise'));
|
||||
echo th(_('Devise'));
|
||||
echo th(_('Montant'), 'style="width:auto;text-align:center" colspan="2"');
|
||||
echo th(_('Prog.'),'style="text-align:right"');
|
||||
echo th(_('Let.'));
|
||||
echo '</tr>';
|
||||
$amount_deb = 0;
|
||||
|
|
@ -541,7 +543,9 @@ for ($e = 0; $e < count($afiche); $e++)
|
|||
echo td(h($row['jr_pj_number']));
|
||||
echo td(HtmlInput::detail_op($row['jr_id'], $row['jr_internal']));
|
||||
echo td(h($row['jr_comment']));
|
||||
if ($row['j_debit'] == 't')
|
||||
echo td($row['cr_code_iso']);
|
||||
echo td(nbm(h($row['currency_amount']),2),'class="num"');
|
||||
if ($row['j_debit'] == 't')
|
||||
{
|
||||
echo td(nbm($row['j_montant']), ' style="text-align:right"');
|
||||
$amount_deb=bcadd($amount_deb,$row['j_montant']);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ CREATE TABLE public.currency_history (
|
|||
|
||||
ALTER TABLE public.currency ADD cr_name varchar(80) NULL;
|
||||
insert into currency (id,cr_code_iso,cr_name) values (0,'EUR','EUR');
|
||||
insert into currency (cr_code_iso,cr_name) values ('XCFA','XCFA');
|
||||
insert into currency_history (ch_value,ch_from,currency_id) values (1,to_date('01.01.2000','DD.MM.YYYY'),0);
|
||||
insert into currency_history (ch_value,ch_from,currency_id) values (655.95700,to_date('01.01.2000','DD.MM.YYYY'),1);
|
||||
|
||||
ALTER TABLE public.currency_history ADD CONSTRAINT currency_history_check CHECK (ch_value > 0) ;
|
||||
|
||||
|
|
@ -104,4 +106,4 @@ ALTER TABLE public.jrn ADD CONSTRAINT jrn_currency_fk FOREIGN KEY (currency_id)
|
|||
|
||||
|
||||
insert into version (val,v_description) values (129,'Currency : create view , create tables ');
|
||||
commit;
|
||||
commit;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue