

<script>
var resizefunc = [];
</script>

<!-- jQuery  -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/tether.min.js"></script><!-- Tether for Bootstrap -->
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/jquery.nicescroll.js"></script>
<script src="assets/plugins/switchery/switchery.min.js"></script>


<!-- validation -->    
<script src="assets/plugins/validation/jquery.validate.js" type="text/javascript"></script> 
<script src="assets/plugins/validation/additional-methods.js" type="text/javascript"></script> 
         
<!-- Required datatable js -->
<script src="assets/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="assets/plugins/datatables/dataTables.bootstrap4.min.js"></script>
<!-- Buttons examples -->
<script src="assets/plugins/datatables/dataTables.buttons.min.js"></script>
<script src="assets/plugins/datatables/buttons.bootstrap4.min.js"></script>
<script src="assets/plugins/datatables/jszip.min.js"></script>
<script src="assets/plugins/datatables/pdfmake.min.js"></script>
<script src="assets/plugins/datatables/vfs_fonts.js"></script>
<script src="assets/plugins/datatables/buttons.html5.min.js"></script>
<script src="assets/plugins/datatables/buttons.print.min.js"></script>
<script src="assets/plugins/datatables/buttons.colVis.min.js"></script>
<!-- Responsive examples -->
<script src="assets/plugins/datatables/dataTables.responsive.min.js"></script>
<script src="assets/plugins/datatables/responsive.bootstrap4.min.js"></script>


<!-- Sweet Alert js -->
<script src="assets/plugins/bootstrap-sweetalert/sweet-alert.min.js"></script>
<script src="assets/pages/jquery.sweet-alert.init.js"></script>

<!-- Modal-Effect -->
<script src="assets/plugins/custombox/js/custombox.min.js"></script>
<script src="assets/plugins/custombox/js/legacy.min.js"></script>


<!-- Selectbox search Plugins js-->
<script type="text/javascript" src="assets/plugins/multiselect/js/jquery.multi-select.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-quicksearch/jquery.quicksearch.js"></script>
<script src="assets/plugins/select2/js/select2.full.min.js" type="text/javascript"></script>

<!-- Date and Date time pickers Plugins js -->
<script src="assets/plugins/moment/moment.js"></script>
<script src="assets/plugins/timepicker/bootstrap-timepicker.min.js"></script>
<script src="assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>


<!-- iCheck -->      
<link type="text/css" href="assets/plugins/iCheck/square/blue.css" rel="stylesheet" />     
<script src="assets/plugins/iCheck/icheck.min.js" type="text/javascript"></script> 
		
<!-- App js -->
<!--<script src="assets/js/jquery.core.js" type="text/javascript"></script>
<script src="assets/js/jquery.app.js" type="text/javascript"></script>-->

<!-- Autocomplete -->
<!--<script src="assets/autocomplete/js/jquery.easy-autocomplete.js" type="text/javascript"></script>-->
 
   

<script type="text/javascript">

var sucmsg = 'has been added successfully';
var exsmsg = 'Already Exists';
var upmsg  = 'has been updated successfully';
var reqmsg = 'Required fields should not be empty';
var delmsg = 'Deleted successfully';
var statusmsg= 'Status updated successfully';
var exsmsg_email = 'Email ID already exists. Please try with other email ID to create account.';
var exsmsg_phone = 'Mobile number already exists. Please try with other mobile number create account.';
var exsmsg_reference = 'Reference exists with other data. Cannot be deleted.';
var oldpass_reference = 'Old Password doesn`t match. Please enter right password.';
var othmsg = 'Opps!!@ Server Error. Please retry again.';
var exsmsg_refstats = 'Reference exists with other data. Cannot Perform the action.';
var dataGridHdn; 


 $(function () {    
	$('input').iCheck({
        checkboxClass: 'icheckbox_square-blue',
        radioClass: 'iradio_square-blue',
        increaseArea: '20%' // optional
    });
	
	
	$(".select2").select2();
 });
  
  
  $(".date-picker-month").datepicker( {
    format: "mm-yyyy",
    startView: "months", 
    minViewMode: "months",
    orientation: "top",
    autoclose: true
});


