noalyss Version-9
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)
 integer parm_periode.p_id , end periode;
 
 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')
 
 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)
 
 write_cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
 

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)
 

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
 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

 $filter_operation
 

Private Attributes

 $from
 
 $ledger
 concerned Ledger
 
 $to
 integer parm_periode.p_id , start periode;
 

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 31 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 )

integer parm_periode.p_id , end periode;

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

45 {
46 parent::__construct($p_cn, $orientation, $unit, $format);
47 $this->ledger=$p_ledger;
48 $this->from=$p_from;
49 $this->to=$p_to;
50 $this->set_filter_operation($p_filter_operation);
51 }
$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 257 of file print_ledger.class.php.

258 {
259 global $g_user;
261 // Find periode
262 $periode=new Periode($cn, $get_from_periode);
263 $exercice=$periode->get_exercice($get_from_periode);
264
265 if ($g_user->Admin()==0&&$g_user->is_local_admin()==0&&$g_user->get_status_security_ledger()
266 ==1)
267 {
268 $sql="select jrn_def_id
269 from jrn_def join jrn_type on jrn_def_type=jrn_type_id
270 join user_sec_jrn on uj_jrn_id=jrn_def_id
271 where
272 uj_login=$1
273 and uj_priv in ('R','W')
274 and ( jrn_enable=1
275 or
276 exists (select 1 from jrn
277 where
278 jr_def_id=jrn_def_id
279 and jr_tech_per in (select p_id from parm_periode where p_exercice=$2)))
280 order by jrn_def_name
281 ";
282 $a_jrn=$cn->get_array($sql, array($g_user->login, $exercice));
283 }
284 else
285 {
286 $a_jrn=$cn->get_array("select jrn_def_id
287 from jrn_def join jrn_type on jrn_def_type=jrn_type_id
288 where
289 jrn_enable=1
290 or exists(select 1 from jrn
291 where
292 jr_def_id=jrn_def_id
293 and jr_tech_per in (select p_id from parm_periode where p_exercice=$1))
294 order by jrn_def_name
295 ", [$exercice]);
296 }
297 $a=[];
298 $nb_jrn=count($a_jrn);
299 for ($i=0; $i<$nb_jrn; $i++)
300 {
301 $a[]=$a_jrn[$i]['jrn_def_id'];
302 }
303 return $a;
304 }
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 309 of file print_ledger.class.php.

310 {
311 switch ($this->get_filter_operation())
312 {
313 case 'all':
314 $sql_filter="";
315 break;
316 case 'paid':
317 $sql_filter=" and (jr_date_paid is not null or jr_rapt ='paid' ) ";
318 break;
319 case 'unpaid':
320 $sql_filter=" and (jr_date_paid is null and coalesce(jr_rapt,'x') <> 'paid' ) ";
321 break;
322 default:
323 throw new Exception(_("Filtre invalide", 5));
324 }
325 return $sql_filter;
326 }
_("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

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

111 {
112 /**
113 * @Bug
114 * Strange PHP Bug when autoloader is not used , the require_once doesn't seems to
115 * work properly and does not include the files , except if you put them here
116 *
117 * if you put them on the top of this file, export_ledger_pdf.php will include the files
118 * but not export_ledger_csv.php
119 */
120
121 /**
122 * For PDF output
123 */
124 switch ($p_type_export) {
125 case 'D':
126 $own=new Noalyss_Parameter_Folder($cn);
127 $jrn_type=$p_ledger->get_type();
128 //---------------------------------------------
129 // Detailled Printing (accounting )
130 //---------------------------------------------
131 if ($jrn_type=='ACH'||$jrn_type=='VEN')
132 {
133 if (
134 ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
135 ==0)||
136 ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
137 ==0)
138 )
139 {
140 $pdf=new Print_Ledger_Simple_without_vat($cn,
141 $p_ledger,$p_from,$p_to,$p_filter_operation);
142 $pdf->set_error(_('Ce journal ne peut être imprimé en mode simple'));
143 return $pdf;
144 }
145 if ($own->MY_TVA_USE=='Y')
146 {
147 $pdf=new Print_Ledger_Simple($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
148 return $pdf;
149 }
150 if ($own->MY_TVA_USE=='N')
151 {
152 $pdf=new Print_Ledger_Simple_without_vat($cn,
153 $p_ledger,$p_from,$p_to,$p_filter_operation);
154 return $pdf;
155 }
156 }
157 elseif ($jrn_type=='FIN')
158 {
159 $pdf=new Print_Ledger_Financial($cn, $p_ledger,$p_from,$p_to);
160 return $pdf;
161 } else
162 {
163 return new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
164 }
165 break;
166
167 case 'L':
168 //----------------------------------------------------------------------
169 // Simple Printing Purchase Ledger
170 //---------------------------------------------------------------------
171 $own=new Noalyss_Parameter_Folder($cn);
172 $jrn_type=$p_ledger->get_type();
173
174
175 if ($jrn_type=='ACH'||$jrn_type=='VEN')
176 {
177 if (
178 ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
179 ==0)||
180 ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
181 ==0)
182 )
183 {
184 $pdf=new Print_Ledger_Simple_without_vat($cn,
185 $p_ledger,$p_from,$p_to,$p_filter_operation);
186 $pdf->set_error(_('Ce journal ne peut être imprimé en mode simple'));
187 return $pdf;
188 }
189 if ($own->MY_TVA_USE=='Y')
190 {
191 $pdf=new Print_Ledger_Simple($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
192 return $pdf;
193 }
194 if ($own->MY_TVA_USE=='N')
195 {
196 $pdf=new Print_Ledger_Simple_without_vat($cn,
197 $p_ledger,$p_from,$p_to,$p_filter_operation);
198 return $pdf;
199 }
200 }
201
202 if ($jrn_type=='FIN')
203 {
204 $pdf=new Print_Ledger_Financial($cn, $p_ledger,$p_from,$p_to);
205 return $pdf;
206 }
207 $pdf=new Print_Ledger_Misc($cn, $p_ledger,$p_from,$p_to);
208 return $pdf;
209 break;
210 case 'E':
211 /**********************************************************
212 * Print Detail Operation + Item
213 * ********************************************************* */
214 $own=new Noalyss_Parameter_Folder($cn);
215 $jrn_type=$p_ledger->get_type();
216 if ($jrn_type=='FIN')
217 {
218 $pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
219 return $pdf;
220 }
221 if ($jrn_type=='ODS'||$p_ledger->id==0)
222 {
223 $pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
224 return $pdf;
225 }
226 if (
227 ($jrn_type=='ACH'&&$cn->get_value('select count(qp_id) from quant_purchase')
228 ==0)||
229 ($jrn_type=='VEN'&&$cn->get_value('select count(qs_id) from quant_sold')
230 ==0)
231 )
232 {
233 $pdf=new Print_Ledger_Simple_without_vat($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
234 $pdf->set_error('Ce journal ne peut être imprimé en mode simple');
235 return $pdf;
236 }
237 $pdf=new Print_Ledger_Detail_Item($cn, $p_ledger,$p_from,$p_to,$p_filter_operation);
238 return $pdf;
239 case 'A':
240 /***********************************************************
241 * Accounting
242 */
243 $pdf=new Print_Ledger_Detail($cn, $p_ledger,$p_from,$p_to);
244 return $pdf;
245 break;
246 } // end switch
247 }
get_type()
Return the type of a ledger (ACH,VEN,ODS or FIN) or GL.
$jrn_type[]
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 ( )

◆ get_from()

◆ get_ledger()

◆ get_to()

Print_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 94 of file print_ledger.class.php.

95 {
96 if (in_array($filter_operation,['all','paid','unpaid']))
97 {
98 $this->filter_operation=$filter_operation;
99 return $this;
100 }
101 throw new Exception(_("Filter invalide ".$filter_operation),5);
102 }

References $filter_operation, and _.

Referenced by __construct().

◆ set_from()

Print_Ledger::set_from ( $from)

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

74 {
75 $this->from=$from;
76 return $this;
77 }

References $from, and from.

◆ set_ledger()

Print_Ledger::set_ledger ( $ledger)

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

68 {
69 $this->ledger=$ledger;
70 return $this;
71 }

References $ledger.

◆ set_to()

Print_Ledger::set_to ( $to)

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

80 {
81 $this->to=$to;
82 return $this;
83 }

References $to, and to.

Field Documentation

◆ $filter_operation

Print_Ledger::$filter_operation
protected

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

Referenced by get_filter_operation(), and set_filter_operation().

◆ $from

Print_Ledger::$from
private

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

Referenced by get_from(), and set_from().

◆ $ledger

◆ $to

Print_Ledger::$to
private

integer parm_periode.p_id , start periode;

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

Referenced by get_to(), and set_to().


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