48 $r=parent::display_form($p_hidden);
49 $icard=
new ISelect(
'card_poste');
51 array(
'value'=>1,
'label'=>
_(
'Fiche /Activité')),
52 array(
'value'=>2,
'label'=>
_(
'Poste comptable/Activité')),
53 array(
'value'=>3,
'label'=>
_(
'Activité/Fiche')),
54 array(
'value'=>4,
'label'=>
_(
'Activité/Poste Comptable'))
60 $r.=HtmlInput::request_to_hidden(array(
'ac'));
73 $this->arow=$this->
db->get_array(
"
74 with m as (select oa_id,po_id,
75 coalesce(jrnx.f_id,operation_analytique.f_id) as f_id1,
76 case when jrnx.j_qcode is not null then
77 ( SELECT fiche_detail.ad_value
79 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = jrnx.f_id)
80 when jrnx.f_id is null and operation_analytique.f_id is not null then
81 ( SELECT fiche_detail.ad_value
83 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
86 case when jrnx.j_poste is not null then
88 when jrnx.j_poste is null then
89 (SELECT fiche_detail.ad_value
91 WHERE fiche_detail.ad_id = 5 AND fiche_detail.f_id = operation_analytique.f_id) end as j_poste
92 FROM operation_analytique
93 left JOIN jrnx USING (j_id) )
94 SELECT po.po_id, po.pa_id, po.po_name, po.po_description, sum(
96 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
97 ELSE operation_analytique.oa_amount
98 END) AS sum_amount, m.j_poste, tmp_pcmn.pcm_lib AS name
99 FROM operation_analytique
100 JOIN poste_analytique po USING (po_id)
102 JOIN tmp_pcmn ON m.j_poste::text = tmp_pcmn.pcm_val::text
103 where pa_id=$1 ".
$date.$sql_from_poste.$sql_to_poste.
"
104 GROUP BY po.po_id, po.po_name, po.pa_id, m.j_poste, tmp_pcmn.pcm_lib, po.po_description
107 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
108 ELSE operation_analytique.oa_amount
109END) <> 0::numeric order by po_id,j_poste
110",array($this->
pa_id));
123 $this->arow=$this->
db->get_array(
"
124with m as (select oa_id, po_id,
125 coalesce(jrnx.f_id,operation_analytique.f_id) as f_id1,
126 case when jrnx.j_qcode is not null then
127 ( SELECT fiche_detail.ad_value
129 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = jrnx.f_id)
130 when jrnx.f_id is null and operation_analytique.f_id is not null then
131 ( SELECT fiche_detail.ad_value
133 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
136 case when jrnx.j_qcode is not null then
138 when jrnx.j_qcode is null then
139 jrnx.j_poste end as j_qcode
140 FROM operation_analytique
141 left JOIN jrnx USING (j_id) )
142SELECT po.po_id, po.pa_id, po.po_name, po.po_description, sum(
144 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
145 ELSE operation_analytique.oa_amount
146 END) AS sum_amount, m.f_id1 as f_id, m.j_qcode, m.name
147 FROM operation_analytique
148 JOIN poste_analytique po USING (po_id)
149 JOIN m USING (oa_id) ".
150 " where pa_id=$1 ".
$date.$sql_from_poste.$sql_to_poste
152 GROUP BY po.po_id, po.po_name, po.pa_id, m.f_id1, m.j_qcode, m.name, po.po_description
155 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
156 ELSE operation_analytique.oa_amount
157END) <> 0::numeric order by po_name,name",array($this->
pa_id));
171 $this->arow=$this->
db->get_array(
"
172 with m as (select oa_id,po_id,
173 coalesce(jrnx.f_id,operation_analytique.f_id) as f_id1,
174 case when jrnx.j_qcode is not null then
175 ( SELECT fiche_detail.ad_value
177 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = jrnx.f_id)
178 when jrnx.f_id is null and operation_analytique.f_id is not null then
179 ( SELECT fiche_detail.ad_value
181 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
184 case when jrnx.j_poste is not null then
186 when jrnx.j_poste is null then
187 (SELECT fiche_detail.ad_value
189 WHERE fiche_detail.ad_id = 5 AND fiche_detail.f_id = operation_analytique.f_id) end as j_poste
190 FROM operation_analytique
191 left JOIN jrnx USING (j_id) )
192 SELECT po.po_id, po.pa_id, po.po_name, po.po_description, sum(
194 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
195 ELSE operation_analytique.oa_amount
196 END) AS sum_amount, m.j_poste, tmp_pcmn.pcm_lib AS name
197 FROM operation_analytique
198 JOIN poste_analytique po USING (po_id)
200 JOIN tmp_pcmn ON m.j_poste::text = tmp_pcmn.pcm_val::text
202 pa_id=$1 ".
$date.$sql_from_poste.$sql_to_poste.
"
203 GROUP BY po.po_id, po.po_name, po.pa_id, m.j_poste, tmp_pcmn.pcm_lib, po.po_description
206 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
207 ELSE operation_analytique.oa_amount
208END) <> 0::numeric order by po_id,po_name
210",array($this->
pa_id));
225 $this->arow=$this->
db->get_array(
"
230 case when operation_analytique.oa_debit = true then operation_analytique.oa_amount *(- 1 )::numeric else operation_analytique.oa_amount end as m_amount,
233 operation_analytique.f_id
236 when jrnx.j_qcode is not null then(
238 fiche_detail.ad_value
242 fiche_detail.ad_id = 1
243 and fiche_detail.f_id = jrnx.f_id
245 when jrnx.f_id is null
246 and operation_analytique.f_id is not null then(
248 fiche_detail.ad_value
252 fiche_detail.ad_id = 1
253 and fiche_detail.f_id = operation_analytique.f_id
257 when jrnx.j_qcode is not null then jrnx.j_qcode
258 when jrnx.f_id is null then(
260 fiche_detail.ad_value
264 fiche_detail.ad_id = 23
265 and fiche_detail.f_id = operation_analytique.f_id
270 left join jrnx using(j_id)
271 join poste_analytique using (po_id)
278 sum( m_amount) as sum_amount,
283 operation_analytique join m using(oa_id)
284 join poste_analytique po on (m.po_id=po.po_id)
287 {$date} {$sql_from_poste} {$sql_to_poste}
297 sum( m_amount )<> 0::numeric
302",array($this->
pa_id));
312 $r.=
'<form method="GET" action="export.php" style="display:inline">';
313 $r.= HtmlInput::hidden(
"act",
"CSV:AncAccList");
314 $r.= HtmlInput::hidden(
"to",$this->
to);
315 $r.= HtmlInput::hidden(
"from",$this->
from);
316 $r.= HtmlInput::hidden(
"pa_id",$this->
pa_id);
318 $r.= HtmlInput::hidden(
"to_poste",$this->
to_poste);
319 $r.= HtmlInput::hidden(
"card_poste",$this->card_poste);
322 $r.= dossier::hidden();
323 $r.=HtmlInput::submit(
'bt_csv',
"Export en CSV");
325 $r.=
'<form method="GET" action="export.php" style="display:inline">';
326 $r.= HtmlInput::hidden(
"act",
"PDF:AncAccList");
327 $r.= HtmlInput::hidden(
"to",$this->
to);
328 $r.= HtmlInput::hidden(
"from",$this->
from);
329 $r.= HtmlInput::hidden(
"pa_id",$this->
pa_id);
331 $r.= HtmlInput::hidden(
"to_poste",$this->
to_poste);
332 $r.= HtmlInput::hidden(
"card_poste",$this->card_poste);
335 $r.= dossier::hidden();
336 $r.=HtmlInput::submit(
'bt_pdf',
"Export en PDF");
350 if ( $this->
check() != 0)
352 alert(
_(
'Date invalide'));
359 if ( $this->card_poste==
'1')
366 $tot_card=0;
$prev=
'';
367 echo
'<table class="result" style="margin-left:5px;margin-top:5px">';
369 for (
$i=0;
$i<count($this->arow);
$i++)
374 echo
'<tr><td>['.HtmlInput::history_card ($this->arow[
$i][
'f_id'],$this->arow[
$i][
'j_qcode'].
'] '.$this->arow[
$i][
'name'],
' display:inline').
'</td></tr>';
376 $style= (
$i % 2 == 0)?
' class="odd" ':
' class="even" ';
377 if (
$i != 0 &&
$prev != $this->arow[
$i][
'f_id'])
380 echo
td(
nbm($tot_card),
' class="num"');
382 echo
'<tr style="padding-top:5px"><td> ['.HtmlInput::history_card($this->arow[
$i][
'f_id'],$this->arow[
$i][
'j_qcode'].
'] '.$this->arow[
$i][
'name'],
' display:inline ').
'</td></tr>';
384 $prev = $this->arow[
$i][
'f_id'];
387 echo
'<tr '.$style.
'>';
391 $tot_card=bcadd($tot_card,
$amount);
392 $tot_glob=bcadd($tot_glob,
$amount);
393 echo
td($this->arow[
$i][
'po_name'].
" ".
394 $this->arow[
$i][
'po_description'],
'style="padding-left:10"');
401 echo
td(
nbm($tot_card),
' class="num"');
405 echo
'<h2>'._(
"Résultat global").
" ".
nbm($tot_glob).
'</h2>';
411 if ( $this->card_poste==
'2')
417 $tot_card=0;
$prev=
'';
418 echo
'<table class="result" style="margin-left:20px;margin-top:5px">';
420 for (
$i=0;
$i<count($this->arow);
$i++)
424 $prev=$this->arow[
$i][
'j_poste'];
425 echo
'<tr><td>['.HtmlInput::history_account ($this->arow[
$i][
'j_poste'],$this->arow[
$i][
'j_poste'].
'] '.$this->arow[
$i][
'name'],
' display:inline').
'</td></tr>';
427 $style= (
$i % 2 == 0)?
' class="odd" ':
' class="even" ';
428 if (
$i != 0 &&
$prev != $this->arow[
$i][
'j_poste'])
431 echo
td(
nbm($tot_card),
' class="num"');
433 echo
'<tr style="padding-top:5px"><td>['.HtmlInput::history_account($this->arow[
$i][
'j_poste'],$this->arow[
$i][
'j_poste'].
'] '.$this->arow[
$i][
'name'],
' display:inline ').
'</td></tr>';
435 $prev = $this->arow[
$i][
'j_poste'];
438 echo
'<tr '.$style.
'>';
442 $tot_card=bcadd($tot_card,
$amount);
443 $tot_glob=bcadd($tot_glob,
$amount);
446 echo
td($this->arow[
$i][
'po_name'].
" ".
447 $this->arow[
$i][
'po_description'],
'style="padding-left:10"');
454 echo
td(
nbm($tot_card),
' class="num"');
458 echo
'<h2>'._(
"Résultat global").
" ".
nbm($tot_glob).
'</h2>';
463 if ( $this->card_poste==
'3')
469 $tot_card=0;
$prev=
'';
470 echo
'<table class="result" style="margin-left:20px;margin-top:5px">';
472 for (
$i=0;
$i<count($this->arow);
$i++)
476 $prev=$this->arow[
$i][
'po_id'];
477 echo
'<tr><td>'.$this->arow[
$i][
'po_name'].
" ".$this->arow[
$i][
'po_description'].
'</td></tr>';
480 $style= (
$i % 2 == 0)?
' class="odd" ':
' class="even" ';
481 if (
$i != 0 &&
$prev != $this->arow[
$i][
'po_id'])
484 echo
td(
nbm($tot_card),
' class="num"');
486 echo
'<tr><td>'.$this->arow[
$i][
'po_name'].
" ".$this->arow[
$i][
'po_description'].
'</td></tr>';
489 $prev = $this->arow[
$i][
'po_id'];
492 echo
'<tr '.$style.
'>';
496 $tot_card=bcadd($tot_card,
$amount);
497 $tot_glob=bcadd($tot_glob,
$amount);
498 echo
'<td style="padding-left:10px;">'.HtmlInput::history_card ($this->arow[
$i][
'f_id'],$this->arow[
$i][
'j_qcode'].
' '.$this->arow[
$i][
'name'],
' display:inline').
'</td>';
506 echo
td(
nbm($tot_card),
' class="num"');
510 echo
'<h2>'._(
"Résultat global").
" ".
nbm($tot_glob).
'</h2>';
517 if ( $this->card_poste==
'4')
524 $tot_card=0;
$prev=
'';
525 echo
'<table class="result" style="margin-left:20px;margin-top:5px">';
527 for (
$i=0;
$i<count($this->arow);
$i++)
531 $prev=$this->arow[
$i][
'po_id'];
532 echo
'<tr><td>'.$this->arow[
$i][
'po_name'].
" ".$this->arow[
$i][
'po_description'].
'</td></tr>';
534 $style= (
$i % 2 == 0)?
' class="odd" ':
' class="even" ';
535 if (
$i != 0 &&
$prev != $this->arow[
$i][
'po_id'])
538 echo
td(
nbm($tot_card),
' class="num"');
542 $prev = $this->arow[
$i][
'po_id'];
543 echo
'<tr><td>'.$this->arow[
$i][
'po_name'].
" ".$this->arow[
$i][
'po_description'].
'</td></tr>';
547 echo
'<tr '.$style.
'>';
551 $tot_card=bcadd($tot_card,
$amount);
552 $tot_glob=bcadd($tot_glob,
$amount);
553 echo
'<td style="padding-left:10px;">'.HtmlInput::history_account ($this->arow[
$i][
'j_poste'],$this->arow[
$i][
'j_poste'].
' '.$this->arow[
$i][
'name'],
' display:inline').
'</td>';
560 echo
td(
nbm($tot_card),
' class="num"');
564 echo
'<h2>'._(
"Résultat global").
" ".
nbm($tot_glob).
'</h2>';
571 $csv=
new Noalyss_CSV(
'export-anc-list');
573 if ( $this->
check () != 0 ) {
throw new Exception (
_(
"date invalide"));}
577 if ( $this->card_poste==
'1')
586 for (
$i=0;
$i<count($this->arow);
$i++)
589 $csv->add($this->arow[
$i][
'j_qcode']);
590 $csv->add($this->arow[
$i][
'name']);
591 $csv->add($this->arow[
$i][
'name']);
592 $csv->add($this->arow[
$i][
'po_name']);
593 $csv->add($this->arow[
$i][
'po_description']);
606 if ( $this->card_poste==
'2')
612 for (
$i=0;
$i<count($this->arow);
$i++)
614 $csv->add( $this->arow[
$i][
'j_poste']);
615 $csv->add( $this->arow[
$i][
'name']);
616 $csv->add( $this->arow[
$i][
'po_name']);
617 $csv->add( $this->arow[
$i][
'po_description']);
632 if ( $this->card_poste==
'3')
638 for (
$i=0;
$i<count($this->arow);
$i++)
640 $csv->add( $this->arow[
$i][
'po_name']);
641 $csv->add( $this->arow[
$i][
'po_description']);
642 $csv->add( $this->arow[
$i][
'j_qcode']);
643 $csv->add( $this->arow[
$i][
'name']);
661 if ( $this->card_poste==
'4')
668 for (
$i=0;
$i<count($this->arow);
$i++)
670 $csv->add( $this->arow[
$i][
'po_name']);
671 $csv->add( $this->arow[
$i][
'po_description']);
672 $csv->add( $this->arow[
$i][
'j_poste']);
673 $csv->add( $this->arow[
$i][
'name']);
td($p_string='', $p_extra='')
surround the string with td
nbm($p_number, $p_dec=2)
format the number with a sep.
alert($p_msg, $buffer=false)
alert in javascript
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$anc_grandlivre from_poste
_("actif, passif,charge,...")
link between accountancy and analytic, like table but as a listing
set_sql_filter()
Set the filter (account_date)
Manage the class for reporting about Analytic Accountancy and Accountancy : card - analytic account,...
display_form($p_hidden='')
display form to get the parameter
load_anc_card()
load the data does not return anything but give a value to this->aheader and this->arow
load_poste()
load the data does not return anything but give a value to this->aheader and this->arow
$arow
$arow array of row from
display_html()
Display the result of accountancy and analytic , Axis / Card Card / Axis Accounting / Axis Axis / Acc...
load_anc_account()
load the data does not return anything but give a value to this->aheader and this->arow
show_button($p_hidden="")
display the button export CSV
load_card()
load the data does not return anything but give a value to this->aheader and this->arow
static escape_string($p_string)
wrapper for the function pg_escape_string
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...