jQuery(document).ready(function($){
	var currentPath  = window.location.pathname;	
	var splitPath = currentPath.split('/');
	var cPath = splitPath[splitPath.length-1];	
	if(cPath.indexOf('_') != -1){		
		var cPathSplit = cPath.split('_');       	
		if(cPathSplit[0].length > 0){		
			$('.navigation-menu li').removeClass('active');		
			$('.navigation-menu a').each(function(){				
				var href = $.trim($(this).attr('href'));
				var hrefSplit = href.split('_');					
				if(hrefSplit[0] == cPathSplit[0]){					
					$(this).closest('li').addClass('active');
					$(this).closest('ul').parent().addClass('active');				
				}
			});
		}
	}
});
 

//Accept Number only function - START
 function isNumber(evt) {
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }
    return true;
}
//Accept Number only function - END


function isNumberKey(evt)
{
	var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	
   return true;
}


//Data table all page display grid common function - START		
  function datatblCal(hdnFld)
	{	  	   	
	    var i=0;	    
        var dataTable = $('#tblresult').dataTable( {		
		initComplete: function () {
			if(typeof hdnFld !='undefined'){				
			}	
			unloading(); 
        },	
			"order":[[0,"desc"]],
            "processing": true,
			//aoColumnDefs: [ { bSortable: true, aTargets: [ '_all' ] },{ bSortable: true, aTargets: [0] }],
			"columnDefs": [ { "targets": remove_sorting_columns(), "orderable": false } ],
			"destroy" : true,
            "serverSide": true,
			"stateSave": true,
			"bStateSave" : false,
			"language": { "processing": loading() },
            "ajax":{
                url :"display-grid-data.php?finaltab="+$('#disptblname').val(), // json datasource
                type: "post",  // method  , by default get
                error: function(){  // error handling                  
                    $("#tblresult").append('<tbody class="employee-grid-error"><tr><th colspan="4">No data found in the server</th></tr></tbody>');
					unloading(); 
                }
            },
			"dom": '<"pull-left "f><"pull-right custom-padding"B>rtip',
        buttons: [{
            filename:  $('#disptblname').val() + '_' + new Date().toISOString().slice(0, 10),
            extend: 'excelHtml5',
            text: 'Download <i class="fa fa-file-excel-o green-color"></i>',
            titleAttr: 'Excel', 
		}],
           }); 
		
}

