<?php 
require_once("config/configDB.php"); 
//session_start();
require "userPermission.php";
require 'financial_year_calculation.php';
?>

<!DOCTYPE html>
<html>
<head>
    <?php 
        require 'meta.php';  
        require 'header.php'; 
    ?>
</head>
<body>
    <?php require 'menu.php' ?>
    
    <form action="employeePaymentAdd.php" method="post">
<div class="container-fluid text-center col-sm-12 dashboard-add">  
  <form name="frmSearch" method="post" action="">

<div class=" col-sm-2">
    <label>From Date</label>
     <input type="text" class="form-control input-lg" id="fromDate" name="fromDate" autocomplete="off">
    <!--<input type="date" class="form-control input-lg" name="search[post_at]"   required pattern="\d{4}-\d{2}-\d{2}">-->
</div>
<div class=" col-sm-2">
    <label>To Date</label>
     <input type="text" class="form-control input-lg" id="toDate" name="toDate" autocomplete="off">
    
    
</div>
<!--<div class=" col-sm-2">
    <label>Vehicle</label>
    <select class="form-control input-lg selectpicker select-trip-vehicle" id="selecttripvehicle" data-live-search="true" name="vehicleno">
        <option disabled selected>Please Select Vehicle</option>
        <?php  // echo $sqlVehicleNo;   ?>
    </select> 
    
</div>-->
<?php if($Employee_Payment_Add==1) {  ?> 
<div class=" col-sm-2">
<!--<input  type="text" id="drivername" name="drivername" class="form-control input-lg  select-trip-drivername selectpicker"  data-live-search="true">-->

    <label class="control-label">Employee Name </label>
	   <select  id="ecode" name="ecode" class="form-control input-lg  select-trip-drivername selectpicker"  data-live-search="true">
        <option value="">Select</option>
         <?php
		
		$sql1 = mysqli_query($conn,"SELECT * FROM employee_master WHERE isdelete=1");
		while($row1=mysqli_fetch_array($sql1))
		{
		?>
        <option value="<?php echo $row1['ecode'];?>"><?php echo $row1['ename'];?></option>
        <?php
		}
		?>	    
        </select>
</div>
<div class=" col-sm-1" style="padding-top: 24px;">
<input type="submit" name="go" value="Search" class="btn btn-primary btn-lg">
</div>
<!--<div class=" col-sm-1" style="padding-top: 24px;">
<button type="button" class="btn btn-primary btn-lg datewise-submit-sale">Apply</button>
</div>-->


</div>
<?php } ?>
</form>
<div class="container-fluid text-right col-sm-12 dashboard-add" style="display:none;">  
<?php if($DriverBatta_View==1) {  ?>  

<a href="driverPaymentAdd.php" class="btn btn-primary">Add</a>

<?php } ?>
</div>

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

<!-- cname, city, pincode, mobile, gst_type, ccode, open_balance -->
    <div class="datatable-header ">
        <h3 class="text-center"><strong>Employee Payment</strong></h3>
        <table id="productMasterDashboard" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
            <thead>
                <tr>
				<th>Id</th>				
                <th>Emp. Name</th>
                <th>Date</th>
				<th>Salary For</th>
                <th>Paid&nbsp;Amount </th>
				<th>Payment&nbsp;Mode.</th>				
                <th>Verified By</th>
				<th>Action</th>
                </tr>
            </thead>
            <tbody></tbody>
           
        </table>
    </div>

</div>



    <?php require 'footer.php' ?>
    <script type="text/javascript">var base_url = "<?= $base_url ?>";</script>
    <script>
    
$(document).ready(function() {
			   var dataTable =  $('#productMasterDashboard').DataTable( {
                    columnDefs: [{ "orderable": false, "targets": 6 } ],
			   	    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,				aaSorting: [[0, 'desc']],
				//ajax: "test.js", // json datasource
				ajax: {
                    url : "employeePaymentgriddata.php",
                    type: 'POST',
                    data:  {
                        userpermissionEdit   : "<?php echo $Employee_Payment_Edit; ?>",
                        userpermissionDelete : "<?php echo $Employee_Payment_Delete; ?>",
                        userpermissionPrint  : "<?php echo $Employee_Payment_Print; ?>"
                }
                }
			    } );
			} );

function ConfirmproductMasterDelete(productid) {
    //alert(productid);
    if(confirm('Are you sure?'))    
    {           
        console.log("Data has been Delected ");
        $.ajax({
            url: base_url+'productMasterDelete.php?productid='+productid,     
            dataType: "json",   
            type: 'GET',    
            success: function(data) {
                console.log("Data has been Delected "); 
                //window.location.href = "productMasterDashboard.php";       
            },
            error: function() {             
                console.log('An error has occurred');               
            }                   
        }); 
    }
     window.location.href = "productMasterDashboard.php";
}

</script>
 <script type="text/javascript" src="js/plugin/jquery-ui.min.js"></script>
<script>
    
$(document).ready(function() {

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

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

			} );

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