44 if ($this->
pa_id == $this->pa_id2)
throw new Exception(_(
"Pas de croisement avec un seul plan"),1000);
51 if ( is_array(
$array) ==
false )
64 $r.=($odd%2==0)?
'<tr class="odd">':
'<tr class="even">';
80 $r.=
"<td class=\"num\">".nbm(
$s).
"</td><td>$d</td>";
88 $r.=
"<table class=\"result\" style=\"margin-bottom:3px\">";
90 $r.=
"<th style=\"width:30%\" >"._(
"Poste Analytique").
"</th>";
91 $r.=
"<th style=\"width:30%\">"._(
"Poste Analytique").
"</th>";
92 $r.=
"<th style=\"text-align:right\">"._(
"Débit").
"</th>";
93 $r.=
"<th style=\"text-align:right\">"._(
"Crédit").
"</th>";
94 $r.=
"<th style=\"text-align:right\">"._(
"Solde").
"</th>";
112 $r.=sprintf(
"<td>%s</td>",
$row[
'a_debit']);
119 $r.=
"<td>Total </td> <td ' class=\"num\"> ".nbm(
$tot_deb).
" </td> <td ' class=\"num\">".
nbm(
$tot_cred).
"</td>";
122 $r.=
td(
nbm(
$s),
' class="num"').
"<td>$d</td>";
128 $r.=
'<table class="result">';
132 th(
'Débit',
' style="text-align:right"').
133 th(
'Crédit',
'style="text-align:right" ').
134 th(
'Solde',
' style="text-align:right"');
138 foreach ($sum as
$row)
141 $r.=
'<td>'.$row[
'poste'].
'</td>';
142 $r.=
'<td>'.$row[
'desc'].
'</td>';
143 $r.=
'<td class="num">'.nbm(
$row[
'debit']).
'</td>';
144 $r.=
'<td class="num">'.nbm(
$row[
'credit']).
'</td>';
151 $r.=
'<td>'.$row[
'dc'].
'</td>';
154 $r.=
'<tr class="highlight">';
161 $r.=
td(
nbm(
$solde),
'class="num" style="border:solid 1px blue;font-weight:bold"');
180 $pdf->setTitle(
"Balance analytique",
true);
181 $pdf->SetAuthor(
'NOALYSS');
182 $pdf->AliasNbPages();
189 $pdf->SetFont(
'DejaVu',
'B',9);
190 $pdf->write_cell(0,7,sprintf(
"Balance croise plan %s %s ",
197 if ( $this->
from !=
"" ||$this->
to !=
"")
198 $filtre_date=sprintf(
"Filtre date %s %s",
202 $filtre_pa=sprintf(
"Filtre poste plan1 %s %s",
206 if ( $this->from_poste2 !=
"" ||$this->to_poste2 !=
"")
207 $filtre_pb=sprintf(
"Filtre poste plan2 %s %s",
208 ($this->from_poste2!=
"")?
"de ".$this->from_poste2:
" ",
209 ($this->to_poste2!=
"")?
"jusque ".$this->to_poste2:
"");
211 $pdf->SetFont(
'DejaVu',
'',8);
212 $pdf->write_cell(50,7,$filtre_date);
213 $pdf->write_cell(50,7,$filtre_pa);
214 $pdf->write_cell(50,7,$filtre_pb);
217 $pdf->SetFont(
'DejaVu',
'',6);
218 $pdf->write_cell(20,7,
'id',
'B');
219 $pdf->write_cell(100,7,
'Poste Comptable',
'B');
220 $pdf->write_cell(20,7,
'Débit',
'B',0,
'L');
221 $pdf->write_cell(20,7,
'Crédit',
'B',0,
'L');
222 $pdf->write_cell(20,7,
'Solde',
'B',0,
'L');
223 $pdf->write_cell(20,7,
'D/C',
'B',0,
'L');
229 $pdf->write_cell(20,6,
$row[
'a_po_name'],0,0,
'L');
230 $pdf->write_cell(40,6,mb_substr(
$row[
'a_po_description'],0,31),0,0,
'L');
231 $pdf->write_cell(20,6,
$row[
'b_po_name'],0,0,
'L');
232 $pdf->write_cell(40,6,mb_substr(
$row[
'b_po_description'],0,31),0,0,
'L');
233 $pdf->write_cell(20,6,
$row[
'a_d'],0,0,
'R');
234 $pdf->write_cell(20,6,
$row[
'a_c'],0,0,
'R');
238 $pdf->write_cell(20,6,
$row[
'a_debit'],0,0,
'C');
243 $pdf->SetFont(
'DejaVu',
'B',8);
244 $pdf->write_cell(70,6,
'Somme',1,0,
'C');
246 $pdf->SetFont(
'DejaVu',
'',6);
248 $pdf->write_cell(20,7,
'Poste');
249 $pdf->write_cell(60,7,
'Description',
'B');
250 $pdf->write_cell(20,7,
'Débit',
'B',0,
'L');
251 $pdf->write_cell(20,7,
'Crédit',
'B',0,
'L');
252 $pdf->write_cell(20,7,
'Solde',
'B',0,
'L');
253 $pdf->write_cell(20,7,
'D/C',
'B',0,
'L');
257 for (
$i=0;
$i<count($sum);
$i++)
260 $pdf->write_cell(20,6,
$row[
'poste'],0,0,
'L');
261 $pdf->write_cell(60,6,
$row[
'desc'],0,0,
'L');
262 $pdf->write_cell(20,6,sprintf(
'%.2f',
$row[
'debit']),0,0,
'R');
263 $pdf->write_cell(20,6,sprintf(
'%.2f',
$row[
'credit']),0,0,
'R');
266 $pdf->write_cell(20,6,sprintf(
$side.
" ".
'%.2f',
$row[
'solde']),0,0,
'R');
267 $pdf->write_cell(20,6,
$row[
'dc'],0,0,
'R');
272 $pdf->write_cell(20,6,
"",0,0,
'L');
273 $pdf->write_cell(60,6,_(
'Total'),0,0,
'L');
280 $pdf->write_cell(20,6,
$row[
'dc'],0,0,
'R');
283 $pdf->output(
'crossbalance-'.
$fDate.
'.pdf',
'D');
296 $csv->add(
"Poste comptable Analytique");
297 $csv->add(
"Poste comptable Analytique");
306 if ( is_array(
$array) ==
false )
318 $csv->add(
$row[
'a_solde'],
'number');
334 $r=parent::display_form($p_string);
336 $r.=
'<span style="padding:5px;margin:5px;border:2px double blue;display:block;">';
338 $plan_id=
new ISelect(
"pa_id2");
339 $plan_id->value=$this->
db->make_array(
"select pa_id, pa_name from plan_analytique order by pa_name");
340 $plan_id->selected=$this->pa_id2;
341 $r.=
"Plan Analytique :".$plan_id->input();
349 $r.=_(
'Entre le poste ');
350 $r.=
$poste->input(
"from_poste2",$this->from_poste2);
351 $javascript=
"search_ca(".dossier::id().
",'from_poste2','pa_id2')";
354 $r.=_(
" et le poste ");
356 $r.=
$poste->input(
"to_poste2",$this->to_poste2);
357 $javascript=
"search_ca(".dossier::id().
",'to_poste2','pa_id2')";
360 $r.=
'<span class="notice" style="display:block">'.
361 _(
'Selectionnez le plan qui vous intéresse avant de cliquer sur Recherche').
378 $r.=
'<form method="GET" action="export.php" style="display:inline">';
389 $r.=dossier::hidden();
393 $r.=
'<form method="GET" action="export.php" style="display:inline">';
404 $r.= dossier::hidden();
415 parent::get_request();
432 $filter_poste.=
" $and upper(pa.po_name)>= upper('".Database::escape_string($this->
from_poste).
"')";
438 $filter_poste.=
" $and upper(pa.po_name)<= upper('".Database::escape_string($this->
to_poste).
"')";
442 if ( $this->from_poste2 !=
"" )
444 $filter_poste.=
" $and upper(pb.po_name)>= upper('".Database::escape_string($this->from_poste2).
"')";
447 if ( $this->to_poste2 !=
"" )
449 $filter_poste.=
" $and upper(pb.po_name)<= upper('".Database::escape_string($this->to_poste2).
"')";
452 if ( $filter_poste !=
"")
453 $filter_poste=
" where ".$filter_poste;
457 pa.po_name as a_po_name,
458 pa.po_description as a_po_description,
459 pb.po_description as b_po_description,
462 pb.po_name as b_po_name,
463 sum(a_oa_amount_c) as a_c,
464 sum(a_oa_amount_d) as a_d
469 case when a.oa_debit='t' then a.oa_amount else 0 end as a_oa_amount_d,
470 case when a.oa_debit='f' then a.oa_amount else 0 end as a_oa_amount_c
472 operation_analytique as a join operation_analytique as b on (a.oa_row=b.oa_row
473 and a.oa_group=b.oa_group
475 join poste_analytique as poa on (a.po_id=poa.po_id)
476 join poste_analytique as pob on (b.po_id=pob.po_id)
478 and pob.pa_id= $2 ".$this->set_sql_filter().
"
479 ) as m join poste_analytique as pa on ( a_po_id=pa.po_id)
480 join poste_analytique as pb on (b_po_id=pb.po_id)
484 group by a_po_id,b_po_id,pa.po_name,pa.po_description,pb.po_name,pb.po_description
490 $this->has_data=count(
$array);
491 if ( $this->has_data == 0 )
503 $a[
$count][
'a_po_description']=
$row[
'a_po_description'];
505 $a[
$count][
'b_po_description']=
$row[
'b_po_description'];
531 if (
$old !=
$row[
'a_po_name'] && $first==
false )
536 $array[]=array(
'poste'=>
$old,
'desc'=>$old_desc
538 'solde'=>
$s,
'dc'=>$d);
544 $old_desc=
$row[
'a_po_description'];
551 $old_desc=
$row[
'a_po_description'];
561 $array[]=array(
'poste'=>
$old,
'desc'=>$old_desc
564 'solde'=>
$s,
'dc'=>$d);
588 echo
'<form method="GET">';
590 echo
$bal->display_form();
592 if ( isset(
$_GET[
'result']))
594 echo
$bal->show_button(
"",
"");
595 echo
"<h1>HTML</h1>";
596 echo
$bal->display_html();
598 echo
$bal->display_csv();
th($p_string, $p_extra='', $raw='')
nb($p_number)
format the number for the CSV export
td($p_string='', $p_extra='')
surround the string with td
nbm($p_number, $p_dec=2)
format the number with a sep.
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$anc_grandlivre from_poste
Print the crossed balance between 2 plan.
show_sum($p_array)
add extra lines with sum of each account
static test_me()
for testing and debuggind the class it must never be called from production system,...
get_request()
complete the object with the data in $_REQUEST
display_html()
compute the html display
show_button($p_string="")
Show the button to export in PDF or CSV.
display_form($p_string='')
Compute the form to display.
display_csv()
Compute the csv export.
display_pdf()
Display the result in pdf.
load()
load the data from the database
Concerns the Analytic plan (table plan_analytique)
this class is the mother class for the CA printing
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
static icon_magnifier($id, $p_javascript, $p_style="")
Display a icon with a magnify glass.
Manage the CSV : manage files and write CSV record.
API for creating PDF, unicode, based on tfpdf.