function disp_result(){ 
	
	$('#tblresult').dataTable({
		initComplete: function () {
			unloading(); 
		},
		bFilter: false, 
		bSort: false,
        "processing": true,
		//"aoColumnDefs": [ { "bSortable": false, "aTargets": [ '_all' ] }],
		"columnDefs": [ { "orderable": false, "aTargets": [ '_all' ]  } ],			
		"destroy" : true,
        "serverSide": true,
		"stateSave": true,
		"bStateSave" : false,
		"language": { "processing": loading() },
        "ajax":{
            url :"listingactivity_actions.php?pageaction="+$('#action').val()+"&srch_type="+$('#SearchOption').val()+"&srch_keyword="+$('#Srchvalautocomplete').val()+"&srch_finyear="+$('#srch_fin_year').val()+"&srch_company="+$('#srch_company').val()+"&srch_customer="+$('#srch_customer').val()+"&srch_fmdate="+$('#txtsrch_fmdate').val()+"&srch_todate="+$('#txtsrch_todate').val(), // json datasource
            type: "post",  // method  , by default get				
            error: function(){  // error handling                  
                $("#tblresult").append('<tbody class="employee-grid-error"><tr><th colspan="4">No data found in the server</th></tr></tbody>');
				unloading(); 
            }
        }
     });
}


 function datatblCalExport(hdnFld)
	{	  	   	
	    var i=0;	    
        var dataTable = $('#tblresult').dataTable( {		
		initComplete: function () {
			if(typeof hdnFld !='undefined'){				
			}	
			unloading(); 
        },	
			"order":[[0,"desc"]],
            "processing": true,
			// "lengthMenu": [[-1], ["All"]],
			"bPaginate": true,	
			pagingType: "simple_numbers",
			//aoColumnDefs: [ { bSortable: true, aTargets: [ '_all' ] },{ bSortable: true, aTargets: [0] }],
			"columnDefs": [ { "targets": remove_sorting_columns(), "orderable": false } ],
			"destroy" : true,
            "serverSide": true,
			"stateSave": true,
			"bStateSave" : false,
			"language": { "processing": loading() },
            "ajax":{
                url :"display-grid-data.php?finaltab="+$('#disptblname').val(), // json datasource
                type: "post",  // method  , by default get
                error: function(){  // error handling                  
                    $("#tblresult").append('<tbody class="employee-grid-error"><tr><th colspan="4">No data found in the server</th></tr></tbody>');
					unloading(); 
                }
            },            			
			dom: '<"pull-left"f><"pull-right custom-padding"B>rtip',	
		//    "iDisplayLength": 1000,
			// lengthMenu: [[10,25,50,100,1000], [10,25,50, 100, "All"]],
	        buttons: [
				{
					extend: 'excelHtml5', 
					text:  'Download <i class="fa fa-file-excel-o green-color"></i>',
					exportOptions: {
							order : 'current',  
							page : 'all',    
							search : 'none' 
					},
				
				footer: true,
				filename: function(){
						var d = new Date();
						var n = d.getTime();
						return $('#disptblname').val() + '_' +n;
					}
				}
			]
        } ); 
}
 function datatblCalSupplier(hdnFld)
	{	  	   	
	    var i=0;	    
        var dataTable = $('#tblresult').dataTable( {		
		initComplete: function () {
			if(typeof hdnFld !='undefined'){				
			}	
			unloading(); 
        },	
			"order":[[0,"desc"]],
            "processing": true,
			// "lengthMenu": [[-1], ["All"]],
			"bPaginate": true,	
			pagingType: "simple_numbers",
			//aoColumnDefs: [ { bSortable: true, aTargets: [ '_all' ] },{ bSortable: true, aTargets: [0] }],
			"columnDefs": [ { "targets": remove_sorting_columns(), "orderable": false } ],
			"destroy" : true,
            "serverSide": true,
			"stateSave": true,
			"bStateSave" : false,
			"language": { "processing": loading() },
            "ajax":{
                url :"display-grid-data.php?finaltab="+$('#disptblname').val(), // json datasource
                type: "post",  // method  , by default get
                error: function(){  // error handling                  
                    $("#tblresult").append('<tbody class="employee-grid-error"><tr><th colspan="4">No data found in the server</th></tr></tbody>');
					unloading(); 
                }
            },            			
			dom: '<"pull-left"f><"pull-right custom-padding"B>rtip',	
		//    "iDisplayLength": 1000,
			// lengthMenu: [[10,25,50,100,1000], [10,25,50, 100, "All"]],
	        buttons: [
				{
					extend: 'excelHtml5', 
					text:  'Download <i class="fa fa-file-excel-o green-color"></i>',
					exportOptions: {
							order : 'current',  
							page : 'all',    
							search : 'none' 
					},
				
				footer: true,
				filename: function(){
						var d = new Date();
						var n = d.getTime();
						return $('#disptblname').val() + '_' +n;
					}
				}
			],

			columnDefs : [
                        {
                            targets: 1,
							width: 80,
							render: function (data, type, row) {
                                var sup_name = row[1];
                                var sup_pdt = row[8];
								
								// if (sup_pdt == '1'){
								// 	sup_pdt = '<span style="color:green; font-size:12px">Raw material</span>';
								// }
								// else {
								// 	sup_pdt = '<span style="color:blue; font-size:12px">Finished Product</span>';
								// }
								return sup_name+'<br><span style="color:green; font-size:12px">'+sup_pdt+'</span>';
							},
							
						},
						{
							targets: 8,
							visible: false, // Hide the 8th column
							searchable: false // Prevent searching on the 8th column
						},
						{
							targets: 3,
							render: function (data, type, row) {
                                var sup_product = row[3];
								if (sup_product == '1'){
									sup_product = '<span style="color:green; font-size:12px">Raw material</span>';
								}
								else {
									sup_product = '<span style="color:blue; font-size:12px"> Product</span>';
								}
								return sup_product;
							}
						}
						 
					],
        } ); 
}
 function datatblCalCustomer(hdnFld)
	{	  	   	
	    var i=0;	    
        var dataTable = $('#tblresult').dataTable( {		
		initComplete: function () {
			if(typeof hdnFld !='undefined'){				
			}	
			unloading(); 
        },	
			"order":[[0,"desc"]],
            "processing": true,
			// "lengthMenu": [[-1], ["All"]],
			"bPaginate": true,	
			pagingType: "simple_numbers",
			//aoColumnDefs: [ { bSortable: true, aTargets: [ '_all' ] },{ bSortable: true, aTargets: [0] }],
			"columnDefs": [ { "targets": remove_sorting_columns(), "orderable": false } ],
			"destroy" : true,
            "serverSide": true,
			"stateSave": true,
			"bStateSave" : false,
			"language": { "processing": loading() },
            "ajax":{
                url :"display-grid-data.php?finaltab="+$('#disptblname').val(), // json datasource
                type: "post",  // method  , by default get
                error: function(){  // error handling                  
                    $("#tblresult").append('<tbody class="employee-grid-error"><tr><th colspan="4">No data found in the server</th></tr></tbody>');
					unloading(); 
                }
            },            			
			dom: '<"pull-left"f><"pull-right custom-padding"B>rtip',	
		//    "iDisplayLength": 1000,
			// lengthMenu: [[10,25,50,100,1000], [10,25,50, 100, "All"]],
	        buttons: [
				{
					extend: 'excelHtml5', 
					text:  'Download <i class="fa fa-file-excel-o green-color"></i>',
					exportOptions: {
							order : 'current',  
							page : 'all',    
							search : 'none' 
					},
				
				footer: true,
				filename: function(){
						var d = new Date();
						var n = d.getTime();
						return 'report_'+n;
					}
				}
			],

			columnDefs : [
                        {
                            targets: 1,
							width: 80,
							render: function (data, type, row) {
                                var sup_name = row[1];
                                var sup_pdt = row[5];
								return sup_name+'<br><span style="color:green; font-size:12px">'+sup_pdt+'</span>';
							},
							
						},
						{
							targets:3,
							render: function (data, type, row) {
								var mobile = row[3];
								var email = row[4];
								return mobile+'<br>'+email;
							}
						},
						{
							targets: 4,
							visible: false, // Hide the 8th column
							searchable: false // Prevent searching on the 8th column
						},
						{
							targets: 5,
							visible: false, // Hide the 8th column
							searchable: false // Prevent searching on the 8th column
						},
						// {
						// 	targets: 6,
						// 	visible: false, // Hide the 8th column
						// 	searchable: false // Prevent searching on the 8th column
						// },
						
						 
					],
        } ); 
}


