1<?php
2/* PDFlib code to set up a new page */
3
4$Perforation = $Page_Width - $Right_Margin - 160;
5
6$YPos = $Page_Height - $Top_Margin;
7
8// Company Logo:
9/*$pdf->addJpegFromFile($_SESSION['LogoFile'], $Page_Width/2-130, $YPos-80, 0, 60);*/
10$pdf->Image(
11	$_SESSION['LogoFile'],// Name of the file containing the image.
12	$Page_Width/2-130,// Abscissa from left border to the upper-left corner (LTR).
13	$Page_Height -($YPos-80) -(60),// Ordinate from top border to the upper-left corner (LTR).
14	0,// Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
15	60,// Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
16	''// Image format. If not specified, the type is inferred from the file extension.
17);// Public function Image() in ~/includes/tcpdf/tcpdf.php
18
19// Title
20$FontSize =15;
21$XPos = $Page_Width/2 - 110;
22$pdf->addText($XPos, $YPos,$FontSize, _('Statement') );
23
24$FontSize = 12;
25$pdf->addText($XPos + 70, $YPos,$FontSize, ' '. _('as of').' ' . Date($_SESSION['DefaultDateFormat']));
26
27// Remittance header
28
29$YPosR = $YPos;
30$FontSize = 10;
31$LineHeight = 13;
32$LineCountR = 0;
33$Remit1 = $Perforation +2;
34
35$pdf->addText($Remit1, $YPosR-$LineCountR*$LineHeight,$FontSize, _('Remittance Advice') );
36$LineCountR += 1;
37$pdf->addText($Remit1, $YPosR-$LineCountR*$LineHeight,$FontSize, _('Statement dated').' ' . Date($_SESSION['DefaultDateFormat']));
38$LineCountR += 1;
39$pdf->addText($Remit1, $YPosR-$LineCountR*$LineHeight,$FontSize, _('Page').': ' . $PageNumber);
40
41/*Also show the page number on the main section */
42$pdf->addText($Perforation-50, $YPos,$FontSize, _('Page').': ' . $PageNumber);
43
44/*Now print out company info at the top left */
45
46$XPos = $Left_Margin;
47$YPos = $Page_Height - $Top_Margin - 20;
48
49$FontSize = 10;
50$LineHeight = 13;
51$LineCount = 0;
52
53$pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, $_SESSION['CompanyRecord']['coyname']);
54
55$FontSize = 8;
56$LineHeight = 10;
57
58if ($_SESSION['CompanyRecord']['regoffice1'] <> '') {
59  $LineCount += 1;
60  $pdf->addText($XPos, $YPos-$LineCount*$LineHeight,$FontSize, $_SESSION['CompanyRecord']['regoffice1']);
61}
62if ($_SESSION['CompanyRecord']['regoffice2'] <> '') {
63  $LineCount += 1;
64  $pdf->addText($XPos, $YPos-$LineCount*$LineHeight,$FontSize, $_SESSION['CompanyRecord']['regoffice2']);
65}
66if (($_SESSION['CompanyRecord']['regoffice3'] <> '') OR ($_SESSION['CompanyRecord']['regoffice4'] <> '') OR ($_SESSION['CompanyRecord']['regoffice5'] <> '')) {
67  $LineCount += 1;
68  $pdf->addText($XPos, $YPos-$LineCount*$LineHeight,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']);  // country in 6 not printed
69}
70$LineCount += 1;
71$pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, _('Phone') . ':' . $_SESSION['CompanyRecord']['telephone']);
72$LineCount += 1;
73$pdf->addText($XPos, $YPos-$LineCount*$LineHeight,$FontSize, _('Fax') . ': ' . $_SESSION['CompanyRecord']['fax']);
74$LineCount += 1;
75$pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, _('Email') . ': ' . $_SESSION['CompanyRecord']['email']);
76
77/*Now the remittance section just company and return postal address */
78
79$FontSize = 10;
80$LineHeight = 13;
81
82$LineCountR += 2;
83$pdf->addText($Perforation+1, $YPosR-$LineCountR*$LineHeight,$FontSize, _('Please send with remittance to').':');
84$LineCountR += 1;
85$pdf->addText($Perforation+1, $YPosR-$LineCountR*$LineHeight, $FontSize, $_SESSION['CompanyRecord']['coyname']);
86if ($_SESSION['CompanyRecord']['regoffice1'] <> '') {
87  $LineCountR += 1;
88  $pdf->addText($Perforation+1, $YPosR-$LineCountR*$LineHeight,$FontSize, $_SESSION['CompanyRecord']['regoffice1']);
89}
90if ($_SESSION['CompanyRecord']['regoffice2'] <> '') {
91  $LineCountR += 1;
92  $pdf->addText($Perforation+1, $YPosR-$LineCountR*$LineHeight,$FontSize, $_SESSION['CompanyRecord']['regoffice2']);
93}
94if (($_SESSION['CompanyRecord']['regoffice3'] <> '') OR ($_SESSION['CompanyRecord']['regoffice4'] <> '') OR ($_SESSION['CompanyRecord']['regoffice5'] <> '')) {
95  $LineCountR += 1;
96  $pdf->addText($Perforation+1, $YPosR-$LineCountR*$LineHeight,$FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ' ' . $_SESSION['CompanyRecord']['regoffice5']);  // country in 6 not printed
97}
98
99/*Now the customer details and statement address */
100
101$XPos = $Left_Margin+20;
102$YPos = $Page_Height - $Top_Margin - 120;
103
104$LineCount = 0;
105
106$pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, $StmtHeader['name']);
107$LineCount += 1;
108$pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, $StmtHeader['address1']);
109$LineCount += 1;
110$pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, $StmtHeader['address2']);
111$LineCount += 1;
112$pdf->addText($XPos, $YPos-$LineCount*$LineHeight, $FontSize, $StmtHeader['address3'] . ' ' . $StmtHeader['address4']  . ' ' . $StmtHeader['address5']  . ' ' . $StmtHeader['address6']);
113
114$YPos = $Page_Height - $Top_Margin - 120;
115
116/*Now note the customer code in the remittance section too */
117
118$FontSize=10;
119$LineCountR += 2;
120$pdf->addText($Perforation+1, $YPosR-$LineCountR*$LineHeight,$FontSize, _('Customer Code').': ' . $StmtHeader['debtorno']);
121
122$FontSize=8;
123$XPos = $Page_Width/2 - 60;
124$pdf->addText($XPos, $YPos,$FontSize, _('All amounts stated in') . ': ' . _($StmtHeader['currency']));
125$YPos -= $line_height;
126$pdf->addText($XPos, $YPos,$FontSize, $StmtHeader['terms']);
127
128$YPos = $Page_Height - $Top_Margin - 180;
129//$YPos -= $line_height;
130$XPos = $Left_Margin;
131
132// Draws a rounded rectangle around the statement details:
133$pdf->RoundedRect(
134	($Left_Margin),// Abscissa of upper-left corner from left border (LTR).
135	$Page_Height -($YPos),// Ordinate of upper-left corner from top border (LTR).
136	($Perforation) -($Left_Margin),// Width.
137	($YPos) -($Bottom_Margin),// Height.
138	10,// The radius of the circle used to round off the corners of the rectangle.
139	'1111',// Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111").
140	'',// Style of rendering. See the getPathPaintOperator() function for more information. Default value: empty ("").
141	array(),// Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array).
142	array()// Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
143);// Public function RoundedRect() in ~/includes/tcpdf/tcpdf.php
144
145// Draws a rounded rectangle around the remittance advice section:
146$pdf->RoundedRect(
147	($Perforation+1),// Abscissa of upper-left corner from left border (LTR).
148	$Page_Height -($YPos),// Ordinate of upper-left corner from top border (LTR).
149	($Page_Width-$Right_Margin) -($Perforation+1),// Width.
150	($YPos) -($Bottom_Margin),// Height.
151	10,// The radius of the circle used to round off the corners of the rectangle.
152	'1111',// Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top right, bottom right, bottom left and top left. Default value: all rounded corner ("1111").
153	'',// Style of rendering. See the getPathPaintOperator() function for more information. Default value: empty ("").
154	array(),// Border style of rectangle. Array like for SetLineStyle(). Default value: default line style (empty array).
155	array()// Fill color. Format: array(GREY) or array(R,G,B) or array(C,M,Y,K) or array(C,M,Y,K,SpotColorName). Default value: default color (empty array).
156);// Public function RoundedRect() in ~/includes/tcpdf/tcpdf.php
157
158$YPos -= $line_height;
159$FontSize =10;
160/*Set up headings */
161$pdf->addText($Left_Margin+1, $YPos,$FontSize, _('Trans Type') );
162$pdf->addText($Left_Margin+100, $YPos,$FontSize, _('Number') );
163$pdf->addText($Left_Margin+210, $YPos,$FontSize, _('Date') );
164$pdf->addText($Left_Margin+300, $YPos,$FontSize, _('Charges') );
165$pdf->addText($Left_Margin+382, $YPos,$FontSize, _('Credits') );
166$pdf->addText($Left_Margin+459, $YPos,$FontSize, _('Allocated') );
167$pdf->addText($Left_Margin+536, $YPos,$FontSize, _('Outstanding') );
168
169/*Set up remittance section headings */
170$FontSize=8;
171$pdf->addText($Perforation+10, $YPos,$FontSize, _('Trans') );
172$pdf->addText($Perforation+55, $YPos,$FontSize, _('Number') );
173$pdf->addText($Perforation+100, $YPos,$FontSize, _('Outstanding') );
174
175$YPos -= $line_height;
176/*draw a line */
177$pdf->line($Page_Width-$Right_Margin, $YPos,$XPos, $YPos);
178
179$YPos -= $line_height;
180$XPos = $Left_Margin;
181
182?>