<?php
	session_start();
	// ============
	include("../../asset/theme/css/myfunc.php");
	include("../../php_crud/my_class.php");
	$obj=new my_class();
	// ============
	extract($_REQUEST);
	$branchid = $_SESSION['LOGIN_BRANCH'];
	$entry_by = $_SESSION['LOGIN_USERID'];
	$date = date('d-M-Y');
	
	if($operation=="insert"){
		$ret_msg = 0;
		$dataTable = 'AQUATIC.TBLGWH_DIVISIONINFO@AQUATIC227';
		$values = array(
			'DIVISIONNAME'=>"'$division_name'",
			'RESPONSIBLEPERSON'=>"'$responsible_person'", 
			'DESIGNATION'=>"'$designation'", 
			'CONTACTNO'=>"'$contact_no'", 
			'CONTACTADDRESS'=>"'$contact_address'", 
			'FLAG'=>"'A'", 
			'CREATEBY'=>"'$entry_by'", 
			'CREATEDATE'=>"'$date'" 
		);
		$sql = $obj->Insert_Data($dataTable,$values);
		if($sql){
			$ret_msg = 1;
		}
		echo $ret_msg;
	}
	
	if($operation=="update"){
		$ret_msg = 0;
		$dataTable = 'AQUATIC.TBLGWH_DIVISIONINFO@AQUATIC227';
		$values = array(
			'DIVISIONNAME'=>"'$e_division_name'",
			'RESPONSIBLEPERSON'=>"'$e_responsible_person'", 
			'DESIGNATION'=>"'$e_designation'", 
			'CONTACTNO'=>"'$e_contact_no'", 
			'CONTACTADDRESS'=>"'$e_contact_address'", 
			'FLAG'=>"'$e_status'", 
			'UPDATEBY'=>"'$entry_by'", 
			'UPDATEDATE'=>"'$date'" 
		);
		$where_clause = "ID='$sel_division'";
		$updateEntry = $obj->Update_Data($dataTable, $values, $where_clause);
		if($updateEntry){
			$ret_msg = 1;
		}
		echo $ret_msg;
	}
	
	if($operation=="delete"){
		$ret_msg = 0;
		$dataTable = 'AQUATIC.TBLGWH_DIVISIONINFO@AQUATIC227';
		$values = array(
			'FLAG'=>"'D'", 
			'UPDATEBY'=>"'$entry_by'", 
			'UPDATEDATE'=>"'$date'" 
		);
		$where_clause = "ID='$sel_division'";
		$updateEntry = $obj->Update_Data($dataTable, $values, $where_clause);
		if($updateEntry){
			$ret_msg = 1;
		}
		echo $ret_msg;
	}
?>