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

API for creating PDF, unicode, based on tfpdf. More...

+ Inheritance diagram for PDF:
+ Collaboration diagram for PDF:

Public Member Functions

 __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 ()
 
 set_filter_operation ($filter_operation)
 
 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 test_me ()
 test the class
 

Data Fields

 $cn = null
 
 $date = ""
 
 $dossier = "n/a"
 
 $own = null
 
 $soc = ""
 

Additional Inherited Members

- 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 inherited from PDF_Core
 $bigger
 
 $cells =array()
 

Detailed Description

API for creating PDF, unicode, based on tfpdf.

See also
TFPDF

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

Constructor & Destructor Documentation

◆ __construct()

PDF::__construct ( Database $p_cn,
$orientation = 'P',
$unit = 'mm',
$format = 'A4' )

Reimplemented in Print_Ledger_Misc.

Definition at line 41 of file pdf.class.php.

42 {
43 $this->cn = $p_cn;
44
45 $this->own = new Noalyss_Parameter_Folder($this->cn);
46 $this->soc = $this->own->MY_NAME;
47 $this->date = date('d.m.Y');
48 parent::__construct($orientation,$unit,$format);
49 date_default_timezone_set ('Europe/Paris');
50 $this->SetCreator("Noalyss");
51 }
$input_from cn

References cn.

Member Function Documentation

◆ Footer()

PDF::Footer ( )

Reimplemented in PDFLand, Print_Ledger_Detail, Print_Ledger_Detail_Item, Print_Ledger_Financial, Print_Ledger_Misc, Print_Ledger_Simple, and Print_Ledger_Simple_Without_Vat.

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

66 {
67 //Position at 2 cm from bottom
68 $this->SetY(-20);
69 //Arial italic 8
70 $this->SetFont('Arial', '', 8);
71 //Page number
72 parent::Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C');
73 parent::Ln(3);
74 // Created by NOALYSS
75 parent::Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'C',false,'https://www.noalyss.eu');
76 }

◆ get_tiers()

PDF::get_tiers ( $p_jr_id,
$p_jrn_type )

retrieve the client name and quick_code

Parameters
$p_jr_idjrn.jr_id
$p_jrn_typeledger type ACH VEN FIN
Returns
array (0=>qcode,1=>name) or for FIN 0=>customer qc 1=>customer name 2=>bank qc 3=>bank name
See also
class_print_ledger_simple, class_print_ledger_simple_without_vat

Definition at line 84 of file pdf.class.php.

