<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
//include("test_page.php");	
require_once("../../asset/custom/mpdf/mpdf.php");
$obj=new my_class();
extract($_GET);

$branchid = $_SESSION['LOGIN_BRANCH'];
/* $month;
$year;
$section_id;
$stdid; */
$uniq_id;
$fee_year;
$mon_list;
$batch_no;
$branch_id = isset($_SESSION['LOGIN_BRANCH']) ? $_SESSION['LOGIN_BRANCH']: '';
if($branch_id !=''){
	$brans_obj = $obj->View_branch_details_By_Cond($branch_id,'B');
	$inst_name = $brans_obj->insName;
	$ins_code_name = $brans_obj->insCodeName; 
	$extablishd_year = $brans_obj->_establish_year ;
	$ins_logo = $brans_obj->_logo_location;
	$ins_address = $brans_obj->_address;
	$inst_thanta = $brans_obj->thana_name ;
	$ins_district = $brans_obj->distrinc_name  ;
	$ins_division = $brans_obj->division_name  ;
	$ins_zip_code = $brans_obj->_zip_code;
	$ins_web = $brans_obj->_web_address !='' ? $brans_obj->_web_address : '' ;
	$ins_email = $brans_obj->_email_add !='' ? '|| '.$brans_obj->_email_add : '' ;
	
}

$detail='<html><head>
<title>Students Fee Invoice </title>
	<style>
		.fee_col_left_bottom{
			border-right: 1px solid;
			border-bottom: 1px solid; 
			border-collapse: collapse;
			width: 10%;
			height: 20px;
		}
		.fee_col_left_bottom_summ{
			border-bottom: 1px solid; 
			border-collapse: collapse;
			width: 10%;
			height: 20px;
		}
		.fee_col_middle_bottom{
			border-right: 1px solid;
			border-bottom: 1px solid; 
			border-collapse: collapse;
			width: 70%;
			height: 20px;
		}
		.fee_col_right_bottom{
			border-left:1px solid;
			border-bottom: 1px solid; 
			border-collapse:collapse;
			width: 20%;
			height: 20px;
		}
		.fee_col_left_top{
			border-top:1px solid; 
			border-right:1px solid;
			border-bottom: 1px solid; 
			border-collapse:collapse;
			width: 10%;
			height: 20px;
		}
		.fee_col_left_top_summ{
			border-top:1px solid;
			border-bottom: 1px solid; 			
			border-collapse:collapse;
			width: 10%;
			height: 20px;
		}
		.fee_col_middle_top{
			border-top:1px solid; 
			border-right:1px solid;
			border-bottom: 1px solid; 
			border-collapse:collapse;
			width: 70%;
			height: 20px;
		}
		.fee_col_right_top{
			border-top:1px solid; 
			border-left:1px solid;
			border-bottom: 1px solid; 
			border-collapse:collapse;
			width: 20%;
			height: 20px;
		}
		.fee_col_left{
			border-right: 1px solid;
			border-collapse: collapse;
			width: 10%;
			height: 20px;
		}
		.fee_col_left_summ{
			width: 10%;
			height: 20px;
		}
		.fee_col_middle{
			border-right: 1px solid;
			border-collapse: collapse;
			width: 70%;
			height: 20px;
		}
		.fee_col_right{
			border-left: 1px solid;
			border-collapse: collapse;
			width: 20%;
			height: 20px;
		}
	</style>
	</head>
	<body>';
function numberTowords($num){ 
	$ones = array( 1 => "One", 2 => "Two", 3 => "Three", 4 => "Four", 5 => "Five", 6 => "Six", 7 => "Seven", 8 => "Eight", 9 => "Nine", 10 => "Ten", 11 => "Eleven", 12 => "Twelve", 
					13 => "Thirteen", 14 => "Fourteen", 15 => "Fifteen", 16 => "Sixteen", 17 => "Seventeen", 18 => "Eighteen", 19 => "Nineteen"); 
	
	$tens = array( 1 => "Ten", 2 => "Twenty", 3 => "Thirty", 4 => "Forty", 5 => "Fifty", 6 => "Sixty", 7 => "Seventy", 8 => "Eighty", 9 => "Ninety" ); 
	
	$hundreds = array( "Hundred", "Thousand", "Million", "Billion", "Trillion", "Quadrillion" ); //limit t quadrillion 

	$num = number_format($num,2,".",","); 
	$num_arr = explode(".",$num); 
	$wholenum = $num_arr[0]; 
	$decnum = $num_arr[1]; 
	$whole_arr = array_reverse(explode(",",$wholenum)); 
	krsort($whole_arr); 
	$rettxt = ""; 
	
	foreach($whole_arr as $key => $i){ 
		if($i < 20){ 
			$rettxt .= $ones[$i]; 
		}elseif($i < 100){ 
			$rettxt .= $tens[substr($i,0,1)]; 
			$rettxt .= " ".$ones[substr($i,1,1)]; 
		}else{ 
			$rettxt .= $ones[substr($i,0,1)]." ".$hundreds[0]; 
			$rettxt .= " ".$tens[substr($i,1,1)]; 
			$rettxt .= " ".$ones[substr($i,2,1)]; 
		} 
		if($key > 0){ 
			$rettxt .= " ".$hundreds[$key]." "; 
		} 
	}
	
	if($decnum > 0){ 
		$rettxt .= " and "; 
		
		if($decnum < 20){ 
			$rettxt .= $ones[$decnum]; 
		}elseif($decnum < 100){ 
			$rettxt .= $tens[substr($decnum,0,1)]; 
			$rettxt .= " ".$ones[substr($decnum,1,1)]; 
		} 
	} 
	return $rettxt; 
} 
// add a page
$std_info_cols = "isv.medium,isv.class AS class_name,isv.class_id AS class_id,isv.department AS dept_name,isv.department_id AS dept_id,
				isv.section AS section_name, isv.section_id AS sec_id,psf._id AS std_id,psf._full_name AS std_name,
				psf._section_roll AS std_sec_roll";
