<?php
ini_set('display_errors', 0);
//error_reporting(E_ALL);
//ini_set('display_errors', 1);

session_start();
ob_start();

require_once('configuration/server_connect.php');
require_once('configuration/all_function.php');


$emp_code = $_REQUEST['emp_code'];
$mon = $_REQUEST['mon'];
$year = $_REQUEST['year'];
$order_no = $_REQUEST['order_no'];
$flag = $_REQUEST['flag'];


$entry_by=$_SESSION['user']['id'];
$entry_at=date('Y-m-d H:i:s');

$order_sql="SELECT * FROM  employee_advance  WHERE id='".$order_no."'";
$order_data = find_all_field_sql($conn,$order_sql);

$revise_note=$order_data->mon.', '.$order_data->year;

//if($flag>0){
//
//$sql_del = 'delete from employee_monthly_salary where emp_code="'.$emp_code.'" and mon="'.$mon.'" and year="'.$year.'" ';
//mysqli_query($conn,$sql_del);
//
//}


 $up_jv='update employee_advance set mon="'.$mon.'", year="'.$year.'", revise_note="'.$revise_note.'",  edit_by="'.$entry_by.'", edit_at="'.$entry_at.'"  where id="'.$order_no.'"';
mysqli_query($conn,$up_jv);


echo 'Success!';
?>