manage the simple balance for CA, inherit from balance_ca
More...
|
static | test_me () |
| for testing and debuggind the class it must never be called from production system, it is intended only for developpers More...
|
|
manage the simple balance for CA, inherit from balance_ca
Definition at line 32 of file anc_balance_simple.class.php.
◆ display_csv()
Anc_Balance_Simple::display_csv |
( |
| ) |
|
Compute the csv export.
- Returns
- string with the csv
Definition at line 228 of file anc_balance_simple.class.php.
229 {
231 if ( is_array(
$array) ==
false )
232 {
234
235 }
240 {
241
246 $csv->add(
$row[
'sum_deb'],
"number");
247 $csv->add(
$row[
'sum_cred'],
"number");
250
252 }
254
255 }
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
load()
load the data from the database
Manage the CSV : manage files and write CSV record.
References $array, $csv, $r, $row, $solde, and load().
◆ display_form()
Anc_Balance_Simple::display_form |
( |
|
$p_string = "" | ) |
|
Compute the form to display.
- Parameters
-
$p_hidden | hidden tag to be included (gDossier,...) |
- Returns
- string containing the data
Reimplemented from Anc_Print.
Definition at line 185 of file anc_balance_simple.class.php.
186 {
187 $r=parent::display_form($p_string);
188
190
192 }
References $r, and HtmlInput\submit().
◆ display_html()
Anc_Balance_Simple::display_html |
( |
| ) |
|
compute the html display
- Returns
- string
Definition at line 124 of file anc_balance_simple.class.php.
125 {
126 $r=
"<table class=\"result\">";
128 $r.=
"<th>Poste comptable Analytique</th>";
129 $r.=
"<th>Groupe</th>";
130 $r.=
"<th>Débit</th>";
131 $r.=
"<th>Crédit</th>";
132 $r.=
"<th>Solde</th>";
135
137 $odd=0;
138 if ( is_array(
$array) ==
false )
139 {
141
142 }
143 bcscale(2);
144 $deb_side=0;$cred_side=0;
146 {
147 $odd++;
148
149 $r.=($odd%2==0)?
'<tr class="odd">':
'<tr class="even">';
150
151
152 $r.=sprintf(
"<td align=\"left\">%s</td>",
h(
$row[
'po_name']));
153 $r.=sprintf(
"<td align=\"left\">%s</td>",
h(
$row[
'ga_description']));
159 $r.=sprintf(
"<td>%s</td>",
$deb);
161 $deb_side=bcadd($deb_side,
$row[
'sum_deb']);
162 $cred_side=bcadd($cred_side,
$row[
'sum_cred']);
163
164 }
165 $r.=
'<tr class="highlight">';
168 $r.=
td(
nbm($deb_side),
'class="num"');
169 $r.=
td(
nbm($cred_side),
'class="num"');
170 $solde_side=abs(bcsub($deb_side,$cred_side));
171 $r.=
td(
nbm($solde_side),
'class="num"');
172 if ( $deb_side == $cred_side )
$r.=
td(
"=");
173 else if ( $deb_side > $cred_side )
$r.=
td(
"D");
177 }
td($p_string='', $p_extra='')
surround the string with td
nbm($p_number, $p_dec=2)
format the number with a sep.
h( $row[ 'oa_description'])
for($i=0;$i< $nb_jrn;$i++) $deb
References $array, $deb, $r, $row, h, load(), nbm(), and td().
◆ display_pdf()
Anc_Balance_Simple::display_pdf |
( |
| ) |
|
Display the result in pdf.
- Returns
- none
Definition at line 199 of file anc_balance_simple.class.php.
200 {
202 $pdf=
new PDFBalance_Simple($this->
db);
204 $pdf->AliasNbPages();
206 $pdf->setTitle(
"Balance analytique",
true);
207
208 $pdf->SetFont(
'DejaVu',
'',6);
210 {
212 $pdf->write_cell(50,6,
$row[
'po_name'],0,0,
'L');
213 $pdf->write_cell(50,6,
$row[
'ga_description'],0,0,
'L');
214 $pdf->write_cell(20,6,sprintf(
'%s',
nbm(
$row[
'sum_deb'])),0,0,
'R');
215 $pdf->write_cell(20,6,sprintf(
'%s',
nbm(
$row[
'sum_cred'])),0,0,
'R');
216 $pdf->write_cell(20,6,sprintf(
'%s',
nbm(
$row[
'solde'])),0,0,
'R');
217 $pdf->write_cell(20,6,
$row[
'debit'],0,0,
'R');
219 }
221 $pdf->output(
'simple-balance-'.
$fDate.
'.pdf',
'D');
222
223 }
$anc_grandlivre from_poste
References $array, $fDate, $i, $pdf, $row, db, from, from_poste, load(), nbm(), to, and to_poste.
◆ load()
Anc_Balance_Simple::load |
( |
| ) |
|
load the data from the database
- Returns
- array or null
Definition at line 40 of file anc_balance_simple.class.php.
41 {
43
44
45 $sql=
"select m.po_id,sum(deb) as sum_deb,sum(cred) as sum_cred,";
46 $sql.=
" po_name||' '||coalesce(po_description,'') as po_name";
47 $sql.=
",ga_description ";
49 $sql.=
" (select po_id,case when oa_debit='t' then oa_amount else 0 end as deb,";
50 $sql.=
"case when oa_debit='f' then oa_amount else 0 end as cred ";
51 $sql.=
" from operation_analytique join poste_analytique using(po_id)";
53 $sql.=
" ) as m join poste_analytique using (po_id)";
54 $sql.=
" left join groupe_analytique on ( poste_analytique.ga_id=groupe_analytique.ga_id)";
55 $sql.=
" where poste_analytique.pa_id=".$this->pa_id;
56 $sql.=
" group by po_id,po_name,po_description,ga_description";
57 $sql.=
" order by po_name";
58
60
62 $this->has_data=0;
63 return null;
64 }
69 {
78 }
81
82
83 }
set_sql_filter()
Set the filter (account_date)
static fetch_all($ret)
wrapper for the function pg_fetch_all
static num_row($ret)
wrapper for the function pg_num_rows
References $a, $array, $count, $filter, $res, $row, $sql, db, DatabaseCore\fetch_all(), DatabaseCore\num_row(), and set_sql_filter().
Referenced by display_csv(), display_html(), and display_pdf().
◆ set_sql_filter()
Anc_Balance_Simple::set_sql_filter |
( |
| ) |
|
Set the filter (account_date)
- Returns
- return the string to add to load
Reimplemented from Anc_Print.
Definition at line 91 of file anc_balance_simple.class.php.
92 {
94 $and="";
95 if ( $this->
from !=
"" )
96 {
97 $sql.=
" oa_date >= to_date('".$this->from.
"','DD.MM.YYYY')";
98 $and=" and ";
99 }
100 if ( $this->
to !=
"" )
101 {
102 $sql.=
" $and oa_date <= to_date('".$this->to.
"','DD.MM.YYYY')";
103 $and=" and ";
104 }
106 {
107 $sql.=
" $and upper(po_name)>= upper('".$this->from_poste.
"')";
108 $and=" and ";
109 }
111 {
112 $sql.=
" $and upper(po_name)<= upper('".$this->to_poste.
"')";
113 $and=" and ";
114 }
116
117 }
References $sql, from, from_poste, to, and to_poste.
Referenced by load().
◆ show_button()
Anc_Balance_Simple::show_button |
( |
|
$p_string = "" | ) |
|
Show the button to export in PDF or CSV.
- Parameters
-
$url_csv | url of the csv |
$url_pdf | url of the pdf |
$p_string | hidden data to include in the form |
- Returns
- string with the button
Definition at line 265 of file anc_balance_simple.class.php.
266 {
268 $r.=
'<form method="GET" action="export.php" style="display:inline">';
270 $r.= dossier::hidden();
273
280
281 $r.=
'<form method="GET" action="export.php" style="display:inline">';
289 $r.= dossier::hidden();
293 }
References $r, from, from_poste, HtmlInput\hidden(), pa_id, HtmlInput\submit(), to, and to_poste.
◆ test_me()
static Anc_Balance_Simple::test_me |
( |
| ) |
|
|
static |
for testing and debuggind the class it must never be called from production system, it is intended only for developpers
- Parameters
-
param
- Parameters
-
return none
Definition at line 306 of file anc_balance_simple.class.php.
307 {
308
310
313
314 echo '<form method="GET">';
315
316 echo
$bal->display_form();
317 echo '</form>';
318 if ( isset(
$_GET[
'result']))
319 {
320 echo
$bal->show_button(
"",
"");
321 echo "<h1>HTML</h1>";
322 echo
$bal->display_html();
323 echo "<h1>CSV</h1>";
324 echo
$bal->display_csv();
325
326
327
328 }
329
330 }
manage the simple balance for CA, inherit from balance_ca
References $_GET, $a, $bal, and Dossier\connect().
The documentation for this class was generated from the following file: