$(document).ready(function(){
	load();
});

function call_btn_only(br_type){
	//alert(br_type);
	$('.btn_all').css("display","none");
	$('.btn_only').css("display","block");
}

function call_btn_all(br_type){
	//alert(br_type);
	$('.btn_only').css("display","none");
	$('.btn_all').css("display","block");
}




function call_save(type){

	if(type=='only'){
		var abs_day = $("#abs_day").val();
		var abs_fee = $("#abs_fee").val();
		var lt_day = $("#lt_day").val();
		var lt_fee = $("#lt_fee").val();

		var operation = "only";
		
		var datastr_only="operation="+operation+"&abs_day="+abs_day+"&abs_fee="+abs_fee+"&lt_day="+lt_day+"&lt_fee="+lt_fee;

		 //alert(datastr_only);
		// exit();

		if(abs_day==""){
			alert("Absent Days Assign");
			$('#abs_day').focus();
			return false;
		}
		else if(abs_fee==""){
			alert("Absent Fee Assign");
			$('#abs_fee').focus();
			return false;
		}
		else if(lt_day==""){
			alert("Late Days Assign");
			$('#lt_day').focus();
			return false;
		}
		else if(lt_fee==""){
			alert("Late Fee Assign");
			$('#lt_fee').focus();
			return false;
		}	
		else{
			$.ajax({
				type:"post",
				url:"module/fees/get_atd_fine_dec.php",data:datastr_only ,success:function(st){
					 //alert(st);
					load();
				}
			});
		}

	}

	else if(type=='all'){
		var abs_day = $("#abs_day").val();
		var abs_fee = $("#abs_fee").val();
		var lt_day = $("#lt_day").val();
		var lt_fee = $("#lt_fee").val();
		var operation = "all";
		
		var datastr_all="operation="+operation+"&abs_day="+abs_day+"&abs_fee="+abs_fee+"&lt_day="+lt_day+"&lt_fee="+lt_fee;

		// alert(datastr_only);
		// exit();

		if(abs_day==""){
			alert("Absent Days Assign");
			$('#abs_day').focus();
			return false;
		}
		else if(abs_fee==""){
			alert("Absent Fee Assign");
			$('#abs_fee').focus();
			return false;
		}
		else if(lt_day==""){
			alert("Late Days Assign");
			$('#lt_day').focus();
			return false;
		}
		else if(lt_fee==""){
			alert("Late Fee Assign");
			$('#lt_fee').focus();
			return false;
		}
		else{
			$.ajax({
				type:"post",
				url:"module/fees/get_atd_fine_dec.php",data:datastr_all ,success:function(st){
					 //alert(st);
					load();
				}
			});
		}

	}


}
// ============================================


$("#edit_save").click(function(){

	var e_absent_days = $("#e_absent_days").val();
	var e_absent_fee = $("#e_absent_fee").val();
	var e_late_days = $("#e_late_days").val();
	var e_late_fee = $("#e_late_fee").val();
	var e_status = $("#e_status").val();
	var id = $("#e_fee_id").val();

	var opr = 'update';


	var dataStr="e_absent_days="+e_absent_days+"&e_absent_fee="+e_absent_fee+"&e_late_days="+e_late_days+"&e_late_fee="+e_late_fee+"&e_status="+e_status+"&id="+id+"&opr="+opr;

	 //alert(dataStr_mark);

	if(e_absent_days==""){
		alert("Select Shift");
		$('#e_absent_days').focus();
		return false;
	}
	else if(e_absent_fee==" "){
		alert("Select Medium");
		$('#e_absent_fee').focus();
		return false;
	}
	else if(e_late_days==""){
		alert("Select Class");
		$('#e_late_days').focus();
		return false;
	}
	else if(e_late_fee==""){
		alert("Select Fee Head");
		$('#e_late_fee').focus();
		return false;
	}
	else if(e_status==""){
		alert("Enter Amount");
		$('#e_status').focus();
		return false;
	}
	else{
		$.ajax({
			type:"post",
			url:"module/fees/get_atd_fine_dec.php",
			data:dataStr,
			success:function(result){
				load();
			}
		});
	}

});




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


function show_edit_view(id){
//alert(id);
var datastr = "id="+id;
$("#model_table_value").load("module/fees/edit_atd_fine_dec.php",datastr);


}



function load(){
	$(".data_fee_type").load("module/fees/get_atd_fine_dec.php");
	
}




