noalyss Version-9
Public Member Functions | Private Member Functions | Private Attributes
PDF_Anc_Acc_List Class Reference
+ Inheritance diagram for PDF_Anc_Acc_List:
+ Collaboration diagram for PDF_Anc_Acc_List:

Public Member Functions

 __construct (Anc_Acc_List $p_anc_acc_list)
 
 export_pdf ()
 Main function , export the ANCBCC list to PDF, crossed by activity , account or card. More...
 
 get_a_size ()
 
 get_anc_acc_list ()
 
 get_str_title ()
 
 set_a_size ($a_size)
 
 set_anc_acc_list ($anc_acc_list)
 
 set_str_title ($str_title)
 
- Public Member Functions inherited from PDF
 __construct (Database $p_cn, $orientation='P', $unit='mm', $format='A4')
 
 Footer ()
 
 get_tiers ($p_jr_id, $p_jrn_type)
 retrieve the client name and quick_code More...
 
 Header ()
 
 set_filter_operation ($filter_operation)
 
 setDossierInfo ($dossier="n/a")
 
- Public Member Functions inherited from PDF_Core
 __construct ( $orientation='P', $unit='mm', $format='A4')
 
 get_margin_bottom ()
 
 get_margin_left ()
 
 get_margin_right ()
 
 get_margin_top ()
 
 get_orientation ()
 
 get_page_size ()
 
 get_unit ()
 
 is_fill ($p_step)
 If the step is even then return 1 and set the backgroup color to blue , otherwise returns 0, and set the background color to white It is use to compute alternated colored row , it the parameter fill in write_cell and cell. More...
 
 line_new ($p_step=null)
 Print all the cell stored and call Ln (new line) More...
 
 LongLine ($w, $h, $txt, $border=0, $align='', $fill=false)
 
 write_cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
 

Private Member Functions

 get_previous ($n_row_idx)
 Return the previous item : card or account or activity depending of the crossing method. More...
 
 pdf_card ()
 
 put_title ($p_pdf, $n_row_idx)
 Print the title. More...
 
 put_total ($a_size, $p_pdf, $p_total)
 Display the total amount. More...
 

Private Attributes

 $a_size
 
 $anc_acc_list
 
 $str_title
 

Additional Inherited Members

- Data Fields inherited from PDF
 $cn = null
 
 $date = ""
 
 $dossier = "n/a"
 
 $own = null
 
 $soc = ""
 
- Protected Member Functions inherited from PDF_Core
 print_row ()
 print the current array of cell and reset it , if different colors are set on the same row you have to print it before changing More...
 

Detailed Description

Definition at line 31 of file pdf_anc_acc_list.class.php.

Constructor & Destructor Documentation

◆ __construct()

PDF_Anc_Acc_List::__construct ( Anc_Acc_List  $p_anc_acc_list)

Definition at line 38 of file pdf_anc_acc_list.class.php.

39 {
40 parent::__construct($p_anc_acc_list->db);
41 $this->anc_acc_list=$p_anc_acc_list;
42 $a_title=array(
43 1=>_('Comptabilité Analytique Fiche/Activité'),
44 2=>_("Comptabilité Analytique Poste comptable/Activité"),
45 3=>_('Comptabilité Analytique Activité/Fiche'),
46 4=>_('Comptabilité Analytique Activité/Poste Comptable'));
47 if (!isset($a_title[$p_anc_acc_list->card_poste]))
48 {
49 throw new Exception("PAAL.46 : invalid object");
50 }
51 $this->str_title=$a_title[$p_anc_acc_list->card_poste];
52 }

Member Function Documentation

◆ export_pdf()

PDF_Anc_Acc_List::export_pdf ( )

Main function , export the ANCBCC list to PDF, crossed by activity , account or card.

Returns
type
Exceptions
Exception

Definition at line 244 of file pdf_anc_acc_list.class.php.

245 {
246
247 if ($this->anc_acc_list->check()!=0)
248 {
249 throw new Exception(_("date invalide"));
250 }
251 switch ($this->anc_acc_list->card_poste)
252 {
253 case 1:
254 // Card - Acc
255 $this->anc_acc_list->load_card();
256 return $this->pdf_card();
257 break;
258 case 2:
259 // Accountancy - Analytic
260 $this->anc_acc_list->load_poste();
261 return $this->pdf_card();
262 break;
263 case 3:
264 // Acc after card
265 $this->anc_acc_list->load_anc_card();
266 return $this->pdf_card();
267 break;
268 case 4:
269 // Analytic - Accountancy
270 $this->anc_acc_list->load_anc_account();
271 return $this->pdf_card();
272 break;
273 default:
274 throw new Exception('AAL700:unknown export');
275 }
276 return;
277 }

References pdf_card().

+ Here is the call graph for this function:

◆ get_a_size()

PDF_Anc_Acc_List::get_a_size ( )

Definition at line 207 of file pdf_anc_acc_list.class.php.

208 {
209 return $this->a_size;
210 }