//Data table all page display grid common function - START		
 function datatblCalAdvanceSearch(hdnFld,)
	{
 	   var iColumns = $('#tblresult thead th').length;  // count all column length
	   var sortrmvcloumn1 = parseInt(iColumns-2); // sorting remove to action column
	   var sortrmvcloumn2 = parseInt(iColumns-1); // sorting remove to status column
	   
	console.log($("#search").serializeArray());
	    var i=0;
        var dataTable = $('#tblresult').dataTable( {		
		initComplete: function () {
			if(typeof hdnFld !='undefined'){				
			}	
			unloading(); 
        },					
            "processing": true,
			//aoColumnDefs: [ { bSortable: true, aTargets: [ '_all' ] },{ bSortable: true, aTargets: [0] }],
			"columnDefs": [ { "targets": [sortrmvcloumn1,sortrmvcloumn2], "orderable": false } ],
			"destroy" : true,
            "serverSide": true,
			"stateSave": false,
			//"bStateSave" : false,
			"language": { "processing": loading() },
            "ajax":{
                url :"display-grid-data.php?"+$("#search").serialize()+"&finaltab="+$('#disptblname').val(), // json datasource
                type: "post",  // method  , by default get
				data : $("#search").serializeArray(),
                error: function(){  // error handling                  
                    $("#tblresult").append('');
					unloading(); 
                }
            },
			

        } ); 
}
//Data table all page display grid common function - END