$std_info_tables = "_pf_std_personal_info psf LEFT JOIN _pf_std_basic_info pbf ON psf._id=pbf._pid
					LEFT JOIN _int_institute_setup_vw isv ON pbf._section_id=isv.section_id";
$std_info_where_cond = "psf._uniq_id='$uniq_id' AND pbf._session='$fee_year' AND psf._status='A'";
$std_info = $obj->View_column_details_By_Cond($std_info_tables,$std_info_cols,$std_info_where_cond);
$std_id = $std_info['std_id'];
if($std_info['medium']=='Bangla' || $std_info['medium']=='Toddler'){
	//$im='../../asset/custom/upload/deen_bangla_logo.png';
	$ins_logo='asset/custom/upload/deen_bangla_logo.png';
	$image = '<img src="../../'.$ins_logo.'" style="top:15px; height:150px; float:left;margin-left: 12px;" title="logo" alt="" id="image" />';
}
else{
	//$im='../../asset/custom/upload/deen_english_logo.png';
	$ins_logo='asset/custom/upload/deen_english_logo.png';
	$image = '<img src="../../'.$ins_logo.'" style="top:15px; height:120px; float:left;margin-left: 12px;" title="logo" alt="" id="image" />';
}
$month_list='';
$month_name_list='';
$inv_no_list='';
$no_of_month=0;
$prev_mon=1;
$is_consecutive=0;
$std_yearly_tot_amount = 0;
$std_yearly_due_amount = 0;
$std_yearly_dis_amount = 0;
$std_yearly_paid_amount = 0;
$std_last_paid_amount = 0;
$num_of_empty_row=9;
$fee_master_cols = "_invoice_no,_month,_total_amount,_due_amount,_discount,_paid_amount,_payment_date,_last_paid_amount";
if($mon_list!=0){
	$fee_master_where_cond = "_std_id='$std_id' AND _year='$fee_year' AND _month IN ($mon_list) ORDER BY CONVERT(_month, DECIMAL) ASC";
}
else if($batch_no!=0){
	echo $fee_master_where_cond = "_std_id='$std_id' AND _year='$fee_year' AND _payment_batch_no='$batch_no' ORDER BY CONVERT(_month, DECIMAL) ASC";
}
else{
	$fee_master_where_cond = "_std_id='$std_id' AND _year='$fee_year' AND _status='P' ORDER BY CONVERT(_month, DECIMAL) ASC";
}
foreach($obj->View_colmn_By_Cond("_fee_master_invoice",$fee_master_cols,$fee_master_where_cond) AS $fee_master_info){
	extract($fee_master_info);
	$no_of_month++;
	$mon_no = $fee_master_info['_month'];
	if($prev_mon==$mon_no){
		$is_consecutive=1;
	}
	else{ $is_consecutive=0; }
	$prev_mon++;
	$month_list .= $fee_master_info['_month'].',';
	$month_name = $obj->Month($fee_master_info['_month']);
	$month_name_list .= substr($month_name, 0, 3).',';
	$inv_no_list .= $fee_master_info['_invoice_no'].',';
	$std_yearly_tot_amount = $std_yearly_tot_amount + $fee_master_info['_total_amount'];
	$std_yearly_due_amount = $std_yearly_due_amount + $fee_master_info['_due_amount'];
	$std_yearly_dis_amount = $std_yearly_dis_amount + $fee_master_info['_discount'];
	$std_yearly_paid_amount = $std_yearly_paid_amount + $fee_master_info['_paid_amount'];
	$std_last_paid_amount = $std_last_paid_amount + $fee_master_info['_last_paid_amount'];
	if(!empty($fee_master_info['_payment_date'])){ 
		if($fee_master_info['_payment_date']=='0000-00-00'){$f_date = '';}
		else { 
			$f_date = date('d/m/Y',strtotime($fee_master_info['_payment_date'])); 
			//$f_date =$paid_date['_entry_date'];
		}
	}
}

