<!DOCTYPE html>

<html lang="en" class="no-js">

<!-- start: HEAD -->

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php

header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");

header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");

header("Cache-Control: post-check=0, pre-check=0", false);

header("Pragma: no-cache");

?>
<title>
<?php



if (isset($sub_menu_name))

    echo strtoupper($sub_menu_name . ' - ');

?>
STOCK MANAGEMENT SYSTEM</title>

<!-- start: META -->



<!--[if IE]><meta http-equiv='X-UA-Compatible' content="IE=edge,IE=9,IE=8,chrome=1" /><![endif]-->

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="description" />
<meta name="author" />

<!--<link rel="stylesheet" href="<?php echo asset_url();?>plugins/bootstrap/css/bootstrap.min.css">
-->
<?php
$this->load->view("common/header"); 
?>


</head>
<div style="top:5px;" class="panel-tools open">
  <button style="display:none" data-toggle="dropdown" class="btn btn-blue dropdown-toggle" onClick="window.print()"><i class="fa fa-print"></i></button>
</div>
<style type="text/css">

th {
	text-align: center !important;
}
.report_view_th {
	color: #000 !important;
	text-align: center !important;
}
body {
	background-color: #fff !important;
	font-size: 15px;
/*	font-family: "serif";*/
	/*, Times, serif; */
	/* font-family:verdana; */
	 /* BPmono helvetica; */
    letter-spacing: 0.5px;
   
     margin-right:10px;
     color:#000 !important;
}
p {
	margin: 0;
}
.print-table td, th {
	padding: 0px;
	vertical-align: top !important;
}
thead {
	display: table-header-group;
}
tfoot {
	display: table-footer-group;
}
</style>
<style type="text/css" media="print">
.print-table {
	width: 100%;
}
.td_border_bottom_1 {
	border-bottom: 1px solid #666 !important;
}
.td_border_bottom_2 {
	border-bottom: 4px double #666 !important;
}
.td_border_top_1 {
	border-top: 1px double #666 !important;
}
.pagebreak {
	page-break-before: always;
}