function remove_sorting_columns(){
	var iColumns = $('#tblresult thead th').length;  // count all column length
	var sortrmvcloumn1 = parseInt(iColumns-2); // sorting remove to action column
	var sortrmvcloumn2 = parseInt(iColumns-1); // sorting remove to status column   	
	disptblclumn = $('#disptblname').val();
	var temprow=[];		
	var rmvfilterclumn = 0;	

	if(disptblclumn == "purchase" || disptblclumn == "amenities"){
		rmvfilterclumn = $('#rmv_sort_clm').val();
	}	
		
	if(rmvfilterclumn == 0){
		temprow.push(sortrmvcloumn1,sortrmvcloumn2);	 
		return temprow;	
	}
	else{
		var row = rmvfilterclumn.split(",").map(Number);				
		$.each(row, function( index, value ) {	
		  temprow.push(parseInt(value));			  
		});	
		
		temprow.push(sortrmvcloumn1,sortrmvcloumn2);	 
		return temprow;
	}
}

//Data table all page display grid common function - END




//Save data to db all page common function - START		
function funSubmt($frm,$urll,$acts,$stats,$lodlnk)
{
	if ($('#'+$acts).valid()) {
		$("button").attr('disabled',true);

		var disabled = $('#'+$acts).find(':input:disabled').removeAttr('disabled');
		var formdatas = $("#"+$acts).serialize();	
		disabled.attr('disabled','disabled');

		$.ajax({
			url        : $urll,
			method     : 'POST',
			dataType   : 'json',
			data       : formdatas,
			beforeSend: function() {
				loading();
 			},
			success: function(response){ 
			
			    if(response.rslt == "1"){
					swal("Success!", $stats +' '+ sucmsg, "success");										
					$("#"+$acts)[0].reset();
					$(location).attr('href', $lodlnk);
				}
				else if(response.rslt == "2"){
					swal("Update!", $stats +' '+ upmsg, "success");
					$("#"+$acts)[0].reset();
					$(location).attr('href', $lodlnk);
				}			
			    else if(response.rslt == "3"){
					swal("Failure!", $stats +' '+ exsmsg, "warning");
				}
				else if(response.rslt == "4"){
					swal("Failure!", $stats +' '+ reqmsg, "warning");
				}
				else{
					swal("Failure!", othmsg, "warning");
				}		
			
				unloading();
				$("button").attr('disabled',false); 
				
			}
		});
	}	
}
//Save data to db all page common function - END	

