MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/hrms_cafsindia_com/timeoffice/timeoffice_callback.php
 <?php
	$frm = "";
	/* Module Initilization */
	if (isset($_REQUEST["frm"])){
	    $frm = $_REQUEST['frm']; 
	    require("./timeoffice_model.php");
	    $api_model = new timeoffice_model;
	}
	if($frm === "manager_sts"){
		$manage_emp_code ="";
		if(isset($_POST['manage_emp_code'])){
			$manage_emp_code = $_POST['manage_emp_code'];
		}
		if(isset($_POST['unpunched_date'])){
			$unpunched_date = $_POST['unpunched_date'];
			$monthly_date   = "date_".(int)date("d",strtotime($unpunched_date));
			$month          = date("Y-m-01",strtotime($unpunched_date));
		}
		$created_on    = date('Y-m-d H:m:s');
		if(isset($_POST['fdata'])){
			$fdata = $_POST['fdata'];
			$fdata = json_decode($fdata);
			foreach($fdata as $form_data){				
				$name            = $form_data->name;
				$value           = $form_data->value;
				$exp_name        = explode("_",$name);
				$unpunched_id    = 	$exp_name[3];		
				$dcode           = 	$exp_name[2];		
				//$unpunched_id    = str_replace("manager_status_",'',$name);
				$ins_manager_sts_qry    = 'INSERT INTO cw_dailyunpunch (att_date,empcode,dcode,swipe_status,manager_status,in_time,out_time,trans_created_by,trans_created_date) SELECT att_date,empcode,dcode,swipe_status,"'.$value .'",in_time,out_time,"'.$manage_emp_code .'","'.$created_on .'" FROM dailyunpunch WHERE dailyunpunch_id = "'.$unpunched_id.'"';
				$insert_manager    = $api_model->runQuery("$ins_manager_sts_qry");				
				//Monthly data update
				if($insert_manager){
					$update_emp_query = "update monthlyattdata set ".$monthly_date." = '".$value ."' where att_month = '".$month."' and  dcode = '".$dcode."' and etype = 'A'";
					$update_monthly    = $api_model->runQuery("$update_emp_query");
				}
				//echo "BSK where att_month = '".$month."' and  dcode = '".$dcode."' and etype = 'A' <br/>";
			}
			$leave_info = $api_model->get_email_data();
			if($leave_info['sts']){
				echo json_encode(array('success' => True,'message' => "Updated successfully and mail is sent to HR Team",'table_info'=>$leave_info['table_info']));
			}else{
				echo json_encode(array('success' => False,'message' => "Please add print design and try again",'table_info'=>$leave_info['table_info']));
			}
		}else{
			echo json_encode(array('success' => False,'message' => "Server Timeout!",'mail_sts'=>0));
		}
	}
?>