<?php
/*	$Id: PDFQuotationPageHeader.inc 7551 2016-06-06 15:28:31Z rchacon $*/
/* pdf-php by R&OS code to set up a new sales order page */

/*	Please note that addTextWrap prints a font-size-height further down than
	addText and other functions.*/

// $PageNumber is initialised in 0 by includes/PDFStarter.php.
$PageNumber ++;// Increments $PageNumber before printing.
if($PageNumber>1) {// Inserts a page break if it is not the first page.
	$pdf->newPage();
}
$pdf->SetFont('Freeserif', 'B', 12,' ' , 'false');
// Prints company logo:
/*$pdf->addJpegFromFile($_SESSION['LogoFile'], 301, 520, 0, 60);// Old function. See ~/includes/class.pdf.php.*/
$pdf->Image(
	$_SESSION['LogoFile'],// Name of the file containing the image.
	301,// Abscissa from left border to the upper-left corner (LTR).
	$Page_Height -(520) -(80),// Ordinate from top border to the upper-left corner (LTR).
	0,// Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
	75,// Height of the image in the page. If not specified or equal to zero, it is automatically calculated.
	''// Image format. If not specified, the type is inferred from the file extension.
);// Public function Image() in ~/includes/tcpdf/tcpdf.php.

// Prints 'Quotation' title:
$pdf->addTextWrap(0, $Page_Height-$Top_Margin-18, $Page_Width+400, 18, _('Creditors Payment Voucher'), 'center');
$pdf->addTextWrap(0, $Page_Height-$Top_Margin-35, $Page_Width+400, 	12, _(''), 'center');
// Prints quotation info:

$pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*1, 200, 14, _('No'). ': '.$paymentno, 'right');


$pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*3, 200, 12, _('Date'). ': '.$quotedate, 'right');
$pdf->addTextWrap($Page_Width-$Right_Margin-200, $Page_Height-$Top_Margin-$FontSize*4, 200, 12, _('Page').': '.$PageNumber, 'right');
$pdf->SetFont('Freeserif', '', 12,' ' , 'false');
// Prints company info:
$XPos = $Page_Width/2+$Left_Margin;
$YPos = 512;
$FontSize = 14;
$pdf->addText($XPos-150, $YPos, $FontSize,  _('Head Office'));
$pdf->addText($XPos, $YPos, $FontSize, _('Nadi Branch'));
$pdf->addText($XPos+150, $YPos, $FontSize, _('Labasa Branch'));
$YPos -= $FontSize;
$FontSize = 10;

$pdf->addText($XPos-150, $YPos, $FontSize,  _('Lot 9 Raiwasa Road,'));
$pdf->addText($XPos-150, $YPos-$FontSize*1, $FontSize, _('Samabula, Suva,'));
$pdf->addText($XPos-150, $YPos-$FontSize*2, $FontSize, _('Ph: +679 336 1999'));
$pdf->addText($XPos-150, $YPos-$FontSize*3, $FontSize, _('Fax: +679 336 2060'));

$pdf->addText($XPos, $YPos, $FontSize,  _('Section 9 Aerotown Mall,'));
$pdf->addText($XPos, $YPos-$FontSize*1, $FontSize, _('Nadi'));
$pdf->addText($XPos, $YPos-$FontSize*2, $FontSize, _('Ph: + 679 672 3688'));

$pdf->addText($XPos+150, $YPos, $FontSize,  _('Nasekula Road,'));
$pdf->addText($XPos+150, $YPos-$FontSize*1, $FontSize, _('Labasa,'));
$pdf->addText($XPos+150, $YPos-$FontSize*2, $FontSize, _('Ph:  679 8814133'));



$pdf->addText($XPos, $YPos-$FontSize*6, $FontSize,  _('Prepared by') . ': ' . $realname.' '._('Email:'). $emailm);
//$pdf->addText($XPos, $YPos-$FontSize*7, $FontSize,  _('Single GLCode: ') . $glcodesingle);
$pdf->addText($XPos, $YPos-$FontSize*7, $FontSize,  _('Manager: ____________________ Authorised By: ______________________ '));
// Prints 'Delivery To' info:
$XPos = 46;
$YPos = 566;
$FontSize=14;
$myrow = array_map(html_entity_decode, $myrow);
$line_height = 15;
$pdf->addText($XPos, $YPos, $FontSize, _('Supplier').':' );
$FontSize=8;


	//$pdf->addText($XPos, $YPos-$line_height*1, $FontSize, _('ATT: ') .$attention);
	$pdf->addText($XPos, $YPos-$line_height*1, $FontSize,$suppname);
$pdf->addText($XPos, $YPos-$line_height*2, $FontSize, _('Tin: ').$tin);


    $pdf->addText($XPos, $YPos-$line_height*3, $FontSize,$address1);
 $pdf->addText($XPos, $YPos-$line_height*4, $FontSize,$address3.' '.$address6);
