<?php $this->load->view("common/header"); ?>
<style type="text/css">
h3 {
	margin-top: 10px;
}
th {
	text-align: center !important;
}
.report_view_th {
	color: #000 !important;
	text-align: center !important;
}
body {
	background-color: #fff !important;
	font-size: 12px;
}
p {
	margin: 0;
}
.modal-body {
	padding: 2px 15px 15px;
	position: relative;
}
body .modal {
	/* new custom width */

	width: 750px;
	/* must be half of the width, minus scrollbar on the left (30px) */

	margin-left: -375px;
}
.print-table td, th {
	padding: 1px;
	vertical-align: top !important;
}
thead {
	display: table-header-group;
}
tfoot {
	display: table-footer-group;
}
.width_cus {
	width: 100px !important;
}
.width_qty {
	width: 100px !important;
}
html.no-js body div.row div.col-xs-12.text-center {
	font-size: 16px;
}
</style>
<body onLoad="window.print()">
<?php $this->load->view("common/report_header.php"); ?>
<div class="row">
  <h3 style="text-align:center; border-bottom:solid 3px #999999">Good Recieve Note</h3>
  <div class="col-md-12"> 
    <!-- start: DYNAMIC TABLE PANEL -->
    <div class="col-lg-12">
      <div class="">
        <div class="col-xs-8">
          <div class="row">
            <div class="col-xs-12">
              <p style="font-weight:bold;font-size:13px">GRN No &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <?php echo $po_header[0]->reference_no; ?></p>
              <p style="font-weight:bold;font-size:13px">Date	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: <?php echo date("Y-m-d",strtotime($po_header[0]->date)); ?></p>
              <p style="font-weight:bold;font-size:13px">Supplier &emsp;&emsp;&nbsp;&nbsp;: <?php echo $po_header[0]->supp_company_name; ?></p>
              <p style="font-weight:bold;font-size:13px">Supplier Address &nbsp;: <?php echo $po_header[0]->supp_address; ?></p>
              <p style="font-weight:bold;font-size:13px">Tel &emsp; &emsp; &emsp;&emsp;&nbsp;&nbsp;: <?php echo $po_header[0]->supp_contact_person_phone; ?></p>
            </div>
            <div class="clearfix"></div>
          </div>
        </div>
        <div class="clearfix"></div>
      </div>
      <div class="table-responsive">
        <table class="table table-bordered table-hover table-striped print-table order-table">
          <thead>
            <tr>
              <th>No</th>
              <th>Description (Code)</th>
              <th>Quantity</th>
              <th style="padding-right:20px;">Unit Cost</th>
              <!--<th style="padding-right:20px; text-align:center; vertical-align:middle;">Tax</th>
                      <th style="padding-right:20px; text-align:center; vertical-align:middle;">Discount</th>
                      -->
              <th style="padding-right:20px;">Subtotal</th>
            </tr>
          </thead>
          <tbody>
            <?php $c =0; foreach ($po_middle as $po_middle) { ?>
            <tr>
              <td style="text-align:center; width:40px; vertical-align:middle;"><?php echo ++$c; ?></td>
              <td style="vertical-align:middle;"><?php echo $po_middle->product_name; ?> (<?php echo $po_middle->product_code; ?>) </td>
              <td style="width: 120px; text-align:center; vertical-align:middle;"><?php echo $po_middle->quantity; ?></td>
              <td style="text-align:right; width:120px; padding-right:10px;"><?php echo $po_middle->unit_price; ?></td>
              <!--<td style="width: 120px; text-align:right; vertical-align:middle;">00.00</td>
                      <td style="width: 120px; text-align:right; vertical-align:middle;"><?php echo $po_middle->discount; ?></td>
                      -->
              <td style="text-align:right; width:120px; padding-right:10px;"><?php echo $po_middle->sub_total; ?></td>
            </tr>
            <?php } ?>
          </tbody>
          </table>
          <table class="table table-bordered table-hover table-striped print-table order-table">

          <tfoot>
            <tr>
              <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="4"> Total Amount (LKR) </td>
              <td style="text-align:right; padding-right:10px; font-weight:bold;"><?php echo number_format($po_header[0]->total,2,'.',','); ?></td>
            </tr>
            <tr>
              <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="4">Discount</td>
              <td style="text-align:right; padding-right:10px; font-weight:bold;"><?php echo $po_header[0]->discount; ?></td>
            </tr>
            <tr>
              <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="4">Grand Total (LKR)</td>
              <td style="text-align:right; padding-right:10px; font-weight:bold;"><?php echo number_format($po_header[0]->grand_total,2,'.',','); ?>
                <input id="pur_grand_tot_amt" type="hidden" value="<?php echo $po_header[0]->grand_total;?>"></td>
            </tr>
            <tr>
              <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="4">Paid (LKR)<br>
                <table style="float:right">
                  <?php foreach ($po_payment as $key => $po_payment) {?>
                  <tr>
                    <td valign="top"><?php echo $po_payment->sale_pymnt_date_time; ?>/</td>
                    <td valign="top"><?php 
														 echo "ref.".$po_payment->sale_pymnt_id;
														  if($po_payment->sale_pymnt_ref_no) echo "<br/>Ref.: ".$po_payment->sale_pymnt_ref_no;
														 if($po_payment->sale_pymnt_cheque_no) echo "<br/>Cheque No.: ".$po_payment->sale_pymnt_cheque_no;
														 if($po_payment->sale_pymnt_note) echo "<br/>Note: ".$po_payment->sale_pymnt_note;
														 
														 ?>/</td>
                    <td valign="top"><?php echo $po_payment->sale_pymnt_paying_by;?>:</td>
                    <td valign="top">LKR <?php echo number_format($po_payment->sale_pymnt_amount,2,'.',',');?></td>
                  </tr>
                  <?php } ?>
                </table></td>
              <td style="text-align:right; padding-right:10px; font-weight:bold;"><?php echo number_format($po_paid_total[0]->grn_paid_total,2,'.',','); ?>
                <input id="pur_paid_amt" type="hidden" value="<?php echo $po_paid_total[0]->grn_paid_total;?>"></td>
            </tr>
            <tr>
              <td style="text-align:right; padding-right:10px; font-weight:bold;" colspan="4">Balance (LKR)</td>
              <td style="text-align:right; padding-right:10px; font-weight:bold;"><?php 
									                     echo number_format($po_header[0]->grand_total - $po_paid_total[0]->grn_paid_total,2,'.',',');
									                     ?></td>
            </tr>
          </tfoot>
        </table>
      </div>
    </div>
  </div>
</div>
<!-- end: PAGE -->
</body>
<!-- end: BODY -->
</html>