noalyss Version-9
Public Member Functions
Print_Ledger_Detail_Item Class Reference

Print detail of operation PURCHASE or SOLD plus the items There is no report of the different amounts. More...

+ Inheritance diagram for Print_Ledger_Detail_Item:
+ Collaboration diagram for Print_Ledger_Detail_Item:

Public Member Functions

 __construct (Database $p_cn, Acc_Ledger $p_jrn, $p_from, $p_to, $p_filter_operation)
 
 export ()
 export the ledger in PDF More...
 
 Footer ()
 write the Footer More...
 
 Header ()
 write the header of each page More...
 
 setDossierInfo ($dossier="n/a")
 
- Public Member Functions inherited from 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; More...
 
 get_filter_operation ()
 
 get_from ()
 
 get_ledger ()
 
 get_to ()
 
 set_filter_operation ($filter_operation)
 Filter the operations ,. More...
 
 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 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='')
 

Additional Inherited Members

- Static Public Member Functions inherited from Print_Ledger
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 More...
 
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) More...
 
- Data Fields inherited from PDF
 $cn = null
 
 $date = ""
 
 $dossier = "n/a"
 
 $own = null
 
 $soc = ""
 
- Protected Member Functions inherited from Print_Ledger
 build_filter_operation ()
 Build a SQL clause to filter operation depending if they are paid, unpaid or no filter. More...
 
- 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...
 
- Protected Attributes inherited from Print_Ledger
 $filter_operation
 

Detailed Description

Print detail of operation PURCHASE or SOLD plus the items There is no report of the different amounts.

Author
danydb

Definition at line 27 of file print_ledger_detail_item.class.php.

Constructor & Destructor Documentation

◆ __construct()

Print_Ledger_Detail_Item::__construct ( Database  $p_cn,
Acc_Ledger  $p_jrn,
  $p_from,
  $p_to,
  $p_filter_operation 
)

Definition at line 29 of file print_ledger_detail_item.class.php.

30 {
31
32 parent::__construct($p_cn,'L', 'mm', 'A4',$p_jrn,$p_from,$p_to,$p_filter_operation);
33 $this->show_col=true;
34 }

References $p_jrn.

Member Function Documentation

◆ export()

Print_Ledger_Detail_Item::export ( )

export the ledger in PDF

Definition at line 85 of file print_ledger_detail_item.class.php.

86 {
87 bcscale(2);
88 $jrn_type=$this->get_ledger()->get_type();
89
90 switch ($jrn_type)
91 {
92 case 'VEN':
93 $ledger=new Acc_Ledger_Sale($this->cn, $this->get_ledger()->jrn_def_id);
94 $ret_detail=$ledger->get_detail_sale($this->get_from(),$this->get_to(), $this->filter_operation);
95 break;
96 case 'ACH':
97 $ledger=new Acc_Ledger_Purchase($this->cn, $this->get_ledger()->jrn_def_id);
98 $ret_detail=$ledger->get_detail_purchase($this->get_from(),$this->get_to(),$this->filter_operation);
99 break;
100 default:
101 die (__FILE__.":".__LINE__.'Journal invalide');
102 break;
103 }
104 if ( $ret_detail == null ) return;
105
106 $prepared_query=new Prepared_Query($this->cn);
107 $prepared_query->prepare_reconcile_date();
108
109 $nb=Database::num_row($ret_detail);
110 $this->SetFont('DejaVu', '', 6);
111 $internal="";
112 $this->SetFillColor(220,221,255);
113 $high=4;
114 for ( $i=0;$i< $nb ;$i++)
115 {
116
117 $row=Database::fetch_array($ret_detail, $i);
118 if ($internal != $row['jr_internal'])
119 {
120
121 // Print the general info line width=270mm
122 $this->LongLine(20, $high, $row['jr_date'],1, 'L', true);
123 $this->write_cell(20, $high,$row['jr_pj_number'].".". $row['jr_internal'], 1, 0, 'L', true);
124 $this->LongLine(50, $high, $row['quick_code']." ".$row['tiers_name'],1,'L',true);
125 $this->LongLine(80, $high, $row['jr_comment'],1,'L',true);
126 $this->write_cell(20, $high, nbm($row['htva']), 1, 0, 'R', true);
127 $this->write_cell(20, $high, nbm($row['tot_tva_np']), 1, 0, 'R', true);
128 $this->write_cell(20, $high, nbm($row['other_tax_amount']), 1, 0, 'R', true);
129 $this->write_cell(20, $high, nbm($row['tot_vat']), 1, 0, 'R', true);
130 $sum=noalyss_bcadd($row['htva'],$row['tot_vat']);
131 $sum=noalyss_bcadd($row['other_tax_amount'],$sum);
132 $sum=noalyss_bcsub($sum,$row['tot_tva_np']);
133 $this->write_cell(20, $high, nbm($sum), 1, 0, 'R', true);
134 $internal=$row['jr_internal'];
135 $this->line_new(6);
136 // Payment info
137 // Prepare the query for reconcile date
138 $ret_reconcile=$this->cn->execute('reconcile_date', array($row['jr_id']));
140 for ($e=0; $e<$max; $e++)
141 {
143 $msg=( $ret_row['qcode_bank']!="")?"[".$ret_row['qcode_bank']."]":$ret_row['jr_internal'];
144 $this->write_cell(200, $high,
145 sprintf(_("Paiement montant %s date %s methoded %s "), $ret_row['jr_montant'],
146 $ret_row['jr_date'], $msg
147 ));
148 $this->line_new(6);
149 }
150 // on the first line, the code for each column is displaid
151 if ( $this->show_col == true ) {
152
153
154 // Header detail
155 $this->LongLine(30,$high,_('QuickCode'));
156 $this->write_cell(30,$high,_('Poste'));
157 $this->LongLine(70,$high,_('Libellé'));
158 $this->write_cell(20,$high,_('Prix/Unit'),0,0,'R');
159 $this->write_cell(20,$high,_('Quant.'),0,0,'R');
160 $this->write_cell(20,$high,_('HTVA'),0,0,'R');
161 $this->write_cell(20,$high,_('TVA NP'),0,0,'R');
162 $this->write_cell(20,$high,_('Code TVA'));
163 $this->write_cell(20,$high,_('TVA'),0,0,'R');
164 $this->write_cell(20,$high,_('TVAC'),0,0,'R');
165 $this->line_new(6);
166 $this->show_col=false;
167 }
168 }
169 // Print detail sale / purchase
170 $this->LongLine(30,$high,$row['j_qcode']);
171 $this->write_cell(30,$high,$row['j_poste']);
172 $comment=($row['j_text']=="")?$row['item_name']:$row['j_text'];
173 $this->LongLine(70,$high,$comment);
174 $this->write_cell(20,$high,nbm($row['price_per_unit']),0,0,'R');
175 $this->write_cell(20,$high,nbm($row['quantity']),0,0,'R');
176 $this->write_cell(20,$high,nbm($row['price']),0,0,'R');
177 $this->write_cell(20,$high,nbm($row['vat_sided']),0,0,'R');
178 $this->write_cell(20,$high,$row['tva_label']);
179 $this->write_cell(20,$high,nbm($row['vat']),0,0,'R');
180 $sum=bcadd($row['price'],$row['vat']);
181 $this->write_cell(20,$high,nbm($sum),0,0,'R');
182 $this->line_new(6);
183
184 }
185 }
noalyss_bcsub($p_first, $p_second, $p_decimal=4)
Definition: ac_common.php:1557
noalyss_bcadd($p_first, $p_second, $p_decimal=4)
Definition: ac_common.php:1563
nbm($p_number, $p_dec=2)
format the number with a sep.
Definition: ac_common.php:137
margin jrn_def_id
$input_from cn
Definition: balance.inc.php:66
Handle the ledger of purchase,.
Handle the ledger of sold,.
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
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='')
contains prepared query used in different classes of the application
$ledger
concerned Ledger
$jrn_type[]