$std_yearly_tot_amount = number_format( (float)($std_yearly_tot_amount), 2, '.', '');
$std_yearly_due_amount = number_format( (float)($std_yearly_due_amount), 2, '.', '');
$std_yearly_dis_amount = number_format( (float)($std_yearly_dis_amount), 2, '.', '');
$std_yearly_paid_amount = number_format( (float)($std_yearly_paid_amount), 2, '.', '');
$std_last_paid_amount = number_format( (float)($std_last_paid_amount), 2, '.', '');

$imi ='';
if($std_yearly_due_amount==0){
	$imi ='<img src="invoice_report/circular_paid_stamp.png" style="top:15px;height:250px; float:right;margin-left: 12px;"/>'; 
}
else if($std_yearly_tot_amount>($std_yearly_paid_amount+$std_yearly_dis_amount) && ($std_yearly_paid_amount+$std_yearly_dis_amount)!=0){
	$imi ='<img src="invoice_report/circular_received_stamp.png" style="top:15px;height:200px; float:right;margin-left: 12px;" />'; 
}
else if($std_yearly_tot_amount==$std_yearly_due_amount){
	$imi ='<img src="invoice_report/empty_img_for_unpaid_status.png" style="top:15px;height:200px; float:right;margin-left: 12px;" />'; 
}
$month_list = substr($month_list, 0, -1);
$month_name_list = substr($month_name_list, 0, -1);
$inv_no_list = substr($inv_no_list, 0, -1);
$mon_list_array = explode(",",$month_name_list);

if($is_consecutive==1){
	if($no_of_month == 3){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[2];
	}
	if($no_of_month == 4){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[3];
	}
	if($no_of_month == 5){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[4];
	}
	if($no_of_month == 6){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[5];
	}
	if($no_of_month == 7){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[6];
	}
	if($no_of_month == 8){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[7];
	}
	if($no_of_month == 9){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[8];
	}
	if($no_of_month == 10){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[9];
	}
	if($no_of_month == 11){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[10];
	}
	if($no_of_month == 12){
		$month_name_list = $mon_list_array[0].'-'.$mon_list_array[11];
	}
}
else{
	if($no_of_month > 6){
		$month_name_list = wordwrap($month_name_list, 24, "\n", true);	
	}
	if($no_of_month == 12){
		$month_name_list = 'Jan-Dec';
	}
}
$fee_head_list=array();
$in=0;
$fee_head_where_cond = "_year='$fee_year' AND _invoice_no IN ($inv_no_list) GROUP BY _fee_head  ORDER BY _id";
foreach($obj->View_colmn_By_Cond("_fee_details_invoice","_fee_head",$fee_head_where_cond) AS $fee_head_info){
	extract($fee_head_info);
	$fee_head_list[$in]= $fee_head_info['_fee_head'];
	$in++;
}
	$detail .= '<table style="width: 100%; padding-top:20px;">
	<tr>';
	//student copy column
	$detail .= '<td style="width: 32%; padding-right:10px;">
					<table style="width:100%; margin-right:12px;">';
	//row holds student copy school info				
	$detail .= '		<tr>
							<td>
								<!--school info table -->
								<table style="width: 100%; margin-right:5px;">
									<tr style="width: 100%;">
										<td style="width: 100%; text-align: center;">
											<p style="font-size: 35px; text-align: center;"><b>'.$inst_name.'</b></p>
										</td>
									</tr>
									<tr style="width: 100%;">
										<td style="width: 80%; text-align: center; font-size: 20px;">
											<p><b>'.$ins_address.'<br>'.$inst_thanta.', '.$ins_district.'-'.$ins_zip_code.'</b></p>
											<p>'.$image.'</p>
										</td>
									</tr>
									<tr style="width: 100%;">
										<td style="width: 100%; text-align: center;">
											<p style="font-size: 26px;"><b>Money Receipt (Accounts Copy)</b></p>
										</td>	
									</tr>
								</table>
							</td>
						</tr>';
	//row holds student copy student info
	$detail .= '		<tr>
							<td>
								<table style="width:100%; height:80px; border-collapse: collapse;">
									<tr> 
										<td style="width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Payment Date :<br/><b>'.$f_date.'</b></p></td>	
										<td  style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Billing Month :<br/><b>'. $month_name_list.'</b></p></td>
									</tr>
									<tr>
										<td colspan="2" style="width: 100%; height: 3px; text-align: left;"><p style="font-size: 18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></td>
									</tr>
									<tr>
										<td colspan="2" style="width: 100%; height: 20px; text-align: left;"><p style="font-size: 28px;">Name : <b>'.$std_info['std_name'].'</b></p></td> 
									</tr>
									<tr> 
										<td style="width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">ID  : <b>'.$uniq_id.'</b></p></td>	
										<td  style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Roll : <b>'.$std_info['std_sec_roll'].'</b></p></td>
									</tr>
									<tr> 
										<td style="width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Class : <b>'.$std_info['class_name'].'</b></p></td>
										<td style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Sec : <b>'.$std_info['section_name'].'</b></p></td>												
										<!--<td style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Dept : <b>'. $std_info['dept_name'].'</b></p></td>-->												
									</tr>
								</table>
							</td>
						</tr>
						<!--<tr><td style="width: 100%; height: 3px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>-->';
	//row holds student copy fee info
	$detail .= '		<tr>
							<td style="border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;">
								<table style="width:100%; border-collapse: collapse;">
								<tr>
									<td class="fee_col_left_bottom" style="font-weight: bold; text-align: center;"><p style="font-size: 26px;">Sl</p></td>
									<td class="fee_col_middle_bottom" style="font-weight: bold; text-align: center;"><p style="font-size: 26px;">Description</p></td>
									<td class="fee_col_right_bottom" style="font-weight: bold; text-align: center;" ><p style="font-size: 26px;">Amount</p></td>
								</tr>';
							$in_std=0;
							for($j=0; $j<$in; $j++){
								$in_std++;
								$fee_head_amount_where_cond = "_year='$fee_year' AND _invoice_no IN ($inv_no_list) AND _fee_head='".$fee_head_list[$j]."'";
								$fee_head_amount_info = $obj->View_column_details_By_Cond("_fee_details_invoice","SUM(_amount) AS fee_amount",$fee_head_amount_where_cond);
								$show_fee_amount="";
								if($fee_head_list[$j]=='Discount'){
									$show_fee_amount = '(-)'.$fee_head_amount_info['fee_amount'];
								}
								else{
									$show_fee_amount = $fee_head_amount_info['fee_amount'];
								}
								$detail .='<tr>
												<td class="fee_col_left" style="text-align: center;"><p style="font-size: 26px;"><p style="font-size: 26px;">'.$in_std.'</p></td>
												<td class="fee_col_middle" style="text-align: left;"><p style="font-size: 26px;"><p style="font-size: 26px;">&nbsp;&nbsp;'.$fee_head_list[$j].'</p></td>
												<td class="fee_col_right" style="text-align: right;"><p style="font-size: 26px;"><p style="font-size: 26px;">'.$show_fee_amount.'&nbsp;&nbsp;</p></td>
											</tr>';
								
							}
							for($i=$in_std+1; $i<=$num_of_empty_row; $i++){
								if($i==($num_of_empty_row-2)){
									$detail .= '<tr>
											<td class="fee_col_left" style="text-align: center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
											<td class="fee_col_middle" style="text-align: center; padding-right: 30px;">'.$imi.'</td>
											<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										</tr>';
								}
								else{
									$detail .= '<tr>
												<td class="fee_col_left" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
												<td class="fee_col_middle" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
												<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
											</tr>';
								}
							}
							if($in_std==$num_of_empty_row || $in_std==($num_of_empty_row-2) || $in_std==($num_of_empty_row-1)){
									$detail .= '<tr>
											<td class="fee_col_left" style="text-align: center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
											<td class="fee_col_middle" style="text-align: center; padding-right: 30px;">'.$imi.'</td>
											<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										</tr>';
								}
							$detail .='<tr>
											<td class="fee_col_left_top_summ" style="text-align: right;"><p style="font-size: 26px;"></p></td>
											<td class="fee_col_middle_top" style="text-align: right;"><p style="font-size: 26px;"><b>Total Payable Amount&nbsp;</b></p></td>
											<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_tot_amount.'&nbsp;</b></p></td>
										</tr>';
							$detail .='<tr>
											<td class="fee_col_left_top_summ" style="text-align: right;"><p style="font-size: 26px;"></p></td>
											<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Discount&nbsp;</b></p></td>
											<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_dis_amount.'&nbsp;</b></p></td>
										</tr>'; 
							$detail .='<tr>
											<td class="fee_col_left_top_summ" style="text-align: right;"><p style="font-size: 26px;"></p></td>
											<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Total Received Amount&nbsp;</b></p></td>
											<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_paid_amount.'&nbsp;</b></p></td>
										</tr>'; 
							$detail .='<tr>
											<td class="fee_col_left_top_summ" style="text-align: right;"><p style="font-size: 26px;"></p></td>
											<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Last Received Amount&nbsp;</b></p></td>
											<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_last_paid_amount.'&nbsp;</b></p></td>
										</tr>'; 
							$detail .='<tr>
											<td class="fee_col_left_summ" style="text-align: right;" ><p style="font-size: 26px;"></p></td>
											<td class="fee_col_middle" style="text-align: right;" ><p style="font-size: 26px;"><b>Due&nbsp;</b></p></td>
											<td class="fee_col_right" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_due_amount.'&nbsp;</b></p></td>
									</tr>';
							$detail .= '				
															</table>
														</td>
													</tr>
											<tr><td style="width: 100%; height: 20px;"><p style="font-size: 20px;">(In Words):&nbsp;<span style="border-bottom: 3px dotted;">'.numberTowords($std_yearly_tot_amount).' Taka Only</span></p></td></tr>
											<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
											<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
											<!--<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>-->
											<tr><td>
												<table style="width:100%;">
													<tr>
														<td  style="height: 20px; text-align: left; font-weight: bold;"><p style="font-size: 20px;">_ _ _ _ _ _ _ _</p></td>
														<td style="height: 20px; text-align: right; font-weight:bold;"><p style="font-size: 20px;">_ _ _ _ _ _ _ _</p></td>
													</tr>
													<tr>
														<td  style="height: 20px; text-align: left; font-weight: bold;"><p style="font-size: 20px;">Depositor</p></td>
														<td style="height: 20px; text-align: right; font-weight: bold;"><p style="font-size: 20px;">Received by F.Afrin</p></td>
													</tr>
													<tr>
														<td  style="height: 20px; text-align: left;"><p style="font-size: 20px;">Printed By: <b>'.$_SESSION["LOGIN_USER"].'</b></p></td>
														<td style="height: 20px; text-align: right;"><p style="font-size: 20px;">Print Date: <b>'.date("d/m/Y").'</b></p></td>
													</tr>
												</table>
											</td></tr>
										</table>
									</td>';
							//1st dotted line column
							$detail .= '<td style=" width: 2%;border-left: 5px dotted black;"></td>';
							//office copy column
							$detail .= '<td style="width: 32%;">
												<table style="width:100%;">';
	//row holds office copy school info				
	$detail .= '		<tr>
							<td>
								<!--school info table -->
								<table style="width: 100%;">
									<tr style="width: 100%;">
										<td style="width: 100%; text-align: center;">
											<p style="font-size: 35px; text-align: center;"><b>'.$inst_name.'</b></p>
										</td>
									</tr>
									<tr style="width: 100%;">
										<td style="width: 100%; text-align: center; font-size: 20px;">
											<p><b>'.$ins_address.' <br>'.$inst_thanta.', '.$ins_district.'-'.$ins_zip_code.'</b></p>
											<p>'.$image.'</p>
										</td>
									</tr>
									<tr style="width: 100%;">
										<td style="width: 100%; text-align: center;">
											<p style="font-size: 26px;"><b>Money Receipt (Office Copy)</b></p></h2>
										</td>
									</tr>
								</table>
							</td>
						</tr>';				
	//row holds office copy student info
	$detail .= '		
						<tr>
							<td>
								<table style="width:100%; height:80px; border-collapse: collapse;" >
									<tr> 
										<td style="width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Payment Date :<br/><b>'.$f_date.'</b></td>	
										<td  style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Billing Month  :<br/><b>'.$month_name_list.'</b></p></td>
									</tr>
									<tr>
										<td colspan="2" style="width: 100%; height: 3px; text-align: left;"><p style="font-size: 18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></td>
									</tr>
									<tr>
										<td colspan="2" style="width: 100%; height: 20px; text-align: left;"><p style="font-size: 28px;">Name : <b>'.$std_info['std_name'].'</b></p></td>
									</tr>
									<tr> 
										<td style="width: 50%; height: 20px; font-size: 18px; text-align: left;"><p style="font-size: 26px;">ID  : <b>'.$uniq_id.'</b></p></td>	
										<td  style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Roll : <b>'.$std_info['std_sec_roll'].'</b></p></td>
									</tr>
									<tr> 
										<td style="width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;"><p style="font-size: 26px;">Class : <b>'.$std_info['class_name'].'</b></p></td>
										<td style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Sec : <b>'.$std_info['section_name'].'</b></p></td>												
										<!--<td style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Dept : <b>'.$std_info['dept_name'].'</b></p></td>-->												
									</tr>	
								</table>
							</td>
						</tr>
						<!--<tr><td style="width: 100%; height: 3px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>-->';
	//row holds office copy fee info
	$detail .= '		<tr>
							<td style="border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;">
								<table style="width:100%; border-collapse: collapse;">
								<tr>
									<td class="fee_col_left_bottom" style="font-weight: bold; text-align: center;"><p style="font-size: 26px;">Sl</p></td>
									<td class="fee_col_middle_bottom" style="font-weight: bold; text-align: center;"><p style="font-size: 26px;">Description</p></td>
									<td class="fee_col_right_bottom" style="font-weight: bold; text-align: center;"><p style="font-size: 26px;">Amount</p></td>
								</tr>';				
						$in_office=0;
						for($j=0; $j<$in; $j++){
							$in_office++;
							$fee_head_amount_where_cond = "_year='$fee_year' AND _invoice_no IN ($inv_no_list) AND _fee_head='".$fee_head_list[$j]."'";
							$fee_head_amount_info = $obj->View_column_details_By_Cond("_fee_details_invoice","SUM(_amount) AS fee_amount",$fee_head_amount_where_cond);
							$show_fee_amount="";
							if($fee_head_list[$j]=='Discount'){
								$show_fee_amount = '(-)'.$fee_head_amount_info['fee_amount'];
							}
							else{
								$show_fee_amount = $fee_head_amount_info['fee_amount'];
							}
							$detail .='<tr>
											<td class="fee_col_left" style="text-align: center;"><p style="font-size: 26px;">'.$in_office.'</p></td>
											<td class="fee_col_middle" style="text-align: left;"><p style="font-size: 26px;">&nbsp;&nbsp;'.$fee_head_list[$j].'</p></td>
											<td class="fee_col_right" style="text-align: right;"><p style="font-size: 26px;">'.$show_fee_amount.'&nbsp;&nbsp;</p></td>
										</tr>';
						}
						for($i=$in_office+1; $i<=$num_of_empty_row; $i++){
							if($i==($num_of_empty_row-2)){
								$detail .= '<tr>
											<td class="fee_col_left" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
											<td class="fee_col_middle" style="text-align: center; padding-right: 30px;">'.$imi.'</td>
											<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										</tr>';
							}
							else{
								$detail .= '<tr>
										<td class="fee_col_left" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										<td class="fee_col_middle" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
									</tr>';
							}
						}
						if($in_office==$num_of_empty_row || $in_office==($num_of_empty_row-2) || $in_office==($num_of_empty_row-1)){
							$detail .= '<tr>
										<td class="fee_col_left" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										<td class="fee_col_middle" style="text-align: center; padding-right: 30px;">'.$imi.'</td>
										<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
								</tr>';
						}
						$detail .='<tr>
								<td class="fee_col_left_top_summ" style="text-align: right;"><p style="font-size: 26px;"></p></td>
								<td class="fee_col_middle_top" style="text-align: right;"><p style="font-size: 26px;"><b>Total Payable Amount&nbsp;</b></p></td>
								<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_tot_amount.'&nbsp;</b></p></td>
							</tr>';
						$detail .='<tr>
								<td class="fee_col_left_top_summ" style="text-align: right;" ><p style="font-size: 26px;"></p></td>
								<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Discount&nbsp;</b></p></td>
								<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_dis_amount.'&nbsp;</b></p></td>
							</tr>';  
						$detail .='<tr>
								<td class="fee_col_left_top_summ" style="text-align: right;" ><p style="font-size: 26px;"></p></td>
								<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Total Received Amount&nbsp;</b></p></td>
								<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_paid_amount.'&nbsp;</b></p></td>
							</tr>';
						$detail .='<tr>
								<td class="fee_col_left_top_summ" style="text-align: right;" ><p style="font-size: 26px;"></p></td>
								<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Last Received Amount&nbsp;</b></p></td>
								<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_last_paid_amount.'&nbsp;</b></p></td>
							</tr>';   							
						$detail .='<tr>
									<td class="fee_col_left_summ" style="text-align: right;" ><p style="font-size: 26px;"></p></td>
									<td class="fee_col_middle" style="text-align: right;" ><p style="font-size: 26px;"><b>due&nbsp;</b></p></td>
									<td class="fee_col_right" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_due_amount.'&nbsp;</b></p></td>
								</tr>';
	$detail .= '		</table>
					</td>
				</tr>
				<tr><td style="width: 100%; height: 20px;"><p style="font-size: 20px;">(In Words):&nbsp;<span style="border-bottom: 3px dotted;">'.numberTowords($std_yearly_tot_amount).' Taka Only</span></p></td></tr>
				<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
				<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
				<!--<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>-->
				<tr><td>
					<table style="width:100%;">
						<tr>
							<td  style="height: 20px; text-align: left; font-weight: bold;"><p style="font-size: 20px;">_ _ _ _ _ _ _ _</p></td>
							<td style="height: 20px; text-align: right; font-weight: bold;"><p style="font-size: 20px;">_ _ _ _ _ _ _ _</p></td>
						</tr>
						<tr>
							<td  style="height: 20px; text-align: left; font-weight: bold;"><p style="font-size: 20px;">Depositor</p></td>
							<td style="height: 20px; text-align: right; font-weight: bold; "><p style="font-size: 20px;">Received by F.Afrin</p></td>
						</tr>
						<tr>
							<td  style="height: 20px; text-align: left;"><p style="font-size: 20px;">Printed By: <b>'.$_SESSION["LOGIN_USER"].'</b></p></td>
							<td style="height: 20px; text-align: right;"><p style="font-size: 20px;">Print Date: <b>'.date("d/m/Y").'</b></p></td>
						</tr>
						
				 </table>
				</td></tr>
			</table></td>';
	//2nd dotted line column		
	$detail .= '<td style=" width: 2%;border-right: 5px dotted black;"></td>';
	//accounts copy column
	$detail .= '<td style="width: 32%;  padding-left:10px;">
					<table style="width:100%; margin-left:12px;">';
	//row holds accounts copy school info				
	$detail .= '		<tr>
							<td>
								<!--school info table -->
								<table style="width: 100%; margin-left:5px;">
									<tr style="width: 100%;">
										<td style="width: 100%; font-size: 28px; text-align: center;">
											<p style="font-size: 35px; text-align: center;"><b>'.$inst_name.'</b></p>
										</td>
									</tr>
									<tr style="width: 100%;">
										<td style="width: 100%; text-align: center; font-size: 20px;">
											<p><b>'.$ins_address.' <br>'.$inst_thanta.', '.$ins_district.'-'.$ins_zip_code.'</b></p>
											<p>'.$image.'</p>
										</td>
									</tr>
									<tr style="width: 100%;">
										<td style="width: 100%; text-align: center;">
											<p style="font-size: 26px;"><b>Money Receipt (Student Copy)</b></p>
										</td>
									</tr>									
								</table>
							</td>
						</tr>';				
	//row holds accounts copy student info
	$detail .= '
						<tr>
							<td>
								<table style="width:100%; height:80px; border-collapse: collapse;" >
									<tr> 
										<td style="width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Payment Date :<br/><b>'.$f_date.'</b></p></td>	
										<td style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Billing Month  :<br/><b>'.$month_name_list.'</b></p></td>
									</tr>
									<tr>
										<td colspan="2" style="width: 100%; height: 3px; text-align: left;"><p style="font-size: 18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p></td>
									</tr>
									<tr>
										<td colspan="2" style="width: 100%; height: 20px; text-align: left;"><p style="font-size: 28px;">Name : <b>'.$std_info['std_name'].'</b></p></td>
									</tr>
									<tr> 
										<td style="width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">ID  : <b>'.$uniq_id.'</b></p></td>	
										<td style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Roll : <b>'.$std_info['std_sec_roll'].'</b></p></td>
									</tr>
									<tr> 
										<td style="width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Class : <b>'.$std_info['class_name'].'</b></p></td>
										<td style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Dept : <b>'.$std_info['section_name'].'</b></p></td>												
										<!--<td style="padding-left: 0px; width: 50%; height: 20px; text-align: left;"><p style="font-size: 26px;">Dept : <b>'.$std_info['dept_name'].'</b></p></td>-->												
									</tr>
								</table>
							</td>
						</tr>
						<!--<tr><td style="width: 100%; height: 3px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>-->';
	//row holds accounts copy fee info
	$detail .= '		<tr>
							<td style="border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;">
								<table style="width:100%; border-collapse: collapse;">
								<tr>
									<td class="fee_col_left_bottom" style="font-weight: bold; text-align: center;"><p style="font-size: 26px;">Sl</p></td>
									<td class="fee_col_middle_bottom" style="font-weight: bold; text-align: center;"><p style="font-size: 26px;">Description</p></td>
									<td class="fee_col_right_bottom" style="font-weight: bold; text-align: center;" ><p style="font-size: 26px;">Amount</p></td>
								</tr>';				
						$in_account=0;
						for($j=0; $j<$in; $j++){
							$in_account++;
							$fee_head_amount_where_cond = "_year='$fee_year' AND _invoice_no IN ($inv_no_list) AND _fee_head='".$fee_head_list[$j]."'";
							$fee_head_amount_info = $obj->View_column_details_By_Cond("_fee_details_invoice","SUM(_amount) AS fee_amount",$fee_head_amount_where_cond);
							$show_fee_amount="";
							if($fee_head_list[$j]=='Discount'){
								$show_fee_amount = '(-)'.$fee_head_amount_info['fee_amount'];
							}
							else{
								$show_fee_amount = $fee_head_amount_info['fee_amount'];
							}
							$detail .='<tr>
											<td class="fee_col_left" style="text-align: center;"><p style="font-size: 26px;">'.$in_account.'</p></td>
											<td class="fee_col_middle" style="text-align: left;"><p style="font-size: 26px;">&nbsp;&nbsp;'.$fee_head_list[$j].'</p></td>
											<td class="fee_col_right" style="text-align: right;"><p style="font-size: 26px;">'.$show_fee_amount.'&nbsp;&nbsp;</p></td>
										</tr>';
							
							
						}
						for($i=$in_account+1; $i<=$num_of_empty_row; $i++){
							if($i==($num_of_empty_row-2)){
								$detail .= '<tr>
											<td class="fee_col_left" style="text-align: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
											<td class="fee_col_middle" style="text-align: center; padding-right: 30px;">'.$imi.'</td>
											<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										</tr>';
							}
							else{
								$detail .= '<tr>
										<td class="fee_col_left" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										<td class="fee_col_middle" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
									</tr>';
							}
						}
						if($in_account==$num_of_empty_row || $in_account==($num_of_empty_row-2) || $in_account==($num_of_empty_row-1)){
							$detail .= '<tr>
										<td class="fee_col_left" style="text-align: right;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
										<td class="fee_col_middle" style="text-align: center;">'.$imi.'</td>
										<td class="fee_col_right" style="text-align: center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
								</tr>';
						}
						$detail .='<tr>
								<td class="fee_col_left_top" style="text-align: right;"><p style="font-size: 26px;"></p></td>
								<td class="fee_col_middle_top" style="text-align: right;"><p style="font-size: 26px;"><b>Total Payable Amount&nbsp;</b></p></td>
								<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_tot_amount.'&nbsp;</b></p></td>
							</tr>';
						$detail .='<tr>
								<td class="fee_col_left_top_summ" style="text-align: right;"><p style="font-size: 26px;"></p></td>
								<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Discount&nbsp;</b></p></td>
								<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_dis_amount.'&nbsp;</b></p></td>
							</tr>'; 
						$detail .='<tr>
								<td class="fee_col_left_top_summ" style="text-align: right;"><p style="font-size: 26px;"></p></td>
								<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Total Received Amount&nbsp;</b></p></td>
								<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_paid_amount.'&nbsp;</b></p></td>
							</tr>';
						$detail .='<tr>
								<td class="fee_col_left_top_summ" style="text-align: right;"><p style="font-size: 26px;"></p></td>
								<td class="fee_col_middle_top" style="text-align: right;" ><p style="font-size: 26px;"><b>Last Received Amount&nbsp;</b></p></td>
								<td class="fee_col_right_top" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_last_paid_amount.'&nbsp;</b></p></td>
							</tr>';
						$detail .='<tr>
										<td class="fee_col_left_summ" style="text-align: right;" ><p style="font-size: 26px;"></p></td>
										<td class="fee_col_middle" style="text-align: right;" ><p style="font-size: 26px;"><b>Due&nbsp;</b></p></td>
										<td class="fee_col_right" style="text-align: right;"><p style="font-size: 26px;"><b>'.$std_yearly_due_amount.'&nbsp;</b></p></td>
							</tr>';
					$detail .= '		</table>
					</td>
				</tr>
				<tr><td style="width: 100%; height: 20px;"><p style="font-size: 20px;">(In Words):&nbsp;<span style="border-bottom: 3px dotted;">'.numberTowords($std_yearly_tot_amount).' Taka Only</span></p></td></tr>
				<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
				<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>
				<!--<tr><td style="width: 100%; height: 20px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>-->
				<tr><td>
					<table style="width:100%;">
						<tr>
							<td  style="height: 20px; text-align: left; font-weight: bold;"><p style="font-size: 20px;">_ _ _ _ _ _ _ _</p></td>
							<td style="height: 20px; text-align: right; font-weight: bold;"><p style="font-size: 20px;">_ _ _ _ _ _ _ _</p></td>
						</tr>
						<tr>
							<td  style="height: 20px; text-align: left; font-weight: bold;"><p style="font-size: 20px;">Depositor</p></td>
							<td style="height: 20px; text-align: right; font-weight: bold;"><p style="font-size: 20px;">Received by F.Afrin</p></td>
						</tr>
						<tr>
							<td  style="height: 20px; text-align: left;"><p style="font-size: 20px;">Printed By: <b>'.$_SESSION["LOGIN_USER"].'</b></p></td>
							<td style="height: 20px; text-align: right;"><p style="font-size: 20px;">Print Date: <b>'.date("d/m/Y").'</b></p></td>
						</tr>
				 </table>
				</td></tr>
			</table></td>';
			//main table ends here
	$detail .= '</tr></table>';
