noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
Print_Ledger Class Reference

Parent class for the print_ledger class. More...

+ Inheritance diagram for Print_Ledger:
+ Collaboration diagram for Print_Ledger:

Public Member Functions

 __construct (\Database $p_cn, $orientation, $unit, $format, Acc_Ledger $p_ledger, $p_from, $p_to, $p_filter_operation)
 
 get_filter_operation ()
 
 get_from ()
 
 get_ledger ()
 
 get_to ()
 
 set_filter_operation ($filter_operation)
 Filter the operations ,.
 
 set_from ($from)
 
 set_ledger ($ledger)
 
 set_to ($to)
 
- 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
 
 Header ()
 
 setDossierInfo ($dossier="n/a")
 
- Public Member Functions inherited from PDF_Core
 __construct ( $orientation='P', $unit='mm', $format='A4')
 
 fill_row ($enable)
 set color for row ,
 
 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.
 
 line_new ($p_step=null)
 Print all the cell stored and call Ln (new line)
 
 LongLine ($w, $h, $txt, $border=0, $align='', $fill=false)
 add a cell with automatic return to the line if the text is too long, deprecated , it calls only PDFCore::write_cell_
 
 write_cell ($width, $height=0, $txt='', $border=0, $interline=0, $align='', $fill=false, $link='')
 add a cell the text is not cut and don't return to this line if too large
 
 write_multi ($width, $interline, $txt, $border=0, $align='', $fill=false)
 add a cell with automatic return to the line if the text is too long
 

Static Public Member Functions

static available_ledger ($get_from_periode)
 find all the active ledger for the exerice of the periode and readable by the current user @global type $g_user
 
static factory (Database $cn, $p_type_export, Acc_Ledger $p_ledger, $p_from, $p_to, $p_filter_operation)
 Create an object Print_Ledger* depending on $p_type_export ( 0 => accounting 1-> one row per operation 2-> detail of item)
 
- Static Public Member Functions inherited from PDF
static test_me ()
 test the class
 

Protected Member Functions

 build_filter_operation ()
 Build a SQL clause to filter operation depending if they are paid, unpaid or no filter.
 
- Protected Member Functions inherited from PDF_Core
 add_cell (Cellule $Ce)
 
 check_page_add ()
 Check if a page must be added due a MultiCell.
 
 count_nb_row ($p_text, $p_colSize)
 Count the number of rows a p_text will take for a multicell.
 
 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
 

Protected Attributes

 $a_Tva
 $other_tax_previous (array)
 
 $filter_operation
 See Acc_Ledger_History::filter_operation.
 
 $flag_other_tax
 $flag_other_tax(bool) true if other tax exists
 
 $from
 
 $jrn_type
 
 $ledger
 concerned Ledger
 
 $other_tax_previous
 
 $previous
 internal variables for computing sum on PDF Listing
 
 $rap_htva
 $previous (array) see Acc_Ledger->previous_amount
 
 $rap_nd
 $rap_nd (float) $no-deductible tax
 
 $rap_other
 VAT when page starts.
 
 $rap_other_tax
 $rap_other_tav, amount to report for other tax than VAT
 
 $rap_priv
 $rap_priv (float) personal expense
 
 $rap_tva
 $rap_tva array(tva_id,amount)
 
 $rap_tva_np
 $rap_tva_np VAT not deductible
 
 $rap_tvac
 $rap_tvac (float) previous amount
 
 $show_col
 
 $to
 
 $tp_htva
 $tp_htva (float) total page price w/o VAT
 
 $tp_nd
 $tp_nd (float) total page price w/o VAT
 
 $tp_priv
 $tp_priv (float) total page personal expense
 
 $tp_tva
 $tp_tva (float) total page VAT
 
 $tp_tva_np
 $tp_tva_np (float) total page not deductible
 
 $tp_tvac
 $tp_tvac (float) total page full price All Tax Incl.
 
- Protected Attributes inherited from PDF_Core
 $bigger
 
 $cells =array()
 

Additional Inherited Members

- Data Fields inherited from PDF
 $cn = null
 
 $date = ""
 
 $dossier = "n/a"
 
 $own = null
 
 $soc = ""
 

Detailed Description

Parent class for the print_ledger class.

Author
danydb

Strategie class for the print_ledger class

Definition at line 32 of file print_ledger.class.php.

Constructor & Destructor Documentation

◆ __construct()

Print_Ledger::__construct ( \Database $p_cn,
$orientation,
$unit,
$format,
Acc_Ledger $p_ledger,
$p_from,
$p_to,
$p_filter_operation )

Definition at line 67 of file print_ledger.class.php.

