<?php
/* $Revision: 1.16 $ */
/*
	R & OS PHP-PDF class code to set up a new page
	a new page is implicit on the establishment of a new pdf object so
	only for subsequent pages
*/

if ($PageNumber>1){
	$pdf->newPage();
}

$YPos = $Page_Height - $Top_Margin - ($line_height*2);


//$pdf->addJpegFromFile($_SESSION['LogoFile'],$Left_Margin,$YPos,0,60);

$FontSize=10;

$XPos = $Page_Width/2+50 ;

$pdf->addText($XPos-110,$YPos+(.3*$line_height),$FontSize+1, _('Purchase Order'));

/*if ($ViewingOnly!=0) {
	$FontSize=12;
	$pdf->addText($XPos,$YPos,$FontSize, _('FOR VIEWING ONLY') . ', ' . _('DO NOT SEND TO SUPPLIER') );
	$pdf->addText($XPos,$YPos-$line_height,$FontSize, _('SUPPLIERS') . ' - ' . _('THIS IS NOT AN ORDER') );
}*/

$YPos -= ($line_height*3);
$FontSize=10;
$XPos = $Page_Width-$Right_Margin-50;
//$pdf->addText($XPos,$YPos +40, $FontSize, _('Page') . ': ' .$PageNumber);

//OUT SIDE BORDER
		$pdf->line($Left_Margin, $YPos+105, $Page_Width-$Right_Margin, $YPos+105);
		$pdf->line($Left_Margin, $YPos+65, $Page_Width-$Right_Margin, $YPos+65);
		$pdf->line($Left_Margin, $YPos+105, $Left_Margin, $YPos-205);
		$pdf->line($Left_Margin+525, $YPos+105, $Left_Margin+525, $YPos-205);

/*Now print out the company name and address */
$XPos = $Left_Margin;
$YPos -= 1*$line_height;
//$pdf->addText($Left_Margin,$YPos, $FontSize, $_SESSION['TaxAuthorityReferenceName'] . ' ' . $_SESSION['CompanyRecord']['gstno']);
$FontSize=20;
$pdf->addText($Left_Margin+200,$YPos-(-6.5*$line_height), $FontSize, $_SESSION['CompanyRecord']['coyname'] );
$FontSize=8;
$pdf->addText($Left_Margin+30,$YPos-(-5.5*$line_height), $FontSize, $_SESSION['CompanyRecord']['regoffice1'].', ');
$pdf->addText($Left_Margin+30+70,$YPos-(-5.5*$line_height), $FontSize, $_SESSION['CompanyRecord']['regoffice2']);
$pdf->addText($Left_Margin+30+70+90,$YPos-(-5.5*$line_height), $FontSize, $_SESSION['CompanyRecord']['regoffice3'] . ' ' . $_SESSION['CompanyRecord']['regoffice4'] . ', ' . $_SESSION['CompanyRecord']['regoffice5'].', ');
$pdf->addText($Left_Margin+30+70+90+105,$YPos-(-5.5*$line_height), $FontSize, _('Ph'). ': ' . $_SESSION['CompanyRecord']['telephone'] . ' , ' ._('Fax').': ' . $_SESSION['CompanyRecord']['fax'].' , ' );
$pdf->addText($Left_Margin+30+70+90+105+120,$YPos-(-5.5*$line_height), $FontSize, _('Email'). ': ' . $_SESSION['CompanyRecord']['email']);

$YPos -=2*$line_height;

/*Now the delivery details */
$YPos -= 8;
$XPos = $Left_Margin;
$FontSize=8;
/*Draw rectangle for Client
		$pdf->line($Left_Margin, $YPos+10, $Left_Margin, $YPos+80);
		$pdf->line($Left_Margin+200, $YPos+10, $Left_Margin+200, $YPos+80);
		$pdf->line($Left_Margin, $YPos+10, $Left_Margin+200, $YPos+10);
		$pdf->line($Left_Margin, $YPos+80, $Left_Margin+200, $YPos+80);*/
		


/*end of the small table showing the coy name and delivery address details */

$XPos = $Left_Margin;
$YPos -= ($line_height*4.5);         /* 4 lines down */

/*$YPos -= 20;
$pdf->addText($XPos+1,$YPos, $FontSize, _('To').': ');

$YPos-=$line_height;
$pdf->addText($XPos+1,$YPos, $FontSize, $POHeader['suppname']);
$pdf->addText($XPos+1,$YPos-$line_height, $FontSize, $POHeader['address1']);
$pdf->addText($XPos+1,$YPos-(2*$line_height), $FontSize, $POHeader['address2']);
$pdf->addText($XPos+1,$YPos-(3*$line_height), $FontSize, $POHeader['address3']);
$pdf->addText($XPos+1,$YPos-(4*$line_height), $FontSize, $POHeader['address4']);*/


$XPos = $Page_Width/2 + 65;
$pdf->addText($XPos,$YPos+172, $FontSize, _('PO No').': ');
$pdf->addText($XPos+70,$YPos+172, $FontSize, $OrderNo);


$XPos = $Page_Width/2 + 65;
$pdf->addText($XPos,$YPos+162, $FontSize, _('Order Date') . ':' );
$pdf->addText($XPos+70,$YPos+161, $FontSize, ConvertSQLDate($POHeader['orddate']));

$YPos -= $line_height;
$pdf->addText($XPos,$YPos+162, $FontSize, _('Fax No').': ');
$pdf->addText($XPos+70,$YPos+162, $FontSize, $_SESSION['CompanyRecord']['fax']);