//Save data to db Image upload page common function - START		
function funSubmtWithImg($frm,$urll,$acts,$stats,$lodlnk)
{    	
//alert($stats)
	if ($('#'+$acts).valid()) {
		$("button").attr('disabled',true);
		
		var m_data = new FormData();
		var disabled = $('#'+$acts).find(':input:disabled').removeAttr('disabled');
		
		var formdatas = $("#"+$acts).serializeArray();	
		disabled.attr('disabled','disabled');		
		
		$.each( formdatas, function( key, value ) {
			 m_data.append( value.name, value.value);							 
		});
		if($stats == 'user'){			
			m_data.append( 'user_photo', $('input[name=user_photo]')[0].files[0]);			
		}
		else if($stats == 'company'){			
			m_data.append( 'company_logo', $('input[name=company_logo]')[0].files[0]);			
		}	
		else if($stats == 'supplier'){			
			m_data.append( 'supplier_logo', $('input[name=sup_company_logo]')[0].files[0]);	
			m_data.append( 'supplier_img', $('input[name=sup_image]')[0].files[0]);
		}
		else if($stats == 'customer'){			
			m_data.append( 'customer_logo', $('input[name=cus_company_logo]')[0].files[0]);	
			m_data.append( 'customer_img', $('input[name=cus_image]')[0].files[0]);
		}
		
		$.ajax({
			url        : $urll,
			type	   : 'POST',
			dataType   : 'json',
			processData: false,
            contentType: false,
			data       : m_data,
			beforeSend: function() {
				loading();
 			},
			success: function(response){ 
			
			    if(response.rslt == "1"){
					swal("Success!", $stats +' '+ sucmsg, "success");										
					$("#"+$acts)[0].reset();
					$(location).attr('href', $lodlnk);
				}
				else if(response.rslt == "2"){
					swal("Update!", $stats +' '+ upmsg, "success");
					$("#"+$acts)[0].reset();
					$(location).attr('href', $lodlnk);
				}			
			    else if(response.rslt == "3"){
					swal("Failure!", $stats +' '+ exsmsg, "warning");
				}
				else if(response.rslt == "4"){
					swal("Failure!", $stats +' '+ reqmsg, "warning");
				}
				else{
					swal("Failure!", othmsg, "warning");
				}		
			
				unloading();
				$("button").attr('disabled',false); 
				
			}
		});
	}	
}
//Save data to db Image upload page common function - END	


//Active / inactive change all page common function - START
function funchangestatus(t,$frm,$par){
	swal({
		title: "Are you sure?",
        text: "Sure You want to change the status?",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "Yes, Change it!",
        closeOnConfirm: false,
		closeOnCancel: true
    },
	function () {
		$.ajax({		
			url        : $frm,
			method     : 'POST',
			dataType   : 'json',
			data       : $par,
			beforeSend: function() {
				loading();
 			},
			success: function(response){ 
				unloading();
				if(response.rslt == '6')
				{					
					swal("Success!", statusmsg, "success");	
					// datatblCalExport(dataGridHdn);
					location.reload();
				}
				else if(response.rslt == '7')
				{					
					if(response.ermsg){
						swal("Failure!", response.ermsg, "warning");
					}
					else{
						swal("Failure!", exsmsg_refstats, "warning");
					}				
				}
				else{
					swal("Failure!", othmsg, "warning");
				}	
			}		
		});	
    }); 
}


//Active / inactive change all page common function - END


//Delete data all page common function - START
function funStats(t,$frm,$par){
	swal({
		title: "Are you sure?",
        text: "You will not be able to recover this details!",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "Yes, delete it!",
        closeOnConfirm: false,
		closeOnCancel: true
    },
    function () {
		$.ajax({		
			url        : $frm,
			method     : 'POST',
			dataType   : 'json',
			data       : $par,
			beforeSend: function() {
				loading();
 			},
			success: function(response){
				unloading();
				if(response.rslt == '5')
				{					
					swal("Success!", delmsg, "success");	
					// disp_result(dataGridHdn);
					 location.reload();
				}
				else if(response.rslt == '7')
				{
					if(response.ermsg){
						swal("Failure!", response.ermsg, "warning");
					}
					else{
						swal("Failure!", exsmsg_refstats, "warning");	
					}	
				}
				else{
					swal("Failure!", othmsg, "warning");
				}
			}		
		});	
	 
    }); 	 
 }
