<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
$obj=new my_class();
// ============

$operation=$_POST['operation'];
$branch_id=$_SESSION['LOGIN_BRANCH'];
$time=addslashes(trim($_POST['time']));

if($operation=='insert'){
	//echo "sdsds";
	//branch_id="+branch_id+"&shift="+shift+"&comment="+comment+"&operation="+operation;
	
	$school_id=addslashes(trim($_POST['school_id']));
	
	$exam_name=addslashes(trim($_POST['exam_name']));
	$no_of_std=addslashes(trim($_POST['no_of_std']));
	
	$per_std_cost=addslashes(trim($_POST['per_std_cost']));
	
	$total_amount=addslashes(trim($_POST['total_amount']));
	
	$session=addslashes(trim($_POST['session']));
	
	
	$form_data1['_pid']=$school_id;
	$form_data1['_exam_name']=$exam_name;
	$form_data1['_no_of_student']=$no_of_std;
	$form_data1['_cost_per_student']=$per_std_cost;
	$form_data1['_total_amount']=$total_amount;
	$form_data1['_session']=$session;
	$form_data1['_due_amount']=$total_amount;
	$form_data1['_status']='U';
	
	/*
	$form_data1['_entry_by']=$_SESSION['LOGIN_USERID'];
	$form_data1['_entry_date']=date("Y:m:d h:i:s");
	*/
	
	
		//inserting in _int_institute_setup
		echo $table_name='_exam_service_registration';
		echo $where_cond=" _pid='".$school_id."' and _exam_name='".$exam_name."' and _session='".$session."'";
		$entry1=$obj->Insert_Data_By_Cond($table_name, $form_data1,$where_cond);
		if($entry1!=NULL){
				echo "New School registration sucessful";
	}
	else{
		echo "Same School name already exist ";
	}
}
if($operation=='update_exam_service_reg_school_info'){
	$edit_school_id_for_reg=trim($_POST['edit_school_id_for_reg']);
	//$shift_id=trim($_POST['edit_shift_id']);
	$edit_exam_name_for_reg=addslashes(trim($_POST['edit_exam_name_for_reg']));
	$edit_no_of_std_for_reg=addslashes(trim($_POST['edit_no_of_std_for_reg']));
	$edit_per_std_cost_for_reg=addslashes(trim($_POST['edit_per_std_cost_for_reg']));
	$edit_total_amount_for_reg=addslashes(trim($_POST['edit_total_amount_for_reg']));
	$edit_session_for_reg=addslashes(trim($_POST['edit_session_for_reg']));
	
	
	//$form_data1['_exam_name']=$edit_exam_name_for_reg;
	$form_data1['_no_of_student']=$edit_no_of_std_for_reg;
	$form_data1['_cost_per_student']=$edit_per_std_cost_for_reg;
	$form_data1['_total_amount']=$edit_total_amount_for_reg;
	$form_data1['_due_amount']=$edit_total_amount_for_reg;
	//$form_data1['_session']=$edit_session_for_reg;
	$form_data1['_update_by']=$_SESSION['LOGIN_USERID'];
	$form_data1['_last_update']=date("Y:m:d h:i:s");
	
	$table_name='_exam_service_registration';
	$where_clause="_pid='".$edit_school_id_for_reg."' and _exam_name='".$edit_exam_name_for_reg."' and _session='".$edit_session_for_reg."'";
	$entry1=$obj->Update_Data($table_name, $form_data1, $where_clause);
	if($entry1!=NULL){
		echo "school information has been updated";
	}else{
		echo "error occured during updating information!!";
	}
}
if($operation=='delete1'){
	$shift_id=trim($_POST['shift_id']);
	$form_data1['_status']='D';
	
	$form_data1['_update_by']=$_SESSION['LOGIN_USERID'];
	$form_data1['_last_update']=date("Y:m:d h:i:s");
		//inserting in _int_institute_setup
		$table_name='_int_institute_setup';
		$check_cond_data="  _pid='".$shift_id."'";
		$where_clause=" _id='".$shift_id."'";
		
		
		$entry1=$obj->Update_Data_By_Check_Duplicate($table_name, $form_data1, $where_clause,$check_cond_data);
		if($entry1!=NULL){
			
				echo "Shift deleted";
				
			
	}
	else{
		echo "There is medium under this shift";
	}
}


?>