75 {
76 parent::__construct($p_cn, $orientation, $unit, $format);
77 $this->ledger=$p_ledger;
78 $this->from=$p_from;
79 $this->to=$p_to;
80 $this->set_filter_operation($p_filter_operation);
81 }
$anc_grandlivre to
$anc_grandlivre from
set_filter_operation($filter_operation)
Filter the operations ,.

References from, set_filter_operation(), and to.

+ Here is the call graph for this function:

Member Function Documentation

◆ available_ledger()

static Print_Ledger::available_ledger ( $get_from_periode)
static

find all the active ledger for the exerice of the periode and readable by the current user @global type $g_user

Parameters
int$get_from_periode
Returns
array of ledger id

Definition at line 287 of file print_ledger.class.php.

288 {
289 global $g_user;
291 // Find periode
292 $periode=new Periode($cn, $get_from_periode);
293 $exercice=$periode->get_exercice($get_from_periode);
294
295 if ($g_user->Admin()==0&&$g_user->is_local_admin()==0&&$g_user->get_status_security_ledger()
296 ==1)
297 {
298 $sql="select jrn_def_id
299 from jrn_def join jrn_type on jrn_def_type=jrn_type_id
300 join user_sec_jrn on uj_jrn_id=jrn_def_id
301 where
302 uj_login=$1
303 and uj_priv in ('R','W')
304 and ( jrn_enable=1
305 or
306 exists (select 1 from jrn
307 where
308 jr_def_id=jrn_def_id
309 and jr_tech_per in (select p_id from parm_periode where p_exercice=$2)))
310 order by jrn_def_name
311 ";
312 $a_jrn=$cn->get_array($sql, array($g_user->login, $exercice));
313 }
314 else
315 {
316 $a_jrn=$cn->get_array("select jrn_def_id
317 from jrn_def join jrn_type on jrn_def_type=jrn_type_id
318 where
319 jrn_enable=1
320 or exists(select 1 from jrn
321 where
322 jr_def_id=jrn_def_id
323 and jr_tech_per in (select p_id from parm_periode where p_exercice=$1))
324 order by jrn_def_name
325 ", [$exercice]);
326 }
327 $a=[];
328 $nb_jrn=count($a_jrn);
329 for ($i=0; $i<$nb_jrn; $i++)
330 {
331 $a[]=$a_jrn[$i]['jrn_def_id'];
332 }
333 return $a;
334 }
global $g_user
if no group available , then stop
catch(Exception $e) $exercice
static connect()
$get_from_periode

References $a, PDF\$cn, $exercice, $g_user, $get_from_periode, $i, $nb_jrn, $periode, and $sql.

Referenced by Acc_Ledger\get_rowSimple().

◆ build_filter_operation()

Print_Ledger::build_filter_operation ( )
protected

Build a SQL clause to filter operation depending if they are paid, unpaid or no filter.

Returns
string SQL Clause

Definition at line 339 of file print_ledger.class.php.

340 {
341 switch ($this->get_filter_operation())
342 {
343 case 'all':
344 $sql_filter="";
345 break;
346 case 'paid':
347 $sql_filter=" and (jr_date_paid is not null or jr_rapt ='paid' ) ";
348 break;
349 case 'unpaid':
350 $sql_filter=" and (jr_date_paid is null and coalesce(jr_rapt,'x') <> 'paid' ) ";
351 break;
352 default:
353 throw new Exception(_("Filtre invalide", 5));
354 }
355 return $sql_filter;
356 }
_("actif, passif,charge,...")
$sql_filter
Definition preod.inc.php:43

References $sql_filter, _, and get_filter_operation().

+ Here is the call graph for this function:

◆ factory()

static Print_Ledger::factory ( Database $cn,
$p_type_export,
Acc_Ledger $p_ledger,
$p_from,
$p_to,
$p_filter_operation )
static

Create an object Print_Ledger* depending on $p_type_export ( 0 => accounting 1-> one row per operation 2-> detail of item)

Parameters
Database$cn
char$p_type_exportE(xtended) L(isting) A(ccounting) D(etail)
Acc_Ledger$ledger

@Bug Strange PHP Bug when autoloader is not used , the require_once doesn't seems to work properly and does not include the files , except if you put them here

if you put them on the top of this file, export_ledger_pdf.php will include the files but not export_ledger_csv.php

For PDF output

Print Detail Operation + Item


Accounting

Definition at line 140 of file print_ledger.class.php.

141 {
142 /**
143 * @Bug
144 * Strange PHP Bug when autoloader is not used , the require_once doesn't seems to
145 * work properly and does not include the files , except if you put them here
146 *
147 * if you put them on the top of this file, export_ledger_pdf.php will include the files
148 * but not export_ledger_csv.php
149 */
150
151 /**
152 * For PDF output
153 */
154 switch ($p_type_export) {
155 case 'D':
156 $own=new Noalyss_Parameter_Folder($cn);
157 $jrn_type=$p_ledger->get_type();
158 //---------------------------------------------
159 // Detailled Printing (accounting )
160 //---------------------------------------------
161 if ($jrn_type=='ACH'||$jrn_type=='VEN')
162 {
163 if (
164 ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
165 ==0)||
166 ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
167 ==0)
168 )
169 {
170 $pdf=new Print_Ledger_Simple_without_vat($cn,
171 $p_ledger,$p_from,$p_to,$p_filter_operation);
172 $pdf->set_error(_('Ce journal ne peut être imprimé en mode simple'));
173 return $pdf;
174 }
175 if ($own->MY_TVA_USE=='Y')
176 {
177 $pdf=new Print_Ledger_Simple($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
178 return $pdf;
179 }
180 if ($own->MY_TVA_USE=='N')
181 {
182 $pdf=new Print_Ledger_Simple_without_vat($cn,
183 $p_ledger,$p_from,$p_to,$p_filter_operation);
184 return $pdf;
185 }
186 }
187 elseif ($jrn_type=='FIN')
188 {
189 $pdf=new Print_Ledger_Financial($cn, $p_ledger,$p_from,$p_to);
190 return $pdf;
191 } else
192 {
193 return new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
194 }
195 break;
196
197 case 'L':
198 //----------------------------------------------------------------------
199 // Simple Printing Purchase Ledger
200 //---------------------------------------------------------------------
201 $own=new Noalyss_Parameter_Folder($cn);
202 $jrn_type=$p_ledger->get_type();
203
204
205 if ($jrn_type=='ACH'||$jrn_type=='VEN')
206 {
207 if (
208 ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
209 ==0)||
210 ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
211 ==0)
212 )
213 {
214 $pdf=new Print_Ledger_Simple_without_vat($cn,
215 $p_ledger,$p_from,$p_to,$p_filter_operation);
216 $pdf->set_error(_('Ce journal ne peut être imprimé en mode simple'));
217 return $pdf;
218 }
219 if ($own->MY_TVA_USE=='Y')
220 {
221 $pdf=new Print_Ledger_Simple($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
222 return $pdf;
223 }
224 if ($own->MY_TVA_USE=='N')
225 {
226 $pdf=new Print_Ledger_Simple_without_vat($cn,
227 $p_ledger,$p_from,$p_to,$p_filter_operation);
228 return $pdf;
229 }
230 }
231
232 if ($jrn_type=='FIN')
233 {
234 $pdf=new Print_Ledger_Financial($cn, $p_ledger,$p_from,$p_to);
235 return $pdf;
236 }
237 $pdf=new Print_Ledger_Misc($cn, $p_ledger,$p_from,$p_to);
238 return $pdf;
239 break;
240 case 'E':
241 /**********************************************************
242 * Print Detail Operation + Item
243 * ********************************************************* */
244 $own=new Noalyss_Parameter_Folder($cn);
245 $jrn_type=$p_ledger->get_type();
246 if ($jrn_type=='FIN')
247 {
248 $pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
249 return $pdf;
250 }
251 if ($jrn_type=='ODS'||$p_ledger->id==0)
252 {
253 $pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
254 return $pdf;
255 }
256 if (
257 ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
258 ==0)||
259 ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
260 ==0)
261 )
262 {
263 $pdf=new Print_Ledger_Simple_without_vat($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
264 $pdf->set_error('Ce journal ne peut être imprimé en mode simple');
265 return $pdf;
266 }
267 $pdf=new Print_Ledger_Detail_Item($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
268 return $pdf;
269 case 'A':
270 /***********************************************************
271 * Accounting
272 */
273 $pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
274 return $pdf;
275 break;
276 } // end switch
277 }
get_type()
Return the type of a ledger (ACH,VEN,ODS or FIN) or GL.
if( $delta< 0) elseif( $delta==0)

