<?php 
ini_set('memory_limit', '-1');
define("TODAY", date("Y-m-d h:i:s"));
require_once dirname(__FILE__).'/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8', 'format' => 'A4-P', 'margin_top' => 0, 'margin_left' => 10, 'margin_right' => 10, 'margin_top' => 10,	'margin_bottom' => 10,

	'mirrorMargins' => false]); 
    $mpdf->autoScriptToLang = true;
    $mpdf->autoLangToFont   = true;
?>

<?php

$stylesheet .= file_get_contents('pdfcss/styles.css');

include 'include/inc.grn-header.php';
include 'include/inc.grn-footer.php';

$mpdf->WriteHTML($stylesheet,1);
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->SetHTMLHeader($header);
$html="
<div class='titlewrap'>
  <ul class='customeraddresswrap'>
      <li class='left'>
         <h5 class='qfrom' style='margin-bottom:8px;'>Payroll</h5>
          <p style='font-size:12px;'><strong>No.37,Soragune,Haldummulla</strong></p>
          <p style='font-size:12px;'><strong>Email :</strong>rathnayakahardware@gmail.com
</p>
          <p style='font-size:12px;'><strong>Phone : </strong> 077 029 3947 / 071 378 5910</p>
      </li>
      <li class='right'>
          <h5 class='qfrom' style='margin-bottom:8px;'>".$supname." For</h5>
          <p style='font-size:12px;'><strong>".$spaddress."</strong></p>
          <p style='font-size:12px;'><strong>Email :</strong>".$spemail."</p>
          <p style='font-size:12px;'><strong>Phone : </strong>".$spphone."</p>
      </li>
  </ul>
</div>

<table class='table'>
  <thead>
    <tr>
    <th scope='col'></th>
      <th scope='col'>Item</th>
      <th scope='col'>Quantity</th>
       <th scope='col'>Discount</th>
       <th scope='col'>Rate</th>
       <th scope='col' style='text-align:right;'>Amount</th>
      
    </tr>
  </thead>
  <tbody>
    ".$tbody."
    <tr>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    
</tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td class=''><h3>Sub Total(LKR)</h3></td>
        <td class='' style='text-align:right;'><h3>LKR ".number_format($total, 2)."</h3></td>
    </tr>
     <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td class=''><h3>Discount(LKR)</h3></td>
        <td class='' style='text-align:right;'><h3>LKR ".number_format($alldiscount, 2)."</h3></td>
    </tr>
	<tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td class=''><h3>RD Allownce(LKR)</h3></td>
        <td class='' style='text-align:right;'><h3>LKR ".number_format($rdallownce, 2)."</h3></td>
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td class=''><h3>GRN TOTAL(LKR)</h3></td>
        <td class='' style='text-align:right;'><h3>LKR ".number_format($discountedtotal, 2)."</h3></td>
    </tr>
  </tbody>
</table>



<div class='clear'></div>

";
$mpdf->SetHTMLFooter($footer);
$mpdf->WriteHTML($html);


$mpdf->Output('grn-'.TODAY.'.pdf', 'I');
?>