1<?php
2/*	Please note that addTextWrap prints a font-size-height further down than
3	addText and other functions.*/
4
5// $PageNumber is initialised in 0 by includes/PDFStarter.php.
6$PageNumber ++;// Increments $PageNumber before printing.
7if ($PageNumber>1) {// Inserts a page break if it is not the first page.
8	$pdf->newPage();
9}
10
11// Prints company logo:
12$XPos = $Page_Width/2 - 140;
13$pdf->addJpegFromFile($_SESSION['LogoFile'],$XPos+90,720,0,60);
14
15// Prints 'Quotation' title:
16$pdf->addTextWrap(0, $Page_Height-$Top_Margin-18, $Page_Width, 18, _('Quotation'), 'center');
17
18// Prints company info:
19$XPos = $Page_Width/2+$Left_Margin;
20$YPos = 720;
21$FontSize = 12;
22$pdf->addText($XPos, $YPos, $FontSize, $_SESSION['CompanyRecord']['coyname']);
23$YPos -= $FontSize;
24$FontSize = 10;
25$pdf->addText($XPos, $YPos, $FontSize, $_SESSION['CompanyRecord']['regoffice1']);
26$pdf->addText($XPos, $YPos-$FontSize*1, $FontSize, $_SESSION['CompanyRecord']['regoffice2']);
27$pdf->addText($XPos, $YPos-$FontSize*2, $FontSize, $_SESSION['CompanyRecord']['regoffice3']);
28$pdf->addText($XPos, $YPos-$FontSize*3, $FontSize, $_SESSION['CompanyRecord']['regoffice4']);
29$pdf->addText($XPos, $YPos-$FontSize*4, $FontSize, $_SESSION['CompanyRecord']['regoffice5'] .
30	' ' . $_SESSION['CompanyRecord']['regoffice6']);
31$pdf->addText($XPos, $YPos-$FontSize*5, $FontSize,  _('Ph') . ': ' . $_SESSION['CompanyRecord']['telephone'] .
32	' ' . _('Fax'). ': ' . $_SESSION['CompanyRecord']['fax']);
33$pdf->addText($XPos, $YPos-$FontSize*6, $FontSize, $_SESSION['CompanyRecord']['email']);
34
35// Prints 'Delivery To' info:
36$XPos = 46;
37$YPos = 770;
38$FontSize=12;
39$myrow = array_map(html_entity_decode, $myrow);
40$pdf->addText($XPos, $YPos+10,$FontSize, _('Delivery To').':' );
41$pdf->addText($XPos, $YPos- 3,$FontSize, $myrow['deliverto']);
42$pdf->addText($XPos, $YPos-15,$FontSize, $myrow['deladd1']);
43$pdf->addText($XPos, $YPos-30,$FontSize, $myrow['deladd2']);
44$pdf->addText($XPos, $YPos-45,$FontSize, $myrow['deladd3'] . ' ' . $myrow['deladd4'] . ' ' . $myrow['deladd5']);
45
46// Prints 'Quotation For' info:
47$YPos -= 80;
48$pdf->addText($XPos, $YPos,$FontSize, _('Quotation For').':');
49$pdf->addText($XPos, $YPos-15,$FontSize, $myrow['name']);
50$pdf->addText($XPos, $YPos-30,$FontSize, $myrow['address1']);
51$pdf->addText($XPos, $YPos-45,$FontSize, $myrow['address2']);
52$pdf->addText($XPos, $YPos-60,$FontSize, $myrow['address3'] . ' ' . $myrow['address4'] . ' ' . $myrow['address5']);
53
54// Draws a box with round corners around 'Delivery To' info:
55$XPos = 50;
56$YPos += 25;
57$pdf->RoundRectangle(
58	$XPos-10,// RoundRectangle $XPos.
59	$YPos+60+10,// RoundRectangle $YPos.
60	200+10+10,// RoundRectangle $Width.
61	60+10+10,// RoundRectangle $Height.
62	10,// RoundRectangle $RadiusX.
63	10);// RoundRectangle $RadiusY.
64
65// Draws a box with round corners around around 'Quotation For' info:
66$YPos -= 90;
67$pdf->RoundRectangle(
68	$XPos-10,// RoundRectangle $XPos.
69	$YPos+60+10,// RoundRectangle $YPos.
70	200+10+10,// RoundRectangle $Width.
71	60+10+10,// RoundRectangle $Height.
72	10,// RoundRectangle $RadiusX.
73	10);// RoundRectangle $RadiusY.
74
75// Prints quotation info:
76$pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*1, 200, $FontSize, _('Number'). ': '.$_GET['QuotationNo'], 'right');
77$pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*2, 200, $FontSize, _('Your Ref'). ': '.$myrow['customerref'], 'right');
78$pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*3, 200, $FontSize, _('Date'). ': '.ConvertSQLDate($myrow['quotedate']), 'right');
79$pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*4, 200, $FontSize, _('Page').': '.$PageNumber, 'right');
80
81$FontSize=10;
82
83// Prints the currency name:
84require_once('includes/CurrenciesArray.php');// To get the currency name from the currency code.
85$pdf->addText($Page_Width/2+$Left_Margin, $YPos+5, $FontSize,
86	_('All amounts stated in') . ' ' . $myrow['currcode'] . ' - ' . $CurrencyName[$myrow['currcode']]);
87
88// Prints table header:
89$YPos -= 45;
90$XPos = 40;
91$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,100,$FontSize, _('Item Code'));
92$LeftOvers = $pdf->addTextWrap(120,$YPos,235,$FontSize, _('Item Description'));
93$LeftOvers = $pdf->addTextWrap(180,$YPos,85,$FontSize, _('Quantity'),'right');
94$LeftOvers = $pdf->addTextWrap(230,$YPos,85,$FontSize,_('Price'),'right');
95$LeftOvers = $pdf->addTextWrap(280,$YPos,85,$FontSize, _('Discount'),'right');
96$LeftOvers = $pdf->addTextWrap(330,$YPos,85,$FontSize, _('Tax Class'),'right');
97$LeftOvers = $pdf->addTextWrap(400,$YPos,85,$FontSize, _('Tax Amount'),'right');
98$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-90, $YPos, 90, $FontSize, _('Total'),'right');
99
100// Draws a box with round corners around line items:
101$pdf->RoundRectangle(
102	$Left_Margin,// RoundRectangle $XPos.
103	$YPos+$FontSize+5,// RoundRectangle $YPos.
104	$Page_Width-$Left_Margin-$Right_Margin,// RoundRectangle $Width.
105	$YPos+$FontSize-$Bottom_Margin+5,// RoundRectangle $Height.
106	10,// RoundRectangle $RadiusX.
107	10);// RoundRectangle $RadiusY.
108
109// Line under table headings:
110$LineYPos = $YPos - $FontSize -1;
111$pdf->line($Page_Width-$Right_Margin, $LineYPos, $Left_Margin, $LineYPos);
112
113$YPos -= $FontSize;// This is to use addTextWrap's $YPos instead of normal $YPos.
114
115?>
116