
<!--onLoad="window.print()"-->
<body >
	<?php $this->load->view("common/header"); ?>
	<style type="text/css">
.report_view_th{
	color:#000 !important;
	font-size:12px;	
}

.table-responsive td{
	font-size:11px;
	background-color:#fff !important;	
}
h4{
	font-size:13px;
}
body{
	background-color:#fff !important;
}
.print_header_tbl{
	font-size:13px;
	border:1px;	
}
.print_header_tbl td{
	padding-bottom:5px;
	border:1px;		
}

.table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td {
  border-top: 1px solid #ddd;
  line-height: 1;
  padding: 3px;
  vertical-align: top;
}
</style>
		

<div class="">

         

         
            <div class="modal-body">

 <div style="top:2px;" class="panel-tools open">
<button data-toggle="dropdown" class="btn btn-blue dropdown-toggle" onClick="window.print()">
<i class="fa fa-print"></i>
</button>
</div>
<div class="row">
<div class="col-xs-12">

<?php //$this->load->view("common/report_header"); ?>

 
 

   </div><!--col-xs-12-->
</div><!--row--> 
<div class="row">
<div class="col-xs-12 text-center">

 <h2 class="text-bold text-left" style=" text-transform: uppercase;">Payment Voucher - Processed</h2>

  </div><!--col-xs-12-->
</div><!--row--> 
 
<br>
<?php

$warehouse_details= $this->Warehouse_Model->get_warehouse_info($mp_details->warehouse_id);

//print_r($warehouse_details);
?>

<div style="margin-bottom:15px;" class="row">
<?php //print_r($exp_details);?>
<div class="col-xs-6 pull-left">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped print-table order-table">
  <tr>
    <td>Voucher No:</td>
    <td><?php echo $mp_details->smp_no ?> </td>
  </tr>
  <tr>
    <td>Voucher Date:</td>
    <td><?php echo site_date($mp_details->smp_added_date) ?> </td>
  </tr>
 <tr>
    <td>Paying by</td>
    <td><?php echo ($mp_itm_list[0]->sale_pymnt_paying_by); ?></td>
  </tr>
  <tr>
    <td>
        <?php if($mp_itm_list[0]->sale_pymnt_paying_by=='Cheque') echo 'Cheque'; ?>
        
         No:</td>
    <td><?php echo ($mp_itm_list[0]->sale_pymnt_cheque_no); ?></td>
  </tr>
  <tr>
    <td>Amount:</td>
    <td><?php echo $mp_details->smp_amount ?> </td>
  </tr>
  </table>
</div>
</div>


<?php
$ref_id = new User_Model();
	 // print_r($mp_details);
	 ?>

<div class="col-xs-6 pull-right">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped print-table order-table">
    <tr>
    <td>Print Date/Time :</td>
    <td>  <?php echo site_date_time($mp_details->smp_date) ?></td>
  </tr>
  <tr>
    <td>User :</td>
    <td>  
   <?php
    $data['user_details']=$ref_id->get_user_info($mp_details->user_id);

	 echo $data['user_details']['user_first_name'];//.' '.$data['user_details']['user_last_name'];
   
   ?>
    </td>
  </tr>
  <!-- 
  <tr>
    <td>Customer Name :</td>
    <td>  <?php echo $mp_details->supp_company_name ?></td>
  </tr>
  -->
  <tr>
    <td>Batch No :</td>
    <td>  <?php echo $mp_details->cus_name ?></td>
  </tr>
  <tr>
    <td>Bank Account :</td>
    <td> 
    <?php 
    
    if(isset($mp_details->b_id)){
        
        //get bank acount des
        //echo $mp_details->b_id;
        
         $bank_details= $this->Supplier_Multiple_Payment_Model->get_all_bank_accounts($mp_details->b_id);
         //print_r($bank_details);
       
       echo $bank_details[0]->b_account_no ." ,  "; 
       echo $bank_details[0]->account_holder_name;
    }
   /// echo $mp_details->b_id;
    
    
   // echo $mp_details->b_account_no ?> <?php echo $mp_details->account_holder_name ?></td>
  </tr>
  <tr>
    <td> Banking Date:</td>
    <td>  <?php echo site_date($mp_itm_list[0]->sale_pymnt_date_time); ?></td>
  </tr>
 
   
</table>
</div>
</div>
</div>          

