<?php
$path_to_root="../../../";

include($path_to_root.'/application/config/config.php');

$summary_cart = unserialize(base64_decode($_GET['data']));
$title = unserialize(base64_decode($_GET['title']));
$subtitle = unserialize(base64_decode($_GET['subtitle']));
$invoice_no = unserialize(base64_decode($_GET['invoice_no']));
$customer = unserialize(base64_decode($_GET['customer']));
$invoice_date = unserialize(base64_decode($_GET['invoice_date']));
$cart = unserialize(base64_decode($_GET['cart_data']));

include_once($path_to_root . "/pdf_report/mpdf60/print/custom_function.php");



$stock_items_gender = array(
'fabric' => _("Fabric"),
'male' => _("Male"),
'female' => _("Female"),
'boy' => _("Boy"),
'girl' => _("Girl"),
'newlook' => _("New Look"),
'others' => _("Others"),
'' => _("Miscellaneous")
);


$header = '
<table width="100%" style="border-bottom: 1px solid #000000;">
	<tr>
		<td colspan=3 width="100%" align="center"><img src="logo_grameenshamogree.png" width="126px" /></td>
	</tr>
	<tr>
		<td width="100%" colspan=3 align="center" style="font-size: 17px; color:#000000;">'.LOCATION_NAME.'</td>
	</tr>
	<tr>
		<td colspan=2 width="100%" align="center">CHALLAN-SUMMARY</td>
	</tr>
	
	<tr>
		<td width ="50%" align="left" style="font-size: 12pt; color:#000000;"><b>Invoice No : </b> '.$invoice_no.'</td>
		<td width ="50%" align="right" style="font-size: 12pt; color:#000000;"><b>Invoice Date : </b>'.$invoice_date.'</td>
	</tr>
	<tr>
		<td width ="50%" align="left" style="font-size: 12pt; color:#000000;"><b>Customer Name : </b> '.$customer.'</td>
		<td width ="50%" align="right" style="font-size: 12pt; color:#000000;"><b>Print Date : </b>'.date("d/m/Y").'</td>
	</tr>
</table>
';

$html='<table width="100%" style="color: #000000;border: 1px solid #000000; border-collapse: collapse;">
    <thead>
        <tr>
		<th style="background-color:#CBC8C8;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;">
		 Item Description
		</th>
		<th style="background-color:#CBC8C8;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;">
		 Total Qty 
		</th>
		<th style="background-color:#CBC8C8;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;">
		 Total Price
		</th>
		<th style="background-color:#CBC8C8;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;">
		 Total Discount
		</th>
		<th style="background-color:#CBC8C8;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;">
		 Total VAT
		</th>
		<th style="background-color:#CBC8C8;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;">
		 Total Invoice Amount
		</th>
	</tr>
    </thead>
    <tbody>';




$serial=1;

$grand_total_qty=0;
$grand_total_sale_amount=0;
$grand_total_discount=0;
$grand_vat_amount=0;
$grand_total_invoice_amount=0;


foreach ($summary_cart as $summary_key => $summary_value) {

	$line_total_qty=0;
	$line_total_sale_amount=0;
	$line_total_discount=0;
	$line_vat_amount=0;
	$line_total_invoice_amount=0;

	$html.='<tr>';
	$html.='<td  colspan=6 style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:left;font-size: 12px; " >&nbsp;'.$serial.'&nbsp;'.$stock_items_gender[$summary_key].'&nbsp;</td>';
	$html.='</tr>';

	foreach ($summary_value as $s_key => $s_value) {


		$html.='<tr>';
		$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:left;font-size: 12px; " >&nbsp;'.$s_key.'&nbsp;</td>';
		$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($s_value['total_qty'],2,'.',',').'&nbsp;</td>';
		$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($s_value['total_sale_amount'],2,'.',',').'&nbsp;</td>';
		$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($s_value['total_discount'],2,'.',',').'&nbsp;</td>';
		$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($s_value['vat_amount'],2,'.',',').'&nbsp;</td>';
		$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($s_value['total_invoice_amount'],2,'.',',').'&nbsp;</td>';
		$html.='</tr>';

		$line_total_qty+=$s_value['total_qty'];
		$line_total_sale_amount+=$s_value['total_sale_amount'];
		$line_total_discount+=$s_value['total_discount'];
		$line_vat_amount+=$s_value['vat_amount'];
		$line_total_invoice_amount+=$s_value['total_invoice_amount'];

	}


	$html.='<tr>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;Sub-Total&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($line_total_qty,2,'.',',').'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($line_total_sale_amount,2,'.',',').'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($line_total_discount,2,'.',',').'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($line_vat_amount,2,'.',',').'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($line_total_invoice_amount,2,'.',',').'&nbsp;</td>';
	$html.='</tr>';


	$grand_total_qty+=$line_total_qty;
	$grand_total_sale_amount+=$line_total_sale_amount;
	$grand_total_discount+=$line_total_discount;
	$grand_vat_amount+=$line_vat_amount;
	$grand_total_invoice_amount+=$line_total_invoice_amount;
	$serial++;
}


