<?php
$getid = $link->hrefquery ();
$getdata = explode ( "///", $getid [1] );
$getid [1] = $getdata [1];
$month = $getdata [0];
$getdata = $db->get_row ( "salaryslipdata", array ("emp_id" => $getid [1] ) );
$companydata = $db->get_row ( "setting", array ("id" => 1 ) );
// get the data of particular employee
$query = $db->get_row ( "payslip", array ("empname" => $getid [1], "payslipdate" => $month ) );
// geth the name of particular employee
$empname = $db->get_row ( "employees", array ("e_id" => $getid [1] ) );

$unserialize_arr = unserialize ( $getdata ['metavalue'] );
$upper_part = $unserialize_arr [0] [0];
$earning_part = $unserialize_arr [0] [1];
$deduction_part = $unserialize_arr [0] [2];
$footer_part = $unserialize_arr [0] [3];

// echo '<pre>'; print_r ( $footer_part ); echo '</pre>';

// $array_count_upper= array_co
//
$total_firstkey = count ( $upper_part );
$total_secondkey = count ( $earning_part );
$total_fourthkey = count ( $footer_part );
$html = '<html>
<title>' . $companydata ['c_name'] . '</title>
<head>
<style>
@media print {
	tr.vendorListHeading {
		background-color: darkseagreen !important;
		-webkit-print-color-adjust: exact;
	}
}
</style>
</head>
<body>
	<div style="margin-left: 10%; width: 100%;">
		<table style="float:left;width: 95%;">
			<tr>
				<td rowspan="6" style="width: 100px;"><img
					src=' . SITE_URL . '/uploads/image/' . $companydata ['c_logo'] . '
					style="width: 93px; height: 93px"></td>
			</tr>
			<tr>
				<td><b style="color: #929494;">' . $companydata ['c_name'] . '</b></td>
				<td style="float:right;width:20%; color: #929494;"><b>Employee</b></td>
				
				<td style="width:20%; color: #929494;">' . $empname ['e_name'] . '</td>
			</tr>
			<tr>
				<td><b style="color: #929494;">' . $companydata ['address'] . '</b></td>
				<td style="float:right;width:20%; color: #929494;"><b>Month</b></td>
				<td style="width:20%; color: #929494;">'.$query['payslipdate'].'</td>
			</tr>
			<tr>
				<td><b>
						<span style="color: #929494;">';
					?>						
<?php

if ($companydata ['telephone'] != '') {
	$html .= $companydata ['telephone'];
}
if ($companydata ['telephone'] != '' && $companydata ['telephone2'] != '') {
	$html .= $companydata ['telephone'] . '' . ',' . $companydata ['telephone2'] . '';
}
if ($companydata ['telephone2'] != '') {
	$html .= $companydata ['telephone2'];
}
$html .= '</span>
					</b></td>
					<td style="float:right;width:15%; color: #929494;"><b>Department</b></td>
					<td style="width:15%; color: #929494;">';
?><?php

