<!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);
//print_r($transactions_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;?>">
    <br/>
<br/><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;">SHIFT DETAILS REPORT</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_cash=$this->Sales_Model->get_total_cash_shift($transactions_details['acctrnss_id'],'Cash');
                 
                 
                 
                 $total_grn_payment=$this->Sales_Model->get_total_grn_payment_cash_shift($transactions_details['acctrnss_id'],'Cash');
                 
                 
                 $total_return_payment=0;
                 
                 $total_return_payment=$this->Sales_Model->get_total_cash_sales_return_shift($transactions_details['acctrnss_id'],'Return Payment');
                 
                 $total_return_cash_payment=0;
                 
                 $total_return_cash_payment=$this->Sales_Model->get_total_cash_sales_return_shift($transactions_details['acctrnss_id'],'Cash');
                 
                 
                 
                 //echo "test:".$total_cash_2;
                 
                 
                 
                //echo  $this->db->last_query();
                 
                 $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');
                 
                 $total_cheque=$this->Sales_Model->get_total_cash_shift($transactions_details['acctrnss_id'],'Cheque');;
                 
                 //echo "<br/>total_cheque:$total_cheque <br/>";
                 //	echo $this->db->last_query();
                 
                  $online_transfer_tot=$this->Sales_Model->get_total_cash_shift($transactions_details['acctrnss_id'],'Online Transfer');
                 
                 
    // 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 $transactions_details['acctrnss_id']; ?></td>
              </tr>
              <tr>
                  <td>Start Time</td>
                  <td>:</td>
                  <td> <?php echo site_date_time($transactions_details['added_date_time']); //date("Y-m-d", strtotime($sale_details['sale_datetime'])); ?></td>
              </tr>
              <!-- 
              <tr>
                  <td>Opening Balance</td>
                  <td>:</td>
                  <td> <?php echo $transactions_details['acctrnss_amount']; ?></td>
              </tr> -->
              <!-- 
              <tr>
                  <td>Cash In Hand</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>Shift Status </td>
                  <td>:</td>
                  <td><?php 
        if($transactions_details['shift_status']==1) echo "Active";
        else echo "Closed";
        
        //echo $transactions_details['shift_status']; ?></td>
              </tr>
              <tr>
                  <td>Shift End Time </td>
                  <td>:</td>
                  <td>
                      
                      <?php 
                      if($transactions_details['shift_status']==0)
                      echo site_date_time($transactions_details['shift_end_datetime']); 
                      
                      ?></td>
              </tr>
              
               <tr>
                  <td>User </td>
                  <td>:</td>
                  <td><?php echo $transactions_details['user_first_name']; ?></td>
              </tr>
          </table>
       
       </div>
       
       
       
       
      </div>
      
    </div>
  </div>
  
  
  <!-- start payment methord -->
         <div class="row col-md-12">
   <div class="col-md-6">
    <table>
        <tr>
            <td width="10%">5000</td>
            <td width="10%">x</td>
            <td width="10%"><?php echo $transactions_details['count_5000']; ?></td>
            <td width="10%">=</td>
            <td width="10%"><?php echo  number_format($transactions_details['count_5000']*5000, 2, '.', ',') ;?></td>
        </tr>
       
        <tr>
            <td>1000</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_1000']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_1000']*1000, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>500</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_500']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_500']*500, 2, '.', ',') ;?></td>
        </tr>
        <!--
        <tr>
            <td>200</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_200']; ?></td>
            <td>=</td>
            <td></td>
        </tr> -->
        <tr>
            <td>100</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_100']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_100']*100, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>50</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_50']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_50']*50, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>20</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_20']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_20']*20, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>10</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_10']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_10']*10, 2, '.', ',') ;?></td>
        </tr>
        <!--
        <tr>
            <td>10 (C)</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_10_c']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_10_c']*10, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>5</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_5']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_5']*5, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>2</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_2']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_2']*2, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>1</td>
            <td>x</td>
            <td><?php echo $transactions_details['count_1']; ?></td>
            <td>=</td>
            <td><?php echo  number_format($transactions_details['count_1']*1, 2, '.', ',') ;?></td>
        </tr>
        -->
    </table>
    
    <table>
        <tr>
            <td width="10%"><h4>Summary of Cash</h4></td>
            <td width="10%"><h4></h4></td>
            <td width="10%"><h4></h4></td>
        </tr>
       <tr>
            <td>Opening Balance</td>
            <td>:</td>
            <td align=""><?php echo number_format($transactions_details['acctrnss_amount'], 2, '.', ','); ?></td>
        </tr>
         <tr>
            <td>+ Total Cash Sale</td>
            <td>:</td>
            <td text-align="right"><?php echo  number_format($total_cash, 2, '.', ',') ;?></td>
        </tr>
        <!-- 
        <tr>
            <td>+ Cash Reciepts</td>
            <td>:</td>
            <td></td>
        </tr> -->
        <?php
         $total_exp=0;
                 $total_exp=$this->Sales_Model->get_total_exp_cash_by_date_and_user_id($transactions_details['acctrnss_id']);
        
        ?>
        
         <tr>
            <td>- Expenses</td>
            <td>:</td>
            <td text-align="right"><?php echo number_format($total_exp, 2, '.', ',');?></td>
            
        </tr>
        <tr>
            <td>- GRN Payments</td>
            <td>:</td>
            <td text-align="right"><?php echo number_format($total_grn_payment, 2, '.', ',');?></td>
            
        </tr>
        <tr>
            <td>- Bank Deposit</td>
            <td>:</td>
           <td text-align="right"><?php echo  number_format($transactions_details['bank_deposit'], 2, '.', ',') ;?></td>
        </tr>
        
        <tr>
            <td>- Cash In </td>
            <td>:</td>
           <td text-align="right"><?php echo  number_format($transactions_details['cash_in'], 2, '.', ',') ;?></td>
        </tr>
    </table>
    
    <br/>
    
    <!-- 
   <h4>Credit Card Details</h4> 
    <table>
       
        <tr>
            <td width="10%"><h4>Card Type</h4></td>
            <td width="10%"><h4>Physical</h4></td>
            <td width="10%"><h4>System</h4></td>
        </tr>
       <tr>
            <td>MAST</td>
            
            <td><?php echo  number_format($transactions_details['mc_amount'], 2, '.', ',') ;?></td>
            <td><?php echo  number_format($mc_total, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>VISA</td>
            
            <td><?php echo  number_format($transactions_details['vc_amount'], 2, '.', ',') ;?></td>
            <td><?php echo  number_format($vc_total, 2, '.', ',') ;?></td>
        </tr>
         
    </table>
    
    -->
    
    </div>
     <div class="col-md-6">
         
        <table class="table table-bordered table-condensed table-hover table-striped dataTable">
        <tr>
            <td width="10%"><h4>Payment Method</h4></td>
            <td width="10%"><h4>Physical</h4></td>
            <td width="10%"><h4>System<br/>
           (Tot.cash-bank-exp+cash in-grn pay)</h4></td>
            <td width="10%"><h4>Varience <br/>(Physical-System)</h4></td>
        </tr>
        <tr>
            <td>Cash</td>
            <td class="text-right"><?php
            $physical_cash=$transactions_details['cash_in_hand'];
            
            echo  number_format($physical_cash, 2, '.', ',') ;
            
            ?></td>
            <td class="text-right">
                
                <?php 
                $system_cash=$total_cash-$transactions_details['bank_deposit']-$total_exp+$transactions_details['acctrnss_amount']+$transactions_details['cash_in']-$total_grn_payment-$total_return_cash_payment;
                
                echo  number_format($system_cash, 2, '.', ',') ;
                
                ?></td>
            <td class="text-right"><?php echo  number_format($physical_cash-$system_cash, 2, '.', ',') ;?></td>
        </tr>
        
        <!-- 
         <tr>
            <td>System Cash</td>
            <td></td>
            <td></td>
            <td></td>
        </tr> 
        -->
        
        <?php
        $tot_sale=$this->Sales_Model->get_total_sale_by_acctrnss_id($transactions_details['acctrnss_id']);
        
        $tot_date_paid=$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'],'');;
        
        
        $tot_selcted_date_inv_date_paid=$this->Sales_Model->get_selected_date_invoice_and_total_paid_cash_by_date_and_user_id($transactions_details['added_date_time'],$transactions_details['user_id'],$transactions_details['acctrnss_id'],'');;
        
      //  echo "tot_selcted_date_inv_date_paid:$tot_selcted_date_inv_date_paid";
        
      //  $tot_sale=0;
        ?>
        <tr>
            <td>Credit Card</td>
            <td class="text-right"><?php echo  number_format($transactions_details['mc_amount']+$transactions_details['vc_amount'], 2, '.', ',') ;?></td>
            <td class="text-right"><?php echo  number_format($total_credit_card, 2, '.', ',') ;?></td>
            <td class="text-right"><?php echo  number_format($transactions_details['mc_amount']+$transactions_details['vc_amount']-$total_credit_card, 2, '.', ',') ;?></td>
        </tr>
        <tr>
            <td>Cheques</td>
           <td class="text-right"><?php echo  number_format($transactions_details['cheque_amount'], 2, '.', ',') ;?></td>
            <td class="text-right"><?php echo  number_format($total_cheque, 2, '.', ',') ;?></td>
            <td class="text-right"><?php echo  number_format($transactions_details['cheque_amount']-$total_cheque, 2, '.', ',') ;?></td>
        </tr>
        
        <tr>
            <td>Online Transfer</td>
           <td class="text-right"><?php //echo  number_format($transactions_details['cheque_amount'], 2, '.', ',') ;?></td>
            <td class="text-right"><?php echo  number_format($online_transfer_tot, 2, '.', ',') ;?></td>
            <td class="text-right"><?php //echo  number_format($transactions_details['cheque_amount']-$total_cheque, 2, '.', ',') ;?></td>
        </tr>
         <tr>
            <td>Total Sales </td>
            <td class="text-right"></td>
            <td class="text-right"><?php echo number_format($tot_sale, 2, '.', ','); ; ?></td>
            <td class="text-right"></td>
        </tr>
        
        <tr>
            <td>Total 
            paid</td>
            <td class="text-right"></td>
            <td class="text-right"><?php echo number_format($tot_date_paid, 2, '.', ',');   ; ?></td>
            <td class="text-right"></td>
        </tr>
        <?php
        //$tot_return_payment=0;
        
        ?>
        
         <tr>
            <td>Cash Return to Customer</td>
            <td class="text-right"></td>
            <td class="text-right"><?php echo number_format($total_return_cash_payment, 2, '.', ',');   ; ?></td>
            <td class="text-right"></td>
        </tr>
        <tr>
            <td>Total Return Cash (Exchange Amount)</td>
            <td class="text-right"></td>
            <td class="text-right"><?php echo number_format($total_return_payment, 2, '.', ',');   ; ?></td>
            <td class="text-right"></td>
        </tr>
        <tr>
            <td>Credit</td>
            <td class="text-right"></td>
            <td class="text-right"><?php //echo number_format($tot_sale-$tot_date_paid-$total_return_payment-$total_cheque, 2, '.', ',');   ; ?>
            
            
            <?php
           // echo "<br/> tot_sale:$tot_sale , tot_date_paid:$tot_date_paid total_return_payment:$total_return_payment , total_cheque:$total_cheque<br/>";
            echo number_format($tot_sale-$tot_selcted_date_inv_date_paid-$total_return_payment, 2, '.', ',');   ; ?>
            </td>
            <td class="text-right"></td>
        </tr>
        <!-- 
        <tr>
            <td>Girt Voucher</td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>Coupons</td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>Money Order</td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td>Other</td>
            <td></td>
            <td></td>
            <td></td>
        </tr> -->
        <!-- 
        <tr>
            <td>Foreign Currency</td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        -->
       
        </table>
        
        <!-- 
        <br/>
        <h4>Cash Receipt</h4> 
    <table>
       
        <tr>
            <td width="10%"><h4>Receipt No</h4></td>
            <td width="10%"><h4>Amount</h4></td>
            <td width="10%"><h4>Remarks</h4></td>
        </tr>
       <tr>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    </table>
    
              -->
        <br/> 
        <h4>Cash Withdrawals</h4> 
    <table>
       
        <tr>
            <td width="10%"><h4>Receipt No</h4></td>
            <td width="10%"><h4>Amount</h4></td>
            <td width="10%"><h4>Remarks</h4></td>
        </tr>
       <tr>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    </table>
    <br/>
    
     <table>
       
        <tr>
            <td width="15%"><h4>Prepared by</h4> <br/>
            ....................</td>
            <td width="10%"></td>
            <td width="15%"><h4>Approved by</h4><br/>
            ....................</td>
           
        </tr>
       <tr>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    </table>
    
  
        
    </div>
    </div>
       <!-- end payment methad -->
       
       
  <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>