<div class="col-xs-12 ">
    Pay able To a sum of :  
    <?php
    	$cheque_amount_in_words=$this->Cheque_Process_Model->convertNumber($mp_details->smp_amount);
    	echo ucwords($cheque_amount_in_words);
    ?>
    </div>
    
    <div class="col-xs-12 ">
        <br/>
    On Account of
    </div>
    
    
    <table class="table table-bordered table-hover table-striped print-table order-table">
    <tr>
    <td>Account</td>
    <td> Description</td>
    <!-- 
    <td text-align="center"> Debit</td>
    <td> Credit</td> -->
  </tr>
  <tr>
    <td><?php echo $mp_details->supp_company_name ?> </td>
    <td></td>
    <!-- 
    <td> <?php echo number_format($mp_details->smp_amount, 2, '.', ','); ?></td>
    <td> 
    <?php 
    $smp_credit_tot=$this->Sales_Model->get_total_paid_by_grn_return_id_and_smp_id($mp_details->smp_id);
    
    echo number_format($smp_credit_tot, 2, '.', ',');;
    ?>
    </td> -->
  </tr>
   <!-- 
  <tr>
    <td></td>
    <td></td>
   
    <td><?php echo number_format($mp_details->smp_amount, 2, '.', ','); ?> </td>
    <td> <?php echo number_format($smp_credit_tot, 2, '.', ','); ?></td>
    
  </tr>-->
  </table>
    
   <div class="col-xs-12 "> 
    Payment Allocation Details
    </div>

<div class="table-responsive">


<table class="table table-bordered table-hover table-striped print-table order-table">
<thead>
<tr class="report_view_th">
    <th class="text-center">#</th>
     <th class="text-center">Date</th>
      <th class="text-center">Type</th>
       <th class="text-center">Ref</th>
        <th class="text-center">Inv</th>
         <th class="text-center">..</th>
          <th class="text-center">Net Amount</th>
<th style="width:50px !important" class="text-center"> Paid Amount</th>
<th class="text-center col-sm- ">Due Amount</th>
<th class="text-center col-sm-1">Amount</th>

</tr>
</thead>
<tbody>
 <?php 
 
 $tmpcount=0;
 $tt_grand_tot=0;
  $tt_paid=0;
   $tt_balance=0;
   $mod_sale=new Sales_Model();
  foreach ($mp_itm_list as $row)
 {
	 $tmpcount++;
	 /*
	 $total_paid_amount=$row['total_paid_amount'];
	 if (empty($total_paid_amount)) {
		  $pay_st = 'Pending';
		}else{
		  if ($total_paid_amount >= $row['po_total']) {
			$pay_st = 'Paid';
		  }else{
			$pay_st = 'Partial';
		  }
		}
		$tt_grand_tot=$tt_grand_tot+$row['po_total'];
		$tt_paid=$tt_paid+$total_paid_amount;
		$tt_balance=$tt_balance+($row['po_total']-$total_paid_amount);
		*/
		//print_r($row);
		$grn_paid_amount=$this->Sales_Model->get_total_paid_by_grn_id($row->sale_id);
	//	echo $this->db->last_query();
 ?>  
<tr>
<td style="text-align:right; width:40px; vertical-align:middle;"><?php echo sprintf("%1d",$tmpcount); ?></td>
<td><?php echo site_date($row->date);?></td>
<td>Purchase</td>
<td></td>
<td><?php echo $row->reference_no;?></td>
<td></td>
<td class="text-right"><?php echo number_format($row->total, 2, '.', ','); ?></td>
<td class="text-right"><?php echo number_format($grn_paid_amount, 2, '.', ',');?></td>
<td style="vertical-align:middle;" class="text-right"><?php echo number_format($row->total-$grn_paid_amount, 2, '.', ',');?>
  <?php //$grn_paid_amount; //echo $row->sale_reference_no; //echo display_date_time_format($row['po_datetime']); ?> </td>
<td class="text-right">  <?php //echo number_format($row['po_total']-$total_paid_amount, 2, '.', ','); ?>
<?php echo number_format($row->sale_pymnt_amount, 2, '.', ','); ?>
</td>
</tr>

<?php }?>

<tr>
    <td></td>
     <td clspan="2"><b>GRN RETURN</b></td>
      <td></td>
       <td></td>
        <td></td>
         <td></td>
          <td></td>
           <td></td>
            <td></td>
            <td></td>
</tr>

<?php 
 
