


function save_previus_due() { 

	
	if ($('#pre_due').is(":checked"))
	{
  		var pre_due = $('#pre_due').val();
	}
	else
	{
		var pre_due = '';
	}

	var month = $('select[name="month"]').val();
	var year = $('select[name="year"]').val();
	var oper = 'prdu';

	var datast_prdu ="oper="+oper+"&month="+month+"&year="+year+"&pre_due="+pre_due;

	//alert(datast_schfs);
	$(".loading").show();
	$('.loading').html("<span style='color:#2e8965;font-size:16px;font-weight:bold;'>Data Generating.... Please Wait.  <img src='php_crud/img/preloader.gif' /></span>");
	//document.getElementById("previus_due").disabled = true;


	if(month==""){
		alert("Select Month");
		$('#month').focus();
		return false;
	}
	else if(year==""){
		alert("select Year");
		$('#year').focus();
		return false;
	}
	else if(pre_due==""){
		alert("Are You Agree ?");
		$('#pre_due').focus();
		$(".loading").hide();
		document.getElementById("previus_due").disabled = false;
		return false;
	}
	
	else{
		$.ajax({
			type:"post",
			url:"module/fees/generae_fee_ajax.php",
			data:datast_prdu ,
			success:function(result){
				alert(result);
				$(".loading").hide();	/*$('.loading').load('module/fees/prdu_generate_fee_summary.php',{'month':month,'year':year,'pre_due':pre_due,'oper':oper},function(data){
			//alert(data);
				});*/
				
				/*if(result==1){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Previous Due Already Calculated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result==2){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Previous Due Not Available</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result==3){
					$('.loading').html("<span style='background-color:green; padding:10px; color:#FFFFFF;'>Generate Successful</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result==4){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Previous Due Not Available</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}*/
			}
		});
	}

	
}

// ==========================================

function save_scholar() { 

	
	if ($('#scholar_generate').is(":checked"))
	{
	  var scholar_generate = $('#scholar_generate').val();
	}
	else
	{
		var scholar_generate = '';
	}

	var month = $('select[name="month"]').val();
	var year = $('select[name="year"]').val();
	var oper = 'schfs';

	var datast_schfs ="oper="+oper+"&month="+month+"&year="+year+"&scholar_generate="+scholar_generate;

	//alert(datast_schfs);
	$(".loading").show();
	$('.loading').html("<span style='color:#2e8965;font-size:16px;font-weight:bold;'>Data Generating.... Please Wait.  <img src='php_crud/img/preloader.gif' /></span>");
	//document.getElementById("scholar").disabled = true;

	if(month==""){
		alert("Select Month");
		$('#month').focus();
		return false;
	}
	else if(year==""){
		alert("select Year");
		$('#year').focus();
		return false;
	}
	else if(scholar_generate==""){
		alert("Are You Agree ?");
		$('#scholar_generate').focus();
		$(".loading").hide();
		document.getElementById("scholar").disabled = false;
		return false;
	}
	
	else{
		$.ajax({
			type:"post",
			url:"module/fees/generae_fee_ajax.php",
			data:datast_schfs ,
			success:function(result){
				alert(result);
				$(".loading").hide();	/*$('.loading').load('module/fees/schfs_generate_fee_summary.php',{'month':month,'year':year,'scholar_generate':scholar_generate,'oper':oper},function(data){
			//alert(data);
				});*/
				/*if(result==1){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Schoolership Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result==2){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>This Month Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result==3){
					$('.loading').html("<span style='background-color:green; padding:10px; color:#FFFFFF;'>Generate Success</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result==4){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>This Month Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}*/
			}
		});
	}

	
}



// =======================================