85 {
86 if ( $p_jrn_type=='ACH' )
87 {
88 $array=$this->cn->get_array('SELECT
89 jrnx.j_grpt,
90 quant_purchase.qp_supplier,
91 quant_purchase.qp_internal,
92 jrn.jr_internal
93 FROM
94 public.quant_purchase,
95 public.jrnx,
96 public.jrn
97 WHERE
98 quant_purchase.j_id = jrnx.j_id AND
99 jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1',array($p_jr_id));
100 if (count($array)==0) return array("ERREUR $p_jr_id",'');
101 $customer_id=$array[0]['qp_supplier'];
102 $fiche=new Fiche($this->cn,$customer_id);
103 $customer_qc=$fiche->get_quick_code($customer_id);
104 $customer_name=$fiche->getName();
105 return array($customer_qc,$customer_name);
106 }
107 if ( $p_jrn_type=='VEN' )
108 {
109 $array=$this->cn->get_array('SELECT
110 quant_sold.qs_client
111 FROM
112 public.quant_sold,
113 public.jrnx,
114 public.jrn
115 WHERE
116 quant_sold.j_id = jrnx.j_id AND
117 jrnx.j_grpt = jrn.jr_grpt_id and jr_id=$1',array($p_jr_id));
118 if (count($array)==0) return array("ERREUR $p_jr_id",'');
119 $customer_id=$array[0]['qs_client'];
120 $fiche=new Fiche($this->cn,$customer_id);
121 $customer_qc=$fiche->get_quick_code($customer_id);
122 $customer_name=$fiche->getName();
123 return array($customer_qc,$customer_name);
124 }
125 if ( $p_jrn_type=='FIN' )
126 {
127 $array=$this->cn->get_array('SELECT
128 qf_other,qf_bank
129 FROM
130 public.quant_fin
131 WHERE
132 quant_fin.jr_id =$1',array($p_jr_id));
133 if (count($array)==0) return array("ERREUR $p_jr_id",'','','');
134 $customer_id=$array[0]['qf_other'];
135 $fiche=new Fiche($this->cn,$customer_id);
136 $customer_qc=$fiche->get_quick_code($customer_id);
137 $customer_name=$fiche->getName();
138
139 $bank_id=$array[0]['qf_bank'];
140 $fiche=new Fiche($this->cn,$bank_id);
141 $bank_qc=$fiche->get_quick_code($bank_id);
142 $bank_name=$fiche->getName();
143
144 return array($customer_qc,$customer_name,$bank_qc,$bank_name);
145 }
146 }

References $array, $fiche, and cn.

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

◆ Header()

PDF::Header ( )

Reimplemented in PDFBalance_simple, PDFLand, Print_Ledger_Detail, Print_Ledger_Detail_Item, Print_Ledger_Financial, Print_Ledger_Misc, Print_Ledger_Simple, and Print_Ledger_Simple_Without_Vat.

Definition at line 56 of file pdf.class.php.

57 {
58 //Arial bold 12
59 $this->SetFont('DejaVu', 'B', 12);
60 //Title
61 parent::Cell(0,10,$this->dossier, 'B', 0, 'C');
62 //Line break
63 parent::Ln(20);
64 }

◆ set_filter_operation()

PDF::set_filter_operation ( $filter_operation)

Reimplemented in Print_Ledger.

Definition at line 148 of file pdf.class.php.

149 {
150 if (in_array($filter_operation, ['all', 'paid', 'unpaid']))
151 {
152 $this->filter_operation=$filter_operation;
153 return $this;
154 }
155 throw new Exception(_("Filter invalide ".$filter_operation), 5);
156 }
_("actif, passif,charge,...")
$filter_operation

References $filter_operation, and _.

◆ setDossierInfo()

PDF::setDossierInfo ( $dossier = "n/a")

Reimplemented in Print_Ledger_Detail, Print_Ledger_Detail_Item, Print_Ledger_Simple, and Print_Ledger_Simple_Without_Vat.

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

53 {
54 $this->dossier = dossier::name()." ".$dossier;
55 }
$dossier
Definition pdf.class.php:38

References $dossier.

Referenced by Card_PDF\__construct().

◆ test_me()

static PDF::test_me ( )
static

test the class

Returns
void

Definition at line 162 of file pdf.class.php.

163 {
165 $pdf=new PDF($cn);
166 $pdf->AddPage();
167 $pdf->SetFont('DejaVu', '', 8);
168 for ($i=0;$i <10;$i++){
169 $ln = $i*2+8;
170 $pdf->write_cell("50",$ln," heigh $ln ln $i",'1',$i);
171 $pdf->line_new();
172
173 }
174
175 $pdf->AddPage();
176 for ($i=0;$i <10;$i++){
177 $ln = $i*2+8;
178 $pdf->LongLine("100",3,"
179 Contrairement à une opinion répandue le Lorem Ipsum n'est pas simplement du texte aléatoire. Il trouve ses racines dans une oeuvre de la littérature latine classique datant de 45 av. J.-C., le rendant vieux de 2000 ans. Un professeur du Hampden-Sydney College, en Virginie, s'est intéressé à un des mots latins les plus obscurs, consectetur, extrait d'un passage du Lorem Ipsum, et en étudiant tous les usages de ce mot dans la littérature classique, découvrit la source incontestable du Lorem Ipsum. Il provient en fait des sections 1.10.32 et 1.10.33 du De Finibus Bonorum et Malorum (Des Suprêmes Biens et des Suprêmes Maux) de Cicéron. Cet ouvrage, très populaire pendant la Renaissance, est un traité sur la théorie de l'éthique. Les premières lignes du Lorem Ipsum, Lorem ipsum dolor sit amet.., proviennent de la section 1.10.32 heigh $ln ln $i",'1',$i);
180
181 $pdf->write_cell("50",$ln," heigh $ln ln $i",'1',$i,align:'C');
182 $pdf->line_new();
183
184 }
185
186
187 $pdf->Output('F','/tmp/a.pdf');
188 }
static connect()

References $cn, $i, and $pdf.

Field Documentation

◆ $cn

◆ $date

PDF::$date = ""

Definition at line 39 of file pdf.class.php.

◆ $dossier

◆ $own

PDF::$own = null

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

Referenced by Print_Ledger\factory().

◆ $soc

PDF::$soc = ""

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


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