$YPos -= $line_height;
$pdf->addText($XPos,$YPos+163, $FontSize, _('Tel No').': ');
$pdf->addText($XPos+70,$YPos+163, $FontSize, 'Telephone');


$YPos -= $line_height;
$pdf->addText($XPos,$YPos+164, $FontSize, _('Cell').': ');
$pdf->addText($XPos+70,$YPos+164, $FontSize, 'Cell no');

$YPos -= $line_height;
$pdf->addText($XPos,$YPos+165, $FontSize, _('Email').': ');
$pdf->addText($XPos+70,$YPos+165, $FontSize, $_SESSION['CompanyRecord']['email']);

$XPos = $Left_Margin;
$YPos -= ($line_height*2);
//$pdf->addText($Left_Margin,$YPos+100, $FontSize, _('All amounts stated in').' - ' . $POHeader['currcode']);


$YPos -= ($line_height*.5);
/*draw a square grid for entering line items */
$pdf->line($Left_Margin, $YPos, $Page_Width-$Right_Margin, $YPos);
$pdf->line($Page_Width-$Right_Margin, $YPos, $Page_Width-$Right_Margin, $Bottom_Margin);
$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin, $Left_Margin, $Bottom_Margin);
$pdf->line($Left_Margin, $Bottom_Margin, $Left_Margin, $YPos);

$YPos -= $line_height*-7.2;



$YPos -= ($line_height);
/*draw a square grid for entering line items */
$pdf->line($Left_Margin, $YPos+84, $Page_Width-$Right_Margin, $YPos+84);
$pdf->line($Page_Width-$Right_Margin, $YPos, $Page_Width-$Right_Margin, $Bottom_Margin);
$pdf->line($Page_Width-$Right_Margin, $Bottom_Margin, $Left_Margin, $Bottom_Margin);
$pdf->line($Left_Margin, $YPos+65, $Page_Width-$Right_Margin, $YPos+65);

$pdf->line($Left_Margin, $Bottom_Margin, $Left_Margin, $YPos);

$YPos -= $line_height;

/*Adding lines in between table*/
		$pdf->line($Left_Margin+35, $YPos+100, $Left_Margin+35, $YPos+82);
		$pdf->line($Left_Margin+80, $YPos+100, $Left_Margin+80, $YPos+82);
		$pdf->line($Left_Margin+240, $YPos+100, $Left_Margin+240, $YPos+82);
		$pdf->line($Left_Margin+285, $YPos+100, $Left_Margin+285, $YPos+82);
		$pdf->line($Left_Margin+320, $YPos+100, $Left_Margin+320, $YPos+82);
		$pdf->line($Left_Margin+390, $YPos+100, $Left_Margin+390, $YPos+82);
		$pdf->line($Left_Margin+435, $YPos+100, $Left_Margin+435, $YPos+82);
		
/*Adding linse for currency rs*/
		$pdf->line($Left_Margin+390, $YPos+100, $Left_Margin+390, $YPos+115);
		$pdf->line($Left_Margin+525, $YPos+10, $Left_Margin+525, $YPos+30);
		$pdf->line($Left_Margin+390, $YPos+115, $Page_Width-$Right_Margin, $YPos+115);
		
	/*  $pdf->addText($Left_Margin+395,$YPos+20, $FontSize, _('CURRENCY') );
		$pdf->addText($Left_Margin+470,$YPos+20, $FontSize, _('Rs.') );  */
		
		$pdf->addText($Left_Margin+395,$YPos+102, $FontSize, _('All amounts stated in').' - ' . $POHeader['currcode']);


		
		 /*$pdf->line($Left_Margin+415, $YPos-220, $Left_Margin+415, $YPos-260);
		 $pdf->line($Left_Margin+415, $YPos-220, $Left_Margin+415, $YPos-260);
		 
		 
		 //$pdf->line($Left_Margin+150, $YPos-230, $Page_Width-$Right_Margin, $YPos-230);
		 //$pdf->line($Left_Margin+150, $YPos-242, $Page_Width-$Right_Margin, $YPos-242);*/


/*Set up headings */
$FontSize=10;

$pdf->addText($Left_Margin+1,$YPos+85, $FontSize-2, _('Sl. No.') );
$pdf->addText($Left_Margin+1+40,$YPos+85, $FontSize-2, _('Code') );
$pdf->addText($Left_Margin+1+40+55,$YPos+85, $FontSize-2, _('Item Description') );
$pdf->addText($Left_Margin+1+40+55+150,$YPos+85, $FontSize-2, _('Quantity') );
$pdf->addText($Left_Margin+1+40+55+150+45,$YPos+85, $FontSize-2, _('Units') );
$pdf->addText($Left_Margin+1+40+55+150+45+45,$YPos+85, $FontSize-2, _('Date Reqd'));
$pdf->addText($Left_Margin+1+40+55+150+45+45+65,$YPos+85, $FontSize-2, _('Price') );
$pdf->addText($Left_Margin+1+40+55+150+40+45+65+60,$YPos+85, $FontSize-2, _('Total') );

$YPos-=$line_height;

/*draw a line */
$pdf->line($Left_Margin, $YPos, $Page_Width-$Right_Margin, $YPos);

/*$YPos -= ($line_height*4);
$FontSize=10;
$pdf->addText($Left_Margin+1,$YPos, $FontSize, 'Product Specification');*/



?>