References $a_size.

◆ get_anc_acc_list()

PDF_Anc_Acc_List::get_anc_acc_list ( )

Definition at line 218 of file pdf_anc_acc_list.class.php.

219 {
220 return $this->anc_acc_list;
221 }

References $anc_acc_list.

◆ get_previous()

PDF_Anc_Acc_List::get_previous (   $n_row_idx)
private

Return the previous item : card or account or activity depending of the crossing method.

Parameters
type$n_row_idx
Returns
type

Definition at line 113 of file pdf_anc_acc_list.class.php.

114 {
115 switch ($this->anc_acc_list->card_poste)
116 {
117 case 1:
118 return $this->anc_acc_list->arow[$n_row_idx]['f_id'];
119 break;
120 case 2:
121 return $this->anc_acc_list->arow[$n_row_idx]['j_poste'];
122 break;
123 case 3:
124 return $this->anc_acc_list->arow[$n_row_idx]['po_id'];
125 break;
126 case 4:
127 return $this->anc_acc_list->arow[$n_row_idx]['po_id'];
128 break;
129 }
130 }

Referenced by pdf_card().

◆ get_str_title()

PDF_Anc_Acc_List::get_str_title ( )

Definition at line 223 of file pdf_anc_acc_list.class.php.

224 {
225 return $this->str_title;
226 }

References $str_title.

◆ pdf_card()

PDF_Anc_Acc_List::pdf_card ( )
private
Returns
\PDF

Definition at line 135 of file pdf_anc_acc_list.class.php.

136 {
137 $pdf=new PDF($this->anc_acc_list->db);
138 $pdf->setDossierInfo(_("Balance croisée A/C"));
139 $pdf->SetTitle($this->str_title);
140 $pdf->AddPage();
141 $pdf->SetFont('DejaVu', 'B', 12);
142 $pdf->write_cell(190, 12, $this->str_title, 1);
143 $pdf->AliasNbPages();
144
145 $nb_row=count($this->anc_acc_list->arow);
146 $a_size=array("po_name"=>60, "po_description"=>100, "po_amount"=>30);
147 $pdf->line_new(20);
148 $pdf->SetFont('DejaVu', '', 7);
149 $tot_card=0; $tot_glob=0;
150 for ($i=0; $i<$nb_row; $i++)
151 {
152 $fill=$pdf->is_fill($i+1);
153 if ($i==0)
154 {
155 $prev=$this->get_previous($i);
156 $this->put_title($pdf, $i);
157 $pdf->SetFont('DejaVu', '', 7);
158 }
159 if ($prev!=$this->get_previous($i))
160 {
161 $prev=$this->get_previous($i);
162 $this->put_total($a_size,$pdf,$tot_card);
163
164 $this->put_title($pdf, $i);
165 $pdf->SetFont('DejaVu', '', 7);
166 $tot_card=0;
167 }
168 $this->anc_acc_list->arow[$i]['sum_amount']=($this->anc_acc_list->arow[$i]['sum_amount']=="")?0:
169 $this->anc_acc_list->arow[$i]['sum_amount'];
170
171 $tot_card=bcadd($tot_card, $this->anc_acc_list->arow[$i]['sum_amount'], 2);
172 $tot_glob=bcadd($tot_glob, $this->anc_acc_list->arow[$i]['sum_amount'], 2);
173 if ($this->anc_acc_list->card_poste<3)
174 {
175 $pdf->write_cell($a_size['po_name'], 4, $this->anc_acc_list->arow[$i]['po_name'], 0, 0, 'L', $fill);
176 $pdf->write_cell($a_size['po_description'], 4, $this->anc_acc_list->arow[$i]['po_description'], 0, 0,
177 'L', $fill);
178 $pdf->write_cell($a_size['po_amount'], 4, nbm($this->anc_acc_list->arow[$i]['sum_amount'], 2), 0, 0,
179 'R', $fill);
180 }
181 elseif ($this->anc_acc_list->card_poste==3)
182 {
183 $pdf->write_cell($a_size['po_name'], 4, $this->anc_acc_list->arow[$i]['j_qcode'], 0, 0, 'L', $fill);
184 $pdf->write_cell($a_size['po_description'], 4, $this->anc_acc_list->arow[$i]['name'], 0, 0, 'L', $fill);
185 $pdf->write_cell($a_size['po_amount'], 4, nbm($this->anc_acc_list->arow[$i]['sum_amount'], 2), 0, 0,
186 'R', $fill);
187 }
188 elseif ($this->anc_acc_list->card_poste==4)
189 {
190 $pdf->write_cell($a_size['po_name'], 4, $this->anc_acc_list->arow[$i]['j_poste'], 0, 0, 'L', $fill);
191 $pdf->write_cell($a_size['po_description'], 4, $this->anc_acc_list->arow[$i]['name'], 0, 0, 'L', $fill);
192 $pdf->write_cell($a_size['po_amount'], 4, nbm($this->anc_acc_list->arow[$i]['sum_amount'], 2), 0, 0,
193 'R', $fill);
194 }
195 $pdf->line_new();
196 }
197 $this->put_total($a_size,$pdf,$tot_card);
198 $pdf->SetFont('DejaVu', '', 7);
199
200 $pdf->line_new(5);
201 $pdf->write_cell($a_size['po_name']+$a_size['po_description'], 10, _("Total Global"),'LBT');
202 $pdf->write_cell($a_size['po_amount'], 10, nbm($tot_glob, 2), 'RBT', 0, 'R');
203 $pdf->line_new();
204 return $pdf;
205 }
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
put_total($a_size, $p_pdf, $p_total)
Display the total amount.
get_previous($n_row_idx)
Return the previous item : card or account or activity depending of the crossing method.
put_title($p_pdf, $n_row_idx)
Print the title.
API for creating PDF, unicode, based on tfpdf.
Definition: pdf.class.php:34
if( $delta< 0) elseif( $delta==0)