$html.='<tr>';
$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;Grand Total&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($grand_total_qty,2,'.',',').'&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($grand_total_sale_amount,2,'.',',').'&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($grand_total_discount,2,'.',',').'&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($grand_vat_amount,2,'.',',').'&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;font-weight:bold;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:right;font-size: 12px; " >&nbsp;'.number_format($grand_total_invoice_amount,2,'.',',').'&nbsp;</td>';
$html.='</tr>';




$html.='</tbody>';
$html.='</table>';



$html.='
	
<htmlpageheader name="myHTMLHeaderForNote">

<table width="100%" style="border-bottom: 1px solid #000000;">
	<tr>
		<td colspan=3 width="100%" align="center"><img src="logo_grameenshamogree.png" width="126px" /></td>
	</tr>
	<tr>
		<td width="100%" colspan=3 align="center" style="font-size: 17px; color:#000000;">'.LOCATION_NAME.'</td>
	</tr>
	<tr>
		<td colspan=2 width="100%" align="center">CHALLAN-SUMMARY</td>
	</tr>
	
	<tr>
		<td width ="50%" align="left" style="font-size: 12pt; color:#000000;"><b>Invoice No : </b> '.$invoice_no.'</td>
		<td width ="50%" align="right" style="font-size: 12pt; color:#000000;"><b>Invoice Date : </b>'.$invoice_date.'</td>
	</tr>
	<tr>
		<td width ="50%" align="left" style="font-size: 12pt; color:#000000;"><b>Customer Name : </b> '.$customer.'</td>
		<td width ="50%" align="right" style="font-size: 12pt; color:#000000;"><b>Print Date : </b>'.date("d/m/Y").'</td>
	</tr>
</table>
</htmlpageheader>';


$html.='
	<htmlpageheader name="myHTMLHeaderForContents">
<table width="100%" style="border-bottom: 1px solid #000000;">
	<tr>
		<td colspan=3 width="100%" align="center"><img src="logo_grameenshamogree.png" width="126px" /></td>
	</tr>
	<tr>
		<td width="100%" colspan=3 align="center" style="font-size: 17px; color:#000000;">'.LOCATION_NAME.'</td>
	</tr>
	<tr>
		<td colspan=2 width="100%" align="center">CHALLAN-SUMMARY</td>
	</tr>
	
	<tr>
		<td width ="50%" align="left" style="font-size: 12pt; color:#000000;"><b>Invoice No : </b> '.$invoice_no.'</td>
		<td width ="50%" align="right" style="font-size: 12pt; color:#000000;"><b>Invoice Date : </b>'.$invoice_date.'</td>
	</tr>
	<tr>
		<td width ="50%" align="left" style="font-size: 12pt; color:#000000;"><b>Customer Name : </b> '.$customer.'</td>
		<td width ="50%" align="right" style="font-size: 12pt; color:#000000;"><b>Print Date : </b>'.date("d/m/Y").'</td>
	</tr>
</table>
</htmlpageheader>

<htmlpagefooter name="myHTMLFooterForContentsNext">
<p align="center" style="border-top: 1px solid #000000;">'.REPORT_FOOTER_LINE_1.'<br />'.REPORT_FOOTER_LINE_2.'&nbsp;&nbsp;&nbsp;&nbsp;<font style="font-style: italic;font-weight:bold;font-size:11px;">Page {PAGENO} of {nb}</font></p>
</htmlpagefooter>

<htmlpageheader name="myHTMLHeaderForWOrkOder">
<table width="100%" style="border-bottom: 1px solid #000000;">
	<tr>
		<td colspan=3 width="100%" align="center"><img src="logo_grameenshamogree.png" width="126px" /></td>
	</tr>
	<tr>
		<td width="100%" colspan=3 align="center" style="font-size: 17px; color:#000000;">'.LOCATION_NAME.'</td>
	</tr>
	<tr>
		<td colspan=2 width="100%" align="center">CHALLAN-SUMMARY</td>
	</tr>
	
	<tr>
		<td width ="50%" align="left" style="font-size: 12pt; color:#000000;"><b>Invoice No : </b> '.$invoice_no.'</td>
		<td width ="50%" align="right" style="font-size: 12pt; color:#000000;"><b>Invoice Date : </b>'.$invoice_date.'</td>
	</tr>
	<tr>
		<td width ="50%" align="left" style="font-size: 12pt; color:#000000;"><b>Customer Name : </b> '.$customer.'</td>
		<td width ="50%" align="right" style="font-size: 12pt; color:#000000;"><b>Print Date : </b>'.date("d/m/Y").'</td>
	</tr>
</table>
</htmlpageheader>
';	

$html.='
<pagebreak odd-header-name="myHTMLHeaderForNote" odd-header-value="1" even-header-name="myHTMLHeaderForNote" even-header-value="1" odd-footer-name="myHTMLFooterForContentsNext" odd-footer-value="1" 
	even-footer-name="myHTMLFooterForContentsNext" 
	even-footer-value="1" />';


$html.='
<table width="100%" style="color: #000000;border: 1px solid #000000; border-collapse: collapse;">
 <thead>
      <tr>
            <th rowspan=2 style="width:20px; background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >SL</th>
			<th colspan=2 style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >Item Description</th>
			<th rowspan=2 style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >LOT No</th>
			<th rowspan=2 style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >Total Qty</th>
			<th rowspan=2 style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >Total Price</th>
			<th rowspan=2 style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >Total Discount</th>
			<th rowspan=2 style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >Total VAT</th>
			<th rowspan=2 style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-left: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >Total Invoice Amount</th>
      </tr>
      <tr>
            <th style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;" >Code</th>
			<th style="background-color:#E0DBDB;color: #000000;border-top: 1px solid black; border-right: 1px solid black; border-bottom: 1px solid black;  border-collapse: collapse; text-align:center;font-size: 12px;" >Name</th>
      </tr>
   </thead>
	<tbody>';


$serial=1;

$grand_total_qty=0;
$grand_total_sale_amount=0;
$grand_total_discount=0;
$grand_vat_amount=0;
$grand_total_invoice_amount=0;

foreach ($cart as $cart_key => $cart_value) {

	$html.='<tr>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px; " >&nbsp;'.$serial.'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; font-size: 12px;text-align:center;" >&nbsp;'.$cart_value['item_id'].'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; font-size: 12px;text-align:left" >&nbsp;'."&nbsp;".str_replace("</br>"," - ",$cart_value['name']).'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; font-size: 12px;text-align:center" >&nbsp;'.$cart_value['lot_no'].'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; font-size: 12px;text-align:right" >&nbsp;'.number_format($cart_value['quantity'],2,'.',',').'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; font-size: 12px;text-align:right" >&nbsp;'.number_format($cart_value['item_cost_price']*$cart_value['quantity'],2,'.',',').'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; font-size: 12px;text-align:right" >&nbsp;'.number_format($cart_value['total_discount'],2,'.',',').'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; font-size: 12px;text-align:right" >&nbsp;'.number_format($cart_value['vat_amount'],2,'.',',').'&nbsp;</td>';
	$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; font-size: 12px;text-align:right" >&nbsp;'.number_format($cart_value['total_sale_amount']+$cart_value['vat_amount'],2,'.',',').'&nbsp;</td>';
	$html.='</tr>';


	$grand_total_qty+=number_format($cart_value['quantity'],2,'.','');
	$grand_total_sale_amount+=number_format($cart_value['item_cost_price']*$cart_value['quantity'],2,'.','');
	$grand_total_discount+=number_format($cart_value['total_discount'],2,'.','');
	$grand_vat_amount+=number_format($cart_value['vat_amount'],2,'.','');
	$grand_total_invoice_amount+=number_format($cart_value['total_sale_amount']+$cart_value['vat_amount'],2,'.','');
	$serial++;
}



$html.='<tr>';
$html.='<td colspan=4 style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px; font-weight:bold; text-align:right;" >Grand Total:</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;text-align:right; font-weight:bold;" >&nbsp;'.number_format($grand_total_qty,2,'.',',').'&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;text-align:right; font-weight:bold;" >&nbsp;'.number_format($grand_total_sale_amount,2,'.',',').'&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;text-align:right; font-weight:bold;" >&nbsp;'.number_format($grand_total_discount,2,'.',',').'&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;text-align:right; font-weight:bold;" >&nbsp;'.number_format($grand_vat_amount,2,'.',',').'&nbsp;</td>';
$html.='<td style="background-color:#FFFFFF;color: #000000;border-top: 1px solid black; border-left: 1px solid black; border-bottom: 1px solid black; border-right: 1px solid black; border-collapse: collapse; text-align:center;font-size: 12px;text-align:right; font-weight:bold;" >&nbsp;'.number_format($grand_total_invoice_amount,2,'.',',').'&nbsp;</td>';

$html.='</tr>';

$html.='</tbody>
</table>';

$footer = '<p align="center" style="border-top: 1px solid #000000;">'.REPORT_FOOTER_LINE_1.'<br />'.REPORT_FOOTER_LINE_2.'&nbsp;&nbsp;&nbsp;&nbsp;<font style="font-style: italic;font-weight:bold;font-size:11px;">Page {PAGENO} of {nb}</font></p>';

include("../mpdf.php");

$mpdf=new mPDF('utf-8', 'A4',0,'',10,10,45,20);

$mpdf->SetHTMLHeader($header);
$mpdf->SetHTMLFooter($footer);

$mpdf->autoScriptToLang = true;
$mpdf->baseScript = 1;
$mpdf->autoVietnamese = true;
$mpdf->autoArabic = true;

$mpdf->SetWatermarkImage('grameen_shamogree_wm.png', 0.10, 'D');

$mpdf->showWatermarkImage = true;
$mpdf->autoLangToFont = true;

$mpdf->WriteHTML($html);

$mpdf->Output('challan_invoice_no'.$invoice_no.'.pdf','I');

exit;
?>