<?php 
include "includes/header.php"; 
include "includes/Mdme-functions.php";
$mdme = getMdme_Rpt_Purchase_Payment_List($db,'');
include_once "includes/pagepermission.php";

include_once "common/dpselect-functions.php";

//check permission - START
if(!($res_modm_prm)){
	header("Location:".admin_public_url."error.php");
}
else if(trim($res_modm_prm['ViewPrm'])=="0") {
	header("Location:".admin_public_url."error.php");
}
//check permission - END

$f_dt_cur_mnth = date('01-m-Y');  
$cu_dt_cur_mnth  = date('d-m-Y');

?> 


<div class="wrapper">
    <div class="container">
        <!-- Page-Title - START -->
        <div class="row">
            <div class="col-sm-12"> 
                <h4 class="page-title">Purchase Payments List</h4>
				<input type="hidden" name="disptblname" id="disptblname" value="<?php echo "rpt_pur_payment_list"; ?>" />
				<input type="hidden" name="rmv_sort_clm" id="rmv_sort_clm" value="<?php echo "0"; ?>" />
            </div>
        </div>
		<!-- Page-Title - END -->	
		
		<div class="row">
            <div class="col-sm-12">
                <div class="card-box">                         
                    <div class="row">
						<div class="col-md-3">
							<?php 
							echo getSelectBox_companylist($db, 'srch_sup_company');
							?>							
						</div>
					
						<div class="col-md-3">
							<?php 
							echo getSelectBox_supplierlist($db, 'srch_sup_supplier');
							?>							
						</div>
						
						<div class="col-md-1">
							<button onclick="search_result();" type="button" class="btn btn-warning pull-right">Search</button>
						</div>
						
					</div>
                </div>
            </div>
        </div>
			
		
		<div class="row">
            <div class="col-sm-12">
                <div class="card-box table-responsive">                         
                    <table id="tblresult_payments_list" class="table table-striped table-bordered">
                        <thead>
                            <tr>
								<th>Payment Id</th>
								<th>Created Date</th>								
								<th>Company</th>								
								<th>Supplier</th>								
								<th>Payment Type</th>																			
								<th>Amount</th>
								<th>Details</th>
                            </tr>
                        </thead>                       
                    </table>
                </div>
            </div>
        </div> <!-- end row -->		

<?php include "includes/footer.php";  ?> 
	</div> <!-- container -->
</div> <!-- End wrapper -->

<?php include "includes/footer_script.php";  ?> 


<script>
$(function () {   		
	disp_result()		
});


function disp_result(){		
		
	$('#tblresult_payments_list').dataTable({
			initComplete: function () {		
				unloading(); 
			},
			bFilter: true, 
			bSort: true,
			"aaSorting": [[ 0, 'desc' ]], 
            "processing": true,
			//"aoColumnDefs": [ { "bSortable": false, "aTargets": [ '_all' ] }],
			"columnDefs": [ { "targets": [6], "orderable": false } ],			
			"destroy" : true,
            "serverSide": true,
			"stateSave": true,
			"bStateSave" : true,			
			"language": { "processing": loading() },			
            "ajax":{
                url :"reportactivity_actions.php?pageaction="+$('#disptblname').val()+"&srch_company="+$('#srch_sup_company').val()+"&srch_supplier="+$('#srch_sup_supplier').val(), // json datasource
                type: "post",  // method  , by default get				
                error: function(){  // error handling                  
                    $("#tblresult_payments_list").append('<tbody class="employee-grid-error"><tr><th colspan="4">No data found in the server</th></tr></tbody>');
					unloading(); 										
                }
            },
     });	 
}


function search_result(){
	disp_result();
}

</script>	

</body>
</html>
