<?php    include_once('../config/db.php');  include_once('../config/check.php');  ?>

<!DOCTYPE html>
<html>
<head>
<?php include_once('../inc/slink.php');   ?>  
</head>
<body <?php include_once('../inc/snav.php');  ?>
<div class="wrapper">

  <!-- Main Header -->
    <header class="main-header">

    <!-- Logo -->
       <?php include_once('../inc/sbrand.php'); ?>

    <!-- Header Navbar -->
    <?php include_once('../inc/snavbar.php'); ?>

  </header>
 
  <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">

    <!-- sidebar: style can be found in sidebar.less -->
     <?php include_once('../inc/smenu.php');   ?>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
   
    <section class="content-header" style="padding-bottom:0px;">
          
            <p class="listheader" > <i class="fa fa-file" ></i> Statement  </p>
                <ol class="breadcrumb">
               
                
                </ol>
              
    </section>
  
  <!-- Main content -->
  <section class="content container-fluid" style="padding-top:0px;" >
    <!-- Calculate depreciation -->
    <div class="">
      <div class="box box-default box-xs">
              <div class="box-body">
                  <div class="row">
             
                    <!-- <form class="form-horizontal "  action="acc_depcalculate_item" method="post"  > -->
                        <div class="row">
                                
                                  <div class="col-md-12" > 
                                            
                                               <!-- <div class="col-md-3">
                                                <label> Download Reports </label>
                                                <div class="col-md-12  " class="mybtn" id="mybtn"  >
                                                 </div>  
                                                  
                                                </div> -->

                                                <div class="col-md-3  ">                                                      
                                                      <label> Select Partner   </label>
                                                      <select class="form-control js-example-basic-single"   name="partner"  required="" id="partner" style="width:100%" >
                                                            <?php $stmt = $conn->prepare("SELECT * FROM bppartner   ");
                                                            $stmt->execute(); foreach ($stmt as $row) {?>
                                                                    <option></option>
                                                                    <option value="<?php echo $row['id']; ?>"><?php
                                                                        echo $row['name']; ?></option> <?php } ?>
                                                        </select>
                                                </div>
                                                <div class="col-md-3">
                                                    <label >   Start Date  </label>
                                                    <input type="date"  class="form-control" required="" autocomplete="off"  id="startdate" name="startdate">    
                                                </div>                                                                                
                                               
                                                                               
                                                <div class="col-md-3">
                                                   <label>  End date  </label>
                                                   <input type="date"  class="form-control" required="" autocomplete="off" id="enddate" name="enddate">    
                                         
                                                </div> 
                                                
                                                <div class="col-md-2" style="padding-top:20px;" >
                                                    <button type="" name="filter" id="filter" class="btn  btn-sm btn-primary ">
                                                         <i class="fa fa-plus "></i>  Generate Statement  </button>
                                                </div>
                                
                                                                                                
                                        </div>  
                                        
                                                              
                        </div>
                        <!-- </form> -->
                        
                    </div>
                </div>
            </div>
      </div>
   
    <!-- End calculate depreciation -->
    <div class="row">        
        <div class="col-md-12">
        <div class="box box-default box-xs">
          <div class="box-body">
                             
                <!-- Filter END -->


                <div class="">

                <table id="customer_data" class="table compact  table-small table-responsive ">
                  <thead>
                    <tr style="height: 0px;" class="bg-default" >                  
          
                    
                    <th >   </th>
                    <th > Date  </th>                
                    <th > Partner </th>
                    <th > Debit  </th>
                    <th > Credit </th>
                    <th > Balance </th>
                    <th > Memo </th>

                    </tr>
                  </thead>
              
                  <tbody></tbody>
                    <!-- <tr style="background-color:aliceblue;" >                           
                                           
                            <th colspan="3" > Current Page Totals  </th>
                            <th  id="mytotal1" style="text-decoration:underline;text-decoration-style:double;font-size:13px;">  </th>
                            <th  id="mytotal2" style="text-decoration:underline;text-decoration-style:double;font-size:13px;">  </th>
                                          
                      </tr> -->
                  </table>
            </div>
          </div>
        </div>
         
        </div>
        <!-- /.col -->
      </div>
  </section>
  
</div>
  <!-- /.content-wrapper -->
  
  <!-- Main Footer -->
  <footer class="main-footer">
    <?php  include_once('../inc/sfooter.php'); ?>
  </footer>
  
</div>
                         
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->
<?php include_once('../inc/slinkjs.php') ?>

</body>
</html>

<!-- dynamic rows start here -->
<!-- DYANAMIC ROWS LISTING HERE --->
<script type="text/javascript" language="javascript" >
 
 $(document).ready(function () {

 $('#filter').click(function(){
   var startdate = $('#startdate').val();
   var enddate = $('#enddate').val();
   var partner = $('#partner').val();

   if( partner != '' && startdate != '' && enddate != '')
        {
            $('#customer_data').DataTable().destroy();
         
            
                    var dataTable = $('#customer_data').DataTable({
                        
                        lengthMenu: [
                                        [10, 25, 50, -1],
                                        [10, 25, 50, 'All'], 
                                    ],
                                    "paging": false,
                                    "dom": '<"top"f>rt<"bottom"ilp><"clear">',
                        "ajax" : {
                                    url:"../filter/partner/partnerstmt",
                                    type:"POST",
                                        data:{
                                        partner:partner,startdate:startdate,enddate:enddate
                                        }
                                    
                                    }


                      


                    }); 


                    // start btn
                      
                 codeListTable = $("#customer_data").DataTable();
                        new $.fn.dataTable.Buttons( codeListTable, {
                            buttons: [
                          
                                {
                                extend:    'excel',
                                footer: true,
                                text:      '<i class="fa fa-files-o"></i> Excel',
                                titleAttr: 'Excel',
                                className: 'btn btn-default btn-sm',
                                exportOptions: {
                                    footer: true,
                                    columns: ':visible'
                                }
                                },
                                {
                                extend:    'pdf',
                                text:      '<i class="fa fa-file-pdf-o"></i> PDF',
                                titleAttr: 'PDF',
                                className: 'btn btn-default btn-sm',
                                exportOptions: {
                                    columns: ':visible'
                                }
                                },               
                                {
                                extend:    'print',
                                text:      '<i class="fa fa-print"></i> Print',
                                titleAttr: 'Print',
                                className: 'btn btn-default btn-sm',
                                exportOptions: {
                                    columns: ':visible'
                                }
                                },  
                            ]
                        } );
                        codeListTable.buttons().container().appendTo('#mybtn');  
                        // end datatable btn 

                    

           
        }
   else
   {
    alert('Select Both filter option');
   
  
   }
  });


});
</script>
 
<!-- DYNAMIC ROWS ENDS HERE --->