<?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.header.php';
include 'include/inc.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;'>".$pdf_title." From</h5>
          <p style='font-size:12px;'><strong>".$from_compay_name."</strong></p>
          <p style='font-size:12px;'>".$from_compay_address."</p>
          <p style='font-size:12px;'><strong>Phone : </strong>".$from_compay_phone."</p>
          <p style='font-size:12px;margin-bottom:15px;'><strong>Email : </strong>".$fromcompanyemail."</p>
         
      </li>
      <li class='right'>
            <h5 class='qfrom' style='margin-bottom:8px;'>".$pdf_title." For</h5>
            <p style='font-size:12px;'><strong>".$for_company_name."</strong></p>
          <p style='font-size:12px;'>".$for_compny_address."</p>
          <p style='font-size:12px;'><strong>Email : </strong>".$emailfor."</p>
          <p style='font-size:12px;'><strong>Phone : </strong>".$for_compay_phone."</p>
          <p style='font-size:12px;'>".$cpersonfor."</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'>Rate</th>
       <th scope='col'>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 class='tot'><h3>Discount(LKR)</h3></td>
    <td class='tot'><h3>LKR ".number_format($discount, 2)."</h3></td>
</tr>
</tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td class=''><h3>Total(LKR)</h3></td>
        <td class=''><h3>LKR ".number_format($total, 2)."</h3></td>
    </tr>
<tr>
<td></td>
<td></td> 
<td></td>
<td class='tot3'><h3>Advance Payment(LKR)</h3></td>
<td class='tot3'><h3>LKR ".number_format($advance_payment, 2)."</h3></td>
</tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td class='tot1'><h3>Balance Due(LKR)</h3></td>
        <td class='tot1'><h3>LKR ".number_format($total-$advance_payment, 2)."</h3></td>
    </tr>
  </tbody>
</table>



<div class='clear'></div>
<div class='qtydate'>Validity Period  <span><strong>".$validity_period."</span></strong></div>
			<div class='qtydate'>NO. of Days For Delivery  <span><strong>".$no_of_days."</span></strong></div>
<div class='tearms'>
    <h4>Terms and Conditions</h4>
    ".$tcon."
</div>
<div class='tearms'>
    <h4>Bank Details</h4>
    <div><strong>Name : ".$bank_name."</strong></div>
    <div><strong>Account : ".$account_number."</strong></div>
    <div><strong>Bank : ".$bank."</strong></div>
    <div><strong>Branch : ".$branch."</strong></div>
</div>
";
$mpdf->SetHTMLFooter($footer);
$mpdf->WriteHTML($html);


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