function save_atd_fine() { 

	var month = $('select[name="month"]').val();
	var year = $('select[name="year"]').val();
	var abs_fine = $('input[name="abs_fine"]:checked').val();
	var abs_fine_head = $('#abs_fine_head').val();

	var late_fine = $('input[name="late_fine"]:checked').val();
	var late_fine_head = $('#late_fine_head').val();

	//alert(abs_fine);

	var oper = 'afs';

	var datast_afs ="oper="+oper+"&month="+month+"&year="+year+"&abs_fine="+abs_fine+"&abs_fine_head="+abs_fine_head+"&late_fine="+late_fine+"&late_fine_head="+late_fine_head;
	$(".loading").show();
	$('.loading').html("<span style='color:#2e8965;font-size:16px;font-weight:bold;'>Data Generating.... Please Wait.  <img src='php_crud/img/preloader.gif' /></span>");
	//document.getElementById("atd_fine").disabled = true;

	if(month==""){
		alert("Select Month");
		$('#month').focus();
		return false;
	}
	else if(year==""){
		alert("select Year");
		$('#year').focus();
		return false;
	}
	else if(abs_fine!="absent_fine" && late_fine!="late_fine"){
		alert("Checked Any One");
		$('#abs_fine').focus();
		$(".loading").hide();
		document.getElementById("atd_fine").disabled = false;
		return false;
	}
	else if(abs_fine=="absent_fine" && abs_fine_head==""){
		alert("Write Absent Fee Head");
		$('#abs_fine_head').focus();
		$(".loading").hide();
		return false;
	}
	else if(late_fine=="late_fine" && late_fine_head==""){
		alert("Write Late Fee Head");
		$('#late_fine_head').focus();
		$(".loading").hide();
		return false;
	}

	else{
		$.ajax({
			type:"post",
			url:"module/fees/generae_fee_ajax.php",
			data:datast_afs ,
			success:function(result1){
				alert(result1);
				$(".loading").hide();	/*$('.loading').load('module/fees/afs_generate_fee_summary.php',{'month':month,'year':year,'abs_fine':abs_fine,'oper':oper,'abs_fine_head':abs_fine_head,'late_fine':late_fine,'late_fine_head':late_fine_head},function(data){
			//alert(data);
				});*/
				/*if(result1==1){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Absent Fine Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result1==2){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Absent Fine Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result1==3){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Late Fine Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result1==4){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Late Fine Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result1==5){
					$('.loading').html("<span style='background-color:green; padding:10px; color:#FFFFFF;'>Generate Success</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result1==6){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Late Fine Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}*/
			}
		});
	}



}


// =============================================

function save_monthly_fee() { 
	
	var month = $('select[name="month"]').val();
	var year = $('select[name="year"]').val();	
	var fee_ids = $('input[name="fee_ids"]').val();

	var oper = 'mfs';

	var datast_mfs ="oper="+oper+"&month="+month+"&year="+year+"&fee_ids="+fee_ids;
	//alert(datast_mfs);
	$(".loading").show();
	$('.loading').html("<span style='color:#2e8965;font-size:16px;font-weight:bold;text-align:center;'>Data Generating.... Please Wait.  <img src='php_crud/img/preloader.gif' /></span>");
	//$(".loading").load("module/fees/loading.php",datastr);
	//document.getElementById("test").disabled = true;
	//alert(1);
	if(month==""){
		alert("Select Month");
		$('#month').focus();
		return false;
	}
	else if(year==""){
		alert("select Year");
		$('#year').focus();
		return false;
	}
	else if(fee_ids==""){
		alert("Checked any Fee Type");
		$('.fee_id').focus();
		$(".loading").hide();
		document.getElementById("test").disabled = false;
		return false;
	}
	else{
		
		$.ajax({
			type:"post",
			url:"module/fees/generae_fee_ajax.php",
			data:datast_mfs ,
			success:function(result){
				alert(result);
				$(".loading").hide();
				/*$('.loading').load('module/fees/mfs_generate_fee_summary.php',{'month':month,'year':year,'fee_ids':fee_ids,'oper':oper},function(data){
			//alert(data);
				}); */
				
				/*if(result==1){
					
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>Monthly This Fee Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					location.href='module/fees/generate_fee_summary.php';
					alert(result);
					}
				if(result==2){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>This Month Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result==3){
					$('.loading').html("<span style='background-color:green; padding:10px; color:#FFFFFF;'>Generate Success</span>");
					$(".loading").show().delay(5000).fadeOut();
					}
				if(result==4){
					$('.loading').html("<span style='background-color:#FF0000; padding:10px; color:#FFFFFF;'>This Month Already Generated</sapn>");
					$(".loading").show().delay(5000).fadeOut();
					}*/
				
				//document.getElementById("test").disabled = false;
			}
		});
	}

	
}


// =============================================

function monthly_fee_select() {

    var permited =[];
    $('input[name="fee_id[]"]').each(function () {
       if($(this).is(':checked')==true)
        {
          //alert(this.value);
		  permited.push(this.value);
        }
    });                
     var s = $('#fee_token').val(permited);
	 //alert(permited);
  
}

// ===============================================