<style>
.hide_this {
	display: none
}
</style>
<div class="main-container"> 
  
  <!-- start: PAGE -->
  <div class="main-content"> 
    <!-- start: PANEL CONFIGURATION MODAL FORM --><!-- /.modal --> 
    <!-- 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">
          </ol>
          <div class="page-header">
            <h1>List Store Note</h1>
          </div>
          <!-- end: PAGE TITLE & BREADCRUMB --> 
        </div>
      </div>
      <!-- start grid -->
      
      <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> List Store Note</div>
            <div class="panel-body">
              <div id="error"></div>
              <!-- table start -0 -->
              
               <table class="table table-bordered table-condensed table-hover table-striped dataTable" id="warehouse_table">
									  <thead>
							            <tr>
                                    <th>Date</th>
                                    <th>Stn Code</th>
                                    <th>Stn No</th>
                                    <th>Invoice No</th>
									<th>Sale Total</th>
                                    <!--<th>Customer</th>-->
                                   
									<!--<th>&nbsp;</th>-->
									<!--<th>&nbsp;</th>-->
									<!--<th>Paid</th>-->
         <!--                           <th>Balance</th>-->
         <!--                           <th>Payment Status</th>-->
                                    <th>Action</th>
                                    </tr>
								           
						          </table>
              
              
               <!-- table end -0 -->
            </div>
          </div>
        </div>
        <!-- end: DYNAMIC TABLE PANEL --> 
      </div>
    </div>
    <!-- end grid --> 
  </div>
  <!-- end: PAGE --> 
</div>
<script src="<?php echo asset_url(); ?>plugins/jQuery-lib/2.0.3/jquery.min.js"></script>
<script src="<?php echo asset_url(); ?>plugins/jquery-ui/jquery-ui-1.10.2.custom.min.js"></script>
<script src="<?php echo asset_url(); ?>plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="<?php echo asset_url(); ?>plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"></script>
<script src="<?php echo asset_url(); ?>plugins/blockUI/jquery.blockUI.js"></script>
<script src="<?php echo asset_url(); ?>plugins/iCheck/jquery.icheck.min.js"></script>
<script src="<?php echo asset_url(); ?>plugins/perfect-scrollbar/src/jquery.mousewheel.js"></script>
<script src="<?php echo asset_url(); ?>plugins/perfect-scrollbar/src/perfect-scrollbar.js"></script>
<script src="<?php echo asset_url(); ?>plugins/less/less-1.5.0.min.js"></script>
<script src="<?php echo asset_url(); ?>plugins/jquery-cookie/jquery.cookie.js"></script>
<script src="<?php echo asset_url(); ?>plugins/bootstrap-colorpalette/js/bootstrap-colorpalette.js"></script>
<script src="<?php echo asset_url(); ?>js/main.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-validation/dist/jquery.validate.min.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/gritter/js/jquery.gritter.min.js"></script>
<script src="<?php echo asset_url(); ?>js/jquery-ui.js" ></script> 
<script src="<?php echo asset_url(); ?>js/moment-with-locales.js"></script> 
<script type="text/javascript" src="<?php echo asset_url(); ?>js/bootstrap-datetimepicker.js"></script> 
<script type="text/javascript" src="<?php echo asset_url(); ?>js/bootbox.min.js"></script> 
<script type="text/javascript" src="<?php echo asset_url(); ?>js/accounting.js"></script> 
<script type="text/javascript" src="<?php echo asset_url(); ?>js/accounting.min.js"></script> 
        <script>
			jQuery(document).ready(function() {
				//TableData.init();
				loadGrid();
				//$( ".search-select" ).select2();
			});

	loadGrid();
			function loadGrid() {
			    var warehouse_id = $('#warehouse_id').val();
					    $('#warehouse_table').DataTable({
					        "ajax": {
                                "url": "<?php echo base_url('store_notes/list_stn') ?>",
                                "data": {
                                    "warehouse_id": warehouse_id
                                },
                                "type": "POST"
                              },
					        "bDestroy": true,
							"serverSide": true,
					        "iDisplayLength": 20,
							"order": [[ 0, "desc" ]], "fnFooterCallback": function (nRow, aaData, iStart, iEnd, aiDisplay) {
							    /*
                                var pq = 0, sq = 0, bq = 0, pa = 0, grand_tot = 0, tech_tot = 0, parts_tot=0 , ser_tot=0;
                    			//alert(aaData.length);
                    			var ser_tot3=0;
                    			var ser_tot2=0;
                    			var ser_tot1=0;
                    			var ser_tot4=0;
                    			//var sales_rtn=0;
                                for (var i = 0; i < aaData.length; i++) {
                    				//alert(aaData[[i]][5]);
                                   // p = (aaData[aiDisplay[i]][2]).split('__');
                    				ser_tot1 += parseFloat(aaData[[i]][3]);
                    				ser_tot2 += parseFloat(aaData[[i]][4]);
                    				ser_tot3 += parseFloat(aaData[[i]][5]);	
                                }
                                var nCells = nRow.getElementsByTagName('th');
                    			nCells[3].innerHTML = '<div class="text-right">'+accounting.formatMoney(ser_tot1, "", 2, ",", ".")+' </div>';
                    			
                    			
                    			nCells[4].innerHTML = '<div class="text-right">'+accounting.formatMoney(ser_tot2, "", 2, ",", ".")+' </div>';
                    			nCells[5].innerHTML = '<div class="text-right">'+accounting.formatMoney(ser_tot3, "", 2, ",", ".")+' </div>';
                    			
                    			var sales_rtn_tot_cost=ser_tot1;
                    			var sales_rtn_tot_val=ser_tot2;
                    			$('#sales-rtn-cost-fld').val(accounting.formatMoney(sales_rtn_tot_cost, "", 2, ",", "."));
                    			$('#sales-rtn-val-fld').val(accounting.formatMoney(sales_rtn_tot_val, "", 2, ",", "."));
                    			$('#sales-rtn-cost-tbl').text(accounting.formatMoney(sales_rtn_tot_cost, "", 2, ",", "."));
                    			$('#sales-rtn-val-tbl').text(accounting.formatMoney(sales_rtn_tot_val, "", 2, ",", "."));
                    			*/
                                }
					    });
			}