References PDF\$cn, $jrn_type, PDF\$own, $pdf, _, elseif, and Acc_Ledger\get_type().

+ Here is the call graph for this function:

◆ get_filter_operation()

Print_Ledger::get_filter_operation ( )

Definition at line 114 of file print_ledger.class.php.

115 {
117 }
$filter_operation
See Acc_Ledger_History::filter_operation.

References $filter_operation.

Referenced by build_filter_operation(), and Print_Ledger_Simple_Without_Vat\export().

◆ get_from()

◆ get_ledger()

◆ get_to()

◆ set_filter_operation()

Print_Ledger::set_filter_operation ( $filter_operation)

Filter the operations ,.

Parameters
string$filter_operation: all , paid, unpaid
Returns
$this
Exceptions
Exception5 , if filter invalid

Reimplemented from PDF.

Definition at line 124 of file print_ledger.class.php.

125 {
126 if (in_array($filter_operation,['all','paid','unpaid']))
127 {
128 $this->filter_operation=$filter_operation;
129 return $this;
130 }
131 throw new Exception(_("Filter invalide ".$filter_operation),5);
132 }

References $filter_operation, and _.

Referenced by __construct().

◆ set_from()

Print_Ledger::set_from ( $from)

Definition at line 103 of file print_ledger.class.php.

