noalyss Version-9
anc_acc_list.class.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
22/*!\file
23 * \brief Anc_Acc_List Manage the class for reporting about Analytic Accountancy and Accountancy : card - analytic account,
24 * accounting - analytic account,
25 */
26
27/*!
28 * \class Anc_Acc_List
29 * \brief Manage the class for reporting about Analytic Accountancy and Accountancy : card - analytic account,
30 * accounting - analytic account,
31 */
32
34{
35 /**
36 *@brief display form to get the parameter
37 * - card_poste 1 by card, 2 by account
38 * - from_poste
39 * - to_poste
40 * - from from date
41 * - to until date
42 * - pa_id Analytic plan to use
43 */
44 function display_form($p_hidden='')
45 {
46 $r=parent::display_form($p_hidden);
47 $icard=new ISelect('card_poste');
48 $icard->value=array(
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'))
53
54 );
55
56 $icard->selected=$this->card_poste;
57 $r.=$icard->input();
58 $r.=HtmlInput::request_to_hidden(array('ac'));
59 return $r;
60 }
61 /**
62 * \brief load the data
63 * does not return anything but give a value to this->aheader and this->arow
64 */
66 {
67 $date=$this->set_sql_filter();
68 $date=($date != '')?" $date":'';
69 $sql_from_poste=($this->from_poste!='')?" and po.po_name >= upper('".Database::escape_string($this->from_poste)."')":'';
70 $sql_to_poste=($this->to_poste!='')?" and po.po_name <= upper('".Database::escape_string($this->to_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
76 FROM fiche_detail
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
80 FROM fiche_detail
81 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
82 end
83 AS name,
84 case when jrnx.j_poste is not null then
85 jrnx.j_poste
86 when jrnx.j_poste is null then
87 (SELECT fiche_detail.ad_value
88 FROM fiche_detail
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(
93 CASE
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)
99 JOIN m USING (oa_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
103 HAVING sum(
104CASE
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));
109
110 }
111 /**
112 * \brief load the data
113 * does not return anything but give a value to this->aheader and this->arow
114 */
115 function load_anc_card()
116 {
117 $date=$this->set_sql_filter();
118 $date=($date != '')?" $date":'';
119 $sql_from_poste=($this->from_poste!='')?" and po.po_name >= upper('".Database::escape_string($this->from_poste)."')":'';
120 $sql_to_poste=($this->to_poste!='')?" and po.po_name <= upper('".Database::escape_string($this->to_poste)."')":'';
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
126 FROM fiche_detail
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
130 FROM fiche_detail
131 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
132 end
133 AS name,
134 case when jrnx.j_qcode is not null then
135 jrnx.j_qcode
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(
141 CASE
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
149 ."
150 GROUP BY po.po_id, po.po_name, po.pa_id, m.f_id1, m.j_qcode, m.name, po.po_description
151 HAVING sum(
152CASE
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));
156
157 }
158
159 /**
160 * \brief load the data
161 * does not return anything but give a value to this->aheader and this->arow
162 */
163 function load_poste()
164 {
165 $date=$this->set_sql_filter();
166 $date=($date != '')?" $date":'';
167 $sql_from_poste=($this->from_poste!='')?" and po.po_name >= upper('".Database::escape_string($this->from_poste)."')":'';
168 $sql_to_poste=($this->to_poste!='')?" and po.po_name <= upper('".Database::escape_string($this->to_poste)."')":'';
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
174 FROM fiche_detail
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
178 FROM fiche_detail
179 WHERE fiche_detail.ad_id = 1 AND fiche_detail.f_id = operation_analytique.f_id)
180 end
181 AS name,
182 case when jrnx.j_poste is not null then
183 jrnx.j_poste
184 when jrnx.j_poste is null then
185 (SELECT fiche_detail.ad_value
186 FROM fiche_detail
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(
191 CASE
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)
197 JOIN m USING (oa_id)
198 JOIN tmp_pcmn ON m.j_poste::text = tmp_pcmn.pcm_val::text
199 where
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
202 HAVING sum(
203CASE
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
207
208",array($this->pa_id));
209
210 }
211
212 /**
213 * \brief load the data
214 * does not return anything but give a value to this->aheader and this->arow
215 */
216 function load_card()
217 {
218 $date=$this->set_sql_filter();
219 $date=($date != '')?" $date":'';
220 $sql_from_poste=($this->from_poste!='')?" and po.po_name >= upper('".Database::escape_string($this->from_poste)."')":'';
221 $sql_to_poste=($this->to_poste!='')?" and po.po_name <= upper('".Database::escape_string($this->to_poste)."')":'';
222
223 $this->arow=$this->db->get_array("
224with m as(
225 select
226 oa_id,
227 po_id,
228 case when operation_analytique.oa_debit = true then operation_analytique.oa_amount *(- 1 )::numeric else operation_analytique.oa_amount end as m_amount,
229 coalesce(
230 jrnx.f_id,
231 operation_analytique.f_id
232 ) as f_id1,
233 case
234 when jrnx.j_qcode is not null then(
235 select
236 fiche_detail.ad_value
237 from
238 fiche_detail
239 where
240 fiche_detail.ad_id = 1
241 and fiche_detail.f_id = jrnx.f_id
242 )
243 when jrnx.f_id is null
244 and operation_analytique.f_id is not null then(
245 select
246 fiche_detail.ad_value
247 from
248 fiche_detail
249 where
250 fiche_detail.ad_id = 1
251 and fiche_detail.f_id = operation_analytique.f_id
252 )
253 end as name,
254 case
255 when jrnx.j_qcode is not null then jrnx.j_qcode
256 when jrnx.f_id is null then(
257 select
258 fiche_detail.ad_value
259 from
260 fiche_detail
261 where
262 fiche_detail.ad_id = 23
263 and fiche_detail.f_id = operation_analytique.f_id
264 )
265 end as j_qcode
266 from
267 operation_analytique
268 left join jrnx using(j_id)
269 join poste_analytique using (po_id)
270 where pa_id=$1
271) select
272 po.po_id,
273 po.pa_id,
274 po.po_name,
275 po.po_description,
276 sum( m_amount) as sum_amount,
277 m.f_id1 as f_id,
278 m.j_qcode,
279 m.name
280from
281 operation_analytique join m using(oa_id)
282 join poste_analytique po on (m.po_id=po.po_id)
283where
284 po.pa_id = $1
285 {$date} {$sql_from_poste} {$sql_to_poste}
286group by
287 m.f_id1,
288 m.j_qcode,
289 po.po_id,
290 po.po_name,
291 po.pa_id,
292 m.name,
293 po.po_description
294having
295 sum( m_amount )<> 0::numeric
296order by
297 name,
298 po_name
299
300",array($this->pa_id));
301 }
302 /**
303 *@brief display the button export CSV
304 *@param $p_hidden is a string containing hidden items
305 *@return html string
306 */
307 function show_button($p_hidden="")
308 {
309 $r="";
310 $r.= '<form method="GET" action="export.php" style="display:inline">';
311 $r.= HtmlInput::hidden("act","CSV:AncAccList");
312 $r.= HtmlInput::hidden("to",$this->to);
313 $r.= HtmlInput::hidden("from",$this->from);
314 $r.= HtmlInput::hidden("pa_id",$this->pa_id);
315 $r.= HtmlInput::hidden("from_poste",$this->from_poste);
316 $r.= HtmlInput::hidden("to_poste",$this->to_poste);
317 $r.= HtmlInput::hidden("card_poste",$this->card_poste);
318
319 $r.= $p_hidden;
320 $r.= dossier::hidden();
321 $r.=HtmlInput::submit('bt_csv',"Export en CSV");
322 $r.= '</form>';
323 $r.= '<form method="GET" action="export.php" style="display:inline">';
324 $r.= HtmlInput::hidden("act","PDF:AncAccList");
325 $r.= HtmlInput::hidden("to",$this->to);
326 $r.= HtmlInput::hidden("from",$this->from);
327 $r.= HtmlInput::hidden("pa_id",$this->pa_id);
328 $r.= HtmlInput::hidden("from_poste",$this->from_poste);
329 $r.= HtmlInput::hidden("to_poste",$this->to_poste);
330 $r.= HtmlInput::hidden("card_poste",$this->card_poste);
331
332 $r.= $p_hidden;
333 $r.= dossier::hidden();
334 $r.=HtmlInput::submit('bt_pdf',"Export en PDF");
335 $r.= '</form>';
336 return $r;
337 }
338 /**
339 * Display the result of accountancy and analytic ,
340 * Axis / Card
341 * Card / Axis
342 * Accounting / Axis
343 * Axis / Accounting
344 */
345 function display_html()
346 {
347 bcscale(2);
348 if ( $this->check() != 0)
349 {
350 alert(_('Date invalide'));
351 return;
352 }
353 //---------------------------------------------------------------------------
354 // Card - Acc
355 //---------------------------------------------------------------------------
356
357 if ( $this->card_poste=='1')
358 {
359 $this->load_card();
360
361 /*
362 * Show all the result
363 */
364 $tot_card=0;$prev='';
365 echo '<table class="result" style="margin-left:5px;margin-top:5px">';
366 $tot_glob=0;
367 for ($i=0;$i<count($this->arow);$i++)
368 {
369 if ( $i == 0 )
370 {
371 $prev=$this->arow[$i]['f_id'];
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>';
373 }
374 $style= ( $i % 2 == 0)?' class="odd" ':' class="even" ';
375 if ( $i != 0 && $prev != $this->arow[$i]['f_id'])
376 {
377 echo td('Total');
378 echo td(nbm($tot_card),' class="num"');
379 echo '</tr>';
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>';
381 $tot_card=0;
382 $prev = $this->arow[$i]['f_id'];
383 }
384
385 echo '<tr '.$style.'>';
386 $amount=$this->arow[$i]['sum_amount'];
387 if ($amount==null)$amount=0;
388
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"');
393 echo td(nbm($amount),' class="num" ');
394 echo '</tr>';
395
396 }
397 echo '<tr>';
398 echo td('Total');
399 echo td(nbm($tot_card),' class="num"');
400 echo '</tr>';
401
402 echo '</table>';
403 echo '<h2>'._("Résultat global")." ".nbm($tot_glob).'</h2>';
404 }
405 //---------------------------------------------------------------------------
406 // Accountancy - Analytic
407 //---------------------------------------------------------------------------
408
409 if ( $this->card_poste=='2')
410 {
411 $this->load_poste();
412 /*
413 * Show all the result
414 */
415 $tot_card=0;$prev='';
416 echo '<table class="result" style="margin-left:20px;margin-top:5px">';
417 $tot_glob=0;
418 for ($i=0;$i<count($this->arow);$i++)
419 {
420 if ( $i == 0 )
421 {
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>';
424 }
425 $style= ( $i % 2 == 0)?' class="odd" ':' class="even" ';
426 if ( $i != 0 && $prev != $this->arow[$i]['j_poste'])
427 {
428 echo td('Total');
429 echo td(nbm($tot_card),' class="num"');
430 echo '</tr>';
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>';
432 $tot_card=0;
433 $prev = $this->arow[$i]['j_poste'];
434 }
435
436 echo '<tr '.$style.'>';
437 $amount=$this->arow[$i]['sum_amount'];
438 if ($amount==null)$amount=0;
439
440 $tot_card=bcadd($tot_card,$amount);
441 $tot_glob=bcadd($tot_glob,$amount);
442
443
444 echo td($this->arow[$i]['po_name']." ".
445 $this->arow[$i]['po_description'],'style="padding-left:10"');
446 echo td(nbm($amount),' class="num" ');
447 echo '</tr>';
448
449 }
450 echo '<tr>';
451 echo td('Total');
452 echo td(nbm($tot_card),' class="num"');
453 echo '</tr>';
454
455 echo '</table>';
456 echo '<h2>'._("Résultat global")." ".nbm($tot_glob).'</h2>';
457 }
458 //---------------------------------------------------------------------------
459 // Acc after card
460 //---------------------------------------------------------------------------
461 if ( $this->card_poste=='3')
462 {
463 $this->load_anc_card();
464 /*
465 * Show all the result
466 */
467 $tot_card=0;$prev='';
468 echo '<table class="result" style="margin-left:20px;margin-top:5px">';
469 $tot_glob=0;
470 for ($i=0;$i<count($this->arow);$i++)
471 {
472 if ( $i == 0 )
473 {
474 $prev=$this->arow[$i]['po_id'];
475 echo '<tr><td>'.$this->arow[$i]['po_name']." ".$this->arow[$i]['po_description'].'</td></tr>';
476
477 }
478 $style= ( $i % 2 == 0)?' class="odd" ':' class="even" ';
479 if ( $i != 0 && $prev != $this->arow[$i]['po_id'])
480 {
481 echo td('Total');
482 echo td(nbm($tot_card),' class="num"');
483 echo '</tr>';
484 echo '<tr><td>'.$this->arow[$i]['po_name']." ".$this->arow[$i]['po_description'].'</td></tr>';
485
486 $tot_card=0;
487 $prev = $this->arow[$i]['po_id'];
488 }
489
490 echo '<tr '.$style.'>';
491 $amount=$this->arow[$i]['sum_amount'];
492 if ($amount==null)$amount=0;
493
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>';
497
498 echo td(nbm($amount),' class="num" ');
499 echo '</tr>';
500
501 }
502 echo '<tr>';
503 echo td('Total');
504 echo td(nbm($tot_card),' class="num"');
505 echo '</tr>';
506
507 echo '</table>';
508 echo '<h2>'._("Résultat global")." ".nbm($tot_glob).'</h2>';
509 }
510 //---------------------------------------------------------------------------
511 // Analytic - Accountancy
512 //---------------------------------------------------------------------------
513
514
515 if ( $this->card_poste=='4')
516 {
517 $this->load_anc_account();
518
519 /*
520 * Show all the result
521 */
522 $tot_card=0;$prev='';
523 echo '<table class="result" style="margin-left:20px;margin-top:5px">';
524 $tot_glob=0;
525 for ($i=0;$i<count($this->arow);$i++)
526 {
527 if ( $i == 0 )
528 {
529 $prev=$this->arow[$i]['po_id'];
530 echo '<tr><td>'.$this->arow[$i]['po_name']." ".$this->arow[$i]['po_description'].'</td></tr>';
531 }
532 $style= ( $i % 2 == 0)?' class="odd" ':' class="even" ';
533 if ( $i != 0 && $prev != $this->arow[$i]['po_id'])
534 {
535 echo td('Total');
536 echo td(nbm($tot_card),' class="num"');
537 echo '</tr>';
538
539 $tot_card=0;
540 $prev = $this->arow[$i]['po_id'];
541 echo '<tr><td>'.$this->arow[$i]['po_name']." ".$this->arow[$i]['po_description'].'</td></tr>';
542
543 }
544
545 echo '<tr '.$style.'>';
546 $amount=$this->arow[$i]['sum_amount'];
547 if ($amount==null)$amount=0;
548
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>';
552 echo td(nbm($amount),' class="num" ');
553 echo '</tr>';
554
555 }
556 echo '<tr>';
557 echo td('Total');
558 echo td(nbm($tot_card),' class="num"');
559 echo '</tr>';
560
561 echo '</table>';
562 echo '<h2>'._("Résultat global")." ".nbm($tot_glob).'</h2>';
563 }
564
565 }
566 function export_csv()
567 {
568 bcscale(2);
569 $csv=new Noalyss_CSV('export-anc-list');
570 $csv->send_header();
571 if ( $this->check () != 0 ) {throw new Exception (_("date invalide"));}
572 //---------------------------------------------------------------------------
573 // Card - Acc
574 //---------------------------------------------------------------------------
575 if ( $this->card_poste=='1')
576 {
577 $this->load_card();
578
579 /*
580 * Show all the result
581 */
582 $prev='';
583
584 for ($i=0;$i<count($this->arow);$i++)
585 {
586
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']);
592
593 $amount=$this->arow[$i]['sum_amount'];
594 if ($amount==null)$amount=0;
595 $csv->add($amount,"number");
596
597 $csv->write();
598 }
599 }
600 //---------------------------------------------------------------------------
601 // Accountancy - Analytic
602 //---------------------------------------------------------------------------
603
604 if ( $this->card_poste=='2')
605 {
606 $this->load_poste();
607 /*
608 * Show all the result
609 */
610 for ($i=0;$i<count($this->arow);$i++)
611 {
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']);
616
617 $amount=$this->arow[$i]['sum_amount'];
618 if ($amount==null)$amount=0;
619 $csv->add($amount,"number");
620
621 $csv->write();
622
623
624 }
625
626 }
627 //---------------------------------------------------------------------------
628 // Acc after card
629 //---------------------------------------------------------------------------
630 if ( $this->card_poste=='3')
631 {
632 $this->load_anc_card();
633 /*
634 * Show all the result
635 */
636 for ($i=0;$i<count($this->arow);$i++)
637 {
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']);
642
643 $amount=$this->arow[$i]['sum_amount'];
644 if ($amount==null)$amount=0;
645
646 $csv->add($amount,"number");
647
648 $csv->write();
649
650
651
652 }
653 }
654 //---------------------------------------------------------------------------
655 // Analytic - Accountancy
656 //---------------------------------------------------------------------------
657
658
659 if ( $this->card_poste=='4')
660 {
661 $this->load_anc_account();
662
663 /*
664 * Show all the result
665 */
666 for ($i=0;$i<count($this->arow);$i++)
667 {
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']);
672
673 $amount=$this->arow[$i]['sum_amount'];
674 if ($amount==null)$amount=0;
675
676 $csv->add($amount,"number");
677
678 $csv->write();
679
680 }
681 }
682
683
684
685
686 }
687
688}
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$anc pa_id
$anc_grandlivre from_poste
$anc_grandlivre to
$anc_grandlivre to_poste
$anc_grandlivre from
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
static request_to_hidden(array $array)
transform $_REQUEST data to hidden
static hidden($p_name, $p_value, $p_id="")
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
$SecUser db