ok
Direktori : /proc/thread-self/root/home2/selectio/www/lilyexpresslive/expense-invoice/api/ |
Current File : //proc/thread-self/root/home2/selectio/www/lilyexpresslive/expense-invoice/api/delete.php |
<?php include"../config/config.php"; 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']=="client_delete"){ $statement = $pdo->prepare("delete from tbl_client WHERE id=?"); $result=$statement->execute(array($_POST['delete_id'])); if($result==1) { $statement = $pdo->prepare("SELECT * FROM `tbl_invoice` where client_id=?"); $statement->execute(array($_POST['delete_id'])); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $resul) { $statement = $pdo->prepare("delete from tbl_invoice_items WHERE invoice_id=?"); $resu=$statement->execute(array($resul['id'])); $statement = $pdo->prepare("delete from tbl_invoice_payment WHERE invoice_id=?"); $resu=$statement->execute(array($resul['id'])); } $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 users 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_exp_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']=="expense_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_expense 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']=="cash_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_cash 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']=="payment_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_invoice_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']=="invoice_item_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_invoice_items 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']=="invoice_payment_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_invoice_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']=="vendor_invoice_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_vendor_invoice WHERE id=$id;delete from tbl_vendor_invoice_payment WHERE invoice_id=$id;delete from tbl_vendor_invoice_items WHERE invoice_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']=="invoice_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_invoice WHERE id=$id;delete from tbl_invoice_payment WHERE invoice_id=$id;delete from tbl_invoice_items WHERE invoice_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; } ?>