//Delete data all page common function - END

function funStats_purchase(t,$frm,$par){
	console.log('hfdgsdg');
	swal({
		title: "Are you sure?",
        text: "You will not be able to recover this details!",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "Yes, delete it!",
        closeOnConfirm: false,
		closeOnCancel: true
    },
    function () {
		$.ajax({		
			url        : $frm,
			method     : 'POST',
			dataType   : 'json',
			data       : $par,
			beforeSend: function() {
				loading();
 			},
			success: function(response){
				unloading();
				if(response.rslt == '5')
				{					
					swal("Success!", delmsg, "success");	
					disp_result(dataGridHdn);
				}
				else if(response.rslt == '7')
				{
					if(response.ermsg){
						swal("Failure!", response.ermsg, "warning");
					}
					else{
						swal("Failure!", exsmsg_refstats, "warning");	
					}	
				}
				else{
					swal("Failure!", othmsg, "warning");
				}
			}		
		});	
	 
    }); 	 
 }

// return data delete -- START 
function funStatsReturn(t,$frm,$par){
	swal({
		title: "Are you sure?",
        text: "Items will be rollback to sold. !",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "Yes, delete it!",
        closeOnConfirm: false,
		closeOnCancel: true
    },
    function () {
		$.ajax({		
			url        : $frm,
			method     : 'POST',
			dataType   : 'json',
			data       : $par,
			beforeSend: function() {
				loading();
 			},
			success: function(response){
				unloading();
				if(response.rslt == '5')
				{					
					swal("Success!", delmsg, "success");	
					disp_result(dataGridHdn);
				}
				else if(response.rslt == '7')
				{
					if(response.ermsg){
						swal("Failure!", response.ermsg, "warning");
					}
					else{
						swal("Failure!", exsmsg_refstats, "warning");	
					}	
				}
				else{
					swal("Failure!", othmsg, "warning");
				}
			}		
		});	
	 
    }); 	 
 }


 // Payment details *******************************************
function funStatsPayment(t,$frm,$par){
	swal({
		title: "Are you sure?",
        text: "You will not be able to recover this details!!",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "Yes, delete it!",
        closeOnConfirm: false,
		closeOnCancel: true
    },
    function () {
		$.ajax({		
			url        : $frm,
			method     : 'POST',
			dataType   : 'json',
			data       : $par,
			beforeSend: function() {
				loading();
 			},
			success: function(response){
				unloading();
				if(response.rslt == '5')
				{					
					swal("Success!", delmsg, "success");	
					disp_result(dataGridHdn);
				}
				else if(response.rslt == '7')
				{
					if(response.ermsg){
						swal("Failure!", response.ermsg, "warning");
					}
					else{
						swal("Failure!", exsmsg_refstats, "warning");	
					}	
				}
				else{
					swal("Failure!", othmsg, "warning");
				}
			}		
		});	
	 
    }); 	 
 }


//Cancel all page common function - START	 
function funCancel($frm,$acts,$stats,$lodlnk)
{  
	swal({
		title: "Are you sure?",
		text: "Are you sure to cancel?",
		type: "warning",
		showCancelButton: true,
		confirmButtonColor: "#DD6B55",
		confirmButtonText: "Ok",
		closeOnConfirm: true
	},
	function (isConfirm) { 
		if (isConfirm) {			
			$("#"+$acts)[0].reset();
			$(location).attr('href', $lodlnk);
		}
	});
}
//Cancel all page common function - END
function downloadcsv(tagname)
	  {
		 
		  $(location).attr('href','<?php echo public1_url; ?>common_download.php?act='+tagname+'&'+$("#search").serialize());
	  }
 
</script>		
		