46 if ($this->
pa_id == $this->pa_id2)
throw new Exception(
_(
"Pas de croisement avec un seul plan"),1000);
53 if ( is_array(
$array) ==
false )
66 $r.=($odd%2==0)?
'<tr class="odd">':
'<tr class="even">';
82 $r.=
"<td class=\"num\">".nbm(
$s).
"</td><td>$d</td>";
90 $r.=
"<table class=\"result\" style=\"margin-bottom:3px\">";
92 $r.=
"<th style=\"width:30%\" >"._(
"Poste Analytique").
"</th>";
93 $r.=
"<th style=\"width:30%\">"._(
"Poste Analytique").
"</th>";
94 $r.=
"<th style=\"text-align:right\">"._(
"Débit").
"</th>";
95 $r.=
"<th style=\"text-align:right\">"._(
"Crédit").
"</th>";
96 $r.=
"<th style=\"text-align:right\">"._(
"Solde").
"</th>";
114 $r.=sprintf(
"<td>%s</td>",
$row[
'a_debit']);
121 $r.=
"<td>Total </td> <td ' class=\"num\"> ".nbm(
$tot_deb).
" </td> <td ' class=\"num\">".
nbm(
$tot_cred).
"</td>";
124 $r.=
td(
nbm(
$s),
' class="num"').
"<td>$d</td>";
130 $r.=
'<table class="result">';
134 th(
'Débit',
' style="text-align:right"').
135 th(
'Crédit',
'style="text-align:right" ').
136 th(
'Solde',
' style="text-align:right"');
140 foreach ($sum as
$row)
143 $r.=
'<td>'.$row[
'poste'].
'</td>';
144 $r.=
'<td>'.$row[
'desc'].
'</td>';
145 $r.=
'<td class="num">'.nbm(
$row[
'debit']).
'</td>';
146 $r.=
'<td class="num">'.nbm(
$row[
'credit']).
'</td>';
153 $r.=
'<td>'.$row[
'dc'].
'</td>';
156 $r.=
'<tr class="highlight">';
163 $r.=
td(
nbm(
$solde),
'class="num" style="border:solid 1px blue;font-weight:bold"');
181 $pdf->Setdossierinfo(dossier::name());
182 $pdf->setTitle(
"Balance analytique",
true);
183 $pdf->SetAuthor(
'NOALYSS');
184 $pdf->AliasNbPages();
191 $pdf->SetFont(
'DejaVu',
'B',9);
192 $pdf->write_cell(0,7,sprintf(
"Balance croise plan %s %s ",
199 if ( $this->
from !=
"" ||$this->
to !=
"")
200 $filtre_date=sprintf(
"Filtre date %s %s",
204 $filtre_pa=sprintf(
"Filtre poste plan1 %s %s",
208 if ( $this->from_poste2 !=
"" ||$this->to_poste2 !=
"")
209 $filtre_pb=sprintf(
"Filtre poste plan2 %s %s",
210 ($this->from_poste2!=
"")?
"de ".$this->from_poste2:
" ",
211 ($this->to_poste2!=
"")?
"jusque ".$this->to_poste2:
"");
213 $pdf->SetFont(
'DejaVu',
'',8);
214 $pdf->write_cell(50,7,$filtre_date);
215 $pdf->write_cell(50,7,$filtre_pa);
216 $pdf->write_cell(50,7,$filtre_pb);
219 $pdf->SetFont(
'DejaVu',
'',6);
220 $pdf->write_cell(20,7,
'id',
'B');
221 $pdf->write_cell(100,7,
'Poste Comptable',
'B');
222 $pdf->write_cell(20,7,
'Débit',
'B',0,
'L');
223 $pdf->write_cell(20,7,
'Crédit',
'B',0,
'L');
224 $pdf->write_cell(20,7,
'Solde',
'B',0,
'L');
225 $pdf->write_cell(20,7,
'D/C',
'B',0,
'L');
231 $pdf->write_cell(20,6,
$row[
'a_po_name'],0,0,
'L');
232 $pdf->write_cell(40,6,mb_substr(
$row[
'a_po_description'],0,31),0,0,
'L');
233 $pdf->write_cell(20,6,
$row[
'b_po_name'],0,0,
'L');
234 $pdf->write_cell(40,6,mb_substr(
$row[
'b_po_description'],0,31),0,0,
'L');
235 $pdf->write_cell(20,6,
$row[
'a_d'],0,0,
'R');
236 $pdf->write_cell(20,6,
$row[
'a_c'],0,0,
'R');
240 $pdf->write_cell(20,6,
$row[
'a_debit'],0,0,
'C');
245 $pdf->SetFont(
'DejaVu',
'B',8);
246 $pdf->write_cell(70,6,
'Somme',1,0,
'C');
248 $pdf->SetFont(
'DejaVu',
'',6);
250 $pdf->write_cell(20,7,
'Poste');
251 $pdf->write_cell(60,7,
'Description',
'B');
252 $pdf->write_cell(20,7,
'Débit',
'B',0,
'L');
253 $pdf->write_cell(20,7,
'Crédit',
'B',0,
'L');
254 $pdf->write_cell(20,7,
'Solde',
'B',0,
'L');
255 $pdf->write_cell(20,7,
'D/C',
'B',0,
'L');
259 for (
$i=0;
$i<count($sum);
$i++)
262 $pdf->write_cell(20,6,
$row[
'poste'],0,0,
'L');
263 $pdf->write_cell(60,6,
$row[
'desc'],0,0,
'L');
264 $pdf->write_cell(20,6,sprintf(
'%.2f',
$row[
'debit']),0,0,
'R');
265 $pdf->write_cell(20,6,sprintf(
'%.2f',
$row[
'credit']),0,0,
'R');
268 $pdf->write_cell(20,6,sprintf(
$side.
" ".
'%.2f',
$row[
'solde']),0,0,
'R');
269 $pdf->write_cell(20,6,
$row[
'dc'],0,0,
'R');
274 $pdf->write_cell(20,6,
"",0,0,
'L');
275 $pdf->write_cell(60,6,
_(
'Total'),0,0,
'L');
282 $pdf->write_cell(20,6,
$row[
'dc'],0,0,
'R');
285 $pdf->output(
'crossbalance-'.
$fDate.
'.pdf',
'D');
298 $csv->add(
"Poste comptable Analytique");
299 $csv->add(
"Poste comptable Analytique");
308 if ( is_array(
$array) ==
false )
320 $csv->add(
$row[
'a_solde'],
'number');
336 $r=parent::display_form($p_string);
338 $r.=
'<span style="padding:5px;margin:5px;border:2px double blue;display:block;">';
340 $plan_id=
new ISelect(
"pa_id2");
341 $plan_id->value=$this->
db->make_array(
"select pa_id, pa_name from plan_analytique order by pa_name");
343 $r.=
"Plan Analytique :".$plan_id->input();
344 $r.=HtmlInput::request_to_hidden(array(
'ac'));
351 $r.=
_(
'Entre le poste ');
352 $r.=
$poste->input(
"from_poste2",$this->from_poste2);
353 $javascript=
"search_ca(".dossier::id().
",'from_poste2','pa_id2')";
356 $r.=
_(
" et le poste ");
358 $r.=
$poste->input(
"to_poste2",$this->to_poste2);
359 $javascript=
"search_ca(".dossier::id().
",'to_poste2','pa_id2')";
362 $r.=
'<span class="notice" style="display:block">'.
363 _(
'Selectionnez le plan qui vous intéresse avant de cliquer sur Recherche').
367 $r.=HtmlInput::submit(
'Affiche',
_(
'Rechercher'));
380 $r.=
'<form method="GET" action="export.php" style="display:inline">';
382 $r.= HtmlInput::hidden(
"to",$this->
to);
383 $r.= HtmlInput::hidden(
"act",
"PDF:AncBalDouble");
384 $r.= HtmlInput::hidden(
"from",$this->
from);
385 $r.= HtmlInput::hidden(
"pa_id",$this->
pa_id);
387 $r.= HtmlInput::hidden(
"to_poste",$this->
to_poste);
388 $r.= HtmlInput::hidden(
"pa_id2",$this->pa_id2);
389 $r.= HtmlInput::hidden(
"from_poste2",$this->from_poste2);
390 $r.= HtmlInput::hidden(
"to_poste2",$this->to_poste2);
391 $r.=dossier::hidden();
392 $r.=HtmlInput::submit(
'bt_pdf',
"Export en PDF");
395 $r.=
'<form method="GET" action="export.php" style="display:inline">';
396 $r.= HtmlInput::hidden(
"to",$this->
to);
397 $r.= HtmlInput::hidden(
"act",
"CSV:AncBalDouble");
398 $r.= HtmlInput::hidden(
"from",$this->
from);
399 $r.= HtmlInput::hidden(
"pa_id",$this->
pa_id);
401 $r.= HtmlInput::hidden(
"to_poste",$this->
to_poste);
402 $r.= HtmlInput::hidden(
"pa_id2",$this->pa_id2);
403 $r.= HtmlInput::hidden(
"from_poste2",$this->from_poste2);
404 $r.= HtmlInput::hidden(
"to_poste2",$this->to_poste2);
406 $r.= dossier::hidden();
407 $r.=HtmlInput::submit(
'bt_csv',
"Export en CSV");
417 parent::get_request();
434 $filter_poste.=
" $and upper(pa.po_name)>= upper('".Database::escape_string($this->
from_poste).
"')";
440 $filter_poste.=
" $and upper(pa.po_name)<= upper('".Database::escape_string($this->
to_poste).
"')";
444 if ( $this->from_poste2 !=
"" )
446 $filter_poste.=
" $and upper(pb.po_name)>= upper('".Database::escape_string($this->from_poste2).
"')";
449 if ( $this->to_poste2 !=
"" )
451 $filter_poste.=
" $and upper(pb.po_name)<= upper('".Database::escape_string($this->to_poste2).
"')";
454 if ( $filter_poste !=
"")
455 $filter_poste=
" where ".$filter_poste;
459 pa.po_name as a_po_name,
460 pa.po_description as a_po_description,
461 pb.po_description as b_po_description,
464 pb.po_name as b_po_name,
465 sum(a_oa_amount_c) as a_c,
466 sum(a_oa_amount_d) as a_d
471 case when a.oa_debit='t' then a.oa_amount else 0 end as a_oa_amount_d,
472 case when a.oa_debit='f' then a.oa_amount else 0 end as a_oa_amount_c
474 operation_analytique as a join operation_analytique as b on (a.oa_row=b.oa_row
475 and a.oa_group=b.oa_group
477 join poste_analytique as poa on (a.po_id=poa.po_id)
478 join poste_analytique as pob on (b.po_id=pob.po_id)
480 and pob.pa_id= $2 ".$this->set_sql_filter().
"
481 ) as m join poste_analytique as pa on ( a_po_id=pa.po_id)
482 join poste_analytique as pb on (b_po_id=pb.po_id)
486 group by a_po_id,b_po_id,pa.po_name,pa.po_description,pb.po_name,pb.po_description
492 $this->has_data=count(
$array);
493 if ( $this->has_data == 0 )
505 $a[
$count][
'a_po_description']=
$row[
'a_po_description'];
507 $a[
$count][
'b_po_description']=
$row[
'b_po_description'];
533 if (
$old !=
$row[
'a_po_name'] && $first==
false )
538 $array[]=array(
'poste'=>
$old,
'desc'=>$old_desc
540 'solde'=>
$s,
'dc'=>$d);
546 $old_desc=
$row[
'a_po_description'];
553 $old_desc=
$row[
'a_po_description'];
563 $array[]=array(
'poste'=>
$old,
'desc'=>$old_desc
566 'solde'=>
$s,
'dc'=>$d);
585 $a=Dossier::connect();
590 echo
'<form method="GET">';
592 echo
$bal->display_form();
594 if ( isset(
$_GET[
'result']))
596 echo
$bal->show_button(
"",
"");
597 echo
"<h1>HTML</h1>";
598 echo
$bal->display_html();
600 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
_("actif, passif,charge,...")
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
show_button($p_string="")
Show the button to export in PDF or CSV.
$from_poste2
compute the html display
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.