//$pdf->addText($XPos, $YPos-$line_height*2, $FontSize, $debtorname);

  






// Prints 'Quotation For' info:
$YPos -= 80;
$line_height = 15;

$FontSize=10;

	
$pdf->SetFont('Freeserif', 'B', 12,' ' , 'false');
$pdf->addText($XPos, $YPos-$line_height*1, $FontSize,_('Payment Amount: ').$paymentamount);
$pdf->SetFont('Freeserif', '', 12,' ' , 'false');
$pdf->addText($XPos, $YPos-$line_height*2, $FontSize,_('Payment Type: ').$paymenttype);
$pdf->addText($XPos, $YPos-$line_height*3, $FontSize,_('Bank: ').$bankname._(' Bank GLCode: ').$bankglcode);

$pdf->addText($XPos, $YPos-$line_height*4, $FontSize,_('Cheque No: ').$chqno);
	



//$pdf->addText($XPos, $YPos-$line_height*4, $FontSize, $address3 . ' ' . $address4 . ' ' . $address5);

// Draws a box with round corners around 'Delivery To' info:
$XPos= 50;
$YPos += 12;
$pdf->RoundRectangle(
	$XPos-10,// RoundRectangle $XPos.
	$YPos+70,// RoundRectangle $YPos.
	245,// RoundRectangle $Width.
	80,// RoundRectangle $Height.
	10,// RoundRectangle $RadiusX.
	10);// RoundRectangle $RadiusY.

// Draws a box with round corners around around 'Quotation For' info:
$YPos -= 82;
$pdf->RoundRectangle(
	$XPos-10,// RoundRectangle $XPos.
	$YPos+70,// RoundRectangle $YPos.
	245,// RoundRectangle $Width.
	90,// RoundRectangle $Height.
	10,// RoundRectangle $RadiusX.
	10);// RoundRectangle $RadiusY.

$FontSize=10;
$pdf->SetFont('Freeserif', '', 12,' ' , 'false');
// Prints the currency name:
//require_once('includes/CurrenciesArray.php');// To get the currency name from the currency code.
//$pdf->addText($Page_Width/2+$Left_Margin, $YPos-5, $FontSize,
	//_('All amounts stated in: FJD') );

// Prints table header:
$XPos = 40;
$YPos -= 37;
//$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos,103, $FontSize, _('PartNo'));
	//if(strlen($LeftOvers) > 0) { // If translated text is greater than 103, prints remainder
	//	$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos-$FontSize, 65, $FontSize, $LeftOvers);
	//}
//$LeftOvers = $pdf->addTextWrap(145, $YPos,55, $FontSize, _('Supp Code'));
$LeftOvers = $pdf->addTextWrap(245, $YPos,600, $FontSize, _('Cost Breakdown'),'left');
//$LeftOvers = $pdf->addTextWrap(520, $YPos, 55, $FontSize, _('Qty'),'right');
	if(strlen($LeftOvers) > 0) { // If translated text is greater than 55, prints remainder
		$LeftOvers = $pdf->addTextWrap(615,$YPos-$FontSize,55, $FontSize, $LeftOvers,'right');
	}
	//$LeftOvers = $pdf->addTextWrap(590, $YPos, 70, $FontSize, _('Unit Price'),'right');

	if(strlen($LeftOvers) > 0) { // If translated text is greater than 55, prints remainder
		$LeftOvers = $pdf->addTextWrap(615,$YPos-$FontSize,55, $FontSize, $LeftOvers,'right');
	}
$LeftOvers = $pdf->addTextWrap(610, $YPos, 70, $FontSize, _('GL'),'right');

//$LeftOvers = $pdf->addTextWrap(630, $YPos, 150, $FontSize, _('ShipmentMode'),'right');
	if(strlen($LeftOvers) > 0) { // If translated text is greater than 70, prints remainder
		$LeftOvers = $pdf->addTextWrap(665, $YPos-$FontSize, 70, $FontSize, $LeftOvers,'right');
	}
$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-90, $YPos, 90, $FontSize, _('Total'),'right');

// Draws a box with round corners around line items:
$pdf->RoundRectangle(
	$Left_Margin,// RoundRectangle $XPos.
	$YPos+$FontSize+5,// RoundRectangle $YPos.
	$Page_Width-$Left_Margin-$Right_Margin,// RoundRectangle $Width.
	$YPos+$FontSize-$Bottom_Margin+5,// RoundRectangle $Height.
	10,// RoundRectangle $RadiusX.
	10);// RoundRectangle $RadiusY.

// Line under table headings:
$LineYPos = $YPos - $FontSize -1;
$pdf->line($Page_Width-$Right_Margin, $LineYPos, $Left_Margin, $LineYPos);

$YPos -= $FontSize + 10 ;// This is to use addTextWrap's $YPos instead of normal $YPos.

?>