References $e, $i, $jrn_type, Print_Ledger\$ledger, $max, $msg, $nb, $ret_reconcile, $row, cn, DatabaseCore\fetch_array(), Print_Ledger\get_from(), Print_Ledger\get_ledger(), Print_Ledger\get_to(), jrn_def_id, PDF_Core\line_new(), PDF_Core\LongLine(), nbm(), noalyss_bcadd(), noalyss_bcsub(), DatabaseCore\num_row(), and PDF_Core\write_cell().

+ Here is the call graph for this function:

◆ Footer()

Print_Ledger_Detail_Item::Footer ( )

write the Footer

Reimplemented from PDF.

Definition at line 69 of file print_ledger_detail_item.class.php.

70 {
71 $this->Ln(2);
72 $this->SetFont('Arial', 'I', 8);
73 $this->Cell(50,8,' Journal '.$this->get_ledger()->get_name(),0,0,'C');
74 //Arial italic 8
75 //Page number
76 $this->Cell(30,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L');
77 // Created by NOALYSS
78 $this->Cell(0,8,'Created by NOALYSS, online on https://www.noalyss.eu',0,0,'R',false,'https://www.noalyss.eu');
79 }

References Print_Ledger\get_ledger().

+ Here is the call graph for this function:

◆ Header()

Print_Ledger_Detail_Item::Header ( )

write the header of each page

Reimplemented from PDF.

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

44 {
45 //Arial bold 12
46 $this->SetFont('DejaVu', 'B', 12);
47 //Title
48 $this->Cell(0,10,$this->dossier, 'B', 0, 'C');
49 //Line break
50 $this->Ln(20);
51 $high=6;
52 $this->SetFont('DejaVu', '', 6);
53 $this->write_cell(20, $high, _('Date'),0,0, 'L', false);
54 $this->write_cell(20, $high, _('Numéro interne'), 0,0, 'L', false);
55 $this->write_cell(50, $high, _('Code'),0,0,'L',false);
56 $this->write_cell(80, $high, _('Libellé'),0,0,'L',false);
57 $this->write_cell(20, $high, _('Tot HTVA'), 0, 0,'R', false,'R', false);
58 $this->write_cell(20, $high, _('Tot TVA NP'), 0, 0,'R', false, false);
59 $this->write_cell(20, $high, _("Autre Tx"), 0, 0, 'R', false);
60 $this->write_cell(20, $high, _('Tot TVA'), 0, 0, 'R', false);
61 $this->write_cell(20, $high, _('TVAC'), 0, 0, 'R', false);
62 $this->line_new(6);
63 $this->show_col=true;
64
65 }

References PDF_Core\line_new(), and PDF_Core\write_cell().

+ Here is the call graph for this function:

◆ setDossierInfo()

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

Reimplemented from PDF.

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

37 {
38 $this->dossier = dossier::name()." ".$dossier;
39 }
$from_poste name
$dossier
Definition: pdf.class.php:38

References PDF\$dossier, and name.


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