<?php $this->load->view("common/header"); ?>
<!-- end: HEAD -->
<!-- start: CSS REQUIRED FOR THIS PAGE ONLY -->
<link href="<?php echo asset_url(); ?>plugins/bootstrap-modal/css/bootstrap-modal.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/datepicker/css/datepicker.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-daterangepicker/daterangepicker-bs3.css">
<link rel="stylesheet" type="text/css" href="<?php echo asset_url(); ?>css/jquery.dataTables.css">
<style type="text/css">
   .table > thead:first-child > tr:first-child > th, .table > thead:first-child > tr:first-child > td, .table-striped thead tr.primary:nth-child(2n+1) th {
   background-color: #428bca;
   border-color: #357ebd;
   border-top: 1px solid #357ebd;
   color: white;
   text-align: center;
   }
</style>
<!-- end: CSS REQUIRED FOR THIS PAGE ONLY -->
<!-- end: HEAD -->
<!-- start: BODY -->
<body>
   <!-- start: HEADER -->
   <div class="navbar navbar-inverse navbar-fixed-top">
      <!-- start: TOP NAVIGATION CONTAINER -->
      <div class="container">
         <div class="navbar-header">
            <!-- start: RESPONSIVE MENU TOGGLER -->
            <button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
            <span class="clip-list-2"></span>
            </button>
            <!-- end: RESPONSIVE MENU TOGGLER -->
            <!-- start: LOGO -->
            <a class="navbar-brand" href="index.html">
            CLIP<i class="clip-clip"></i>ONE
            </a>
            <!-- end: LOGO -->
         </div>
         <div class="navbar-tools">
            <!-- start: TOP NAVIGATION MENU -->
            <?php $this->load->view("common/notifications.php"); ?>
            <!-- end: TOP NAVIGATION MENU -->
         </div>
      </div>
      <!-- end: TOP NAVIGATION CONTAINER -->
   </div>
   <!-- end: HEADER -->
   <!-- start: MAIN CONTAINER -->
   <div class="main-container">
      <div class="navbar-content">
         <!-- start: SIDEBAR -->
         <?php $this->load->view("common/navigation"); ?>
         <!-- end: SIDEBAR -->
      </div>
      <!-- start: PAGE -->
      <div class="main-content">
         <!-- end: SPANEL CONFIGURATION MODAL FORM -->
         <div class="container">
            <!-- start: PAGE HEADER -->
            <div class="row">
               <div class="col-sm-12">
                  <!-- start: PAGE TITLE & BREADCRUMB -->
                  <ol class="breadcrumb">
                     <li>
                        <a href="<?php echo base_url('dashboard'); ?>">
                        Dashboard 
                        </a>
                     </li>
                     <li>
                        <a href="#">
                        Purchases 
                        </a>
                     </li>
                     <li class="active">
                        View
                     </li>
                     <li class="search-box">
                        <form class="sidebar-search">
                           <div class="form-group">
                              <input type="text" placeholder="Start Searching...">
                              <button class="submit">
                              <i class="clip-search-3"></i>
                              </button>
                           </div>
                        </form>
                     </li>
                  </ol>
                  <div class="page-header">
                  </div>
               </div>
            </div>
            <!-- end: PAGE HEADER -->
            <!-- start: PAGE CONTENT 
               <!-- start grid -->
            <style type="text/css">
               h2 {
               font-size: 16px;
               font-weight: bold;
               line-height: 16px;
               }
            </style>
            <div class="row">
               <div class="col-md-12">
                  <!-- start: DYNAMIC TABLE PANEL -->
                  <div class="panel panel-default">
                     <div class="panel-heading">
                          
                        <i class="fa fa-external-link-square">  </i>
                     </div>
                     <div class="panel-body">
                        
                        <div class="box-content">
                           <div class="row">
                              <div class="col-lg-12">
                                  <h1>payment details</h1>
                                 <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['payment_system_ref_no']; ?> </td>
                                          </tr>
                                          <tr>
                                             <td>Voucher Date:</td>
                                             <td><?php echo site_date($mp_details['pay_g_date_time']) ?> </td>
                                          </tr>
                                          <tr>
                                             <td>Paying by</td>
                                             <td><?php echo ($mp_details['p_type_name']); ?></td>
                                          </tr>
                                          <tr>
                                             <td>
                                                <?php if($mp_details['p_type_name']=='Cheque') echo 'Cheque'; ?>
                                                No:
                                             </td>
                                             <td><?php if($mp_details['p_type_name']=='Cheque') {echo ($mp_details['cheque_no']);}else{ echo ($mp_details['ref_no']);} ?></td>
                                          </tr>
                                          <tr>
                                             <td>Amount:</td>
                                             <td><?php echo $mp_details['pay_amount'] ?> </td>
                                          </tr>
                                       </table>
                                    </div>
                                 </div>
                                 <?php
                                    $ref_id = new User_Model();
                                    	 ?>
                                 <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['system_date_time'] ) ?></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['supp_company_name'] ?></td>
                                          </tr>
                                          <tr>
                                             <td>Bank Account :</td>
                                             <td> 
                                                <?php 
                                                   if(isset($mp_details['bank_id'])){
                                                      if($mp_details['p_type_name']!='Cash'){
                                                          
                                                          echo $mp_details['account_no'];
                                                      }
                                                   }
                                                   ?>
                                             </td>
                                          </tr>
                                          <tr>
                                             <td> Bank :</td>
                                             <td>   <?php 
                                                   if(isset($mp_details['bank_id'])){
                                                      if($mp_details['p_type_name']!='Cash'){
                                                          
                                                          echo $mp_details['bank_name'];
                                                      }
                                                   }?></td>
                                          </tr>
                                       </table>
                                    </div>
                                 </div>
                              </div>
                           </div>
                           <div class="row">
                              <div class="col-xs-12">
                                 <div class="table-responsive">
                                     <hr>
                                     <h2>payment allocation</h2>
                                    
                                     
                                    <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;
                                              foreach ($mp_itm_list as $row)
                                             {
                                              $tmpcount++;
                                              $grn_return_total = $this->Supplier_Payment_Process_Model->get_grn_return_total_payment($row->invoice_id);
                                              $balance_amount   =($row->total-$grn_return_total)-$row->allocation_amount;
                                              $balance_amount   = (float) $balance_amount;
                                             ?>  
                                          <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($row->allocation_amount, 2, '.', ',');?></td>
                                             <td style="vertical-align:middle;" class="text-right"><?php echo number_format($balance_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->allocation_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>-->
                                          <!--<tr>
                                             <td></td>
                                              <td clspan="2"><b>SUPPLIER PAYMENT ADJUSTMENT</b></td>
                                               <td></td>
                                                <td></td>
                                                 <td></td>
                                                  <td></td>
                                                   <td></td>
                                                    <td></td>
                                                     <td></td>
                                                     <td></td>
                                             </tr>-->
                                          <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['pay_amount'], 2, '.', ','); ?>
                                             </td>
                                          </tr>
                                       </tbody>
                                       <tfoot></tfoot>
                                    </table>
                                    <hr>
                                    
                                    <span> NOTE : <?php echo $mp_details['note'] ?></span>
                                    
                                    <hr>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <div class="buttons">
                           <div class="btn-group btn-group-justified">
                              <div class="btn-group"><a class="tip btn btn-success tip" onClick="fbs_click(<?php echo $mp_details['pay_g_id']; ?>)"><i class="fa fa-print"></i>
                                 <span class="hidden-sm hidden-xs">Print</span></a>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
               </div>
               <!-- end: DYNAMIC TABLE PANEL -->
            </div>
         </div>
         <!-- end grid -->
      </div>
      <!-- end: PAGE -->
   </div>
   <!-- end: MAIN CONTAINER -->
   <!-- start: FOOTER -->
   <div class="footer clearfix">
      <div class="footer-inner">
         2014 &copy; clip-one by cliptheme.
      </div>
      <div class="footer-items">
         <span class="go-top"><i class="clip-chevron-up"></i></span>
      </div>
   </div>
   <!-- end: FOOTER -->
   <!-- start: RIGHT SIDEBAR -->
   <!-- end: RIGHT SIDEBAR -->
   <div id="event-management" class="modal fade" tabindex="-1" data-width="760" style="display: none;">
      <div class="modal-dialog">
         <div class="modal-content">
            <div class="modal-header">
               <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
               &times;
               </button>
               <h4 class="modal-title">Event Management</h4>
            </div>
            <div class="modal-body"></div>
            <div class="modal-footer">
               <button type="button" data-dismiss="modal" class="btn btn-light-grey">
               Close
               </button>
               <button type="button" class="btn btn-danger remove-event no-display">
               <i class='fa fa-trash-o'></i> Delete Event
               </button>
               <button type='submit' class='btn btn-success save-event'>
               <i class='fa fa-check'></i> Save
               </button>
            </div>
         </div>
      </div>
   </div>
   <!-- start ajax model -->
   <div id="ajax-modal" class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" style="display: none;"></div>
   <!-- end ajax model -->
   <!-- start: MAIN JAVASCRIPTS -->
   <?php $this->load->view("common/footer"); ?>
   <!-- start: JAVASCRIPTS REQUIRED FOR THIS PAGE ONLY -->
   <script src="<?php echo asset_url(); ?>plugins/jquery-inputlimiter/jquery.inputlimiter.1.3.1.min.js"></script>
   <script src="<?php echo asset_url(); ?>plugins/jquery.maskedinput/src/jquery.maskedinput.js"></script>
   <script type="text/javascript" src="<?php echo asset_url(); ?>plugins/bootbox/bootbox.min.js"></script>
   <script type="text/javascript" src="<?php echo asset_url(); ?>plugins/jquery-mockjax/jquery.mockjax.js"></script>
   <script type="text/javascript" src="<?php echo asset_url(); ?>plugins/DataTables/media/js/jquery.dataTables.min.js"></script>
   <script type="text/javascript" src="<?php echo asset_url(); ?>plugins/DataTables/media/js/DT_bootstrap.js"></script>
   <script src="<?php echo asset_url(); ?>js/table-data.js"></script>
   <script src="<?php echo asset_url(); ?>plugins/bootstrap-modal/js/bootstrap-modal.js"></script>
   <script src="<?php echo asset_url(); ?>plugins/bootstrap-modal/js/bootstrap-modalmanager.js"></script>
   <script src="<?php echo asset_url(); ?>js/ui-modals.js"></script>
   <script src="<?php echo asset_url(); ?>plugins/bootstrap-fileupload/bootstrap-fileupload.min.js"></script>
   <script src="<?php echo asset_url(); ?>plugins/select2/select2.min.js"></script>
   <script src="<?php echo asset_url(); ?>plugins/jQuery-lib/2.0.3/jquery.min.js"></script>
   <script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>js/jquery.dataTables.js"></script>
   <script type="text/javascript" language="javascript" >
      var j = jQuery.noConflict();
      
     function fbs_click(id) {
	u=location.href;
	t=document.title;
	window.open('<?php echo base_url().'supplier_payment_process/supplier_multiple_payment_print'?>?id='+id,'sharer','toolbar=0,status=0,width=626,height=700, left=10, top=10,scrollbars=yes');return false;
}

      
   </script>
</body>
<!-- end: BODY -->
</html>