<?php  

require_once("config/configDB.php");


$sql_customer = mysqli_query($conn,"SELECT sh.id as SLID,sh.customer_id,cm.cname FROM saleheader as sh  join customer_master as cm on cm.id=sh.customer_id WHERE cm.isdelete='1' GROUP BY sh.customer_id ");

$row_customer = '';

$sqlproduct = mysqli_query($conn,"SELECT id, productname FROM product_master WHERE isdelete='1' ");

$sql_product = '';

while($prow = mysqli_fetch_array($sqlproduct)){

    $sql_product =$sql_product."<option value='".$prow['id']."'>".$prow['productname']."</option>";
}

?>
<!DOCTYPE html>
<html>
<head>
    <title>Stock Report</title>
    <?php require 'header.php' ?>
    <link href = "https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"
         rel = "stylesheet">
	

</head>
<body>
    <?php require 'menu.php' ?>


    <div class="container text-center" id="saleStock">
  
  <form class="form-inline">
    
    <div class="form-group">
      <label for="email">From Date:</label>
      <input type="date" class="form-control" id="fromDate">
    </div>
    <div class="form-group">
      <label for="pwd">To Date</label>
      <input type="date" class="form-control" id="toDate">
    </div>

    <button type="button" class="btn btn-primary btn-md datewise-submit-saleoverall">Submit</button>

    <!--<a href="stockreportsalepdf.php" target="_blank" class="btn btn-info sale-stockreport-pdf" role="button">PDF</a>  -->
	

	<!-- sale-stockreport-excel  -->
    <a href="servicereportsale_excel.php" data-href="servicereportsale_excel.php" target="_blank" class="btn btn-info sale-stockOverreport-excle" id= "sale-stockOverreport-excle" role="button">Excel</a>    
  </form>
  
</div>

<div class="container text-center">
    <form class="form-inline "> 
    

   

    </form>
</div>

    



<div class="container col-sm-12">

<table id="salestockDashboardOverAll" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Invoice No</th>
                <th>Date</th>
                <th>Customer</th>
                <th>GSTIN</th> 
                <th>Product</th>
                <th>HSN</th>
                <th>Rate</th>
                <th>GST(%)</th>
                <th>Qty</th>               
                <th>Amount</th>
				<th>CGST(2.5%)</th>
                <th>SGST(2.5%)</th>
                <th>CGST(6%)</th>
                <th>SGST(6%)</th>
                <th>CGST(9%)</th>
                <th>SGST(9%)</th>
                <th>IGST</th>
                <th>Net&nbsp;Amount</th>
               
                <!-- <th>Action</th> -->
            </tr>
        </thead>
        <tbody>
            
                    
           
        </tbody>
       
    </table>
    
</div>



    <?php require 'footer.php' ?>

    <script type="text/javascript">var base_url = "<?= $base_url ?>";</script>
    
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/jquery-ui.min.js"></script>
	<script type="text/javascript" language="javascript" src="js/servicereportoverall.js"></script>
    <script>


$(document).ready(function() {

    //$('.sale-stockreport-pdf').hide();
    $('.sale-stockOverreport-excle').hide();
    //sale-stockreport-excel
    
            var dataTable =  $('#salestockDashboardOverAll').DataTable({
                responsive: {
                    details: {
                        renderer: function ( api, rowIdx ) {
                            var data = api.cells( rowIdx, ':hidden' ).eq(0).map( function ( cell ) {
                                var header = $( api.column( cell.column ).header() );
                                return  '<p style="color:#00A">'+header.text()+' : '+api.cell( cell ).data()+'</p>';
                            } ).toArray().join('');

                            return data ?    $('<table/>').append( data ) :    false;
                        }
                    }
                },
                processing: true,
                serverSide: true,
                
                ajax: {
                    url : "./serviceOverAllgriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionPrint: 1,
                        customerID  : '',
                        startDate   : '',
                        endDate     : ''
                    }
                }
            }); 
            } );

           /* $("#fromDate").datepicker({
        minDate: '-1Y-6M',
        maxDate: '+1Y+6M',
        dateFormat: 'dd-mm-yy',
        onSelect: function (dateStr) {
            var min = $(this).datepicker('getDate'); // Get selected date
            $("#toDate").datepicker('option', 'minDate', min || '0'); // Set other min, default to today
        }
    });

    //toDate

    $("#toDate").datepicker({
        minDate: '1',
        maxDate: '+1Y+6M',
        dateFormat: 'dd-mm-yy',
        onSelect: function (dateStr) {
            var max = $(this).datepicker('getDate'); // Get selected date

            $('#datepicker').datepicker('option', 'maxDate', max || '+1Y+6M'); // Set other max, default to +18 months

            
        }
    });*/

            


</script>
</body>
</html>