<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="datatable/data.css">
<script src="datatable/data.js" type="text/javascript"></script>
<script src="datatable/table.js" type="text/javascript"></script>
<script src="datatable/datatable.js"></script>
<link rel="stylesheet" href="datatable/data-boot.css">
<link href="javascript/select2.css" rel="stylesheet" >
<script src="javascript/selectt2.js"></script>
<link rel="stylesheet" href="calendar-15/calendar-15/fonts/icomoon/style.css">

<link rel="stylesheet" href="calendar-15/calendar-15/css/rome.css">
<link rel="stylesheet" href="calendar-15/calendar-15/css/style.css">
<script src = "ajax/salesreportest.js"></script>
<style>
    
    #navbar
    {
        flex:15%;
        height:100%; 
        flex-direction:row;
        overflow:auto;
        
    }
    #content
    {
        flex:90%;
        overflow:auto;
        padding-left:5px;
        padding-right:5px;
    }
    #fullbody
    {
        display:flex;
        
         height:100%;         
    }
    label
    {
      font-size:20px;
    }
    .edit
    {
        font-size:18px;
        color:green;
        cursor:pointer;
    }
    .dele
    {
        font-size:18px;
        color:red;
        cursor:pointer;
    }
    .edit:hover
    {
        font-size:20px;
        
    }
    .dele:hover
    {
        font-size:20px;
        color:red;
        cursor:pointer;
        
    }
    td
    {
      text-align:center;
    }
    th
    {
      text-align:center;
    }
    li a 
    {
      color:black;
    }
    .page-item.active .page-link {
    
    background-color:yellow;
    border-color: #007bff;
}

.searchfeilds input
{
height:30px;
}
.daterow
{
  margin-top:10px;
}
    @media (max-width: 800px) {
        #fullbody
    {
        display:flex;
        flex-wrap: wrap;
                 
    }
        #navbar,#content {
    flex: 100%;
  }
}
</style>
<script>
  $(function () {

// INITIALIZE DATEPICKER PLUGIN
$('.datepicker').datepicker({
    clearBtn: true,
    format: "dd/mm/yyyy"
});


// FOR DEMO PURPOSE
$('#reservationDate').on('change', function () {
    var pickedDate = $('input').val();
    $('#pickedDate').html(pickedDate);
});
});

</script>
<script>
$(document).ready( function () {
    $('#protable').DataTable();
} );
</script>

</head>
<body>
    
    <div id="fullbody"> 
<div id="navbar" class="bg-info"><?php include "navbar.php"?></div>
<div id="content">
<br>
<h3>Sales Report-EST</h3>
<br>
<button type="button" style="margin-left:40%;" class="btn btn-primary" data-toggle="collapse" data-target="#searchdiv"><i class="fas fa-filter"></i> &nbsp To Filter</button>
<!-- search collaspe -->
  <div id="searchdiv" class="collapse container-fluid">
      <!-- search -->
      <br>
  <div class="row searchfeilds" >
  <div class="col-sm-2"></div>  <div class="col-sm-2">
<select class="selectpro" id="customertype">
    <option value="0">--Select Customer Type--</option>
<option>cash</option> 
<option>BANK-GPAY</option> 
<option>credit</option>  
</select>

</div>

<div class="col-sm-2">
<select class="selectpro" id="customer">
    <option value="0">--Select Customer--</option>
<?php 
$cus=mysqli_query($connect,"select * from customerdetails where status !='deleted'");
while($cusshow = mysqli_fetch_array($cus))
{
?>
<option value="<?php echo $cusshow['code'] ?>"><?php  echo $cusshow['name'] ?></option>
        <?php }?>         
</select>

</div>
    <div class="col-sm-2">
    <select class="selectpro" id="product">
    <option value="01">--Select Product--</option>
    <?php 
$cus=mysqli_query($connect,"select * from productdetail where status !='deleted'");
while($cusshow = mysqli_fetch_array($cus))
{
?>
<option value="<?php echo $cusshow['productcode'] ?>"><?php  echo $cusshow['productname'] ?></option>
        <?php }?>        