h1, h2, h3 {
    margin-bottom: 0 !important;
    margin-top: 0 !important;
}
h1, .h1, h2, .h2, h3, .h3 {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
/*
td{
    padding:5px;
}
*/
 @page {
size: auto;   /* auto is the initial value */
margin: 0;  /* this affects the margin in the printer settings */
}

.row {
  padding-left: 20px;
  padding-right: 15px;
}
</style>
<!--  onLoad="window.print(),window.close()" -->
<?php 
//print_r($warehouse_details);




$close_text='';
if($this->session->userdata('ss_warehouse_id')==8){
    
   $close_text='';
}else{
    
    
}

$close_text=',window.close()';
$print_text='window.print()';
if($this->session->userdata('ss_user_id')==1){
	$close_text='';
	$print_text='';
}
$close_text='';
?>
<body onLoad="<?php echo $print_text;?> <?php echo $close_text;?>">
<div class="print_area print" style="width:100%;">
    
    
  <div class="row">
    <div class="col-xs-12" style="text-align:center">
      <center>
        <div style="display:none; border:solid 3px; border-radius:50px; width:13%; padding:15px; line-height:1"><span style="font-size:31px;font-weight:bold">SO</span> <span style="font-size:14px;font-weight:bold">Yummy</span></div>
      </center>
      
      
      <H2 style="font-size:25px; margin-bottom:0px; font-weight: bold; margin-top: 1px; line-height: 0.9;"> 
      
      <?php echo $warehouse_details['name']; ?></H2> 
      
      
      <!-- 
      <p class="text-center" style="font-weight:bold; font-size:17px;">Mobile Phone & Accessories</p> -->
      <p style="font-size:15px"><?php echo $warehouse_details['address']; ?></p>
      <?php if($warehouse_details['email']) //echo $warehouse_details['email']."<br>"; ?>
      <?php if($warehouse_details['phone']) echo "<span style=\"font-size:15px\">  ".$warehouse_details['phone']."</span><br>"; ?>
      
      <p style="padding:3px; font-weight:bold;">SUPPLIER PAYMENT ADJUSTMENT</p>
      
    <!-- <p style="font-size:15px">INVOICE<P/>-->
     <div style="height:2px; border-bottom: 0px dashed black;"></div>
     
    
    </div>
    
    <!--col-xs-12--> 
    
  </div>
  
  <?php 
                  //get total cash sale
                  $total_cash=0;
                 $total_cash=$this->Sales_Model->get_total_paid_cash_by_date_and_user_id($transactions_details['added_date_time'],$transactions_details['user_id'],$transactions_details['acctrnss_id'],'Cash');
                 
                 $total_credit_card=$this->Sales_Model->get_total_paid_cash_by_date_and_user_id($transactions_details['added_date_time'],$transactions_details['user_id'],$transactions_details['acctrnss_id'],'Credit Card');
                 $mc_total=$this->Sales_Model->get_total_paid_cash_by_date_and_user_id($transactions_details['added_date_time'],$transactions_details['user_id'],$transactions_details['acctrnss_id'],'Credit Card','MasterCard');
                 $vc_total=$this->Sales_Model->get_total_paid_cash_by_date_and_user_id($transactions_details['added_date_time'],$transactions_details['user_id'],$transactions_details['acctrnss_id'],'Credit Card','Visa');
                 //echo "vc_total:$vc_total";
                 //	echo $this->db->last_query();
                 
                 $total_cheque=$this->Sales_Model->get_total_paid_cash_by_date_and_user_id($transactions_details['added_date_time'],$transactions_details['user_id'],$transactions_details['acctrnss_id'],'Cheque');
                 
                 
    // echo "total_cash:
         
       //  echo $total_cash;
       
       
      
         ?>
         
         
  <div class="row">
    <div class="col-xs-12" style="margin-left:0px;">
      <div class="" style="margin-left:0px; padding-left:0;">
          <div class="col-xs-6">
          <table>
              <tr>
                  <td>Ref. No</td>
                  <td>:</td>
                  <td><?php echo sprintf('%04d', $transactions_details['spa_id']); ?></td>
              </tr>
              <tr>
                  <td>Date</td>
                  <td>:</td>
                  <td> <?php echo site_date_time($transactions_details['spa_added_datetime']); //date("Y-m-d", strtotime($sale_details['sale_datetime'])); ?></td>
              </tr>
              
              <tr>
                  <td>Supplier</td>
                  <td>:</td>
                  <td> <?php echo $transactions_details['supp_company_name']; ?></td>
              </tr>
              
              
              
              <tr>
                  <td>Deduction/Addition</td>
                  <td>:</td>
                  <td> <?php 
                  if($transactions_details['spa_debit_credit']==1) echo "Deduction"; else if($transactions_details['spa_debit_credit']==0) echo "Addition"; ?></td>
              </tr> 
              
               <tr>
                  <td>Amount</td>
                  <td>:</td>
                  <td> <?php 
                  echo $transactions_details['spa_amount']; ?></td>
              </tr> 
              
               <tr>
                  <td>Note</td>
                  <td>:</td>
                  <td> <?php 
                  //echo $transactions_details['cash_in_hand']; ?></td>
              </tr> 
              
              
              <!--
               <tr>
                  <td>Total of Cash</td>
                  <td>:</td>
                  <td> 
                  
                  
                  
                  
                  </td>
              </tr>
              -->
              <!-- 
              <tr>
                  <td>Variance</td>
                  <td>:</td>
                  <td>
                      <?php
                      $variance=0;
                      $variance=$transactions_details['acctrnss_amount']+$total_cash-$transactions_details['cash_in_hand'];
                      echo $variance;
                      ?>
                      
                      
                  </td>
              </tr> -->
             
              
               <tr>
                  <td>Prepared by</td>
                  <td>:</td>
                  <td><?php echo $transactions_details['user_first_name']; ?></td>
              </tr>
          </table>
       
       </div>
       
       
       
       
      </div>
      
    </div>
  </div>
  
  <!-- payment list -->
  
  <?php
  
  if(count($sale_payments_list)){
  ?>

<div class="row">
<div class="col-xs-12">
    <p><b>Payment List</b></p>
    
<div class="table-responsive">
<table class="table items table-striped table-bordered table-condensed table-hover">
<thead>
<tr class="report_view_th">
<th>Date</th>
<th>Payment Reference</th>
<th>Paid by</th>
<th>Amount</th>
<th>Created by</th>


</tr>
</thead>
<tbody>
<?php   foreach ($sale_payments_list as $row){?>
<tr>
<td><?php echo display_date_time_format($row->sale_pymnt_date_time) ?></td>
<td><?php 
														 echo $row->sale_pymnt_id;
														  if($row->sale_pymnt_ref_no) echo "<br/>Ref.: ".$row->sale_pymnt_ref_no;
														 if($row->sale_pymnt_cheque_no) echo "<br/>Cheque No.: ".$row->sale_pymnt_cheque_no;
														 if($row->sale_pymnt_note) echo "<br/>Note: ".$row->sale_pymnt_note;
														 
														 ?></td>
<td><?php echo $row->sale_pymnt_paying_by ?></td>
<td><?php echo number_format($row->sale_pymnt_amount, 2, '.', ',') ?></td>
<td> <?php echo $row->user_first_name ?> (<?php echo $row->user_group_name ?>)


</td>


</tr>
<?php }?>




 

</tbody>
</table>
<input name="" type="hidden" id="warehouse_id" value="<?php if (isset($sale_details['warehouse_id'])) echo $sale_details['warehouse_id'];?>">
</div>
</div>
</div>
<div class="clearfix"></div>
<br>
<div class="clearfix"></div>

<?php } ?>
<!-- end payment list-->
  
       
       
  <div class="print-start">
    <?php //print_r($sale_details);?>
    <div class="row col-md-12">
   
    </div>
  </div>
</div>
<!--
<div class="pagebreak"> - </div>
-->



<!--print-start-->

</body>
<!-- <script src="<?php echo asset_url(); ?>plugins/jQuery-lib/2.0.3/jquery.min.js"></script>-->
<script type="text/javascript">
jQuery(document).ready(function() {
    
    setTimeout(
  function() 
  {
    //do something special
  }, 2000);
	//alert();
//window.close();
				// $("#modal_ajax_sales_payment_btn").trigger("click");
				//fbs_click('<?php //echo $sale_id ?>')
				//Main.init();
				//TableData.init();
				//UIModals.init();

			});
			
			</script>
