<?php
ob_start();
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
include('includes/session.inc');
$Title = _('Print Timesheet for GFS');
include('includes/SQL_CommonFunctions.inc');
 
include('includes/header.inc');


if (isset($_GET['employeeid'])) {
		$_SESSION['employeeid'] = stripslashes($_GET['employeeid']);
	}
	$employeeid = $_SESSION['employeeid'];



	
if (isset($_GET['fnpf'])) {
		$_SESSION['fnpf'] = stripslashes($_GET['fnpf']);
	}
	$fnpf = $_SESSION['fnpf'];
	

if (isset($_GET['tin'])) {
		$_SESSION['tin'] = stripslashes($_GET['tin']);
	}
	$tin = $_SESSION['tin'];


if (isset($_GET['fullname'])) {
		$_SESSION['fullname'] = stripslashes($_GET['fullname']);
	}
	$fullname = $_SESSION['fullname'];

if (isset($_GET['startdate'])) {
		$_SESSION['startdate'] = stripslashes($_GET['startdate']);
	}
	$startdate = $_SESSION['startdate'];


if (isset($_GET['enddate'])) {
		$_SESSION['enddate'] = stripslashes($_GET['enddate']);
	}
	$enddate = $_SESSION['enddate'];

$printdate = date("d-m-Y");


if (isset($_GET['grosspaid'])) {
		$_SESSION['grosspaid'] = stripslashes($_GET['grosspaid']);
	}
	$grosspaid = $_SESSION['grosspaid'];


if (isset($_GET['bonuspaid'])) {
		$_SESSION['bonuspaid'] = stripslashes($_GET['bonuspaid']);
	}
	$bonuspaid = $_SESSION['bonuspaid'];


if (isset($_GET['incometaxpaid'])) {
		$_SESSION['incometaxpaid'] = stripslashes($_GET['incometaxpaid']);
	}
	$incometaxpaid= $_SESSION['incometaxpaid'];

		if (isset($_GET['srt'])) {
		$_SESSION['srt'] = stripslashes($_GET['srt']);
	}
	$srt= $_SESSION['srt'];
if (isset($_GET['ecal'])) {
		$_SESSION['ecal'] = stripslashes($_GET['ecal']);
	}
	$ecal= $_SESSION['ecal'];

	

if (isset($_GET['totaltax'])) {
		$_SESSION['totaltax'] = stripslashes($_GET['totaltax']);
	}
	$totaltax= $_SESSION['totaltax'];


if (isset($_GET['annualsalary'])) {
		$_SESSION['annualsalary'] = stripslashes($_GET['annualsalary']);
	}
	$annualsalary= $_SESSION['annualsalary'];


if (isset($_GET['annualsalarybonus'])) {
		$_SESSION['annualsalarybonus'] = stripslashes($_GET['annualsalarybonus']);
	}
	$annualsalarybonus= $_SESSION['annualsalarybonus'];

if (isset($_GET['period'])) {
		$_SESSION['period'] = stripslashes($_GET['period']);
	}
	$periodraw= $_SESSION['period'];


$period = date('Y', strtotime($periodraw));

if (isset($_GET['email'])) {
		$_SESSION['email'] = stripslashes($_GET['email']);
	}
	$email= $_SESSION['email'];

	
$PaperSize = 'A4_Landscape';// PDFStarter.php: $Page_Width=842; $Page_Height=595; $Top_Margin=30; $Bottom_Margin=30; $Left_Margin=40; $Right_Margin=30;
include('includes/PDFStarter.php');
$pdf->addInfo('Title', _('employeetaxeport') );
$pdf->addInfo('Subject', _('employeetaxeport') );
$FontSize = 12;
	
$line_height = 12;// Recoeommended: $line_height = $x * $FontSize.
	$headinggap = 6;	
	
	



		include('includes/PDFEmployeeTaxStatementheader.inc');

  $topheading = $YPos + 35;
		
		
		//timesheet
 

$rowCount= 0;
	$cellcount = 0;	
	$cellcount2 = 6;
$totalhours = 0;	
		