$dep = $db->get_col ( "departments", array ("id" => $empname ['department'] ), "name" );
$html .= $dep [0];
$html .= '</td>
			</tr>
			<tr>
				<td><b style="color: #929494;">' . $companydata ['c_email'] . '</b></td>
				<td style="float:right;width:20%; color: #929494;"><b>Address</b></td>
				<td style="width:20%; color: #929494;">' . $empname ['address'] . '</td>
			</tr>
			<tr>
				<td><b style="color: #929494;">' . $companydata ['website'] . '</b></td>
				<td style="float:right;width:20%; color: #929494;"><b>Phone</b></td>
				<td style="width:20%; color: #929494;">' . $empname ['mobile'] . '</td>
			</tr>
		</table>
	</div>




	<table style="margin-left: 10%; width: 100%;">
		<tr>
			<td colspan="6" style="color: #000;"><hr></td>
		</tr>
	</table>
	<table style="margin-left: 10%; width: 100%;">
		<tr>
			<td style="width:25%;"><b>Employee Income</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['employment_income'] . '</p></td>
			<td style="width:15%;"><b>Employee Expenses</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['employment_expences'] . '</p></td>
			
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
		</tr>
		<tr>
			<td style="width:40%;"><b>Emp Code</b></td>
			<td style="width:10%;"><p>' . $query ['empcode'] . '</p></td>
			<td style="width:25%;"><b>Net Employment Income</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['net_employment_income'] . '</p></td>
			
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
		</tr>
		<tr>
			<td style="width:40%;"><b>Num Of Days(Present)</b></td>
			<td style="width:10%;"><p>' . $query ['presentday'] . '&nbsp;days' . '</p></td>
			<td style="width:25%;"><b>Total Leaves</b></td>
			<td style="width:25%;"><p>' . $query ['total_leaves'] . '&nbsp;days' . '</p></td>
			
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
		</tr>
		<tr>
			<td style="width:40%;"><b>Num Of Weekend Presents</b></td>
			<td style="width:10%;"><p>' . $query ['extrawork'] . '&nbsp;days' . '</p></td>
			<td style="width:25%;"><b>Weeks Off</b></td>
			<td style="width:25%;"><p>' . $query ['weekoff'] . '&nbsp;days' . '</p></td>
		</tr>
	</table>
	
	<br>	 
	<table style="margin-left: 10%; width: 100%;">
		<tr>
			<td></td>
		</tr>
		<tr>
			<td><b style="color:rgb(36, 205, 219);">RELIEFS / DEDUCTIONS</b></td>
		</tr>
		<tr>
			<td  style="color: #000;">
				<hr>
			</td>
		</tr>
	</table>
	<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td style="width:25%;"><b>Earned Income Relief</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['earned_income_relief'] . '</p></td>
			<td style="width:40%;"><b>Spouse/handicapped spouse relief</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['spouse_relief'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b>Qualifying/handicapped child relief</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['qualifying_relief'] . '</p></td>
			<td style="width:40%;"><b>Working mother"s child relief</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['mother_relief'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b>Parent/handicapped parent relief</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['parent_relief'] . '</p></td>
			<td style="width:40%;"><b>Grandparent caregiver relief</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['grandparent_relief'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b>Parent/handicapped parent relief</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['parent_relief'] . '</p></td>
			<td style="width:40%;"><b>Grandparent caregiver relief</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['grandparent_relief'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b>Handicapped brother/sister relief</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['brosis_relief'] . '</p></td>
			<td style="width:40%;"><b>CPF/provident Fund relief</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['cpf_relief'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b>Life Insurance relief</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['life_insurance_relief'] . '</p></td>
			<td style="width:40%;"><b>Course Fee relief</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['coursefee_relief'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b>Foreign maid leavy relief</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['life_insurance_relief'] . '</p></td>
			<td style="width:40%;"><b>CPF cash top-up relief(self, dependent and medisave account)</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['cpf'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b>Supplementary Retirement Scheme (SRS) relief</b></td>
			<td style="width:25%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['srs'] . '</p></td>
			<td style="width:40%;"><b>NSman(Self/Wife/Parent) relief</b></td>
			<td style="width:10%;"><p>' . $companydata ['currency'] . '&nbsp;' . $query ['nsman'] . '</p></td>
		</tr>
	</table>
	<br>	 
	<table style="margin-left: 10%; width: 100%;">
		<tr>
			<td></td>
		</tr>
		<tr>
			<td><b style="color:rgb(36, 205, 219);">CALCULATED</b></td>
		</tr>
		<tr>
			<td  style="color: #929494;">
				<hr>
			</td>
		</tr>
	</table>
	<table style="margin-left: 10%; width: 100%;">
		<tr>
			<td style="width:25%;"><b style="color:#929494;">Assessable Income</b></td>
			<td style="width:25%;"><p style="color:#929494;">' . $companydata ['currency'] . '&nbsp;' . $query ['assessableincome'] . '</p></td>
			<td style="width:40%;"><b style="color:#929494;">Chargeable Income</b></td>
			<td style="width:10%;"><p style="color:#929494;">' . $companydata ['currency'] . '&nbsp;' . $query ['chargeableincome'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b style="color:#929494;">Tax Payable On Chargeable Income</b></td>
			<td style="width:25%;"><p style="color:#929494;">' . $companydata ['currency'] . '&nbsp;' . $query ['chargeableincometax'] . '</p></td>
			<td style="width:40%;"><b style="color:#929494;">Parenthood Tax Rebate</b></td>
			<td style="width:10%;"><p style="color:#929494;">' . $companydata ['currency'] . '&nbsp;' . $query ['parenthood_tax'] . '</p></td>
		</tr>
		<tr>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td>
			<td style="width:25%;"></td> 
		</tr>
		<tr>
			<td style="width:25%;"><b style="color:#929494;">Net Tax Payable</b></td>
			<td style="width:25%;"><p style="color:#929494;">' . $companydata ['currency'] . '&nbsp;' . $query ['nettax_payable'] . '</p></td>
		</tr>
	</table>
	<br><br>
	<table style="margin-left: 10%; width: 100%;">
		<tr style="">
			<td style="font-size: 12px; color: #929494;text-align: center;">' . GENERATED . '</td>
		</tr>
	</table>
</body>
</html>';
?>

<?php
$getempname= $db->get_col("employees", array("e_id"=>$getid[1]), 'e_name');
$filename = SERVER_ROOT . '/uploads/pdf/'.$getempname[0]."_".$month. "_invoice.html";
file_put_contents ( $filename, $html );
?>
<html>
<title>Payslip</title>
<head>
<style>
@media print {
	tr.vendorListHeading {
		background-color: darkseagreen !important;
		-webkit-print-color-adjust: exact;
	}
}
</style>
</head>
<body>
	<table style="margin-left: 10%; width: 80%;" id="table1">
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 32%;"></td>
			<td style="width: 18%;"><span onclick=""
				style="color: #3366FF; font-family: sans-serif; cursor: pointer;"
				class="print">Print</span> &nbsp;,&nbsp; <span> <a
					href="<?php echo $link->link("pdfgenerate", Admin,'?id='.$getid[1].'&month='.$month);?>"
					style="text-decoration: none; font-family: sans-serif; color: #3366FF; cursor: pointer;"
					class="pdf"> PDF Generate </a>
			</span></td>
		</tr>
	</table>
	<div style="margin-left: 10%; width: 80%;">
		<table style="float: left; width: 40%;">
			<tr>
				<td rowspan="6" style="width: 100px;"><img
					src="<?php echo SITE_URL.'/uploads/image/'.$companydata['c_logo'];?>"
					style="width: 93px; height: 93px"></td>
			</tr>
			<tr>
				<td><b
					style="color: #929494; font-family: sans-serif; font-size: 12px;"><?php echo $companydata['c_name'];?></b></td>
			</tr>
			<tr>
				<td><b
					style="color: #929494; font-family: sans-serif; font-size: 12px;"><?php echo $companydata['address'];?></b></td>
			</tr>
			<tr>
				<td><b> <span
						style="color: #929494; font-family: sans-serif; font-size: 12px;"><?php
						
						if ($companydata ['telephone'] != '') {
							echo $companydata ['telephone'];
						}
						if ($companydata ['telephone'] != '' && $companydata ['telephone2'] != '') {
							echo $companydata ['telephone'] . '' . ',' . $companydata ['telephone2'] . '';
						}
						if ($companydata ['telephone2'] != '') {
							echo $companydata ['telephone2'];
						}
						?></span> <!-- , <span> <?php //echo $companydata['fax'];?></span> -->
				</b></td>
			</tr>
			<tr>
				<td><b
					style="color: #929494; font-family: sans-serif; font-size: 12px;"><?php echo $companydata['c_email'];?></b></td>
			</tr>
			<tr>
				<td><b
					style="color: #929494; font-family: sans-serif; font-size: 12px;"><?php echo $companydata['website'];?></b></td>
			</tr>
		</table>
		<table style="width: 20%; float: right;">
			<tr>
				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><b>Employee</b></td>

				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><?php echo $empname['e_name'];?></td>
			</tr>
			<tr>
				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><b>Month</b></td>

				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;">
					<?php
					echo $query['payslipdate'];
					?>
				</td>
			</tr>
			<tr>
				<td
					style=" width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><b>Department</b></td>

				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><?php
					$dep = $db->get_col ( "departments", array ("id" => $empname ['department'] ), "name" );
					echo $dep [0];
					?></td>
			</tr>

			<tr>
				<td
					style=" width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><b>Address</b></td>

				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><?php echo $empname['address'];?></td>
			</tr>
			<tr>
				<td
					style=" width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><b>Phone</b></td>

				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><?php echo $empname['mobile'];?></td>
			</tr>
			<tr>
				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><b>Emp
						Code</b></td>

				<td
					style="width: 10%; color: #929494; font-family: sans-serif; font-size: 12px;"><p><?php echo $query['empcode'];?></p></td>
			</tr>
		</table>
	</div>


	<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td colspan="6" style="color: #000;"><hr></td>
		</tr>
	</table>
	<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Employee
					Expenses</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['employment_expences'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Employee
					Income</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['employment_income'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Net
					Employment Income</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['net_employment_income'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"></td>

		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Num Of Days(<?php echo substr ( $current_month, 0, 3 );?>)</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $query['paidday'].'&nbsp;days';?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Num
					Of Days(Present)</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $query['presentday'].'&nbsp;days';?></p></td>

		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Total
					Leaves</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $query['total_leaves'].'&nbsp;days';?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Num
					Of Weekend Presents</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $query['extrawork'].'&nbsp;days';?></p></td>

		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 20%; font-family: sans-serif; font-size: 10px;"><b>Weeks
					Off</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $query['weekoff'].'&nbsp;days';?></p></td>
		</tr>
	</table>	
	<!--<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td></td>
		</tr>
		<tr>
			<td><b
				style="color: rgb(36, 205, 219); font-family: sans-serif; font-size: 10px;">INCOME
					/ EARNINGS</b></td>
		</tr>
		<tr>
			<td style="color: #000;">
				<hr>
			</td>
		</tr>
	</table>-->
	<!--<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Dividends</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['dividends'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Interest</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['interest'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Rent
					Form Property</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['property_rent'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Royalty,
					Charge, Estate/Trust Income</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].''.$query['royality_income'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Gains
					Or Profits Of An Income Nature</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['gain_income_nature'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Royalty,
					Charge, Estate/Trust Income</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['royality_income'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Total
					Income</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['total_income'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Approved
					Donations</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['approved_donations'];?></p></td>
		</tr>
	</table>-->
	<br>
	<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td></td>
		</tr>
		<tr>
			<td><b
				style="color: rgb(36, 205, 219); font-family: sans-serif; font-size: 10px;">RELIEFS
					/ DEDUCTIONS</b></td>
		</tr>
		<tr>
			<td style="color: #000;">
				<hr>
			</td>
		</tr>
	</table>
	<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Earned
					Income Relief</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['earned_income_relief'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Spouse/handicapped
					spouse relief</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['spouse_relief'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Qualifying/handicapped
					child relief</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['qualifying_relief'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Working
					mother's child relief</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['mother_relief'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Parent/handicapped
					parent relief</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['parent_relief'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Grandparent
					caregiver relief</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['grandparent_relief'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Parent/handicapped
					parent relief</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['parent_relief'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Grandparent
					caregiver relief</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['grandparent_relief'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Handicapped
					brother/sister relief</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['brosis_relief'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>CPF/provident
					Fund relief</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['cpf_relief'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Life
					Insurance relief</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['life_insurance_relief'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>Course
					Fee relief</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['coursefee_relief'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Foreign
					maid leavy relief</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['life_insurance_relief'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>CPF
					cash top-up relief(self, dependent and medisave account)</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['cpf'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b>Supplementary
					Retirement Scheme (SRS) relief</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['srs'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b>NSman(Self/Wife/Parent)
					relief</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p><?php echo $companydata['currency'].'&nbsp;'.$query['nsman'];?></p></td>
		</tr>
	</table>
	<br>
	<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td></td>
		</tr>
		<tr>
			<td><b
				style="color: rgb(36, 205, 219); font-family: sans-serif; font-size: 10px;">CALCULATED</b></td>
		</tr>
		<tr>
			<td style="color: #929494;">
				<hr>
			</td>
		</tr>
	</table>
	<table style="margin-left: 10%; width: 80%;">
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b
				style="color: #929494;">Assessable Income</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p
					style="color: #929494;"><?php echo $companydata['currency'].'&nbsp;'.$query['assessableincome'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b
				style="color: #929494;">Chargeable Income</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p
					style="color: #929494;"><?php echo $companydata['currency'].'&nbsp;'.$query['chargeableincome'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b
				style="color: #929494;">Tax Payable On Chargeable Income</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p
					style="color: #929494;"><?php echo $companydata['currency'].'&nbsp;'.$query['chargeableincometax'];?></p></td>
			<td style="width: 40%; font-family: sans-serif; font-size: 10px;"><b
				style="color: #929494;">Parenthood Tax Rebate</b></td>
			<td style="width: 10%; font-family: sans-serif; font-size: 10px;"><p
					style="color: #929494;"><?php echo $companydata['currency'].'&nbsp;'.$query['parenthood_tax'];?></p></td>
		</tr>
		<tr>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
			<td style="width: 25%;"></td>
		</tr>
		<tr>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><b
				style="color: #929494;">Net Tax Payable</b></td>
			<td style="width: 25%; font-family: sans-serif; font-size: 10px;"><p
					style="color: #929494;"><?php echo $companydata['currency'].'&nbsp;'.$query['nettax_payable'];?></p></td>
		</tr>
	</table>
	<br>
	<br>
	<table style="margin-left: 10%; width: 80%;">
		<tr style="text-align: center; color: #929494;">
			<td
				style="font-size: 12px; font-family: sans-serif; font-size: 10px;"><?php echo GENERATED;?></td>
		</tr>
	</table>
</body>
</html>
<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
	$(".print").click(function(){
		$("#table1").hide();
		window.print();
		setTimeout(function(){$("#table1").show()},1000);
		});
	$(".pdf").click(function(){
		$("#table1").hide();
		setTimeout(function(){$("#table1").show()},1000);
		});
});
</script>