ok
Direktori : /proc/thread-self/root/home2/selectio/public_html/tnpsctestbatch.com/admin/old/api/ |
Current File : //proc/thread-self/root/home2/selectio/public_html/tnpsctestbatch.com/admin/old/api/delete.php |
<?php include"../config/config.php"; // Banner Delete if($_POST['type']=="hard_delete_banner"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from ".$_POST['table_name']." WHERE id=$id"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="events_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_event WHERE id=$id"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_in_active"){ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_active"){ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?"); $result=$statement->execute(array(1,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="employee_delete"){ $statement = $pdo->prepare("UPDATE tbl_employee SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="desgination_delete"){ $statement = $pdo->prepare("UPDATE tbl_desgination SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="department_delete"){ $statement = $pdo->prepare("UPDATE tbl_departement SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="leave_request_delete"){ $statement = $pdo->prepare("UPDATE tbl_leave_request SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="hard_delete_pdf"){ $statement = $pdo->prepare("UPDATE tbl_pdf SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="hard_delete_department"){ $statement = $pdo->prepare("UPDATE tbl_department SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="permission_delete"){ $statement = $pdo->prepare("UPDATE tbl_permision_request SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="role_delete"){ $statement = $pdo->prepare("UPDATE tbl_role SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="user_delete"){ $statement = $pdo->prepare("UPDATE tbl_user SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="location_delete"){ $statement = $pdo->prepare("UPDATE tbl_exp_location SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="category_delete"){ $statement = $pdo->prepare("UPDATE tbl_category SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_delete"){ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_active"){ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?"); $result=$statement->execute(array(1,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_followup_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_follow_up WHERE id=$id;delete from tbl_follow_up_tracking WHERE follow_up_id=$id;"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_followup_history_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_follow_up_tracking WHERE id=$id;"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_lead_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_lead WHERE id=$id;delete from tbl_payment WHERE lead_id=$id;"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_lead_payment_history_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_payment WHERE id=$id"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="hard_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from ".$_POST['table_name']." WHERE id=$id"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="payslip_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("SELECT p.* FROM tbl_payslip_generation p where p.id=$id"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); if($totalData){ /*$statement = $pdo->prepare("UPDATE `tbl_user` SET `common_leave`=common_leave-? WHERE id=?"); $results=$statement->execute(array($query[0]['common_leave_added'],$query[0]['employee_id'])); $statement = $pdo->prepare("UPDATE `tbl_user` SET `common_leave`=common_leave+? WHERE id=?"); $results=$statement->execute(array($query[0]['common_leave_taken'],$query[0]['employee_id']));*/ $statement = $pdo->prepare("UPDATE `tbl_user` SET `cumulative_leave`=cumulative_leave-? WHERE id=?"); $results=$statement->execute(array($query[0]['cumulative_leave_add'],$query[0]['employee_id'])); $statement = $pdo->prepare("UPDATE `tbl_user` SET `cumulative_leave`=cumulative_leave+? WHERE id=?"); $results=$statement->execute(array($query[0]['cumulative_leave_taken'],$query[0]['employee_id'])); $statement = $pdo->prepare("UPDATE `tbl_user` SET `casual_leave`=casual_leave-? WHERE id=?"); $results=$statement->execute(array($query[0]['casual_leave_add'],$query[0]['employee_id'])); $statement = $pdo->prepare("UPDATE `tbl_user` SET `casual_leave`=casual_leave+? WHERE id=?"); $results=$statement->execute(array($query[0]['casual_leave_taken'],$query[0]['employee_id'])); $employee_id=$_POST['employee_id']; $statement = $pdo->prepare("delete from tbl_payslip_generation WHERE id=$id"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; }else{ $message='Delete Id Invalid'; echo $message; } } ?>