104 {
105 $this->from=$from;
106 return $this;
107 }

References $from, and from.

◆ set_ledger()

Print_Ledger::set_ledger ( $ledger)

Definition at line 97 of file print_ledger.class.php.

98 {
99 $this->ledger=$ledger;
100 return $this;
101 }

References $ledger.

◆ set_to()

Print_Ledger::set_to ( $to)

Definition at line 109 of file print_ledger.class.php.

110 {
111 $this->to=$to;
112 return $this;
113 }

References $to, and to.

Field Documentation

◆ $a_Tva

Print_Ledger::$a_Tva
protected

$other_tax_previous (array)

$a_Tva array ( tva_id,tva_label,tva_poste ) of existing_vat

Definition at line 52 of file print_ledger.class.php.

◆ $filter_operation

Print_Ledger::$filter_operation
protected

See Acc_Ledger_History::filter_operation.

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

Referenced by get_filter_operation(), and set_filter_operation().

◆ $flag_other_tax

Print_Ledger::$flag_other_tax
protected

$flag_other_tax(bool) true if other tax exists

Definition at line 57 of file print_ledger.class.php.

◆ $from

Print_Ledger::$from
protected

Definition at line 37 of file print_ledger.class.php.

Referenced by get_from(), and set_from().

◆ $jrn_type

Print_Ledger::$jrn_type
protected

Definition at line 53 of file print_ledger.class.php.

Referenced by Print_Ledger_Detail_Item\export(), and factory().

◆ $ledger

◆ $other_tax_previous

Print_Ledger::$other_tax_previous
protected

Definition at line 50 of file print_ledger.class.php.

◆ $previous

Print_Ledger::$previous
protected

internal variables for computing sum on PDF Listing

Definition at line 43 of file print_ledger.class.php.

◆ $rap_htva

Print_Ledger::$rap_htva
protected

$previous (array) see Acc_Ledger->previous_amount

$rap_htva (float) previous price w/o VAT

Definition at line 44 of file print_ledger.class.php.

◆ $rap_nd

Print_Ledger::$rap_nd
protected

$rap_nd (float) $no-deductible tax

Definition at line 54 of file print_ledger.class.php.

◆ $rap_other

Print_Ledger::$rap_other
protected

VAT when page starts.

Definition at line 65 of file print_ledger.class.php.

◆ $rap_other_tax

Print_Ledger::$rap_other_tax
protected

$rap_other_tav, amount to report for other tax than VAT

Definition at line 49 of file print_ledger.class.php.

◆ $rap_priv

Print_Ledger::$rap_priv
protected

$rap_priv (float) personal expense

Definition at line 48 of file print_ledger.class.php.

◆ $rap_tva

Print_Ledger::$rap_tva
protected

$rap_tva array(tva_id,amount)

Definition at line 47 of file print_ledger.class.php.

◆ $rap_tva_np

Print_Ledger::$rap_tva_np
protected

$rap_tva_np VAT not deductible

Definition at line 55 of file print_ledger.class.php.

◆ $rap_tvac

Print_Ledger::$rap_tvac
protected

$rap_tvac (float) previous amount

Definition at line 45 of file print_ledger.class.php.

◆ $show_col

Print_Ledger::$show_col
protected

Definition at line 64 of file print_ledger.class.php.

◆ $to

Print_Ledger::$to
protected

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

Referenced by get_to(), and set_to().

◆ $tp_htva

Print_Ledger::$tp_htva
protected

$tp_htva (float) total page price w/o VAT

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

◆ $tp_nd

Print_Ledger::$tp_nd
protected

$tp_nd (float) total page price w/o VAT

Definition at line 62 of file print_ledger.class.php.

◆ $tp_priv

Print_Ledger::$tp_priv
protected

$tp_priv (float) total page personal expense

Definition at line 61 of file print_ledger.class.php.

◆ $tp_tva

Print_Ledger::$tp_tva
protected

$tp_tva (float) total page VAT

Definition at line 59 of file print_ledger.class.php.

◆ $tp_tva_np

Print_Ledger::$tp_tva_np
protected

$tp_tva_np (float) total page not deductible

Definition at line 63 of file print_ledger.class.php.

◆ $tp_tvac

Print_Ledger::$tp_tvac
protected

$tp_tvac (float) total page full price All Tax Incl.

Definition at line 60 of file print_ledger.class.php.


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