References $a_size, $i, $nb_row, $pdf, $prev, elseif, get_previous(), nbm(), put_title(), and put_total().

Referenced by export_pdf().

+ Here is the call graph for this function:

◆ put_title()

PDF_Anc_Acc_List::put_title (   $p_pdf,
  $n_row_idx 
)
private

Print the title.

Parameters
PDF$p_pdf
int$n_row_idx,idxof anc_acc_list->arow

Definition at line 70 of file pdf_anc_acc_list.class.php.

71 {
72 $p_pdf->SetFont('DejaVu', 'BU', 10);
73 switch ($this->anc_acc_list->card_poste)
74 {
75 case 1:
76
77 $p_pdf->write_cell(190, 12,
78 $this->anc_acc_list->arow[$n_row_idx]['j_qcode']." ".
79 $this->anc_acc_list->arow[$n_row_idx]['name']);
80
81 break;
82 case 2:
83
84 $p_pdf->write_cell(190, 12,
85 $this->anc_acc_list->arow[$n_row_idx]['j_poste']." ".
86 $this->anc_acc_list->arow[$n_row_idx]['name']);
87
88 break;
89 case 3:
90
91 $p_pdf->write_cell(190, 12,
92 $this->anc_acc_list->arow[$n_row_idx]['po_name']." ".
93 $this->anc_acc_list->arow[$n_row_idx]['po_description']);
94
95 break;
96 case 4:
97
98 $p_pdf->write_cell(190, 12,
99 $this->anc_acc_list->arow[$n_row_idx]['po_name']." ".
100 $this->anc_acc_list->arow[$n_row_idx]['po_description']);
101
102 break;
103 default:
104 break;
105 }
106 $p_pdf->line_new();
107 }

Referenced by pdf_card().

◆ put_total()

PDF_Anc_Acc_List::put_total (   $a_size,
  $p_pdf,
  $p_total 
)
private

Display the total amount.

Parameters
type$p_pdf
type$p_total

Definition at line 58 of file pdf_anc_acc_list.class.php.

59 {
60 $p_pdf->SetFont('DejaVu', 'B', 7);
61 $p_pdf->write_cell($a_size['po_name']+$a_size['po_description'], 5, _("Total"));
62 $p_pdf->write_cell($a_size['po_amount'], 5, nbm($p_total, 2), 0, 0, 'R');
63 $p_pdf->line_new(5);
64 }

References $a_size, and nbm().

Referenced by pdf_card().

+ Here is the call graph for this function:

◆ set_a_size()

PDF_Anc_Acc_List::set_a_size (   $a_size)

Definition at line 212 of file pdf_anc_acc_list.class.php.

213 {
214 $this->a_size=$a_size;
215 return $this;
216 }

References $a_size.

◆ set_anc_acc_list()

PDF_Anc_Acc_List::set_anc_acc_list (   $anc_acc_list)

Definition at line 228 of file pdf_anc_acc_list.class.php.

229 {
230 $this->anc_acc_list=$anc_acc_list;
231 return $this;
232 }

References $anc_acc_list.

◆ set_str_title()

PDF_Anc_Acc_List::set_str_title (   $str_title)

Definition at line 234 of file pdf_anc_acc_list.class.php.

235 {
236 $this->str_title=$str_title;
237 return $this;
238 }

References $str_title.

Field Documentation

◆ $a_size

PDF_Anc_Acc_List::$a_size
private

Definition at line 36 of file pdf_anc_acc_list.class.php.

Referenced by get_a_size(), pdf_card(), put_total(), and set_a_size().

◆ $anc_acc_list

PDF_Anc_Acc_List::$anc_acc_list
private

Definition at line 34 of file pdf_anc_acc_list.class.php.

Referenced by get_anc_acc_list(), and set_anc_acc_list().

◆ $str_title

PDF_Anc_Acc_List::$str_title
private

Definition at line 35 of file pdf_anc_acc_list.class.php.

Referenced by get_str_title(), and set_str_title().


The documentation for this class was generated from the following file: