ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/old/api/backups/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/old/api/backups/bulk-updates.php |
<?php ob_start(); session_start(); include "../config/config.php"; $session_id = $_SESSION['hrm']['id']; if($_POST['type']=="shift_assign"){ $assign_id = implode(',', $_POST['assign_id']); $shift_details=$_POST['shift_details']; $date = date('Y-m-d'); $statement = $pdo->prepare("UPDATE tbl_user SET emp_shift=$shift_details WHERE id in (".$assign_id.");"); $result=$statement->execute(); /*for($i=0;$i<count($_POST['assign_id']);$i++){ $statement = $pdo->prepare("INSERT INTO tbl_crm_assign_routes (`routes_id`, `assign_user`, `assign_date`) VALUES ('".$_POST['assign_id'][$i]."',$ids,'$date')"); $result=$statement->execute(); }*/ if($result) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="task_assign"){ $assign_id = implode(',', $_POST['assign_id']); $task_id = $_POST['task_details']; $date = date('Y-m-d'); $statement = $pdo->prepare("UPDATE tbl_user SET task_id=$task_id WHERE id in (".$assign_id.");"); $result=$statement->execute(); for($i=0;$i<count($_POST['assign_id']);$i++){ $statement = $pdo->prepare("INSERT INTO tbl_tasks_reports (`emp_id`, `task_id`, `date`, `allocated_id`) VALUES ('".$_POST['assign_id'][$i]."', $task_id, '$date', $session_id)"); $result=$statement->execute(); } if($result) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } ?>