$detail.='</body></html>';
//echo $detail;
//exit;
$foothtml='<table width="100%">
			<tr>
				<td style="width: 32%; padding-right:10px;">
					<table style="width:100%; margin-right:12px;">
					<tr>
						<td style="text-align:left;font-size:10px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
						<td style="text-align:right;font-size:10px;">Powered By: www.'.$_SESSION["powred"].'</td>
					</tr>
					</table>
				</td>
				<td style=" width: 2%;"></td>
				<td style="width: 32%;">
					<table style="width:100%;">
						<tr>
							<td style="text-align:left;font-size:10px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
							<td style="text-align:right;font-size:10px;">Powered By: www.'.$_SESSION["powred"].'</td>
						</tr>
					</table>
				</td>
				<td style=" width: 2%;"></td>
				<td style="width: 32%;  padding-left:10px;">
					<table style="width:100%; margin-left:12px;">
					<tr>
						<td style="text-align:left;font-size:10px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
						<td style="text-align:right;font-size:10px;">Powered By: www.'.$_SESSION["powred"].'</td>
					</tr>
					</table>
				</tr>
			</tr>	
			</table>
			';
$mpdf=new mPDF('c','A4-L','','' , 0 , 0 , 0 ,0, 0 , 0); 
//$mpdf=new mPDF('utf-8','A4','L');
//$mpdf = new mPDF('utf-8', 'A4', '', '', 0, 0, 0, 0, 0, 0, 'L');
$mpdf->SetDisplayMode('fullpage');
$mpdf->setFooter($foothtml);
$mpdf->WriteHTML($detail);
$mpdf->Output();
?>