0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: Employee_delete.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Employee delete | OFMSP</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="../style.css" rel="stylesheet" type="text/css" /> <link rel="icon" href="../images/icon.ico" /> <style type="text/css"> <!-- #apDiv2 { position:absolute; width:66px; height:36px; z-index:1; left: 708px; top: 300px; } .style6 { color: #660000; font-weight: bold; } --> </style> </head> <body> <p><?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; //MySql connection //require_once BASE_DIR."/Proposels/imagePath.php"; require_once BASE_DIR."/Proposels/imagePath.php"; ?> <!--<div id="headerbg"> <div id="headerblank">--> <?php include("include/first_userheader.php"); $id=$_GET['emp_id ']; if(isset($_POST['Delete'])) { $u_id=@$_SESSION['user_id']; $p_id=@$_SESSION['project_id']; $Emp_id=$_POST['txtempid']; $Emp_name = $_POST['txtempname']; $active_flag=0; $sql="select * from employe where user_id='$u_id' and project_id ='$p_id' and emp_name ='$Emp_name'"; $sql=mysql_query($sql); while($row=mysql_fetch_array($sql)) { $empdb_id = $row['emp_id']; $empdb_photo = $row['photo']; } //-------------active checking---------------- //-------------salary voucher-------- $sql="select * from salaryvoucher where user_id='$u_id' and project_id ='$p_id' and emp_id ='$empdb_id'"; $sql=mysql_query($sql); $row=mysql_fetch_array($sql); if($row != NULL) { $active_flag=1; } //-------------payment-------- $sql="select * from payment where user_id='$u_id' and project_id ='$p_id' and account_Name ='$Emp_name'"; $sql=mysql_query($sql); $row=mysql_fetch_array($sql); if($row != NULL) { $active_flag=1; } //-------------reciept-------- $sql="select * from reciept where user_id='$u_id' and project_id ='$p_id' and account_Name ='$Emp_name'"; $sql=mysql_query($sql); $row=mysql_fetch_array($sql); if($row != NULL) { $active_flag=1; } //-------------custemaccount_cashentry-------- $sql="select * from custemaccount_cashentry where user_id='$u_id' and project_id ='$p_id' and (accountname ='$Emp_name' or groupname='$Emp_name')"; $sql=mysql_query($sql); $row=mysql_fetch_array($sql); if($row != NULL) { $active_flag=1; } if($active_flag==1) { $message="This is an active Item. You cannot delete this details."; } else { $DelFilePath = ROOT_DIR . $empdb_photo; if (file_exists($DelFilePath)) { unlink ($DelFilePath); } //---delete from employee------ $sql="delete from employe where user_id='$u_id' and project_id ='$p_id' and emp_id ='$empdb_id'"; mysql_query($sql); //---delete from account------ $sql="delete from account where user_id='$u_id' and project_id ='$p_id' and group_name='Salary Paid' and account_name ='$Emp_name'"; mysql_query($sql); $message="Delete successfully.."; } $url=$server_ip."/USER/search_emp.php?message=$message"; echo "<script>window.location='$url'</script>"; } ?> </div> </div> </p> <form action="Employee_delete.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <p> </p> <div align="center" class="style6">Delete Employee Details</div> <p align="center"> </p> <div id="apDiv1"><a href="search_emp.php"></a></div> <table width="415" align="center"> <tr> <td width="106"><div align="right" class="projectboldtxt"> <div align="left" class="projectboldtxt">Employee ID</div> </div></td> <td width="339"><label> <input type="text" name="txtempid" id="txtempid" value="<?php echo $_GET['id'];?>" readonly="readonly"/> </label></td> </tr> <tr> <td class="projectboldtxt">Employee name</td> <td><input type="text" name="txtempname" id="txtempname" value="<?php echo $_GET['name'];?>" readonly="readonly"/></td> </tr> </table> <p> </p> <table width="435" align="center"> <tr> <td width="212" class="projectboldtxt"> Do you want to delete the file...?</td> <td width="233"><label> <input type="submit" name="Delete" id="Delete" value="Delete" /> <a href="search_emp.php" class="projectboldtxt style2">Back</a></label></td> </tr> </table></form> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </div> <?php include "include/footer.php"; ?> </p> </body> </html>