//while ($rowCount <= $num) {
	  


	
	
	//timesheet
	
	
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
				include('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
			
			$FontSize = 7;// Font size for the line item.

		$LeftOvers = $pdf->addTextWrap(20, $YPos+12-$cellcount,200,$FontSize,$period,'left');
		
		
	
	
	
	
		
			$LeftOvers = $pdf->addTextWrap(150, $YPos+12 - $cellcount,200,$FontSize,"Total Gross Paid",'left');
		
			
		
		
		$LeftOvers = $pdf->addTextWrap(780, $YPos+12 - $cellcount,200,$FontSize,"$" . number_format($grosspaid,2),'left');
		$
			
		
	
		
		//$totalamount   = $myrow3['amount'] ;
		//$totalhours +=$totalamount;
		
		
		$cellcount = $cellcount * 0.5;
		$cellcount2 = $cellcount2 + 6;
		
		
			
			
			// Prints salesorderdetails.narrative:
		$FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative.
		$Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative.
		$LeftOvers = trim($myrow1['narrative']);
		//**********
		$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
		$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
		$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
			
			while (mb_strlen($LeftOvers) > 1) {
			$YPos -= $FontSize2;
			if ($YPos < ($Bottom_Margin)) {// Begins new page.
					include('includes/PDFEmployeeTaxStatementheader.inc');
			}
			$LeftOvers = $pdf->addTextWrap(145, $YPos, $Width2, $FontSize2, $LeftOvers);
		}
			
			if ((mb_strlen($quoteterms) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($quoteterms) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finish off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
	 //end if need a new page headed up
			}
			
		
			// timehalf
	
	
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
			
			$FontSize = 7;// Font size for the line item.

		$LeftOvers = $pdf->addTextWrap(20, $YPos+12-$cellcount,200,$FontSize,$period,'left');
		
		
	
	
	
	
		
			$LeftOvers = $pdf->addTextWrap(150, $YPos+12 - $cellcount,200,$FontSize,"Bonus Paid",'left');
		
			
		
		
		$LeftOvers = $pdf->addTextWrap(780, $YPos+12 - $cellcount,200,$FontSize,"$" . number_format($bonuspaid,2),'left');
		
			
		
	
		
		//$totalamount   = $myrow3['amount'] ;
		//$totalhours +=$totalamount;
		
		
		$cellcount = $cellcount * 0.5;
		$cellcount2 = $cellcount2 + 6;
		
		
			
			
			// Prints salesorderdetails.narrative:
		$FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative.
		$Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative.
		$LeftOvers = trim($myrow1['narrative']);
		//**********
		$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
		$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
		$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
			
			while (mb_strlen($LeftOvers) > 1) {
			$YPos -= $FontSize2;
			if ($YPos < ($Bottom_Margin)) {// Begins new page.
				include ('includes/PDFEmployeeTaxStatementheader.inc');
			}
			$LeftOvers = $pdf->addTextWrap(145, $YPos, $Width2, $FontSize2, $LeftOvers);
		}
			
			if ((mb_strlen($quoteterms) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($quoteterms) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finish off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
	 //end if need a new page headed up
			}
			
		
	
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
			
			$FontSize = 7;// Font size for the line item.

		$LeftOvers = $pdf->addTextWrap(20, $YPos+12-$cellcount,200,$FontSize,$period,'left');
		
		
	
	
	
	
		
			$LeftOvers = $pdf->addTextWrap(150, $YPos+12 - $cellcount,200,$FontSize,"Paye Income Tax Paid",'left');
		
			
		
		
		
		$LeftOvers = $pdf->addTextWrap(780, $YPos+12 - $cellcount,200,$FontSize,"$" . number_format($incometaxpaid,2),'left');
		
			
		
	
		
		//$totalamount   = $myrow3['amount'] ;
		//$totalhours +=$totalamount;
		
		
		$cellcount = $cellcount * 0.5;
		$cellcount2 = $cellcount2 + 6;
		
		
			
			
			// Prints salesorderdetails.narrative:
		$FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative.
		$Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative.
		$LeftOvers = trim($myrow1['narrative']);
		//**********
		$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
		$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
		$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
			
			while (mb_strlen($LeftOvers) > 1) {
			$YPos -= $FontSize2;
			if ($YPos < ($Bottom_Margin)) {// Begins new page.
				include ('includes/PDFEmployeeTaxStatementheader.inc');
			}
			$LeftOvers = $pdf->addTextWrap(145, $YPos, $Width2, $FontSize2, $LeftOvers);
		}
			
			if ((mb_strlen($quoteterms) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($quoteterms) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finish off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
	 //end if need a new page headed up
			}
			
			
	
	
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
			
			$FontSize = 7;// Font size for the line item.

		$LeftOvers = $pdf->addTextWrap(20, $YPos+12-$cellcount,200,$FontSize,$period,'left');
		
		
	
	
	
	
		
			$LeftOvers = $pdf->addTextWrap(150, $YPos+12 - $cellcount,200,$FontSize,"SRT Tax Paid",'left');
		
			
		
		
		
		$LeftOvers = $pdf->addTextWrap(780, $YPos+12 - $cellcount,200,$FontSize,"$" . number_format($srt,2),'left');
		
			
		
	
		
		//$totalamount   = $myrow3['amount'] ;
		//$totalhours +=$totalamount;
		
		
		$cellcount = $cellcount * 0.5;
		$cellcount2 = $cellcount2 + 6;
		
		
			
			
			// Prints salesorderdetails.narrative:
		$FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative.
		$Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative.
		$LeftOvers = trim($myrow1['narrative']);
		//**********
		$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
		$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
		$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
			
			while (mb_strlen($LeftOvers) > 1) {
			$YPos -= $FontSize2;
			if ($YPos < ($Bottom_Margin)) {// Begins new page.
				include ('includes/PDFEmployeeTaxStatementheader.inc');
			}
			$LeftOvers = $pdf->addTextWrap(145, $YPos, $Width2, $FontSize2, $LeftOvers);
		}
			
			if ((mb_strlen($quoteterms) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($quoteterms) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finish off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
	 //end if need a new page headed up
			}
			
		
		
		
	
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
			
			$FontSize = 7;// Font size for the line item.

		$LeftOvers = $pdf->addTextWrap(20, $YPos+12-$cellcount,200,$FontSize,$period,'left');
		
		
	
	
	
	
		
			$LeftOvers = $pdf->addTextWrap(150, $YPos+12 - $cellcount,200,$FontSize,"ECAL Tax Paid",'left');
		
			
		
		$LeftOvers = $pdf->addTextWrap(780, $YPos+12 - $cellcount,200,$FontSize,"$" . number_format($ecal,2),'left');
		
			
		
	
		
		//$totalamount   = $myrow3['amount'] ;
		//$totalhours +=$totalamount;
		
		
		$cellcount = $cellcount * 0.5;
		$cellcount2 = $cellcount2 + 6;
		
		
			
			
			// Prints salesorderdetails.narrative:
		$FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative.
		$Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative.
		$LeftOvers = trim($myrow1['narrative']);
		//**********
		$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
		$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
		$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
			
			while (mb_strlen($LeftOvers) > 1) {
			$YPos -= $FontSize2;
			if ($YPos < ($Bottom_Margin)) {// Begins new page.
				include ('includes/PDFEmployeeTaxStatementheader.inc');
			}
			$LeftOvers = $pdf->addTextWrap(145, $YPos, $Width2, $FontSize2, $LeftOvers);
		}
			
			if ((mb_strlen($quoteterms) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($quoteterms) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finish off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
	 //end if need a new page headed up
			}
			
		
	
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
			
			$FontSize = 7;// Font size for the line item.

		$LeftOvers = $pdf->addTextWrap(20, $YPos+12-$cellcount,200,$FontSize,$period,'left');
		
		
	
	
	
	
		
			$LeftOvers = $pdf->addTextWrap(150, $YPos+12 - $cellcount,200,$FontSize,"Total Tax Paid",'left');
		
			
		
		
		

		
		
	
		
		$LeftOvers = $pdf->addTextWrap(780, $YPos+12 - $cellcount,200,$FontSize,"$" . number_format($totaltax,2),'left');
		
			
		
	
		
		//$totalamount   = $myrow3['amount'] ;
		//$totalhours +=$totalamount;
		
		
		$cellcount = $cellcount * 0.5;
		$cellcount2 = $cellcount2 + 6;
		
		
			
			
			// Prints salesorderdetails.narrative:
		$FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative.
		$Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative.
		$LeftOvers = trim($myrow1['narrative']);
		//**********
		$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
		$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
		$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
			
			while (mb_strlen($LeftOvers) > 1) {
			$YPos -= $FontSize2;
			if ($YPos < ($Bottom_Margin)) {// Begins new page.
				include ('includes/PDFEmployeeTaxStatementheader.inc');
			}
			$LeftOvers = $pdf->addTextWrap(145, $YPos, $Width2, $FontSize2, $LeftOvers);
		}
			
			if ((mb_strlen($quoteterms) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($quoteterms) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finish off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
	 //end if need a new page headed up
			}
			
		
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
			
			$FontSize = 7;// Font size for the line item.

		$LeftOvers = $pdf->addTextWrap(20, $YPos+12-$cellcount,200,$FontSize,$period,'left');
		
		
	
	
	
	
		
			$LeftOvers = $pdf->addTextWrap(150, $YPos+12 - $cellcount,200,$FontSize,"Annual Salary",'left');
		
			
		
		
		
		$LeftOvers = $pdf->addTextWrap(780, $YPos+12 - $cellcount,200,$FontSize,"$" . number_format($annualsalary,2),'left');
		
			
		
	
		
		//$totalamount   = $myrow3['amount'] ;
		//$totalhours +=$totalamount;
		
		
		$cellcount = $cellcount * 0.5;
		$cellcount2 = $cellcount2 + 6;
		
		
			
			
			// Prints salesorderdetails.narrative:
		$FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative.
		$Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative.
		$LeftOvers = trim($myrow1['narrative']);
		//**********
		$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
		$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
		$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
			
			while (mb_strlen($LeftOvers) > 1) {
			$YPos -= $FontSize2;
			if ($YPos < ($Bottom_Margin)) {// Begins new page.
				include ('includes/PDFEmployeeTaxStatementheader.inc');
			}
			$LeftOvers = $pdf->addTextWrap(145, $YPos, $Width2, $FontSize2, $LeftOvers);
		}
			
			if ((mb_strlen($quoteterms) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($quoteterms) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finish off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
	 //end if need a new page headed up
			}
			
			
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
			
			$FontSize = 7;// Font size for the line item.

		$LeftOvers = $pdf->addTextWrap(20, $YPos+12-$cellcount,200,$FontSize,$period,'left');
		
		
	
	
	
	
		
			$LeftOvers = $pdf->addTextWrap(150, $YPos+12 - $cellcount,200,$FontSize,"Annual Salary with bonus",'left');
		
			
		
		
		$LeftOvers = $pdf->addTextWrap(780, $YPos+12 - $cellcount,200,$FontSize,"$" . number_format($annualsalarybonus,2),'left');
		
			
		
	
		
		//$totalamount   = $myrow3['amount'] ;
		//$totalhours +=$totalamount;
		
		
		$cellcount = $cellcount * 0.5;
		$cellcount2 = $cellcount2 + 6;
		
		
			
			
			// Prints salesorderdetails.narrative:
		$FontSize2 = $FontSize*0.8;// Font size to print salesorderdetails.narrative.
		$Width2 = $Page_Width-$Right_Margin-145;// Width to print salesorderdetails.narrative.
		$LeftOvers = trim($myrow1['narrative']);
		//**********
		$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
		$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
		$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
			
			while (mb_strlen($LeftOvers) > 1) {
			$YPos -= $FontSize2;
			if ($YPos < ($Bottom_Margin)) {// Begins new page.
				include ('includes/PDFEmployeeTaxStatementheader.inc');
			}
			$LeftOvers = $pdf->addTextWrap(145, $YPos, $Width2, $FontSize2, $LeftOvers);
		}
			
			if ((mb_strlen($quoteterms) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($quoteterms) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finish off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
	 //end if need a new page headed up
			}
			
		
	
	
				  $ListCount ++;
				

		$YPos -= $line_height;// Increment a line down for the next line item.
				
      
		if ((mb_strlen($myrow1['narrative']) >200 AND $YPos-$line_height <= 75)
			OR (mb_strlen($myrow1['narrative']) >1 AND $YPos-$line_height <= 62)
			OR $YPos-$line_height <= 50){
		/* We reached the end of the page so finsih off the page and start a newy */
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		} //end if need a new page headed up

			
								//$myrow6 = DB_fetch_array($result6) ;
				
				
				//write to pdf
				
				//$total = $myrow7979['quantity'] * $myrow3['materialcost'] ;
			    
			 
			  // $grandtotal += $total;
				
				//$costprice = locale_number_format($myrow3['materialcost'],2);
				
				//$roundtotal= locale_number_format($total,2);

	
		
		$pdf->addTextWrap(60, $Bottom_Margin+(3*$line_height+10),200,$FontSize,"",'left');

$pdf->addTextWrap(700, $Bottom_Margin+(3*$line_height+10),200,$FontSize,"",'left');
		/* Print a column vertical line  with enough space for the footer */
			/* draw the vertical column lines to 4 lines shy of the bottom to leave space for invoice footer info ie totals etc */
			//the first part is the horizontal path, second is from top 
$pdf->line(143, $topheading,143,$Bottom_Margin+(3*$line_height));

$pdf->line(459, $topheading,459,$Bottom_Margin+(3*$line_height));

$pdf->line(681, $topheading,681,$Bottom_Margin+(3*$line_height));
//tallies columns
$pdf->line(755, $topheading,755,$Bottom_Margin+(3*$line_height));

		$FontSize = 10;
		

	$pdf->line($Page_Width-$Right_Margin-810, $Bottom_Margin+(3*$line_height),$Page_Width-$Right_Margin,$Bottom_Margin+(3*$line_height));		$pdf->line($Page_Width-$Right_Margin-810, $Bottom_Margin+(3*$line_height+20),$Page_Width-$Right_Margin,$Bottom_Margin+(3*$line_height+20));
	$pdf->SetFont('Helvetica', 'B', 12,' ' , 'false');
	$pdf->addTextWrap(60, $Bottom_Margin+(2*$line_height),200,$FontSize,"Signed By",'left');
			$pdf->SetFont('Helvetica', '', 12,' ' , 'false');
$pdf->addTextWrap(160, $Bottom_Margin+(2*$line_height),200,$FontSize,"____________________________",'left');
	$pdf->SetFont('Helvetica', 'B', 12,' ' , 'false');
	
		
		//$pdf->addTextWrap(380, $Bottom_Margin+($line_height-1),200,9,"Powered by E-Business",'left');
			//$pdf->addTextWrap(60, $Bottom_Margin+($line_height-1),200,9,"Email: ".$myrow50['email_address'],'left');
			$DisplayFreight = 0;
			
			
			
	$YPos -= $line_height;
	/*rule off for total */
		//	$pdf->line($Page_Width-$Right_Margin-222, $YPos+7,$Page_Width-$Right_Margin,$YPos+7);
$YPos -= $FontSize;
	//$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-90-655, $YPos, 655, $FontSize, _('GRAND TOTAL'), 'right');
	//$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-90, $YPos, 90, $FontSize, _('$').$grand, 'right');
	$YPos -= $FontSize;





	// Print salesorders.comments:
	$YPos -= $FontSize*3;
	//$pdf->addText($XPos+550, $YPos+$FontSize, $FontSize, _('Supervision Signiture By:'));
    //$pdf->addText($XPos+650, $YPos+$FontSize, $FontSize, $received_by);
//$pdf->line($Page_Width-$Right_Margin-222, $YPos+$FontSize*-1,$Page_Width-$Right_Margin,$YPos+$FontSize*-1);

//
	//$pdf->addText($XPos+550, $YPos+$FontSize*-2, $FontSize, _('Authorized By:'));
   // $pdf->addText($XPos+650, $YPos+$FontSize*-2, $FontSize, $authorized_by);
//$pdf->line($Page_Width-$Right_Margin-222, $YPos+$FontSize*-3.5,$Page_Width-$Right_Margin,$YPos+$FontSize*-3.5);

	//$pdf->addText($XPos, $YPos+$FontSize-45, $FontSize, _('Comments').':');
	$Width2 = $Page_Width-$Right_Margin-120;// Width to print salesorders.comments.
$LeftOvers =	$pdf->addText($XPos, $YPos+$FontSize-55, $FontSize, $narrative);
	//$LeftOvers = trim($quoteterms);
	//**********
	$LeftOvers = str_replace('\n', ' ', $LeftOvers);// Replaces line feed character.
	$LeftOvers = str_replace('\r', '', $LeftOvers);// Delete carriage return character
	$LeftOvers = str_replace('\t', '', $LeftOvers);// Delete tabulator character
	//**********
	while(mb_strlen($LeftOvers) > 1) {
		$YPos -= $FontSize;
		if ($YPos < ($Bottom_Margin)) {// Begins new page.
			include ('includes/PDFEmployeeTaxStatementheader.inc');
		}
		$LeftOvers = $pdf->addTextWrap(40, $YPos, $Width2, $FontSize, $LeftOvers);
	}

		
	
	

	
	

ob_end_clean();
	 //its not an email just print the invoice to PDF
		$pdf->OutputD('EmployeeTaxReport_' . $employeeid. '.pdf');

		
		
	
	$pdf->__destruct();
		
			
	
	
				
		
		
		
			    
		
	
//echo 'Quotation Created Successfully'. $jobno.'!';




//echo 'Quotation Created Successfully'. $jobno.'!';
echo '</div>';
echo '</div>';

//include('includes/footer.inc'); 

?>