// $tmpcount=0;
// $tt_grand_tot=0;
////  $tt_paid=0;
  // $tt_balance=0;
  // $mod_sale=new Sales_Model();
  foreach ($mp_itm_grn_return_list as $row_r)
 {
	 $tmpcount++; 
	 $grn_return_paid_amount=0;
	 $grn_return_paid_amount=$this->Sales_Model->get_total_paid_by_grn_return_id($row_r->pur_rtn_id);
	 ?>
	 
	 <tr>
    <td class="text-right"><?php echo $tmpcount;?></td>
      <td><?php echo site_date($row_r->pur_rtn_datetime);?></td>
       <td>Purchase Return</td>
      <td></td>
       <td><?php echo ($row_r->pur_rtn_reference_no);?></td>
        <td></td>
         <td class="text-right"><?php echo number_format($row_r->pur_rtn_inv_total, 2, '.', ','); ?></td>
          <td class="text-right">
              <?php echo $grn_return_paid_amount;?>
          </td>
           <td class="text-right"><?php echo number_format($row_r->pur_rtn_inv_total+$grn_return_paid_amount, 2, '.', ','); ?></td>
            <td class="text-right"><?php echo number_format($row_r->sale_pymnt_amount, 2, '.', ','); ?></td>
</tr>
	 
	 <?php
	 
 } ?>
<tr>
  <td colspan="9" style="text-align:right; width:40px; vertical-align:middle;">Total</td>
  <td class="text-right"><?php echo number_format($mp_details->smp_amount, 2, '.', ','); ?>
  </td>
</tr>
</tbody>
<tfoot>
</tfoot>
</table>
</div>



<div class="row">
<br>
<br>

<div class="col-xs-3">

<br/>
Prepared by <br/><br/>
...........................<br>
<?php  
$ref_id = new User_Model();
?>
<?php 
if($mp_details->user_id){
$data['user_details']=$ref_id->get_user_info($mp_details->user_id);
//echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
//echo "<br/>". $data['user_details']['user_designation'];

}?>

</div>

<div class="col-xs-3">

<br/>
Checked by <br/><br/>
...........................<br>
<?php  
$ref_id = new User_Model();
?>
<?php 
if($mp_details->user_id){
$data['user_details']=$ref_id->get_user_info($mp_details->user_id);
//echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
//echo "<br/>". $data['user_details']['user_designation'];

}?>

</div>

<div class="col-xs-3">

<br/>
Approved by <br/><br/>
...........................<br>
<?php  
$ref_id = new User_Model();
?>
<?php 
if($mp_details->user_id){
$data['user_details']=$ref_id->get_user_info($mp_details->user_id);
//echo $data['user_details']['user_first_name'].' '.$data['user_details']['user_last_name'];
//echo "<br/>". $data['user_details']['user_designation'];

}?>

</div>

<div class="col-xs-3"><br/>Authorized by<br/>

<br/>...........................
 <br>
<?php  
$ref_id = new User_Model();
?>

<br>

</div>



</div>


<!--<div class="row">

<div class="col-xs-5 pull-right">
<div class="well-sm">
<p>
Created by:  <?php echo $this->session->userdata('ss_user_first_name'); ?> (<?php echo $this->session->userdata('ss_user_group_name'); ?>)</p> <p>
Date: <?php echo display_date_time_format(date("Y-m-d H:i:s")); ?> </p>
</div>
</div>-->
</div>

             
                 <!--/.col-md-12-->
                 
    <div class="row">              
 <div class="col-xs-12">
     <div class="col-xs-12" style="border-top: 2px dotted;">
     <h3 class="text-center">RECEIPT</h3>
     
     </div>
     
     <div class="col-xs-6">
         Receirved Cheque No:  <?php echo ($mp_itm_list[0]->sale_pymnt_cheque_no); ?>
         
          <br/> <br/>
         SLR : <?php echo number_format($mp_details->smp_amount, 2, '.', ','); ?>
         
         <br/> <br/>
         <br/> <br/>
         Date : .....................<br/>
         
         <br/>
         <table>
             
             <tr>
                 <td>Receirved By &nbsp;&nbsp;&nbsp; </td>
                  <td><p>Name : ...................... </p>
                  <p>ID Number : ..................... </p>
                  <p>Signature : ..................... </p>
                  
                  </td>
                 
             </tr>
         </table>
         
         <br/>
         
         
         
         </div>
         
         
         <div class="col-xs-6">
             
             From : <?php echo $warehouse_details['name'] ;?>
             </div>
     
</div>  
</div>
                 
                 

</body>