</select>
    </div>
    
</div>
<!--  -->
<div class="row daterow" style="overflow:auto">  
                <div class="col-sm-2"></div>
           <div class="col-sm-3">
                <input type="text" class="form-control" id="input_from" placeholder="Start Date"></div>
                <div class="col-sm-3">
                            
                <input type="text" class="form-control" id="input_to" placeholder="To Date">
              </div>
              
              <div class="col-sm-1"><button class="btn btn-info" id="calender"><i class="fas fa-calendar-check" style="font-size:23px;"></i></button></div>
              
            </div><br>
<!-- search -->
  </div>

<!-- date -->
<!-- Date Picker Input -->
<!-- search ollapse  -->

<!-- date -->
<div>
    <br>
    <div id="keyupresult">
<table class="table table-bordered table-hover" id="protable">
    <thead>      
<tr>
<th>S.no</th>
<th>Date</th>
<th>Invcode</th>
<th>Tkt</th>
<th>Customer</th>
<th>VehicleNo</th>
<!-- <th>Vehiclename</th> -->
<th>Material</th>
<th>EmptyWeight</th>
<th>LoadWeight</th>
<th>Qty</th>
<th>NetAmount</th>

</tr>    
</thead>
    <tbody>
    <?php
    error_reporting(0); 
$proedit=mysqli_query($connect,"
select *,(select customerdetails.name from customerdetails where customerdetails.code = second_transaction_est.customer )as cusname,(select productdetail.productname from productdetail where productdetail.productcode = second_transaction_est.product )as proname from second_transaction_est where second_transaction_est.status !='deleted' 
order by ticket desc");
while($proshowedi = mysqli_fetch_array($proedit))
{
  $datechk=$proshowedi['date'];
    $dateval = date_create($datechk);
    $date = date_format($dateval,"d/m/Y");
    $sno+=1;
?>
        <tr>
            <td><?php echo $sno ?></td>
            <td><?php echo $date?></td>
            <td><?php echo $proshowedi['salescode'] ?></td>
            <td><?php echo $proshowedi['ticket'] ?></td>

<td><?php echo $proshowedi['cusname'] ?></td>
<td><?php echo $proshowedi['vehicleno'] ?></td>
<!-- <td><?php echo $proshowedi['vehiclename'] ?></td> -->
<td><?php echo $proshowedi['productname'] ?></td>
<td><?php echo $proshowedi['emptyweight'] ?></td>
<td><?php echo $proshowedi['loadweight'] ?></td>
<td><?php echo $proshowedi['netqty'] ?></td>
<td><?php echo $proshowedi['totalamount'] ?></td>
        </tr>
        <?php }?>
    </tbody>
</table>
</div>
</div>
<!-- modal -->
<button type="button" class="btn btn-primary" style="display:none" data-backdrop="static" id="modaldis" data-toggle="modal" data-target="#myModal">
    Open modal
  </button>

  <!-- The Modal -->
  <div class="modal fade" id="myModal" >
    <div class="modal-dialog modal-xl modal-dialog-scrollable">
      <div class="modal-content">
      
        <!-- Modal Header -->
        
        <div class="modal-header">
          <h4 class="modal-title">Report</h4>
          <button type="button" class="close" onclick="window.location.reload();" data-dismiss="modal">&times;</button>
        </div>
        <!-- Modal body -->
        <div class="modal-body">
         <!-- data entry -->
         <div id="fullreport">
         <div class="spinner-border text-primary" style="margin-left:45%;margin-top:20%;margin-bottom:20%;padding:3%"></div>
         </div>
         <!-- data entry -->
        </div>
        
        <!-- Modal footer -->
        
        
      </div>
    </div>
  </div>
  
<!-- modal -->
<!-- table for report -->
</div>

<script>
    $('.selectpro').select2({ width: '100%',height:'420px;' });
    
</script>
<script src="calendar-15/calendar-15/js/rome.js"></script>

<script src="calendar-15/calendar-15/js/main.js"></script>

</body>
</html>