35 parent::__construct(
$p_id);
36 $this->signature=
'closing';
59 $this->exercice =
$http->request(
"exercice_cl",
"number");
67 $cn = Dossier::connect();
70with total_account as (
71 select sum(a.montant) as tot_amount, j_poste, f_id
73 (select j_id, case when j_debit='t' then j_montant
74 else j_montant * (-1) end as montant
76 join jrnx using (j_id)
77 join parm_periode on (j_tech_per = p_id )
80 and( j_poste::text like '7%'
81 or j_poste::text like '6%')
83 having (sum(a.montant) != 0 )
87 ,(select pcm_lib from tmp_pcmn where pcm_val=t1.j_poste) as lib_accounting
89 ,(select ad_value fd2 from fiche_detail fd2 where fd2.f_id=t1.f_id and fd2.ad_id=23) qcode
90,(select fd3.ad_value from fiche_detail fd3 where fd3.f_id=t1.f_id and fd3.ad_id=1) f_name
91,abs(t1.tot_amount) atot_amount
92,case when tot_amount <0 then 't' else 'f' end debit
96 $this->operation_exercice_sql->setp(
"oe_type", $this->signature)
97 ->setp(
"oe_dossier_id", Dossier::id())
98 ->set(
"oe_text",
_(
"Ecriture cloture $exercice_report"))
99 ->setp(
"oe_exercice", $this->exercice);
102 $this->operation_exercice_sql->insert();
104 if (empty(
$array))
return;
105 foreach (
$array as $item) {
107 $row->oe_id = $this->operation_exercice_sql->oe_id;
108 $row->oed_poste = (empty($item[
'qcode']))?$item[
"j_poste"]:
null;
109 $row->oed_qcode = $item[
"qcode"];
110 $row->oed_amount = $item[
'atot_amount'];
111 $row->oed_label=(empty($item[
'qcode']))?$item[
'lib_accounting']:$item[
'f_name'];
112 $row->oed_debit = $item[
"debit"];
117 }
catch (\Exception
$e) {
119 echo
$e->getMessage();
126 echo
h2(
"ClĂ´ture compte");
128 parent::display_result();
h2($p_string, $p_class="", $raw="")
_("actif, passif,charge,...")
closing operation , end of exercice for French accountancy
insert()
insert data into data operation_exercice and operation_exercice_detail
abstract of the table operation_exercice_detail
Special operations end or start of exercice.