46 $r=parent::display_form($p_hidden);
47 $icard=
new ISelect(
'card_poste');
49 array(
'value'=>1,
'label'=>_(
'Fiche /Activité')),
50 array(
'value'=>2,
'label'=>_(
'Poste comptable/Activité')),
51 array(
'value'=>3,
'label'=>_(
'Activité/Fiche')),
52 array(
'value'=>4,
'label'=>_(
'Activité/Poste Comptable'))
56 $icard->selected=$this->card_poste;
71 $this->arow=$this->
db->get_array(
"
72 with m as (select oa_id,po_id,
73 coalesce(jrnx.f_id,operation_analytique.f_id) as f_id1,
74 case when jrnx.j_qcode is not null then
75 ( SELECT fiche_detail.ad_value
77 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = jrnx.f_id)
78 when jrnx.f_id is null and operation_analytique.f_id is not null then
79 ( SELECT fiche_detail.ad_value
81 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
84 case when jrnx.j_poste is not null then
86 when jrnx.j_poste is null then
87 (SELECT fiche_detail.ad_value
89 WHERE fiche_detail.ad_id = 5 AND fiche_detail.f_id = operation_analytique.f_id) end as j_poste
90 FROM operation_analytique
91 left JOIN jrnx USING (j_id) )
92 SELECT po.po_id, po.pa_id, po.po_name, po.po_description, sum(
94 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
95 ELSE operation_analytique.oa_amount
96 END) AS sum_amount, m.j_poste, tmp_pcmn.pcm_lib AS name
97 FROM operation_analytique
98 JOIN poste_analytique po USING (po_id)
100 JOIN tmp_pcmn ON m.j_poste::text = tmp_pcmn.pcm_val::text
101 where pa_id=$1 ".
$date.$sql_from_poste.$sql_to_poste.
"
102 GROUP BY po.po_id, po.po_name, po.pa_id, m.j_poste, tmp_pcmn.pcm_lib, po.po_description
105 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
106 ELSE operation_analytique.oa_amount
107END) <> 0::numeric order by po_id,j_poste
108",array($this->
pa_id));
121 $this->arow=$this->
db->get_array(
"
122with m as (select oa_id, po_id,
123 coalesce(jrnx.f_id,operation_analytique.f_id) as f_id1,
124 case when jrnx.j_qcode is not null then
125 ( SELECT fiche_detail.ad_value
127 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = jrnx.f_id)
128 when jrnx.f_id is null and operation_analytique.f_id is not null then
129 ( SELECT fiche_detail.ad_value
131 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
134 case when jrnx.j_qcode is not null then
136 when jrnx.j_qcode is null then
137 jrnx.j_poste end as j_qcode
138 FROM operation_analytique
139 left JOIN jrnx USING (j_id) )
140SELECT po.po_id, po.pa_id, po.po_name, po.po_description, sum(
142 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
143 ELSE operation_analytique.oa_amount
144 END) AS sum_amount, m.f_id1 as f_id, m.j_qcode, m.name
145 FROM operation_analytique
146 JOIN poste_analytique po USING (po_id)
147 JOIN m USING (oa_id) ".
148 " where pa_id=$1 ".
$date.$sql_from_poste.$sql_to_poste
150 GROUP BY po.po_id, po.po_name, po.pa_id, m.f_id1, m.j_qcode, m.name, po.po_description
153 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
154 ELSE operation_analytique.oa_amount
155END) <> 0::numeric order by po_name,name",array($this->
pa_id));
169 $this->arow=$this->
db->get_array(
"
170 with m as (select oa_id,po_id,
171 coalesce(jrnx.f_id,operation_analytique.f_id) as f_id1,
172 case when jrnx.j_qcode is not null then
173 ( SELECT fiche_detail.ad_value
175 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = jrnx.f_id)
176 when jrnx.f_id is null and operation_analytique.f_id is not null then
177 ( SELECT fiche_detail.ad_value
179 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
182 case when jrnx.j_poste is not null then
184 when jrnx.j_poste is null then
185 (SELECT fiche_detail.ad_value
187 WHERE fiche_detail.ad_id = 5 AND fiche_detail.f_id = operation_analytique.f_id) end as j_poste
188 FROM operation_analytique
189 left JOIN jrnx USING (j_id) )
190 SELECT po.po_id, po.pa_id, po.po_name, po.po_description, sum(
192 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
193 ELSE operation_analytique.oa_amount
194 END) AS sum_amount, m.j_poste, tmp_pcmn.pcm_lib AS name
195 FROM operation_analytique
196 JOIN poste_analytique po USING (po_id)
198 JOIN tmp_pcmn ON m.j_poste::text = tmp_pcmn.pcm_val::text
200 pa_id=$1 ".
$date.$sql_from_poste.$sql_to_poste.
"
201 GROUP BY po.po_id, po.po_name, po.pa_id, m.j_poste, tmp_pcmn.pcm_lib, po.po_description
204 WHEN operation_analytique.oa_debit = true THEN operation_analytique.oa_amount * (-1)::numeric
205 ELSE operation_analytique.oa_amount
206END) <> 0::numeric order by po_id,po_name
208",array($this->
pa_id));
223 $this->arow=$this->
db->get_array(
"
228 case when operation_analytique.oa_debit = true then operation_analytique.oa_amount *(- 1 )::numeric else operation_analytique.oa_amount end as m_amount,
231 operation_analytique.f_id
234 when jrnx.j_qcode is not null then(
236 fiche_detail.ad_value
240 fiche_detail.ad_id = 1
241 and fiche_detail.f_id = jrnx.f_id
243 when jrnx.f_id is null
244 and operation_analytique.f_id is not null then(
246 fiche_detail.ad_value
250 fiche_detail.ad_id = 1
251 and fiche_detail.f_id = operation_analytique.f_id
255 when jrnx.j_qcode is not null then jrnx.j_qcode
256 when jrnx.f_id is null then(
258 fiche_detail.ad_value
262 fiche_detail.ad_id = 23
263 and fiche_detail.f_id = operation_analytique.f_id
268 left join jrnx using(j_id)
269 join poste_analytique using (po_id)
276 sum( m_amount) as sum_amount,
281 operation_analytique join m using(oa_id)
282 join poste_analytique po on (m.po_id=po.po_id)
285 {$date} {$sql_from_poste} {$sql_to_poste}
295 sum( m_amount )<> 0::numeric
300",array($this->
pa_id));
310 $r.=
'<form method="GET" action="export.php" style="display:inline">';
320 $r.= dossier::hidden();
323 $r.=
'<form method="GET" action="export.php" style="display:inline">';
333 $r.= dossier::hidden();
348 if ( $this->
check() != 0)
350 alert(_(
'Date invalide'));
357 if ( $this->card_poste==
'1')
364 $tot_card=0;
$prev=
'';
365 echo
'<table class="result" style="margin-left:5px;margin-top:5px">';
367 for (
$i=0;
$i<count($this->arow);
$i++)
372 echo
'<tr><td>['.HtmlInput::history_card ($this->arow[
$i][
'f_id'],$this->arow[
$i][
'j_qcode'].
'] '.$this->arow[
$i][
'name'],
' display:inline').
'</td></tr>';
374 $style= (
$i % 2 == 0)?
' class="odd" ':
' class="even" ';
375 if (
$i != 0 &&
$prev != $this->arow[
$i][
'f_id'])
378 echo
td(
nbm($tot_card),
' class="num"');
380 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>';
382 $prev = $this->arow[
$i][
'f_id'];
385 echo
'<tr '.$style.
'>';
389 $tot_card=bcadd($tot_card,
$amount);
390 $tot_glob=bcadd($tot_glob,
$amount);
391 echo
td($this->arow[
$i][
'po_name'].
" ".
392 $this->arow[
$i][
'po_description'],
'style="padding-left:10"');
399 echo
td(
nbm($tot_card),
' class="num"');
403 echo
'<h2>'._(
"Résultat global").
" ".
nbm($tot_glob).
'</h2>';
409 if ( $this->card_poste==
'2')
415 $tot_card=0;
$prev=
'';
416 echo
'<table class="result" style="margin-left:20px;margin-top:5px">';
418 for (
$i=0;
$i<count($this->arow);
$i++)
422 $prev=$this->arow[
$i][
'j_poste'];
423 echo
'<tr><td>['.HtmlInput::history_account ($this->arow[
$i][
'j_poste'],$this->arow[
$i][
'j_poste'].
'] '.$this->arow[
$i][
'name'],
' display:inline').
'</td></tr>';
425 $style= (
$i % 2 == 0)?
' class="odd" ':
' class="even" ';
426 if (
$i != 0 &&
$prev != $this->arow[
$i][
'j_poste'])
429 echo
td(
nbm($tot_card),
' class="num"');
431 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>';
433 $prev = $this->arow[
$i][
'j_poste'];
436 echo
'<tr '.$style.
'>';
440 $tot_card=bcadd($tot_card,
$amount);
441 $tot_glob=bcadd($tot_glob,
$amount);
444 echo
td($this->arow[
$i][
'po_name'].
" ".
445 $this->arow[
$i][
'po_description'],
'style="padding-left:10"');
452 echo
td(
nbm($tot_card),
' class="num"');
456 echo
'<h2>'._(
"Résultat global").
" ".
nbm($tot_glob).
'</h2>';
461 if ( $this->card_poste==
'3')
467 $tot_card=0;
$prev=
'';
468 echo
'<table class="result" style="margin-left:20px;margin-top:5px">';
470 for (
$i=0;
$i<count($this->arow);
$i++)
474 $prev=$this->arow[
$i][
'po_id'];
475 echo
'<tr><td>'.$this->arow[
$i][
'po_name'].
" ".$this->arow[
$i][
'po_description'].
'</td></tr>';
478 $style= (
$i % 2 == 0)?
' class="odd" ':
' class="even" ';
479 if (
$i != 0 &&
$prev != $this->arow[
$i][
'po_id'])
482 echo
td(
nbm($tot_card),
' class="num"');
484 echo
'<tr><td>'.$this->arow[
$i][
'po_name'].
" ".$this->arow[
$i][
'po_description'].
'</td></tr>';
487 $prev = $this->arow[
$i][
'po_id'];
490 echo
'<tr '.$style.
'>';
494 $tot_card=bcadd($tot_card,
$amount);
495 $tot_glob=bcadd($tot_glob,
$amount);
496 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>';
504 echo
td(
nbm($tot_card),
' class="num"');
508 echo
'<h2>'._(
"Résultat global").
" ".
nbm($tot_glob).
'</h2>';
515 if ( $this->card_poste==
'4')
522 $tot_card=0;
$prev=
'';
523 echo
'<table class="result" style="margin-left:20px;margin-top:5px">';
525 for (
$i=0;
$i<count($this->arow);
$i++)
529 $prev=$this->arow[
$i][
'po_id'];
530 echo
'<tr><td>'.$this->arow[
$i][
'po_name'].
" ".$this->arow[
$i][
'po_description'].
'</td></tr>';
532 $style= (
$i % 2 == 0)?
' class="odd" ':
' class="even" ';
533 if (
$i != 0 &&
$prev != $this->arow[
$i][
'po_id'])
536 echo
td(
nbm($tot_card),
' class="num"');
540 $prev = $this->arow[
$i][
'po_id'];
541 echo
'<tr><td>'.$this->arow[
$i][
'po_name'].
" ".$this->arow[
$i][
'po_description'].
'</td></tr>';
545 echo
'<tr '.$style.
'>';
549 $tot_card=bcadd($tot_card,
$amount);
550 $tot_glob=bcadd($tot_glob,
$amount);
551 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>';
558 echo
td(
nbm($tot_card),
' class="num"');
562 echo
'<h2>'._(
"Résultat global").
" ".
nbm($tot_glob).
'</h2>';
569 $csv=
new Noalyss_CSV(
'export-anc-list');
571 if ( $this->
check () != 0 ) {
throw new Exception (_(
"date invalide"));}
575 if ( $this->card_poste==
'1')
584 for (
$i=0;
$i<count($this->arow);
$i++)
587 $csv->add($this->arow[
$i][
'j_qcode']);
588 $csv->add($this->arow[
$i][
'name']);
589 $csv->add($this->arow[
$i][
'name']);
590 $csv->add($this->arow[
$i][
'po_name']);
591 $csv->add($this->arow[
$i][
'po_description']);
604 if ( $this->card_poste==
'2')
610 for (
$i=0;
$i<count($this->arow);
$i++)
612 $csv->add( $this->arow[
$i][
'j_poste']);
613 $csv->add( $this->arow[
$i][
'name']);
614 $csv->add( $this->arow[
$i][
'po_name']);
615 $csv->add( $this->arow[
$i][
'po_description']);
630 if ( $this->card_poste==
'3')
636 for (
$i=0;
$i<count($this->arow);
$i++)
638 $csv->add( $this->arow[
$i][
'po_name']);
639 $csv->add( $this->arow[
$i][
'po_description']);
640 $csv->add( $this->arow[
$i][
'j_qcode']);
641 $csv->add( $this->arow[
$i][
'name']);
659 if ( $this->card_poste==
'4')
666 for (
$i=0;
$i<count($this->arow);
$i++)
668 $csv->add( $this->arow[
$i][
'po_name']);
669 $csv->add( $this->arow[
$i][
'po_description']);
670 $csv->add( $this->arow[
$i][
'j_poste']);
671 $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
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
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...