0byt3m1n1
Path:
/
home
/
k74ns2xygros
/
www
/
globetech
/
cms
/
assets
/
[
Home
]
File: config.php
<?php //// server should keep session data for AT LEAST 1 hour //ini_set('session.gc_maxlifetime', 3600); // //// each client should remember their session id for EXACTLY 1 hour //session_set_cookie_params(3600); clearstatcache(); //apc_cache_clear('user'); //To clear the user cache //apc_cache_clear(); //To clear the system cache //session_cache_expire(180); //ini_set('max_execution_time', 7200); //set_time_limit(0); // //ini_get('max_execution_time'); date_default_timezone_set('Asia/Kolkata'); //define('SALT', 'd#f453dd'); //date_default_timezone_set('UTC'); //set global sql_mode="NO_ENGINE_SUBSTITUTION"; //SQL_MODE = "NO_ENGINE_SUBSTITUTION"; ini_set('sql_mode', "NO_ENGINE_SUBSTITUTION"); include "connection.php"; error_reporting(0); class User { var $conn; // For Connection Construct function __construct() { $con = new connection(); $this->conn = $con->connect(); } // For Data Encryption function encrypt($data, $key) { $iv = mcrypt_create_iv( mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM ); $encrypted = base64_encode( $iv . mcrypt_encrypt( MCRYPT_RIJNDAEL_128, hash('sha256', $key, true), $data, MCRYPT_MODE_CBC, $iv ) ); return $encrypted; } // For Data Decryption function decrypt($encrypted, $key) { $data = base64_decode($encrypted); $iv = substr($data, 0, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); $decrypted = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_128, hash('sha256', $key, true), substr($data, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)), MCRYPT_MODE_CBC, $iv ), "\0" ); return $decrypted; } function dec_enc($action, $string) { $output = false; $encrypt_method = "AES-256-CBC"; $secret_key = '3sc3RLrpd17'; $secret_iv = chr(0x0); // hash $key = hash('sha256', $secret_key); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr(hash('sha256', $secret_iv), 0, 16); if ($action == 'encrypt') { $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv); $output = base64_encode($output); } else if ($action == 'decrypt') { $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv); } return $output; } // Admin Login public function login_with_company() { $company_name = $_POST['company_name']; $company_id = $_POST['company_id']; $late_reason = $_POST['late_reason']; $late_reason_id = $_POST['late_reason_id']; $office_timing = $_POST['office_timing']; $login_timing = $_POST['login_timing']; $logout_timing = $_POST['logout_timing']; $authority_name = $_POST['authority_name']; $authority_id = $_POST['authority_id']; $login_rule_apply = $_POST['login_rule_apply']; if ($authority_id == '') { $authority_id = 0; } $is_late = $_POST['is_late']; if ($login_rule_apply == 'NO') { $attendence = 'P'; $status = 'approved'; } else { if ($is_late == 'NO') { $attendence = 'P'; } else { $attendence = ''; } $status = 'generated'; } // $login_timing = date('H:i:s'); $date = date('Y-m-d'); $date_time = date('Y-m-d H:i:s'); $no_login_status = $_POST['no_login_status']; $logout_found = $_POST['logout_found']; $rotation_shift_id = $_POST['rotation_shift_id']; if (isset($_POST['login']) == 'yes') { $emp_id = $_SESSION['admin_emp_id']; $admin_cid = $_SESSION['admin_cid']; $admin_name = $_SESSION['name']; if ($no_login_status != 'YES') { $val = $this->company_details($company_id); $dashboard_img = $val['ep_upload_dashboard_img']; $voucher_img = $val['ep_upload_head_img']; $_SESSION['company_id'] = $company_id; $_SESSION['company_name'] = $company_name; $_SESSION['dashboard_img'] = $dashboard_img; $_SESSION['voucher_img'] = $voucher_img; $_SESSION['office_timing'] = $office_timing; $_SESSION['login_timing'] = $login_timing; $_SESSION['logout_timing'] = $logout_timing; } $sq = "SELECT * FROM `admin_attendence` WHERE `date`='$date' AND `emp_id`='$emp_id' AND `log_type`='LOGIN'"; $qu_res = mysqli_query($this->conn, $sq); if (mysqli_num_rows($qu_res) > 0) { $this->save_user_log('LOGIN'); echo "<script type='text/javascript'> document.location = 'admin/dashboard.php'; </script>"; } else { if ($logout_found == 'NO') { $last_login_date = $_POST['last_login_date']; $prev_date = $last_login_date; //date('Y-m-d', strtotime('-1 day', strtotime($date))); $last_logout_id = $this->get_final_logout_id('1'); $logout_reason = $this->get_logout_reason_name($last_logout_id); $sq_prev_day_login = "SELECT * FROM `admin_attendence` WHERE `date`='$prev_date' AND `emp_id`='$emp_id' AND `log_type`='LOGIN'"; $qu_res_prev_day_login = mysqli_query($this->conn, $sq_prev_day_login); $prev_day_login_det = mysqli_fetch_array($qu_res_prev_day_login); $logout_timing = $prev_day_login_det['logout_timing']; $sqlog = "INSERT INTO `admin_logouts`(`emp_id`, `date`, `logout_timing`, `last_logout`, `status`, `added_by`, `added_by_name`, `added_date`, `logout_reason`, `logout_reason_id`, `logout_description`, `log_type`, `authority_permission`, `permitted_by`, `permitted_by_name`, `is_early_logout`)" . " VALUES ('$emp_id','$prev_date','$logout_timing','00:00:00','$status','$admin_cid','$admin_name','$date_time','$logout_reason','$last_logout_id','NO LOGOUT','LOGOUT','2','$authority_id','$authority_name','YES')"; // echo $sqlog; // die; $qulog = mysqli_query($this->conn, $sqlog); echo "<script type='text/javascript'> document.location = 'select_company.php'; </script>"; } else { if ($no_login_status == 'YES') { // if ($late_reason_id == '7') { // NO LOGIN MULTIPLE DAYS $late_reason_no_login = $_POST['late_reason_no_login']; $late_reason_id_no_login = $_POST['late_reason_id_no_login']; $authority_permission = $_POST['authority_permission']; $authority_name_no_login = $_POST['authority_name_no_login']; $authority_id_no_login = $_POST['authority_id_no_login']; if ($authority_id_no_login == '') { $authority_id_no_login = 0; } $not_login_dates_arr = $_POST['not_login_dates_arr']; foreach ($not_login_dates_arr as $dates_val) { $entry_date = $dates_val; $attendence = ''; $sqlog = "INSERT INTO `admin_attendence`(`emp_id`, `date`, `office_timing`, `login_timing`, `logout_timing`, `attendence`, `status`, `added_by`, `added_by_name`, `added_date`, `late_reason`, `late_reason_id`, `late_description`, `log_type`, `permitted_by`, `permitted_by_name`, `is_late`, `authority_permission`, `rotation_shift_id`)" . " VALUES ('$emp_id','$entry_date','$office_timing','00:00:00','$logout_timing','','$status','$admin_cid','$admin_name','$date_time','$late_reason_no_login','$late_reason_id_no_login','NO LOGIN','LOGIN','$authority_id_no_login','$authority_name_no_login','$is_late', '$authority_permission', '$rotation_shift_id')"; $qulog = mysqli_query($this->conn, $sqlog); } $this->save_user_log('LOGIN'); echo "<script type='text/javascript'> document.location = 'select_company.php'; </script>"; } else { $sqlog = "INSERT INTO `admin_attendence`(`emp_id`, `date`, `office_timing`, `login_timing`, `logout_timing`, `attendence`, `status`, `added_by`, `added_by_name`, `added_date`, `late_reason`, `late_reason_id`, `late_description`, `log_type`, `permitted_by`, `permitted_by_name`, `is_late`, `rotation_shift_id`)" . " VALUES ('$emp_id','$date','$office_timing','$login_timing','$logout_timing','$attendence','$status','$admin_cid','$admin_name','$date_time','$late_reason','$late_reason_id','$late_description','LOGIN','$authority_id','$authority_name','$is_late', '$rotation_shift_id')"; $qulog = mysqli_query($this->conn, $sqlog); $this->save_user_log('LOGIN'); echo "<script type='text/javascript'> document.location = 'admin/dashboard.php'; </script>"; } } } } } public function save_user_log($remark) { $emp_id = $_SESSION['admin_emp_id']; $admin_cid = $_SESSION['admin_cid']; $admin_name = $_SESSION['name']; $date = date('Y-m-d'); $date_time = date('Y-m-d H:i:s'); $ip_address = $_SERVER['REMOTE_ADDR']; $BrowserName = $this->getBrowser(); $OSName = $this->getOS(); $user_agent = $BrowserName . ", " . $OSName; $url = $this->curPageName(); $country = $this->ip_info("$ip_address", "Country"); // United States $country_code = $this->ip_info("$ip_address", "Country Code"); // US $state = $this->ip_info("$ip_address", "State"); // California $city = $this->ip_info("$ip_address", "City"); // Menlo Park $address = $this->ip_info("$ip_address", "Address"); // Menlo Park, California, United States $location = $this->ip_info("$ip_address", "Location"); // print_r($location); // Array ( [city] => Menlo Park [state] => California [country] => United States [country_code] => US [continent] => North America [continent_code] => NA ) $sqlog_1 = "INSERT INTO `userlog`(`user`, `role`, `ipaddress`, `user_agent`, `login_datetime`, `url`, `city`, `country`, `remark`) " . " VALUES ('$emp_id','ADMIN','$ip_address','$user_agent','$date_time','$url','$city','$country','$remark')"; $result = mysqli_query($this->conn, $sqlog_1); return $result; } public function login() { // $company_name = $_POST['company_name']; // $company_id = $_POST['company_id']; $uname = strtoupper($_POST['name']); $pass = $_POST['password']; // $dec_pass = md5(SALT.$pass); $dec_pass = md5($pass); // $val = $this->company_details($company_id); // $dashboard_img = $val['ep_upload_dashboard_img']; // $cnd = "user_name='$uname' AND password='$pass' AND status='1'"; $cnd = "user_name='$uname' AND password='$dec_pass' AND status='1'"; // $checklogin = $db->select_row('sub_admin',$cnd); $sq = "SELECT * FROM `sub_admin` WHERE $cnd"; $qu = mysqli_query($this->conn, $sq); if (mysqli_num_rows($qu) > 0) { $row = mysqli_fetch_array($qu); // $_SESSION['company_id'] = $company_id; // $_SESSION['company_name'] = $company_name; // $_SESSION['dashboard_img'] = $dashboard_img; $_SESSION['admin_cid'] = $row['id']; $_SESSION['login'] = 'Globe123'; $_SESSION['name'] = $uname; $_SESSION['subadminname'] = $row['name']; $_SESSION['admin_emp_id'] = $row['emp_id']; $role = json_decode($row['role']); //print_r($role); if (in_array(1, $role)) { $_SESSION['subadminedit'] = TRUE; } if (in_array(2, $role)) { $_SESSION['subadminverify'] = TRUE; } if (in_array(3, $role)) { $_SESSION['subadmindelete'] = TRUE; } if (in_array(4, $role)) { $_SESSION['subadminadd'] = TRUE; } if (in_array(5, $role)) { $_SESSION['subadmin_onlyview'] = TRUE; } if (in_array(6, $role)) { $_SESSION['subadmin_admin'] = TRUE; } if (in_array(7, $role)) { $_SESSION['subadmin_hr'] = TRUE; } if (in_array(8, $role)) { $_SESSION['subadmin_accounts'] = TRUE; } if (in_array(9, $role)) { $_SESSION['subadmin_epf'] = TRUE; } if (in_array(10, $role)) { $_SESSION['subadmin_esic'] = TRUE; } if (in_array(11, $role)) { $_SESSION['subadmin_sign'] = TRUE; } if (in_array(12, $role)) { $_SESSION['subadmin_cashier'] = TRUE; } if (in_array(13, $role)) { $_SESSION['subadmin_pm'] = TRUE; } if (in_array(14, $role)) { $_SESSION['subadmin_voucher'] = TRUE; } if (in_array(15, $role)) { $_SESSION['subadmin_fs'] = TRUE; } if (in_array(16, $role)) { $_SESSION['subadmin_tp'] = TRUE; } if (in_array(17, $role)) { $_SESSION['subadmin_leave_L1'] = TRUE; } if (in_array(18, $role)) { $_SESSION['subadmin_leave_L2'] = TRUE; } if (in_array(19, $role)) { $_SESSION['subadmin_leave_L3'] = TRUE; } if (in_array(20, $role)) { $_SESSION['subadmin_dispatch'] = TRUE; } if (in_array(21, $role)) { $_SESSION['subadmin_fs1'] = TRUE; } if (isset($_SESSION['login'])) { // echo $_SESSION['login'].$_SESSION['admin_cid']; // echo "<script type='text/javascript'> document.location = 'admin/dashboard.php'; </script>"; echo "<script type='text/javascript'> document.location = 'select_company.php'; </script>"; } // echo "<script>location.href='admin/dashboard.php';</script>"; // echo '<script type="text/javascript"> window.location = "admin/dashboard.php" </script>'; // header("Location:admin/dashboard.php"); } else { $_SESSION['err_login'] = "Username or Password is Wrong!"; // echo '<meta http-equiv="refresh" content="0">'; } } public function login11() { $name = $_POST['name']; $password = $_POST['password']; $sq = "SELECT * FROM admin_company INNER JOIN admin_user ON admin_company.company_id= admin_user.company_id WHERE admin_user='$name'and admin_pass='$password'"; $qu = mysqli_query($this->conn, $sq); if (mysqli_num_rows($qu)) { $row = mysqli_fetch_array($qu); $_SESSION['admin_cid'] = $row['cid']; $_SESSION['login'] = 'Globe123'; $_SESSION['name'] = $name; // if (!empty($_POST["remember"])) { // setcookie("name1", $name, time() + (10 * 365 * 24 * 60 * 60)); // setcookie("password1", $password, time() + (10 * 365 * 24 * 60 * 60)); // } else { // if (isset($_COOKIE["name1"])) { // setcookie("name1", ""); // } // if (isset($_COOKIE["password1"])) { // setcookie("password1", ""); // } // } if (isset($_SESSION['login'])) { echo "<script type='text/javascript'> document.location = 'admin/dashboard.php'; </script>"; } // echo "<script>location.href='admin/dashboard.php';</script>"; // echo '<script type="text/javascript"> window.location = "admin/dashboard.php" </script>'; // header("Location:admin/dashboard.php"); } else { $_SESSION['err_login'] = "Username or Password is Wrong!"; } } // Reseller Or Provider Login public function employee_login() { $phone = $_POST['phone']; // $password = $_POST['password']; $sq = "SELECT * FROM employee WHERE phone='$phone'"; $qu = mysqli_query($this->conn, $sq); if (mysqli_num_rows($qu)) { $row = mysqli_fetch_array($qu); $_SESSION['cid'] = $row['cid']; $_SESSION['emp_login'] = 'yes'; $_SESSION['emp_no'] = $row['emp_no']; if (!empty($_POST["remember"])) { setcookie("name1", $name, time() + (10 * 365 * 24 * 60 * 60)); setcookie("password1", $password, time() + (10 * 365 * 24 * 60 * 60)); } else { if (isset($_COOKIE["name1"])) { setcookie("name1", ""); } if (isset($_COOKIE["password1"])) { setcookie("password1", ""); } } if ($row['form_status'] == 1) { echo '<script type="text/javascript"> window.location = "employee_address.php" </script>'; } elseif ($row['form_status'] == 2) { echo '<script type="text/javascript"> window.location = "account_details.php" </script>'; } elseif ($row['form_status'] == 3) { echo '<script type="text/javascript"> window.location = "insurance_details.php" </script>'; } elseif ($row['form_status'] == 'complete') { echo '<script type="text/javascript"> window.location = "employee_dashboard.php" </script>'; // echo '<script type="text/javascript"> window.location = "emp/index.php" </script>'; } } else { $_SESSION['err_login'] = "Your Phone No. or OTP is Wrong!"; } } // Get Reseller Data public function get_data($id) { $sq1 = "SELECT * FROM admin_user WHERE user_id='$id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); return $res; } // get general data IN settings public function get_gendata($cid) { $sq1 = "SELECT * FROM admin_company WHERE company_id='$cid'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); return $res; } // update general data IN settings public function update_gendata($id, $name, $email, $phone, $address, $country, $state, $city, $zcode, $tname, $tno, $trate) { $company_type = $_SESSION['type']; $sq2 = "UPDATE admin_company SET name = '$name', company_email = '$email', address = '$address', city = '$city',state='$state', country='$country', zcode = '$zcode', phone = '$phone', taxname='$tname', tax_no='$tno', tax='$trate' WHERE company_id= '$id'"; $qu2 = mysqli_query($this->conn, $sq2); $_SESSION['msg_iteration'] = 0; if ($qu2) { $_SESSION['msg'] = 'Company Details Updated Successfully.'; $message = 'General Settings Updated Successfully by <a href="../profile/company_profile.php?q=' . $id . '"> ' . $company_type . ' #' . $id . ' </a>'; $log_status = 'activity'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; $message = 'Updation IN General Settings Failed! by <a href="../profile/company_profile.php?q=' . $id . '"> ' . $company_type . ' #' . $id . ' </a>'; $log_status = 'error'; } $sqlog = "INSERT INTO log (`log_id`, `message`,`log_status`) VALUES('NULL', '$message','$log_status')"; $qulog = mysqli_query($this->conn, $sqlog); header("location:general_settings.php"); } // update profile of loggedin user public function update_data($id, $name, $email, $phone, $add, $city, $zcode, $cpass) { $company_type = $_SESSION['type']; $sq2 = "UPDATE admin_user SET user_name = '$name', admin_pass = '$cpass', user_email = '$email', user_phone = '$phone', user_address = '$add', user_city = '$city', user_zcode = '$zcode' WHERE user_id= '$id'"; $qu2 = mysqli_query($this->conn, $sq2); $_SESSION['msg_iteration'] = 0; if ($qu2) { $_SESSION['msg'] = 'User Profile Updated Successfully!'; $message = 'Profile Updated Successfully by <a href="../profile/company_profile.php?q=' . $id . '"> ' . $company_type . ' #' . $id . ' </a>'; $log_status = 'activity'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; $message = 'Updation IN Profile Failed! by <a href="../profile/company_profile.php?q=' . $id . '"> ' . $company_type . ' #' . $id . ' </a>'; $log_status = 'error'; } $sqlog = "INSERT INTO log (`log_id`, `message`,`log_status`) VALUES('NULL', '$message','$log_status')"; $qulog = mysqli_query($this->conn, $sqlog); header("location:profile.php"); } public function add_employee() { $fname = $_POST['fullname']; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; $phone = $_POST['phone']; $email = $_POST['email']; $dob = $_POST['dob']; $gender = $_POST['gender']; $nationality = $_POST['nationality']; $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $street = $_POST['street']; $village = $_POST['village']; $post = $_POST['post']; $state = $_POST['state']; $city = $_POST['city']; $pincode = $_POST['pincode']; $thana = $_POST['thana']; // $country = $_POST['country']; $skilled = $_POST['skilled']; $emp_no = $_POST['emp_no']; $ipno = $_POST['ipno']; $ic = $_POST['ic']; $samprice = $_POST['samprice']; $nominee = $_POST['nominee']; $nominee_rel = $_POST['nominee_rel']; $childs = $_POST['childs']; $epf = $_POST['epf']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $pan = $_POST['pan']; $target_dir = "../include/uploads/"; $t_dir = "include/uploads/"; // only for url image use IN db $target_file = $target_dir . basename($_FILES["clogo"]["name"]); $target_file1 = $t_dir . $emp_no . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_dir . $emp_no . ".jpg")) { $clogo = $target_file . $_FILES["clogo"]["tmp_name"]; $errtext = "The images " . basename($_FILES["clogo"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } if ($x == 'ok') { $sq = "INSERT INTO `employee`(`cid`, `customer_name`, `father_name`, `mother_name`, `phone`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `street`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `emp_no`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `epf_reg`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `pan_no`, `clogo`, `nationality`, `bank_address`,`childs`) VALUES (NULL,'$fname','$father_name','$mother_name','$phone','$email','$dob','$gender','$mstatus','$wife_name','$street','$village','$post','$state','$city','$pincode','$thana','$skilled','$emp_no','$ipno','$ic','$samprice','$nominee','$nominee_rel','$epf','$accname','$accnumber','$ifsc','$bank_name','$bank_branch','$pan','$target_file1','$nationality','$bank_address','$childs')"; $qu = mysqli_query($this->conn, $sq); $cid = mysqli_insert_id($this->conn); if ($qu) { $_SESSION['msg'] = 'Company Added Successfully.'; // echo "<script type='text/javascript'> // window.location = 'lists/view_employee.php?q=$cid'; // </script>"; echo "<script>location.href='lists/view_employee.php?q=$cid';</script>"; // header("Location:lists/view_employee.php?q=$cid"); } else { $_SESSION['err_msg'] = 'Something Went Wrong1!'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong2!'; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function add_employee_itself() { $fname = $_POST['fullname']; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; $phone = $_POST['phone']; $email = $_POST['email']; $dob = $_POST['dob']; $gender = $_POST['gender']; $nationality = $_POST['nationality']; $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $street = $_POST['street']; $village = $_POST['village']; $post = $_POST['post']; $state = $_POST['state']; $city = $_POST['city']; $pincode = $_POST['pincode']; $thana = $_POST['thana']; // $country = $_POST['country']; $skilled = $_POST['skilled']; $emp_no = $_POST['emp_no']; $ipno = $_POST['ipno']; $ic = $_POST['ic']; $samprice = $_POST['samprice']; $nominee = $_POST['nominee']; $nominee_rel = $_POST['nominee_rel']; $childs = $_POST['childs']; $epf = $_POST['epf']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $pan = $_POST['pan']; $target_dir = "include/uploads/"; $target_file = $target_dir . basename($_FILES["clogo"]["name"]); $target_file1 = "../" . $target_dir . $emp_no . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_dir . $emp_no . ".jpg")) { $clogo = $target_file . $_FILES["clogo"]["tmp_name"]; $errtext = "The images " . basename($_FILES["clogo"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } if ($x == 'ok') { $sq = "INSERT INTO `employee`(`cid`, `customer_name`, `father_name`, `mother_name`, `phone`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `street`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `emp_no`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `epf_reg`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `pan_no`, `clogo`, `nationality`, `bank_address`,`childs`) VALUES (NULL,'$fname','$father_name','$mother_name','$phone','$email','$dob','$gender','$mstatus','$wife_name','$street','$village','$post','$state','$city','$pincode','$thana','$skilled','$emp_no','$ipno','$ic','$samprice','$nominee','$nominee_rel','$epf','$accname','$accnumber','$ifsc','$bank_name','$bank_branch','$pan','$target_file1','$nationality','$bank_address','$childs')"; $qu = mysqli_query($this->conn, $sq); $cid = mysqli_insert_id($this->conn); if ($qu) { $_SESSION['msg'] = 'Company Added Successfully.'; echo "<script>location.href='print_details.php?q=$cid';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function initial_registration() { $fname = $_POST['f_name']; $lname = $_POST['l_name']; $mname = $_POST['m_name']; $fullname = $fname . ' ' . $mname . ' ' . $lname; $father_name = $_POST['father_name']; $phone = $_POST['phone']; // $email = $_POST['email']; $fulladdress = $_POST['fulladdress']; // $nationality = $_POST['nationality']; $identity_type = $_POST['identity_type']; $zone = $_POST['zone']; $s_engineer = $_POST['s_engineer']; $ex_engineer = $_POST['ex_engineer']; $electry_city = $_POST['electry_city']; $reg_date = date('Y-m-d'); // $emp_no = date('dmY') . rand(100, 1000); //for file name only $sq = "INSERT INTO `employee`(`cid`, `customer_name`, `father_name`, `phone`, `identity_type`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `reg_date`, `reg_date1`) VALUES (NULL,'$fullname','$father_name','$phone','$identity_type','$fulladdress','$zone','$s_engineer','$ex_engineer','$electry_city','$reg_date',now())"; $qu = mysqli_query($this->conn, $sq); $cid = mysqli_insert_id($this->conn); if ($qu) { $_SESSION['msg'] = 'You have registered yourself successfully.'; $_SESSION['cid'] = $cid; $_SESSION['phone'] = $phone; // echo "<script>location.href='print_after_registration.php?q=$cid';</script>"; echo "<script>location.href='send_success_message.php';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Registration Failed.'; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function already_registered_employee($cid_old) { $fname = $_POST['f_name']; $lname = $_POST['l_name']; $mname = $_POST['m_name']; $fullname = $fname . ' ' . $mname . ' ' . $lname; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; $phone = $_POST['phone']; $phone2 = $_POST['phone2']; $email = $_POST['email']; $dob = $_POST['dob']; $gender = $_POST['gender']; // $fulladdress = $_POST['fulladdress']; $nationality = $_POST['nationality']; $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $childs = $_POST['childs']; // $identity_type = $_POST['identity_type']; $zone = $_POST['zone']; $s_engineer = $_POST['s_engineer']; $ex_engineer = $_POST['ex_engineer']; $electry_city = $_POST['electry_city']; $emp_sign_upload = $_POST['emp_sign']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); $emp_no = 'GCPL' . date('YmdHis') . rand(100, 1000); //for file name only $target_dir = "include/uploads/"; $target_file = $target_dir . basename($_FILES["clogo"]["name"]); $target_file1 = "../" . $target_dir . $emp_no . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_dir . $emp_no . ".jpg")) { $clogo = $target_file . $_FILES["clogo"]["tmp_name"]; $errtext = "The images " . basename($_FILES["clogo"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } /* image upload for emp_sign proof start */ if (isset($_FILES['emp_sign_upload']) && !empty($_FILES['emp_sign_upload']['name'])) { $target_dir_emp_sign = "include/emp_sign/"; $target_file_emp_sign = $target_dir_emp_sign . basename($_FILES["emp_sign_upload"]["name"]); $target_file_emp_sign1 = "../" . $target_dir_emp_sign . $emp_no . 'emp_sign.jpg'; $target_file_emp_sign1 = str_replace(' ', '+', $target_file_emp_sign1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_emp_sign, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["emp_sign_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["emp_sign_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_emp_sign)) { chmod($target_file_emp_sign, 0755); //Change the file permissions if allowed unlink($target_file_emp_sign); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["emp_sign_upload"]["tmp_name"], $target_dir_emp_sign . $emp_no . "emp_sign.jpg")) { $emp_sign_upload = $target_file_emp_sign . $_FILES["emp_sign_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["emp_sign_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y = 'ok'; } /* image upload for emp_sign proof end */ if ($x == 'ok' && $y == 'ok') { // $sq_del = "DELETE FROM `employee` WHERE `application_status`='unaccepted' AND `cid`='$cid_old'"; $sq_del = "DELETE FROM `employee` WHERE `application_status`='unaccepted' AND `phone`='$phone' AND form_status!='complete'"; // $this->conn->my_delete($sq_del); mysqli_query($this->conn, $sq_del); $sq = "INSERT INTO `employee`(`cid`, `customer_name`,`first_name` ,`middle_name` ,`last_name` ,`father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `emp_sign`, `nationality`,`childs`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `emp_no`, `reg_date`, `reg_date1`,`form_status`) VALUES (NULL,'$fullname','$fname','$mname','$lname','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$target_file1','$target_file_emp_sign1','$nationality','$childs','$zone','$s_engineer','$ex_engineer','$electry_city','$emp_no','$reg_date','$reg_date1','1')"; // $sq = "INSERT INTO `employee`(`cid`, `customer_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `nationality`,`childs`, `identity_type`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `emp_no`, `reg_date`) VALUES (NULL,'$fullname','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$target_file1','$nationality','$childs','$identity_type','$fulladdress','$zone','$s_engineer','$ex_engineer','$electry_city','$emp_no','$reg_date')"; $qu = mysqli_query($this->conn, $sq); $cid = mysqli_insert_id($this->conn); if ($qu) { $_SESSION['msg'] = 'Employee Personal Details Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; echo "<script>location.href='employee_address.php';</script>"; // echo "<script>location.href='print_after_registration.php?q=$cid';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Your Registration Failed.'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function initial_employee_registration($cid_old) { $fname = $_POST['f_name']; $lname = $_POST['l_name']; $mname = $_POST['m_name']; $fullname = $fname . ' ' . $mname . ' ' . $lname; $phone = $_POST['phone']; $phone2 = $_POST['phone2']; $email = $_POST['email']; $dob = $_POST['dob']; $gender = $_POST['gender']; // $fulladdress = $_POST['fulladdress']; $nationality = $_POST['nationality']; $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $childs = $_POST['childs']; // $identity_type = $_POST['identity_type']; $zone = $_POST['zone']; $s_engineer = $_POST['s_engineer']; $ex_engineer = $_POST['ex_engineer']; $electry_city = $_POST['electry_city']; $emp_sign_upload = $_POST['emp_sign_upload']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); $ep_id = $_POST['ep_id']; $csc_id = $_POST['csc_id']; $cid_old = $_POST['cid']; // $select_id = "SELECT * FROM `employee` ORDER BY cid DESC LIMIT 0, 1"; // $qu_id = mysqli_query($this->conn, $select_id); // $fetch_id = mysqli_fetch_assoc($qu_id); // $max_id = $fetch_id['cid']+1; // $max_id_last_three_digit = substr($max_id, -3); // if ($max_id_last_three_digit < 100) { // $max_id_last_three_digit = str_pad($max_id_last_three_digit, 3, '0', STR_PAD_LEFT); // } $emp_no = 'GCPL' . date('YmdHis') . rand(100, 1000); //for file name only // // $emp_no = 'GCPL' . date('YmdGis') . $max_id_last_three_digit; //for file name only $religion = $_POST['religion']; $caste = $_POST['caste']; $community = $_POST['community']; $father_name = $_POST['father_name']; $father_status = $_POST['father_status']; $father_dob = $_POST['father_dob']; $father_identity_type = $_POST['father_identity_type']; $father_identity_no = $_POST['father_identity_no']; $father_name_on_identity = $_POST['father_name_on_identity']; $father_identity_proof = $_POST['father_identity_proof']; // $father_clogo = $_POST['father_clogo']; $mother_name = $_POST['mother_name']; $mother_status = $_POST['mother_status']; $mother_dob = $_POST['mother_dob']; $mother_identity_type = $_POST['mother_identity_type']; $mother_identity_no = $_POST['mother_identity_no']; $mother_name_on_identity = $_POST['mother_name_on_identity']; $mother_identity_proof = $_POST['mother_identity_proof']; // $mother_clogo = $_POST['mother_clogo']; // if (isset($_FILES['clogo']) && !empty($_FILES['clogo']['name'])) { // $target_dir = "include/uploads/"; $target_dir = 'include/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file = $target_dir . basename($_FILES["clogo"]["name"]); $target_file1 = $target_dir . $emp_no . '_photo.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_file1)) { $target_file1 = '../' . $target_file1; $errtext = "The images " . basename($_FILES["clogo"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x = 'ok'; } /* image upload for emp_sign proof start */ if (isset($_FILES['emp_sign_upload']) && !empty($_FILES['emp_sign_upload']['name'])) { // $target_dir_emp_sign = "include/emp_sign/"; $target_dir_emp_sign = 'include/emp_sign' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir_emp_sign)) { // mkdir($target_dir_emp_sign, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir_emp_sign)) { // mkdir($target_dir_emp_sign); // } $tags = explode('/', $target_dir_emp_sign); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file_emp_sign = $target_dir_emp_sign . basename($_FILES["emp_sign_upload"]["name"]); $target_file_emp_sign1 = $target_dir_emp_sign . $emp_no . 'emp_sign.jpg'; $target_file_emp_sign1 = str_replace(' ', '+', $target_file_emp_sign1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_emp_sign, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["emp_sign_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["emp_sign_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_emp_sign)) { chmod($target_file_emp_sign, 0755); //Change the file permissions if allowed unlink($target_file_emp_sign); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["emp_sign_upload"]["tmp_name"], $target_file_emp_sign1)) { $target_file_emp_sign1 = "../" . $target_file_emp_sign1; $errtexty = "The images " . basename($_FILES["emp_sign_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y = 'ok'; } /* image upload for emp_sign proof end */ $target_dir = 'parents/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } if (isset($_FILES['father_clogo']) && !empty($_FILES['father_clogo']['name'])) { $target_file_father_clogo = $target_dir . basename($_FILES["father_clogo"]["name"]); $target_file_father_clogo1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_father_photo.jpg'; $target_file_father_clogo1 = str_replace(' ', '+', $target_file_father_clogo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_father_clogo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_fp; $check = getimagesize($_FILES["father_clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_fp = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["father_clogo"]["size"] > 300000) { echo $errtext_fp = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_fp = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_father_clogo)) { chmod($target_file_father_clogo, 0755); //Change the file permissions if allowed unlink($target_file_father_clogo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["father_clogo"]["tmp_name"], $target_file_father_clogo1)) { $target_file_father_clogo1 = '../' . $target_file_father_clogo1; $errtext_fp = "The images " . basename($_FILES["father_clogo"]["name"]) . " has been uploaded."; $x_father_clogo = 'ok'; } else { echo $errtext_fp = "Sorry, there was an error uploading your Father photo." . $_FILES["file"]["error"]; } } } else { $x_father_clogo = 'ok'; $target_file_father_clogo1 = $_POST['father_clogo_uploaded']; } /* image upload for father_identity_proof start */ if (isset($_FILES['father_identity_proof']) && !empty($_FILES['father_identity_proof']['name'])) { $target_dir_father_identity_proof = $target_dir; $target_file_father_identity_proof = $target_dir_father_identity_proof . basename($_FILES["father_identity_proof"]["name"]); $target_file_father_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_father_identity_proof.jpg'; $target_file_father_identity_proof1 = str_replace(' ', '+', $target_file_father_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_father_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_fi; $check = getimagesize($_FILES["father_identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_fi = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["father_identity_proof"]["size"] > 300000) { echo $errtext_fi = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_fi = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_father_identity_proof)) { chmod($target_file_father_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_father_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["father_identity_proof"]["tmp_name"], $target_file_father_identity_proof1)) { $target_file_father_identity_proof1 = '../' . $target_file_father_identity_proof1; $errtext_fi = "The images " . basename($_FILES["father_identity_proof"]["name"]) . " has been uploaded."; $y_father_identity_proof = 'ok'; } else { echo $errtext_fi = "Sorry, there was an error uploading your Father identity Proof."; } } } else { $y_father_identity_proof = 'ok'; $target_file_father_identity_proof1 = $_POST['father_identity_uploaded']; } /* image upload for father_identity_proof end */ /* image upload for mother photo start */ if (isset($_FILES['mother_clogo']) && !empty($_FILES['mother_clogo']['name'])) { $target_file_mother_clogo = $target_dir . basename($_FILES["mother_clogo"]["name"]); $target_file_mother_clogo1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_mother_photo.jpg'; $target_file_mother_clogo1 = str_replace(' ', '+', $target_file_mother_clogo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_mother_clogo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_mp; $check = getimagesize($_FILES["mother_clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_mp = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["mother_clogo"]["size"] > 300000) { echo $errtext_mp = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_mp = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_mother_clogo)) { chmod($target_file_mother_clogo, 0755); //Change the file permissions if allowed unlink($target_file_mother_clogo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["mother_clogo"]["tmp_name"], $target_file_mother_clogo1)) { $target_file_mother_clogo1 = '../' . $target_file_mother_clogo1; $errtext_mp = "The images " . basename($_FILES["mother_clogo"]["name"]) . " has been uploaded."; $x_mother_clogo = 'ok'; } else { echo $errtext_mp = "Sorry, there was an error uploading your Mother photo." . $_FILES["file"]["error"]; } } } else { $x_mother_clogo = 'ok'; $target_file_mother_clogo1 = $_POST['mother_clogo_uploaded']; } /* image upload for mother photo proof end */ /* image upload for mother_identity_proof start */ if (isset($_FILES['mother_identity_proof']) && !empty($_FILES['mother_identity_proof']['name'])) { $target_dir_mother_identity_proof = $target_dir; $target_file_mother_identity_proof = $target_dir_mother_identity_proof . basename($_FILES["mother_identity_proof"]["name"]); $target_file_mother_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_mother_identity_proof.jpg'; $target_file_mother_identity_proof1 = str_replace(' ', '+', $target_file_mother_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_mother_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_mi; $check = getimagesize($_FILES["mother_identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_mi = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["mother_identity_proof"]["size"] > 300000) { echo $errtext_mi = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_mi = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_mother_identity_proof)) { chmod($target_file_mother_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_mother_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["mother_identity_proof"]["tmp_name"], $target_file_mother_identity_proof1)) { $target_file_mother_identity_proof1 = '../' . $target_file_mother_identity_proof1; $errtext_mi = "The images " . basename($_FILES["mother_identity_proof"]["name"]) . " has been uploaded."; $y_mother_identity_proof = 'ok'; } else { echo $errtext_mi = "Sorry, there was an error uploading your Mother identity Proof."; } } } else { $y_mother_identity_proof = 'ok'; $target_file_mother_identity_proof1 = $_POST['mother_identity_uploaded']; } /* image upload for mother_identity_proof end */ if ($x == 'ok' && $y == 'ok' && $x_father_clogo == 'ok' && $y_father_identity_proof == 'ok' && $x_mother_clogo == 'ok' && $y_mother_identity_proof == 'ok') { if ($cid_old > 0) { $sq = "UPDATE `employee` SET `recommended_by`='$ep_id',`customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname',`father_name`='$father_name',`mother_name`='$mother_name',`phone`='$phone',`phone2`='$phone2',`emailid`='$email',`dob`='$dob',`gender`='$gender',`mstatus`='$mstatus',`wife_name`='$wife_name', `clogo`='$target_file1', `emp_sign`='$target_file_emp_sign1', `nationality`='$nationality',`childs`='$childs', `zone`='$zone', `s_engineer`='$s_engineer', `ex_engineer`='$ex_engineer', `electrycity_zone`='$electry_city', `emp_no`='$emp_no', `reg_date`='$reg_date', `reg_date1`='$reg_date1',`form_status`='1',`registered_by`='self' WHERE `cid`='$cid_old'"; $qu = mysqli_query($this->conn, $sq); $cid = $cid_old; } else { // $sq_del = "DELETE FROM `employee` WHERE `application_status`='unaccepted' AND `cid`='$cid_old'"; $sq_del = "DELETE FROM `employee` WHERE `application_status`='unaccepted' AND `phone`='$phone' AND form_status!='complete'"; // // $this->conn->my_delete($sq_del); //prev mysqli_query($this->conn, $sq_del); // new $check = "SELECT * FROM `employee` WHERE `phone`='$phone'"; $check1 = mysqli_query($this->conn, $check); $checkrows = mysqli_num_rows($check1); if ($checkrows > 0) { $_SESSION['err_msg'] = "Employee already exists. Enter Different Mobile No."; echo '<meta http-equiv="refresh" content="0">'; } else { // $sq = "INSERT INTO `employee`(`cid`, `customer_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `nationality`,`childs`, `identity_type`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `emp_no`, `reg_date`) VALUES (NULL,'$fullname','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$target_file1','$nationality','$childs','$identity_type','$fulladdress','$zone','$s_engineer','$ex_engineer','$electry_city','$emp_no','$reg_date')"; $sq = "INSERT INTO `employee`(`cid`, `customer_name`,`first_name` ,`middle_name` ,`last_name` ,`father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `emp_sign`, `nationality`,`childs`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `emp_no`, `reg_date`, `reg_date1`,`form_status`,`registered_by`,`recommended_by`) VALUES (NULL,'$fullname','$fname','$mname','$lname','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$target_file1','$target_file_emp_sign1','$nationality','$childs','$zone','$s_engineer','$ex_engineer','$electry_city','$emp_no','$reg_date','$reg_date1','1','self','$ep_id')"; $qu = mysqli_query($this->conn, $sq); $cid = mysqli_insert_id($this->conn); } } if ($qu) { if ($cid_old > 0) { $sq_fees = "UPDATE `employee_other_details` SET `emp_id`='$cid' WHERE `emp_id`='$cid_old'"; $qu_fees = mysqli_query($this->conn, $sq_fees); } if ($p_id > 0) { $sq_1 = "UPDATE `parents_details` SET `religion`='$religion',`caste`='$caste',`community`='$community',`father_name`='$father_name',`father_status`='$father_status',`father_dob`='$father_dob',`father_clogo_prev`=`father_clogo`,`father_clogo`='$target_file_father_clogo1',`father_identity_type`='$father_identity_type',`father_identity_no`='$father_identity_no',`father_name_on_identity`='$father_name_on_identity',`father_identity_upload_prev`=`father_identity_upload`,`father_identity_upload`='$target_file_father_identity_proof1',`mother_name`='$mother_name',`mother_status`='$mother_status',`mother_dob`='$mother_dob',`mother_clogo_prev`=`mother_clogo`,`mother_clogo`='$target_file_mother_clogo1',`mother_identity_type`='$mother_identity_type',`mother_identity_no`='$mother_identity_no',`mother_name_on_identity`='$mother_name_on_identity',`mother_identity_upload_prev`=`mother_identity_upload`,`mother_identity_upload`='$target_file_mother_identity_proof1',`updated_by_id`='$cid',`updated_by_name`='',`updated_by_sign`='',`updated_date`='$reg_date1',`added_by_provider_company`='$ep_id',`added_by_csc_user`='$csc_id',`added_by_csc_user_date`='$reg_date1' WHERE `p_id`='$p_id'"; $qu_1 = mysqli_query($this->conn, $sq_1); $p_id = $p_id; } else { $sq_1 = "INSERT INTO `parents_details`(`p_id`, `emp_id`, `religion`, `caste`, `community`, `father_name`, `father_status`, `father_dob`, `father_clogo`, `father_clogo_prev`, `father_identity_type`, `father_identity_no`, `father_name_on_identity`, `father_identity_upload`, `father_identity_upload_prev`, `mother_name`, `mother_status`, `mother_dob`, `mother_clogo`, `mother_clogo_prev`, `mother_identity_type`, `mother_identity_no`, `mother_name_on_identity`, `mother_identity_upload`, `mother_identity_upload_prev`, `added_by_id`, `added_by_name`, `added_by_sign`, `added_date`, `added_by_provider_company`,`added_by_csc_user`,`added_by_csc_user_date`) VALUES (NULL,'$cid','$religion','$caste','$community','$father_name','$father_status','$father_dob','$target_file_father_clogo1','$target_file_father_clogo1','$father_identity_type','$father_identity_no','$father_name_on_identity','$target_file_father_identity_proof1','$target_file_father_identity_proof1','$mother_name','$mother_status','$mother_dob','$target_file_mother_clogo1','$target_file_mother_clogo1','$mother_identity_type','$mother_identity_no','$mother_name_on_identity','$target_file_mother_identity_proof1','$target_file_mother_identity_proof1','$cid','','','$reg_date1','$ep_id','$csc_id','$reg_date1')"; $qu_1 = mysqli_query($this->conn, $sq_1); $p_id = mysqli_insert_id($this->conn); } $_SESSION['msg'] = 'Employee Personal Details Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; echo "<script>location.href='employee_address.php';</script>"; // echo "<script>location.href='print_after_registration.php?q=$cid';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Your Registration Failed due to ' . mysqli_error($this->conn); echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Images Upload due to ' . $errtext . $errtext_fp . $errtext_fi . $errtext_mp . $errtext_mi; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function add_employee_address($emp_no, $cid) { $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $pincode = $_POST['pincode']; $post = $_POST['post']; $city = $_POST['city']; $state = $_POST['state']; $name_on_identity = $_POST['name_on_identity']; $address_type = $_POST['address_type']; // $address_upload = $_POST['address_upload']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); $mstatus = $_POST['mstatus']; $childs = $_POST['childs']; $wife_name = $_POST['wife_name']; $wife_status = $_POST['wife_status']; $wife_dob = $_POST['wife_dob']; $wife_identity_type = $_POST['wife_identity_type']; $wife_identity_no = $_POST['wife_identity_no']; $wife_name_on_identity = $_POST['wife_name_on_identity']; // $wife_identity_proof = $_POST['wife_identity_proof']; // $wife_clogo = $_POST['wife_clogo']; if (isset($_FILES['identity_proof']) && !empty($_FILES['identity_proof']['name'])) { // $target_dir = "include/identity/"; $target_dir = 'include/identity' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file = $target_dir . basename($_FILES["identity_proof"]["name"]); $target_file1 = $target_dir . $emp_no . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_proof"]["size"] > 300000) { echo $errtext = "Sorry, your image size is larger than 300 KB."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_proof"]["tmp_name"], $target_file1)) { $target_file1 = '../' . $target_file1; $errtext = "The images " . basename($_FILES["identity_proof"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x = 'ok'; } /* image upload for address proof start */ if (isset($_FILES['address_upload']) && !empty($_FILES['address_upload']['name'])) { // $target_dir_address = "include/address_upload/"; $target_dir_address = 'include/address_upload' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir_address)) { // mkdir($target_dir_address, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir_address)) { // mkdir($target_dir_address); // } $tags = explode('/', $target_dir_address); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file_address = $target_dir_address . basename($_FILES["address_upload"]["name"]); $target_file_address1 = $target_dir_address . $emp_no . 'address.jpg'; $target_file_address1 = str_replace(' ', '+', $target_file_address1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_address, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["address_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["address_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_address)) { chmod($target_file_address, 0755); //Change the file permissions if allowed unlink($target_file_address); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["address_upload"]["tmp_name"], $target_file_address1)) { $target_file_address1 = '../' . $target_file_address1; $errtexty = "The images " . basename($_FILES["address_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y = 'ok'; } /* image upload for address proof end */ /* image upload for photo start */ $target_dir = 'wife/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } if (isset($_FILES['wife_clogo']) && !empty($_FILES['wife_clogo']['name'])) { $target_file_wife_clogo = $target_dir . basename($_FILES["wife_clogo"]["name"]); $target_file_wife_clogo1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_wife_photo.jpg'; $target_file_wife_clogo1 = str_replace(' ', '+', $target_file_wife_clogo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_wife_clogo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_fp; $check = getimagesize($_FILES["wife_clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_fp = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["wife_clogo"]["size"] > 300000) { echo $errtext_fp = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_fp = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_wife_clogo)) { chmod($target_file_wife_clogo, 0755); //Change the file permissions if allowed unlink($target_file_wife_clogo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["wife_clogo"]["tmp_name"], $target_file_wife_clogo1)) { $target_file_wife_clogo1 = '../' . $target_file_wife_clogo1; $errtext_fp = "The images " . basename($_FILES["wife_clogo"]["name"]) . " has been uploaded."; $x_wife_clogo = 'ok'; } else { echo $errtext_fp = "Sorry, there was an error uploading your Father photo." . $_FILES["file"]["error"]; } } } else { $x_wife_clogo = 'ok'; $target_file_wife_clogo1 = $_POST['wife_clogo_uploaded']; } /* image upload for photo end */ /* image upload for wife_identity_proof start */ if (isset($_FILES['wife_identity_proof']) && !empty($_FILES['wife_identity_proof']['name'])) { $target_dir_wife_identity_proof = $target_dir; $target_file_wife_identity_proof = $target_dir_wife_identity_proof . basename($_FILES["wife_identity_proof"]["name"]); $target_file_wife_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_wife_identity_proof.jpg'; $target_file_wife_identity_proof1 = str_replace(' ', '+', $target_file_wife_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_wife_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_fi; $check = getimagesize($_FILES["wife_identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_fi = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["wife_identity_proof"]["size"] > 300000) { echo $errtext_fi = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_fi = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_wife_identity_proof)) { chmod($target_file_wife_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_wife_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["wife_identity_proof"]["tmp_name"], $target_file_wife_identity_proof1)) { $target_file_wife_identity_proof1 = '../' . $target_file_wife_identity_proof1; $errtext_fi = "The images " . basename($_FILES["wife_identity_proof"]["name"]) . " has been uploaded."; $y_wife_identity_proof = 'ok'; } else { echo $errtext_fi = "Sorry, there was an error uploading your Father identity Proof."; } } } else { $y_wife_identity_proof = 'ok'; $target_file_wife_identity_proof1 = $_POST['wife_identity_uploaded']; } /* image upload for wife_identity_proof end */ if ($x == 'ok' && $y == 'ok' && $x_wife_clogo == 'ok' && $y_wife_identity_proof == 'ok') { $sq = "UPDATE `employee` SET `mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`block`='$block',`tahsil`='$tahsil',`identity_type`='$identity_type',`identity_no`='$identity_no',`name_on_identity`='$name_on_identity',`identity_upload`='$target_file1',`address_type`='$address_type',`address_upload`='$target_file_address1',`form_status`='2',`registered_by`='self', `mstatus`='$mstatus', `wife_name`='$wife_name',`childs`='$childs' WHERE `cid`='$cid'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { if ($w_id > 0) { $sq_1 = "UPDATE `wife_details` SET `wife_name`='$wife_name',`wife_status`='$wife_status',`wife_dob`='$wife_dob',`wife_clogo_prev`=`wife_clogo`,`wife_clogo`='$target_file_wife_clogo1',`wife_identity_type`='$wife_identity_type',`wife_identity_no`='$wife_identity_no',`wife_name_on_identity`='$wife_name_on_identity',`wife_identity_upload_prev`=`wife_identity_upload`,`wife_identity_upload`='$target_file_wife_identity_proof1',`updated_by_id`='$cid',`updated_by_name`='',`updated_by_sign`='',`updated_date`='$reg_date1' WHERE `w_id`='$w_id'"; $qu_1 = mysqli_query($this->conn, $sq_1); $w_id = $w_id; } else { $sq_1 = "INSERT INTO `wife_details`(`w_id`, `emp_id`, `wife_name`, `wife_status`, `wife_dob`, `wife_clogo`, `wife_clogo_prev`, `wife_identity_type`, `wife_identity_no`, `wife_name_on_identity`, `wife_identity_upload`, `wife_identity_upload_prev`, `added_by_id`, `added_by_name`, `added_by_sign`, `added_date`) VALUES (NULL,'$cid','$wife_name','$wife_status','$wife_dob','$target_file_wife_clogo1','$target_file_wife_clogo1','$wife_identity_type','$wife_identity_no','$wife_name_on_identity','$target_file_wife_identity_proof1','$target_file_wife_identity_proof1','$cid','','','$reg_date1')"; $qu_1 = mysqli_query($this->conn, $sq_1); $w_id = mysqli_insert_id($this->conn); } $_SESSION['msg'] = 'Employee Address Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; echo "<script>location.href='account_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; // echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; // echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function add_employee_bank_details($emp_no, $cid) { $skilled = $_POST['skilled']; $skilled_type = $_POST['skilled_type']; // $skilled_upload = $_POST['skilled_upload']; $work_type = $_POST['work_type']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $ip_detail = $_POST['ip_detail']; $ipno = $_POST['ipno']; $ic = $_POST['ic']; $ip_expiry = $_POST['ip_expiry']; $samprice = $_POST['samprice']; $nominee = $_POST['nominee']; $result_fullname = explode(" ", $nominee); $fname = $result_fullname[0]; //$_POST['f_name']; $lname = $result_fullname[1]; //$_POST['l_name']; $mname = $result_fullname[2]; //$_POST['m_name']; $epf_detail = $_POST['epf_detail']; $epf = $_POST['epf']; $epf_expiry = $_POST['epf_expiry']; $esic_detail = $_POST['esic_detail']; $esic = $_POST['esic']; $pan_detail = $_POST['pan_detail']; $pan_no = $_POST['pan_no']; /* image upload for passbook start */ // $target_dir = "include/passbook/"; $target_dir = 'include/passbook' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file = $target_dir . basename($_FILES["passbook"]["name"]); $target_file1 = $target_dir . $emp_no . 'passbook.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["passbook"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["passbook"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["passbook"]["tmp_name"], $target_file1)) { $target_file1 = "../" . $target_file1; $errtext = "The images " . basename($_FILES["passbook"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } /* image upload for passbook end */ /* image upload for skill start */ // if ($skilled == 'Skilled') { if ($skilled == '2' || $skilled == '6') { // $target_dir_skill = "include/skill_upload/"; $target_dir_skill = 'include/skill_upload' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir_skill)) { // mkdir($target_dir_skill, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir_skill)) { // mkdir($target_dir_skill); // } $tags = explode('/', $target_dir_skill); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file_skill = $target_dir_skill . basename($_FILES["skilled_upload"]["name"]); $target_file_skill1 = $target_dir_skill . $emp_no . 'skill.jpg'; $target_file_skill1 = str_replace(' ', '+', $target_file_skill1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_skill, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["skilled_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["skilled_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_skill)) { chmod($target_file_skill, 0755); //Change the file permissions if allowed unlink($target_file_skill); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["skilled_upload"]["tmp_name"], $target_file_skill1)) { $target_file_skill1 = '../' . $target_file_skill1; $errtexty = "The images " . basename($_FILES["skilled_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y = 'ok'; } /* image upload for skill end */ /* image upload for pancard start */ if ($pan_detail == 'yes') { // $target_dir = "include/pan_upload/"; $target_dir = 'include/pan_upload' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file_pan_upload = $target_dir . basename($_FILES["pan_upload"]["name"]); $target_file_pan_upload1 = $target_dir . $emp_no . 'pan.jpg'; $target_file_pan_upload1 = str_replace(' ', '+', $target_file_pan_upload1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_pan_upload, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["pan_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["pan_upload"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_pan_upload)) { chmod($target_file_pan_upload, 0755); //Change the file permissions if allowed unlink($target_file_pan_upload); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["pan_upload"]["tmp_name"], $target_file_pan_upload1)) { $target_file_pan_upload1 = "../" . $target_file_pan_upload1; $errtext = "The images " . basename($_FILES["pan_upload"]["name"]) . " has been uploaded."; $x_pan = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your pancard."; } } } else { $x_pan = 'ok'; } /* image upload for pancard end */ if ($x == 'ok' && $y == 'ok' && $x_pan == 'ok') { $sq = "UPDATE `employee` SET `skilled`='$skilled',`skilled_type`='$skilled_type',`skilled_upload`='$target_file_skill1',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`work_type`='$work_type',`passbook_upload`='$target_file1',`form_status`='3',`ip_detail`='$ip_detail',`insurance_policy_no`='$ipno',`insurance_company`='$ic',`s_price`='$samprice',`epf_detail`='$epf_detail',`epf_reg`='$epf',`esic_detail`='$esic_detail',`esic_regno`='$esic',`ip_expiry`='$ip_expiry',`pan_no`='$pan_no',`pan_detail`='$pan_detail',`pan_upload`='$target_file_pan_upload1' WHERE `cid`='$cid'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Bank Detail Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; echo "<script>location.href='insurance_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext . $errtexty; echo '<meta http-equiv="refresh" content="0">'; } } public function add_employee_insurance_details($emp_no, $cid) { $nominee = $_POST['nominee_name']; $nominee_father_name = $_POST['father_name']; $result_fullname = explode(" ", $nominee); $fname = $result_fullname[0]; //$_POST['f_name']; $lname = $result_fullname[1]; //$_POST['l_name']; $mname = $result_fullname[2]; //$_POST['m_name']; // $nominee = $fname . ' ' . $mname . ' ' . $lname; $nominee_rel = $_POST['nominee_rel']; $nominee_other = $_POST['nominee_other']; $nominee_phone = $_POST['phone']; $nominee_dob = $_POST['dob']; $nominee_gender = $_POST['gender']; $nominee_identity_type = $_POST['identity_type']; $nominee_identity_no = $_POST['identity_no']; $nominee_name_on_identity = $_POST['name_on_identity']; $clogo_uploaded = $_POST['clogo_uploaded']; $identity_proof_uploaded = $_POST['identity_proof_uploaded']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $target_dir = 'nominee/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } if (isset($_FILES['clogo']) && !empty($_FILES['clogo']['name'])) { $target_file_clogo = $target_dir . basename($_FILES["clogo"]["name"]); $target_file_clogo1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_photo.jpg'; $target_file_clogo1 = str_replace(' ', '+', $target_file_clogo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_clogo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_clogo)) { chmod($target_file_clogo, 0755); //Change the file permissions if allowed unlink($target_file_clogo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_file_clogo1)) { // if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_dir . $emp_no . '_' . date('ymdHis') . ".jpg")) { $clogo = '../' . $target_file_clogo1; $x_clogo = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your photo images." . $_FILES["file"]["error"]; } } } else { $clogo = $clogo_uploaded; $x_clogo = 'ok'; } /* image upload for identity proof start */ if (isset($_FILES['identity_proof']) && !empty($_FILES['identity_proof']['name'])) { $target_file_identity_proof = $target_dir . basename($_FILES["identity_proof"]["name"]); $target_file_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_identity.jpg'; $target_file_identity_proof1 = str_replace(' ', '+', $target_file_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_proof"]["size"] > 300000) { echo $errtext = "Sorry, your image size is larger than 300 KB."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_identity_proof)) { chmod($target_file_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_proof"]["tmp_name"], $target_file_identity_proof1)) { // $identity_proof = '../' . $target_file_identity_proof . $_FILES["identity_proof"]["tmp_name"]; $identity_proof = '../' . $target_file_identity_proof1; $errtext = "The images " . basename($_FILES["identity_proof"]["name"]) . " has been uploaded."; $x_identity = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $identity_proof = $identity_proof_uploaded; $x_identity = 'ok'; } /* image upload for identity proof end */ /* image upload for bank proof start */ if (isset($_FILES['passbook']) && !empty($_FILES['passbook']['name'])) { $target_file_passbook = $target_dir . basename($_FILES["passbook"]["name"]); $target_file_passbook1 = $target_dir . $emp_no . 'passbook.jpg'; $target_file_passbook1 = str_replace(' ', '+', $target_file_passbook1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_passbook, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["passbook"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["passbook"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_passbook)) { chmod($target_file_passbook, 0755); //Change the file permissions if allowed unlink($target_file_passbook); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["passbook"]["tmp_name"], $target_file_passbook1)) { $target_file_passbook1 = "../" . $target_file_passbook1; $errtext = "The images " . basename($_FILES["passbook"]["name"]) . " has been uploaded."; $x_bank = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your bank passbook."; } } } else { $x_bank = 'ok'; } /* image upload for bank proof end */ if ($x_clogo == 'ok' && $x_identity == 'ok' && $x_bank == 'ok') { // $sq = "UPDATE `employee` SET `ip_detail`='$ip_detail',`insurance_policy_no`='$ipno',`insurance_company`='$ic',`s_price`='$samprice',`nominee`='$nominee',`nominee_relation`='$nominee_rel',`nominee_other`='$nominee_other',`epf_detail`='$epf_detail',`epf_reg`='$epf',`esic_detail`='$esic_detail',`esic_regno`='$esic',`ip_expiry`='$ip_expiry',`pan_no`='$pan_no',`pan_detail`='$pan_detail',`pan_upload`='$target_file1',`form_status`='complete' WHERE `cid`='$cid'"; // $sq = "UPDATE `employee` SET `ip_detail`='$ip_detail',`insurance_policy_no`='$ipno',`insurance_company`='$ic',`s_price`='$samprice',`nominee`='$nominee',`nominee_relation`='$nominee_rel',`nominee_other`='$nominee_other',`epf_detail`='$epf_detail',`epf_reg`='$epf',`esic_detail`='$esic_detail',`esic_regno`='$esic',`ip_expiry`='$ip_expiry',`pan_no`='$pan_no',`pan_detail`='$pan_detail',`pan_upload`='$target_file1',`form_status`='4' WHERE `cid`='$cid'"; $sq = "UPDATE `employee` SET `nominee`='$nominee',`nominee_relation`='$nominee_rel',`nominee_other`='$nominee_other',`form_status`='4' WHERE `cid`='$cid'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $sq_nom = "INSERT INTO `nominee_details`(`nid`, `cid`, `customer_name`,`first_name` ,`middle_name` ,`last_name` , `nominee_relation`, `nominee_other`,`father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `emp_sign`, `nationality`,`childs`, `emp_no`, `reg_date`, `reg_date1`, `form_status`, `relation_proof_upload`, `relation_proof_no`, `relation_proof_date`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `passbook_upload`, `company_id`) VALUES (NULL,'$cid','$nominee','$fname','$mname','$lname','$nominee_rel','$nominee_other','$nominee_father_name','$nominee_mother_name','$nominee_phone','$phone2','$email','$nominee_dob','$nominee_gender','$mstatus','$wife_name','$clogo','$target_file_emp_sign1','$nationality','$childs','$emp_no','$reg_date','$reg_date1','0','$target_file_relation_proof1','$relation_proof_no','$relation_proof_date','$nominee_identity_type','$nominee_name_on_identity','$nominee_identity_no','$identity_proof','$accname','$accnumber','$ifsc','$bank_name','$bank_branch','$bank_address','$target_file_passbook1','1')"; $qu_nom = mysqli_query($this->conn, $sq_nom); $nid = mysqli_insert_id($this->conn); $_SESSION['cid'] = $cid; $_SESSION['emp_no'] = $emp_no; $_SESSION['msg'] = 'Insurance Detail Added Successfully.'; // echo "<script>location.href='send_success_message.php';</script>"; // echo "<script>location.href='print_after_registration.php';</script>"; echo "<script>location.href='substation_choices.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } } public function add_employee_substation_choices($emp_no, $cid) { $choices = $_POST['substation_choices']; $ex_engg = $_POST['ex_engg']; $k = 1; $prefix = ''; // if(!empty($_POST['substation_choices'])){ foreach ($choices as $value) { // $choice_loc = ' choice_' . $k . '=' . $value; $all_choices .= $prefix . '`choice_' . $k . '`="' . $value . '"'; // $choice_all .= $prefix . $choice_loc; $prefix = ','; $k++; } // } // echo $choice_all; // echo $all_choices; // $all_choices = ltrim($all_choices, ','); if ($all_choices == '') { $sq = "UPDATE `employee` SET `choice_ex_id`='$ex_engg',`form_status`='5' WHERE `cid`='$cid'"; } else { $sq = "UPDATE `employee` SET $all_choices,`choice_ex_id`='$ex_engg',`form_status`='5' WHERE `cid`='$cid'"; } $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['cid'] = $cid; $_SESSION['status'] = 'TXN_SUCCESS'; $effective_date = date('Y-m-d H:i:s'); $sq_reg_fees = "SELECT * FROM `reg_fees_new` WHERE `ex_id`='$ex_engg' AND effective_date<='$effective_date' ORDER BY effective_date DESC"; $result_reg_fees = $this->select_custom_query($sq_reg_fees); if ($result_reg_fees[0]['fees_applicable'] == 'NO') { $fees_applicable = 'NO'; } else if ($result_reg_fees[0]['fees_applicable'] == 'YES') { $fees_applicable = 'YES'; } $sq_reg_fees_emp = "SELECT * FROM `employee_other_details` WHERE `emp_id`='$cid' ORDER BY add_date DESC"; $result_reg_fees_emp = $this->select_custom_query($sq_reg_fees_emp); if ($result_reg_fees_emp[0]['fees_applicable'] == 'NO') { $fees_applicable = 'NO'; } else if ($result_reg_fees_emp[0]['fees_applicable'] == 'YES') { $fees_applicable = 'YES'; } if ($fees_applicable == 'NO') { $_SESSION['msg'] = 'Registration Form Submitted Successfully.'; echo "<script>location.href='print_after_registration_wp.php';</script>"; } else { $_SESSION['msg'] = 'Choices for Substation Added Successfully.'; // echo "<script>location.href='send_success_message.php';</script>"; // echo "<script>location.href='print_after_registration.php';</script>"; // echo "<script>location.href='CCavenue-payment-gateway/index.php';</script>"; echo "<script>location.href='PaytmKit/index.php';</script>"; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; // echo "<script>location.href='error_message_payment.php';</script>"; // echo '<meta http-equiv="refresh" content="0">'; } } public function initial_employee_registration_byadmin() { $fname = $_POST['f_name']; $lname = $_POST['l_name']; $mname = $_POST['m_name']; $fullname = $fname . ' ' . $mname . ' ' . $lname; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; $phone = $_POST['phone']; $phone2 = $_POST['phone2']; $email = $_POST['email']; $dob = $_POST['dob']; $gender = $_POST['gender']; // $fulladdress = $_POST['fulladdress']; $nationality = $_POST['nationality']; $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $childs = $_POST['childs']; // $identity_type = $_POST['identity_type']; $zone = $_POST['zone']; $s_engineer = $_POST['s_engineer']; $ex_engineer = $_POST['ex_engineer']; $electry_city = $_POST['electry_city']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); $emp_no = 'GCPL' . date('YmdHis') . rand(100, 1000); //for file name only $target_dir = "../include/uploads/"; $target_file = $target_dir . basename($_FILES["clogo"]["name"]); $target_file1 = $target_dir . $emp_no . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_dir . $emp_no . ".jpg")) { $clogo = $target_file . $_FILES["clogo"]["tmp_name"]; $errtext = "The images " . basename($_FILES["clogo"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } if ($x == 'ok') { $sq = "INSERT INTO `employee`(`cid`, `customer_name`,`first_name` ,`middle_name` ,`last_name` ,`father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `nationality`,`childs`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `emp_no`, `reg_date`, `reg_date1`,`form_status`) VALUES (NULL,'$fullname','$fname','$mname','$lname','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$target_file1','$nationality','$childs','$zone','$s_engineer','$ex_engineer','$electry_city','$emp_no','$reg_date','$reg_date1','1')"; // $sq = "INSERT INTO `employee`(`cid`, `customer_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `nationality`,`childs`, `identity_type`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `emp_no`, `reg_date`) VALUES (NULL,'$fullname','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$target_file1','$nationality','$childs','$identity_type','$fulladdress','$zone','$s_engineer','$ex_engineer','$electry_city','$emp_no','$reg_date')"; $qu = mysqli_query($this->conn, $sq); $cid = mysqli_insert_id($this->conn); if ($qu) { $_SESSION['msg'] = 'Employee Personal Details Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; echo "<script>location.href='employee_address.php';</script>"; // echo "<script>location.href='print_after_registration.php?q=$cid';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Your Registration Failed.'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function add_employee_address_byadmin($emp_no, $cid) { $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $pincode = $_POST['pincode']; $post = $_POST['post']; $city = $_POST['city']; $state = $_POST['state']; // $country = $_POST['country']; $name_on_identity = $_POST['name_on_identity']; $target_dir = "../include/identity/"; $target_file = $target_dir . basename($_FILES["identity_proof"]["name"]); $target_file1 = $target_dir . $emp_no . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_proof"]["size"] > 300000) { echo $errtext = "Sorry, your image size is larger than 300 KB."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_proof"]["tmp_name"], $target_dir . $emp_no . ".jpg")) { $identity_proof = $target_file . $_FILES["identity_proof"]["tmp_name"]; $errtext = "The images " . basename($_FILES["identity_proof"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } if ($x == 'ok') { $sq = "UPDATE `employee` SET `mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`block`='$block',`tahsil`='$tahsil',`identity_type`='$identity_type',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`identity_upload`='$target_file1',`form_status`='2' WHERE `cid`='$cid'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Employee Address Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; echo "<script>location.href='account_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function add_employee_bank_details_byadmin($emp_no, $cid) { $skilled = $_POST['skilled']; $skilled_type = $_POST['skilled_type']; // $skilled_upload = $_POST['skilled_upload']; $work_type = $_POST['work_type']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; // $pan = $_POST['pan']; /* image upload for passbook start */ $target_dir = "../include/passbook/"; $target_file = $target_dir . basename($_FILES["passbook"]["name"]); $target_file1 = $target_dir . $emp_no . 'passbook.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["passbook"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["passbook"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["passbook"]["tmp_name"], $target_dir . $emp_no . "passbook.jpg")) { $passbook = $target_file . $_FILES["passbook"]["tmp_name"]; $errtext = "The images " . basename($_FILES["passbook"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } /* image upload for passbook end */ /* image upload for skill start */ // if ($skilled == 'Skilled') { if ($skilled == '2' || $skilled == '6') { $target_dir_skill = "../include/skill_upload/"; $target_file_skill = $target_dir_skill . basename($_FILES["skilled_upload"]["name"]); $target_file_skill1 = $target_dir_skill . $emp_no . 'skill.jpg'; $target_file_skill1 = str_replace(' ', '+', $target_file_skill1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_skill, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["skilled_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["skilled_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_skill)) { chmod($target_file_skill, 0755); //Change the file permissions if allowed unlink($target_file_skill); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["skilled_upload"]["tmp_name"], $target_dir_skill . $emp_no . "skill.jpg")) { $skilled_upload = $target_file_skill . $_FILES["skilled_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["skilled_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y = 'ok'; } /* image upload for skill end */ if ($x == 'ok' && $y == 'ok') { $sq = "UPDATE `employee` SET `skilled`='$skilled',`skilled_type`='$skilled_type',`skilled_upload`='$target_file_skill1',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`work_type`='$work_type',`passbook_upload`='$target_file1',`form_status`='3' WHERE `cid`='$cid'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Bank Detail Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; echo "<script>location.href='insurance_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext . $errtexty; echo '<meta http-equiv="refresh" content="0">'; } } public function add_employee_insurance_details_byadmin($emp_no, $cid) { $ip_detail = $_POST['ip_detail']; $ipno = $_POST['ipno']; $ic = $_POST['ic']; $ip_expiry = $_POST['ip_expiry']; $samprice = $_POST['samprice']; $nominee = $_POST['nominee']; $nominee_rel = $_POST['nominee_rel']; $nominee_other = $_POST['nominee_other']; $epf_detail = $_POST['epf_detail']; $epf = $_POST['epf']; $epf_expiry = $_POST['epf_expiry']; $esic_detail = $_POST['esic_detail']; $esic = $_POST['esic']; $pan_detail = $_POST['pan_detail']; $pan_no = $_POST['pan_no']; // $pan_upload = $_POST['pan_upload']; if ($pan_detail == 'yes') { $target_dir = "../include/pan_upload/"; $target_file = $target_dir . basename($_FILES["pan_upload"]["name"]); $target_file1 = $target_dir . $emp_no . 'pan.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["pan_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["pan_upload"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["pan_upload"]["tmp_name"], $target_dir . $emp_no . "pan.jpg")) { $pan_upload = $target_file . $_FILES["pan_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["pan_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x = 'ok'; } if ($x == 'ok') { $sq = "UPDATE `employee` SET `ip_detail`='$ip_detail',`insurance_policy_no`='$ipno',`insurance_company`='$ic',`s_price`='$samprice',`nominee`='$nominee',`nominee_relation`='$nominee_rel',`nominee_other`='$nominee_other',`epf_detail`='$epf_detail',`epf_reg`='$epf',`esic_detail`='$esic_detail',`esic_regno`='$esic',`ip_expiry`='$ip_expiry',`pan_no`='$pan_no',`pan_detail`='$pan_detail',`pan_upload`='$target_file1',`form_status`='complete' WHERE `cid`='$cid'"; $qu = mysqli_query($this->conn, $sq); $sqphone = "SELECT phone FROM employee WHERE cid='$cid'"; $quphone = mysqli_query($this->conn, $sqphone); $fetch = mysqli_fetch_assoc($quphone); if ($qu) { $_SESSION['cid'] = $cid; $_SESSION['phone'] = $fetch['phone']; $_SESSION['msg'] = 'Insurance Detail Added Successfully.'; // echo "<script>location.href='send_success_message.php';</script>"; echo "<script>location.href='print_after_registration.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } } // Get Countries public function getcountries() { $sq = "SELECT * FROM countries"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function getzone_company($company_id) { $sq = "SELECT * FROM zone WHERE company_id='$company_id' AND status='1' ORDER BY zone_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get ZONE public function getzone() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM zone WHERE company_id='$company_id' AND status='1' ORDER BY zone_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get ZONE public function get_selected_zone($zone_id) { $sq = "SELECT * FROM zone WHERE zone_id IN ($zone_id) ORDER BY zone_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get discom name public function getdiscom_by_zone_name($zone_name) { $company_id = $_SESSION['company_id']; $query = "SELECT * FROM `zone` z LEFT JOIN `discom` d ON d.d_id=z.discom_id WHERE zone_name='$zone_name' AND z.status='1' ORDER BY discom_name ASC"; $result = mysqli_query($this->conn, $query); $row = mysqli_fetch_assoc($result); return strip_tags($row['discom_name']); } // Get discom public function getdiscom() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `discom` WHERE company_id='$company_id' AND status='1' ORDER BY discom_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get discom public function getdispensary() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `dispensary` WHERE company_id='$company_id' AND status='1' ORDER BY dispensary_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //Get SUPERITENTENT ENGINEER public function get_zone_by_discom($id) { $sq = "SELECT * FROM `zone` WHERE `discom_id` IN ('$id') AND status='1' ORDER BY zone_name ASC"; $result = mysqli_query($this->conn, $sq); return $result; } //Get SUPERITENTENT ENGINEER public function get_s_engineer($id) { $sq = "SELECT * FROM `super_engineer` WHERE `zone_id` IN (SELECT zone_id FROM zone WHERE zone_name='$id') ORDER BY super_name ASC"; $result = mysqli_query($this->conn, $sq); return $result; } //Get EXECUTIVE_ENGINEER public function getedds() { $sq = "SELECT * FROM executive_engineer ORDER BY ex_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function account_details_using_edd($company_id, $edd_id) { $sq3 = "SELECT * FROM executive_engineer WHERE ex_id='$edd_id' ORDER BY ex_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } //Get EXECUTIVE_ENGINEER using super_name public function get_ex_engineer($super_name) { $sq = "SELECT * FROM `executive_engineer` WHERE `super_id` IN (SELECT super_id FROM super_engineer WHERE super_name='$super_name')"; $result = mysqli_query($this->conn, $sq); return $result; } //Get EXECUTIVE_ENGINEER using super_name public function get_ex_engineer_by_super_name($super_name) { $sq = "SELECT * FROM `executive_engineer` WHERE `super_id` IN (SELECT super_id FROM super_engineer WHERE super_name='$super_name')"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //Get ElectriCity Zone by edd name public function electry_city($city_id) { $sq = "SELECT * FROM `electrycity_zone` WHERE `ex_id` IN (SELECT ex_id FROM executive_engineer WHERE ex_name='$city_id')"; $result = mysqli_query($this->conn, $sq); return $result; } //Get ElectriCity Zone by edsd_id public function electry_city_by_edsd($city_id) { $sq = "SELECT * FROM `electrycity_zone` WHERE `edsd_id` IN ('$city_id')"; $result = mysqli_query($this->conn, $sq); return $result; } //Get ElectriCity Zone IN emp table public function emp_electrycity($city_id, $ex_id) { // $sq = "SELECT * FROM `employee` WHERE `electrycity_zone`='$city_id'"; $sq = "SELECT * FROM `employee` WHERE `electrycity_zone`='$city_id' AND `ex_engineer` IN (SELECT `ex_name` FROM executive_engineer WHERE `ex_id` IN ($ex_id))"; $result = mysqli_query($this->conn, $sq); return $result; } public function emp_electry_city($city_id) { $sq = "SELECT * FROM `employee` WHERE `electrycity_zone`='$city_id'"; $result = mysqli_query($this->conn, $sq); return $result; } public function emp_feeder_wise($feeder_id) { $sq = "SELECT * FROM `parents_details` WHERE `feeder_id`='$feeder_id'"; $result = mysqli_query($this->conn, $sq); return $result; } //Get States public function getstates() { $sq = "SELECT * FROM `states` WHERE `country_id` IN (SELECT id FROM countries WHERE name='$cname')"; $result = mysqli_query($this->conn, $sq); return $result; } //Get Cities public function getcities() { $sname = $_REQUEST['sname']; $sq = "SELECT * FROM `cities` WHERE `state_id` in(SELECT id FROM states WHERE name='$sname')"; $result = mysqli_query($this->conn, $sq); return $result; } //Check Unique Company Reseller User Name public function getuser() { $name = $_REQUEST['name']; $sq = "SELECT admin_user FROM admin_user WHERE admin_user='$name'"; $qu = mysqli_query($this->conn, $sq); $n = mysqli_num_rows($qu); return $n; } //List all active provider public function list_activeprovider() { $sq3 = "SELECT * FROM admin_company WHERE company_type='provider' AND comp_status='active'"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } //List all suspendedprovider public function list_suspprovider() { $sq3 = "SELECT * FROM admin_company WHERE company_type='provider' AND comp_status='suspended'"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } //List all client public function list_client() { $company_id = $_SESSION['company_id']; $zone = $_SESSION['zone']; $sengg = $_SESSION['s_engineer']; $exngg = $_SESSION['ex_engineer']; $electry = $_SESSION['electry_city']; $list_type = $_SESSION['list_type']; $cnd = ''; $area_name = ''; $url = ''; if ($zone) { if ($zone == 'all') { $cnd .= " 1"; $url .= ""; $area_name = 'All Zones'; $zone_list = 'true'; $sengg_list = 'false'; $exngg_list = 'false'; $electry_list = 'false'; } else { // $cnd .= " AND zone='$zone'"; $cnd .= " zone='$zone'"; $url .= "?zone='$zone'"; $area_name = $zone; $zone_list = 'true'; $sengg_list = 'false'; $exngg_list = 'false'; $electry_list = 'false'; } } else if ($zone == '') { $cnd .= " 1"; $url .= ""; $area_name = 'All Zones'; $zone_list = 'true'; $sengg_list = 'false'; $exngg_list = 'false'; $electry_list = 'false'; } if ($sengg) { $cnd .= " AND s_engineer='$sengg'"; $url .= "s_engineer='$sengg'"; $area_name = $sengg; $zone_list = 'false'; $sengg_list = 'true'; $exngg_list = 'false'; $electry_list = 'false'; } if ($exngg) { $cnd .= " AND ex_engineer='$exngg'"; $url .= "&ex_engineer='$exngg'"; $area_name = $exngg; $zone_list = 'false'; $sengg_list = 'false'; $exngg_list = 'true'; $electry_list = 'false'; } if ($electry) { $cnd .= " AND electrycity_zone='$electry'"; $url .= "&electrycity_zone='$electry'"; $area_name = $electry; $zone_list = 'false'; $sengg_list = 'false'; $exngg_list = 'false'; $electry_list = 'true'; } // echo $cnd; $cnd = ' 1'; // if ($list_type == 'dl') { // $limit_rows = ' LIMIT 200'; // } else { // $limit_rows = ' '; // } $order_by = 'ORDER BY accepted_date desc,electrycity_zone asc,employee.work_type asc,reg_date1 desc' . $limit_rows; // $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name FROM `employee` INNER JOIN `sub_admin` ON `employee`.`approve_by_admin_id`=`sub_admin`.`id` ORDER BY zone asc,electrycity_zone asc,work_type asc,reg_date1 desc"; // $sq3 = "SELECT * FROM `employee` WHERE $cnd AND company_id='$company_id' ORDER BY zone asc,electrycity_zone asc,work_type asc,reg_date1 desc" . $limit_rows; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,ep_id,ep_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`accepted_by`=`sub_admin`.`id` LEFT JOIN employee_providers ep ON ep.ep_id=employee.recommended_by LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND`employee`.company_id='$company_id' $order_by"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function list_client_all_except() { $sq3 = "SELECT * FROM `employee` WHERE application_status NOT IN ('emergency','old_emergency') ORDER BY zone asc,electrycity_zone asc,work_type asc,reg_date1 desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function list_accepted_client($app_status, $list_type = '') { // echo $app_status; $company_id = $_SESSION['company_id']; $zone = $_SESSION['zone']; $sengg = $_SESSION['s_engineer']; $exngg = $_SESSION['ex_engineer']; $electry = $_SESSION['electry_city']; if ($list_type != 'NO') { $list_type = $_SESSION['list_type']; } $date = date('Y-m-d'); $cnd = ''; $area_name = ''; $url = ''; if ($zone) { if ($zone == 'all') { $cnd .= " 1"; $url .= ""; $area_name = 'All Zones'; $zone_list = 'true'; $sengg_list = 'false'; $exngg_list = 'false'; $electry_list = 'false'; } else { // $cnd .= " AND zone='$zone'"; $cnd .= " zone='$zone'"; $url .= "?zone='$zone'"; $area_name = $zone; $zone_list = 'true'; $sengg_list = 'false'; $exngg_list = 'false'; $electry_list = 'false'; } } else if ($zone == '') { $cnd .= " 1"; $url .= ""; $area_name = 'All Zones'; $zone_list = 'true'; $sengg_list = 'false'; $exngg_list = 'false'; $electry_list = 'false'; } if ($sengg) { $cnd .= " AND s_engineer='$sengg'"; $url .= "s_engineer='$sengg'"; $area_name = $sengg; $zone_list = 'false'; $sengg_list = 'true'; $exngg_list = 'false'; $electry_list = 'false'; } if ($exngg) { $cnd .= " AND ex_engineer='$exngg'"; $url .= "&ex_engineer='$exngg'"; $area_name = $exngg; $zone_list = 'false'; $sengg_list = 'false'; $exngg_list = 'true'; $electry_list = 'false'; } if ($electry) { $cnd .= " AND electrycity_zone='$electry'"; $url .= "&electrycity_zone='$electry'"; $area_name = $electry; $zone_list = 'false'; $sengg_list = 'false'; $exngg_list = 'false'; $electry_list = 'true'; } // echo $cnd; // $cnd = ' 1'; if ($list_type == 'dl') { $limit_rows = ' LIMIT 200'; } else { $limit_rows = ' '; } $order_by = ''; // $order_by='ORDER BY employee.work_type asc ,zone asc'; // $order_by = 'ORDER BY updated_date desc,zone asc,electrycity_zone asc,employee.work_type asc'; if ($app_status == 'accepted') { $order_by = 'ORDER BY accepted_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; // $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name FROM `employee` INNER JOIN `sub_admin` ON `employee`.`approve_by_admin_id`=`sub_admin`.`id` WHERE $cnd AND application_status IN ('$app_status','pro_accepted') $order_by"; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,ep_id,ep_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`accepted_by`=`sub_admin`.`id` LEFT JOIN employee_providers ep ON ep.ep_id=employee.recommended_by LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND`employee`.company_id='$company_id' AND application_status IN ('$app_status') $order_by"; } else if ($app_status == 'unaccepted') { // $order_by = 'ORDER BY reg_date1 desc,electrycity_zone asc,employee.work_type asc'; $order_by = 'ORDER BY reg_date1 desc' . $limit_rows; $sq3 = "SELECT `employee`.*,eo.*,ep_id,ep_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN employee_other_details eo ON eo.emp_id=`employee`.cid LEFT JOIN employee_providers ep ON ep.ep_id=`employee`.recommended_by LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND application_status='$app_status' AND registered_by='self' $order_by"; } else if ($app_status == 'rejected') { $order_by = 'ORDER BY updated_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`updated_by`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND application_status='$app_status' $order_by"; } else if ($app_status == 'waiting') { $order_by = 'ORDER BY updated_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,ep_id,ep_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`approve_by_admin_id`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND application_status='$app_status' $order_by"; } else if ($app_status == 'pro_accepted') { $order_by = 'ORDER BY accepted_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,ep_id,ep_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`accepted_by`=`sub_admin`.`id` LEFT JOIN employee_providers ep ON ep.ep_id=employee.recommended_by LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND application_status='$app_status' $order_by"; } else if ($app_status == 'extra_emp') { $order_by = 'ORDER BY extra_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`approve_by_admin_id`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND application_status='$app_status' $order_by"; } else if ($app_status == 'notice') { $order_by = 'ORDER BY added_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT `terminated_employee`.*,`employee`.*,`sub_admin`.`user_name` as admin_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `terminated_employee` INNER JOIN `employee` ON `employee`.`cid`=`terminated_employee`.`emp_id` LEFT JOIN `sub_admin` ON `employee`.`approve_by_admin_id`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND process_type='$app_status' AND process_status NOT IN ('rejected','approved') AND injury_letter_no='0' $order_by"; } else if ($app_status == 'CATEGOERY') { $order_by = 'ORDER BY added_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT `terminated_employee`.*,`employee`.*,`sub_admin`.`user_name` as admin_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `terminated_employee` INNER JOIN `employee` ON `employee`.`cid`=`terminated_employee`.`emp_id` LEFT JOIN `sub_admin` ON `employee`.`approve_by_admin_id`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND process_type='$app_status' AND process_status NOT IN ('rejected') AND authority_status NOT IN ('approved') $order_by"; } else if ($app_status == 'retired' || $app_status == 'transfer' || $app_status == 'resign' || $app_status == 'discharge' || $app_status == 'absent' || $app_status == 'injury' || $app_status == 'death') { $order_by = 'ORDER BY added_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT `terminated_employee`.*,`employee`.*,`sub_admin`.`user_name` as admin_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `terminated_employee` INNER JOIN `employee` ON `employee`.`cid`=`terminated_employee`.`emp_id` LEFT JOIN `sub_admin` ON `employee`.`approve_by_admin_id`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND process_type='$app_status' AND process_status NOT IN ('rejected','approved') AND application_status IN ('$app_status') $order_by"; } else if ($app_status == 'leave') { $order_by = 'ORDER BY added_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT a.*,te.*,`employee`.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM tbl_leave_apply a LEFT JOIN terminated_employee te ON te.t_id=a.t_id INNER JOIN `employee` ON `employee`.`cid`=te.`emp_id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND process_type='$app_status' AND `process_status` NOT IN ('rejected') AND '$date' BETWEEN leave_start_date AND leave_end_date ORDER BY leave_start_date ASC"; } else if ($app_status == 'emergency') { $order_by = 'ORDER BY accepted_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; $sq3 = "SELECT `employee`.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND application_status='$app_status' $order_by"; } else if ($app_status == 'old_emergency') { $order_by = 'ORDER BY updated_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; // $sq3 = "SELECT * FROM `employee` WHERE $cnd AND company_id='$company_id' AND application_status='$app_status' $order_by"; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`approve_by_admin_id`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND application_status='$app_status' $order_by"; } else if ($app_status == 'office') { $zone_detail = $this->zone_details('6'); $office_zone = $zone_detail['zone_name']; $order_by = 'ORDER BY accepted_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; // $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name FROM `employee` INNER JOIN `sub_admin` ON `employee`.`accepted_by`=`sub_admin`.`id` WHERE $cnd AND company_id='$company_id' AND electrycity_zone='GLOBE OFFICE' $order_by"; // $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name FROM `employee` INNER JOIN `sub_admin` ON `employee`.`accepted_by`=`sub_admin`.`id` WHERE $cnd AND company_id='$company_id' AND electrycity_zone='GLOBE OFFICE' AND application_status IN ('accepted','pro_accepted') $order_by"; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`accepted_by`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND zone='$office_zone' AND application_status IN ('accepted','pro_accepted') $order_by"; } else if ($app_status == 'req_doc') { $order_by = 'GROUP BY cid ORDER BY db_time DESC' . $limit_rows; // $sq3 = "SELECT * FROM required_document WHERE emp_id='" . $cid . "' AND checkbox='yes' AND DATE(end_date)>='" . $todayDate . "'"; $sq3 = "SELECT cid,customer_name,phone,electrycity_zone,work_type,skilled,emp_joining_date,created_by,created_at,end_date,upload_date as db_time,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM required_document INNER JOIN employee on employee.cid=required_document.emp_id LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE checkbox='yes' AND cur_doc IS NOT NULL AND org_id='$company_id' AND approved_status='no' AND DATE_FORMAT(required_document.`created_at`,'%Y-%m') > '2024-09' $order_by"; } else { // $app_status == 'retired' || $app_status == 'termination' || $app_status == 'discharge' || $app_status == 'death' || $app_status == 'injury' $order_by = 'ORDER BY updated_date desc,electrycity_zone asc,employee.work_type asc' . $limit_rows; // $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name FROM `employee` INNER JOIN `sub_admin` ON `employee`.`updated_by`=`sub_admin`.`id` WHERE $cnd AND company_id='$company_id' AND application_status='$app_status' $order_by"; $sq3 = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN `sub_admin` ON `employee`.`updated_by`=`sub_admin`.`id` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE $cnd AND `employee`.company_id='$company_id' AND application_status='$app_status' $order_by"; } // echo $sq3; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function list_addbymobile_client($app_status) { $order_by = ''; if ($app_status == 'accepted') { // $order_by='ORDER BY work_type asc ,zone asc'; $order_by = 'ORDER BY zone asc,electrycity_zone asc,e.work_type asc'; $sq3 = "SELECT * FROM `employee` LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE application_status IN ('$app_status','pro_accepted') $order_by"; } else if ($app_status == 'mobile' || $app_status == 'bymobile') { $order_by = 'ORDER BY reg_date1 desc,electrycity_zone asc,e.work_type asc'; // $sq3 = "SELECT * FROM `employee` WHERE registered_by='admin' $order_by"; $sq3 = "SELECT * FROM `employee` e LEFT JOIN employee_other_details eo ON eo.emp_id=e.cid LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE application_status='unaccepted' AND registered_by='admin' $order_by"; } $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function list_deleted_client($app_status) { $company_id = $_SESSION['company_id']; // $sq3 = "SELECT `employee_deleted`.*,`sub_admin`.`user_name` as admin_name FROM `employee_deleted` INNER JOIN `sub_admin` ON `employee_deleted`.`approve_by_admin_id`=`sub_admin`.`id` ORDER BY deleted_date desc,zone asc,electrycity_zone asc,work_type asc"; // $sq3 = "SELECT e.*,posts.*,categoery.*,e.deleted_date as deleted_date FROM `employee_deleted` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE e.company_id='$company_id' ORDER BY e.deleted_date desc,zone asc,electrycity_zone asc,e.work_type asc"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi,e.deleted_date as deleted_date FROM `employee_deleted` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE e.company_id='$company_id' ORDER BY e.deleted_date desc,zone asc,electrycity_zone asc,e.work_type asc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function list_deleted_bill($app_status) { $company_id = $_SESSION['company_id']; $sq3 = "SELECT * FROM `billing_table_deleted` WHERE bill_company_id='$company_id' ORDER BY deleted_date desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function list_client_substationwise($station) { $sq3 = "SELECT * FROM `employee` WHERE electrycity_zone='$station' ORDER BY zone asc,electrycity_zone asc,work_type asc"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function view_specific_employee($cid) { // $sq3 = "SELECT * FROM `employee` WHERE cid='$cid'"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,skilled desc"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc, work_type asc, FIELD(skilled,'Skilled','Semi Skilled','Non Skilled'), FIELD(application_status, 'accepted', 'pro_accepted', 'rejected', 'waiting', 'unaccepted')"; // $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,`employee`.`updated_by` as admin_id,sub_admin.*,electrycity_zone.*,executive_engineer.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,skilled desc"; $sq3 = "SELECT DISTINCT(cid) as dist_cid,e.*,e.`updated_by` as admin_id,sub_admin.*,electrycity_zone.*,executive_engineer.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`updated_by` LEFT JOIN electrycity_zone ON e.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function view_terminated_table_employee($cid, $t_id) { // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc, work_type asc, FIELD(skilled,'Skilled','Semi Skilled','Non Skilled'), FIELD(application_status, 'accepted', 'pro_accepted', 'rejected', 'waiting', 'unaccepted')"; // $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,sub_admin.*,electrycity_zone.*,executive_engineer.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,skilled desc"; // $sq3 = "SELECT * FROM `employee` INNER JOIN terminated_employee ON terminated_employee.emp_id=employee.`cid` LEFT JOIN sub_admin ON sub_admin.id=terminated_employee.`added_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) AND t_id='$t_id' ORDER BY electrycity_zone asc,skilled desc"; $sq3 = "SELECT e.*,t.*,sub_admin.*,ez.*,ex.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e INNER JOIN terminated_employee t ON t.emp_id=e.`cid` LEFT JOIN sub_admin ON sub_admin.id=t.`added_by` LEFT JOIN electrycity_zone ez ON e.electrycity_zone = ez.electrycity_zone_name LEFT JOIN executive_engineer ex ON ex.ex_id=ez.ex_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) AND t_id='$t_id' ORDER BY electrycity_zone asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function view_retired_employee($cid) { // $sq3 = "SELECT * FROM `employee` WHERE cid='$cid'"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,skilled desc"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc, work_type asc, FIELD(skilled,'Skilled','Semi Skilled','Non Skilled'), FIELD(application_status, 'accepted', 'pro_accepted', 'rejected', 'waiting', 'unaccepted')"; $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,sub_admin.*,electrycity_zone.*,executive_engineer.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`updated_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function employee_details_monthwise_by_imported_emp_cid($cid, $month, $year) { // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid)"; // $sq3 = "SELECT * FROM `employee_acc_wages` WHERE `imported_emp_cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected') AND exit_status!='yes' ORDER BY wages_id DESC"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee_acc_wages` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `imported_emp_cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected') AND exit_status!='yes' ORDER BY wages_id DESC"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function employee_details_monthwise($cid, $month, $year) { // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid)"; // $sq3 = "SELECT * FROM `employee_acc_wages` WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected') ORDER BY wages_id DESC"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee_acc_wages` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected') ORDER BY wages_id DESC"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function employee_details_monthwise_substationwise($cid, $month, $year, $edd_name, $substation_name) { // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid)"; // $sq3 = "SELECT * FROM `employee_acc_wages` WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected') ORDER BY wages_id DESC"; // $sq3 = "SELECT * FROM `employee_acc_wages` WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND `ex_engineer`='$edd_name' AND electrycity_zone='$substation_name' AND list_status NOT IN ('rejected') ORDER BY wages_id DESC"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee_acc_wages` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND `ex_engineer`='$edd_name' AND electrycity_zone='$substation_name' AND list_status NOT IN ('rejected') ORDER BY wages_id DESC"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function employee_details_monthwise_all($cid, $month, $year) { // $sq3 = "SELECT * FROM `employee_acc_wages` WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected') ORDER BY wages_id DESC"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee_acc_wages` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected') ORDER BY wages_id DESC"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function employee_details($cid) { // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid)"; $sq3 = "SELECT * FROM `employee` WHERE `cid` IN ($cid)"; // $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid)"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function get_employee_details($cid) { $sql = "SELECT * FROM `employee` WHERE `cid` IN ($cid)"; // $sql = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid)"; $qu1 = mysqli_query($this->conn, $sql); $res = mysqli_fetch_assoc($qu1); return $res; } public function view_employee_by_emp_no($emp_no) { // $sql = "SELECT * FROM `employee` WHERE (`emp_no` !='' AND `emp_no` IN ('$emp_no')) OR (`approved_emp_no` !='' AND `approved_emp_no` IN ('$emp_no'))"; $sql = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE (`emp_no` !='' AND `emp_no` IN ('$emp_no')) OR (`approved_emp_no` !='' AND `approved_emp_no` IN ('$emp_no'))"; $qu1 = mysqli_query($this->conn, $sql); $res = mysqli_fetch_assoc($qu1); return $res; } public function view_employee_monthwise($cid, $month, $year) { // $sq3 = "SELECT * FROM `employee_acc_wages` LEFT JOIN sub_admin ON sub_admin.id=employee_acc_wages.`accepted_by` LEFT JOIN electrycity_zone ON employee_acc_wages.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected')"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi, ez.*,sub_admin.* FROM `employee_acc_wages` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ez ON e.electrycity_zone = ez.electrycity_zone_name WHERE `cid`='$cid' AND wages_month='$month' AND wages_year='$year' AND list_status NOT IN ('rejected')"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function view_specific_employee_list($cid) { // $sq3 = "SELECT * FROM `employee` WHERE cid='$cid'"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,skilled desc"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc, work_type asc, FIELD(skilled,'Skilled','Semi Skilled','Non Skilled'), FIELD(application_status, 'accepted', 'pro_accepted', 'rejected', 'waiting', 'unaccepted')"; // $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,sub_admin.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id WHERE `cid` IN ($cid) ORDER BY ex_engineer ASC,electrycity_zone asc,work_type asc,skilled desc"; $sq3 = "SELECT DISTINCT(cid) as dist_cid,e.*,sub_admin.*,ez.*,ex.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ez ON e.electrycity_zone = ez.electrycity_zone_name LEFT JOIN executive_engineer ex ON ex.ex_id=ez.ex_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function view_specific_employee_after_edit($cid) { // $sq3 = "SELECT * FROM `employee` WHERE cid='$cid'"; // $sq3 = "SELECT * FROM `employee_edited` LEFT JOIN sub_admin ON sub_admin.id=employee_edited.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee_edited.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,skilled desc"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi, ez.*,sub_admin.* FROM `employee_edited` e LEFT JOIN sub_admin ON sub_admin.id=e.`approve_by_admin_id` LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled LEFT JOIN electrycity_zone ez ON e.electrycity_zone = ez.electrycity_zone_name WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function view_selected_employee($cid) { // $sq3 = "SELECT * FROM `employee` WHERE cid IN ($cid) AND application_status IN ('accepted','pro_accepted')"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted')"; // $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,sub_admin.*,electrycity_zone.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted') ORDER BY electrycity_zone asc,skilled desc"; $sq3 = "SELECT DISTINCT(cid) as dist_cid,e.*,sub_admin.*,ez.*,ex.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ez ON e.electrycity_zone = ez.electrycity_zone_name LEFT JOIN executive_engineer ex ON ex.ex_id=ez.ex_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } //List all client view_specific_employee_working($cid) public function view_selected_employee_working($cid) { // $sq3 = "SELECT * FROM `employee` WHERE cid IN ($cid) AND application_status IN ('accepted','pro_accepted')"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted')"; // $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,sub_admin.*,electrycity_zone.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,skilled desc"; $sq3 = "SELECT DISTINCT(cid) as dist_cid,e.*,sub_admin.*,ez.*,ex.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ez ON e.electrycity_zone = ez.electrycity_zone_name LEFT JOIN executive_engineer ex ON ex.ex_id=ez.ex_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function view_selected_employee_working_epf_esic($cid) { // $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,sub_admin.*,electrycity_zone.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,skilled desc"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting')"; // $sq3 = "SELECT * FROM `employee` WHERE cid IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting')"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE cid IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting')"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function view_selected_employee_for_bank($cid) { // $sq3 = "SELECT * FROM `employee` WHERE cid IN ($cid) AND application_status IN ('accepted','pro_accepted')"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted')"; // $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,sub_admin.*,electrycity_zone.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,skilled desc"; $sq3 = "SELECT DISTINCT(cid) as dist_cid,e.*,sub_admin.*,ez.*,ex.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ez ON e.electrycity_zone = ez.electrycity_zone_name LEFT JOIN executive_engineer ex ON ex.ex_id=ez.ex_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } //List all client for salary bank details with remitter detAILS public function view_selected_employee_remitter($cid) { // $sq3 = "SELECT * FROM `employee` WHERE cid IN ($cid) AND application_status IN ('accepted','pro_accepted')"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted')"; // $sq3 = "SELECT DISTINCT(cid) as dist_cid,`employee`.*,sub_admin.*,electrycity_zone.*,executive_engineer.* FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name INNER JOIN executive_engineer ON employee.`ex_engineer` = executive_engineer.`ex_name` WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,skilled desc"; $sq3 = "SELECT DISTINCT(cid) as dist_cid,e.*,sub_admin.*,ez.*,ex.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ez ON e.electrycity_zone = ez.electrycity_zone_name LEFT JOIN executive_engineer ex ON ex.ex_id=ez.ex_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) AND application_status IN ('accepted','pro_accepted','rejected','waiting') ORDER BY electrycity_zone asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } //List all employees public function list_selected_employee($cid) { // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid)"; // $sq3 = "SELECT * FROM `employee` WHERE `cid` IN ($cid)"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid)"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } //List all employees public function list_selected_new_employee($cid) { // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`approve_by_admin_id` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `cid` IN ($cid)"; // $sq3 = "SELECT * FROM `employee` WHERE `cid` IN ($cid) ORDER BY reg_date1 desc,electrycity_zone asc,work_type asc"; // $sq3 = "SELECT * FROM `employee` WHERE `cid` IN ($cid) ORDER BY reg_date1 desc"; $sq3 = "SELECT e.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) ORDER BY reg_date1 desc"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } //Update Client Profile public function update_clientdata($val) { $sq3 = "UPDATE register SET pname= '$val[0]', email= '$val[1]', phone= '$val[2]', address= '$val[3]', city= '$val[4]', state= '$val[5]', country= '$val[6]', c_cur= '$val[7]' WHERE customer_id='$val[8]'"; // $sq3 = "UPDATE register SET pname= '$val[0]', email= '$val[1]', phone= '$val[2]', address= '$val[3].$val[4]', city= '$val[5]', state= '$val[6]', country= '$val[7]' WHERE customer_id='$val[8]'"; $qu3 = mysqli_query($this->conn, $sq3); $customer_id = $val[8]; if ($qu3) { $message = '<a href="../profile/company_profile.php?q=' . $_SESSION['cid'] . '"> ' . $_SESSION['type'] . ' #' . $_SESSION['cid'] . ' </a> updated data of <a href="../profile/profile.php?q=' . $customer_id . '"> Client #' . $customer_id . ' </a>'; $log_status = 'activity'; } else { $message = 'Updation IN Client Data Failed by <a href="../profile/company_profile.php?q=' . $_SESSION['cid'] . '"> ' . $_SESSION['type'] . ' #' . $_SESSION['cid'] . ' </a>'; $log_status = 'error'; } $sqlog = "INSERT INTO log (`log_id`, `message`,`log_status`) VALUES('NULL', '$message','$log_status')"; $qulog = mysqli_query($this->conn, $sqlog); return $qu3; } //Reset Password AND Send Email public function reset_sent($id, $cid, $x) { $sq1 = "SELECT * FROM admin_company WHERE company_id = '$cid'"; $qu1 = mysqli_query($this->conn, $sq1); $row1 = mysqli_fetch_assoc($qu1); $gen_by_email = $row1['company_email']; $gen_by_name = $row1['name']; $gen_by_phone = $row1['phone']; $gen_by_logo = $row1['clogo']; $curl = $row1['company_domain']; $gen_by = $cid; $chars = "0123456789qwertyuiopasdfhjllzmnbxvc"; $password = substr(str_shuffle($chars), 0, 10); $passwd = $password; if ($x == 'company') { $sq = "SELECT * FROM admin_company WHERE company_id = '$id'"; $qu = mysqli_query($this->conn, $sq); $row = mysqli_fetch_assoc($qu); $gen_to_email = $row['company_email']; $gen_to_name = $row['name']; $url = 'https://manage.' . $curl; // $gen_by = $id; $sq2 = "UPDATE admin_user SET admin_pass= '$passwd' WHERE company_id='$id'"; } else if ($x == 'client') { $sq = "SELECT * FROM register WHERE customer_id = '$id'"; $qu = mysqli_query($this->conn, $sq); $row = mysqli_fetch_assoc($qu); $gen_to_email = $row['email']; $gen_to_name = $row['pname']; // $gen_by = $id; $sq2 = "UPDATE register SET password= '$passwd' WHERE customer_id='$id'"; $url = 'https://' . $curl; } $qu2 = mysqli_query($this->conn, $sq2); if ($qu2) { $email_send_url = '/assets/send_email.php?genby=' . $gen_by . '&temp_cat=7&genbyemail=' . $gen_by_email . '&genbyname=' . $gen_by_name . '&logo=' . $gen_by_logo . '&gentoname=' . $gen_to_name . '&gentoemail=' . $gen_to_email . '&genbyphone=' . $gen_by_phone . '&passwd=' . $passwd . '&url=' . $url . '&x=' . $x . '&id=' . $id; exec('/usr/bin/wget -O - -q -t 1 "https://' . $_SERVER['HTTP_HOST'] . '/' . addslashes($email_send_url) . '" > /dev/null &' ); if ($x == 'company') { $message = 'Password reset of <a href="../profile/company_profile.php?q=' . $id . '"> Company id #' . $id . ' </a> done successfully.'; } else if ($x == 'client') { $message = 'Password reset of <a href="../profile/profile.php?q=' . $id . '"> Client id #' . $id . ' </a> done successfully.'; } $log_status = 'activity'; $sqlog = "INSERT INTO log (`log_id`, `message`,`log_status`) VALUES('NULL', '$message','$log_status')"; $qulog = mysqli_query($this->conn, $sqlog); return 1; } } //Get Company Details public function profile_info($id) { $sq3 = "SELECT * FROM admin_company WHERE company_id='$id'"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } //Get 5 Recent Customers public function list_cust($id) { $sql3 = "SELECT * FROM register WHERE company_id='$id' ORDER BY customer_id desc LIMIT 5"; $qul3 = mysqli_query($this->conn, $sql3); return $qul3; } //Delete Company User public function user_delete($id) { $sq = "DELETE FROM admin_user WHERE user_id='$id'"; $qu = mysqli_query($this->conn, $sq); $_SESSION['msg_iteration'] = 0; if ($qu) { $_SESSION['msg'] = 'User Deleted Successfully.'; $message = '<a href="../profile/company_profile.php?q=' . $_SESSION['cid'] . '"> ' . $_SESSION['type'] . ' #' . $_SESSION['cid'] . ' </a> has Deleted User #' . $id . ' Sucessfully.'; $log_status = 'activity'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; $message = 'User Deletion Failed by <a href="../profile/company_profile.php?q=' . $_SESSION['cid'] . '"> ' . $_SESSION['type'] . ' #' . $_SESSION['cid'] . ' </a>'; $log_status = 'error'; } $sqlog = "INSERT INTO log (`log_id`, `message`,`log_status`) VALUES('NULL', '$message','$log_status')"; $qulog = mysqli_query($this->conn, $sqlog); header('location:staff_mgmt.php'); } //Get New Customers as per Company Id public function get_new_customers() { $sq = "SELECT * FROM `employee` ORDER BY cid desc LIMIT 5"; $qu1 = mysqli_query($this->conn, $sq); return $qu1; } // Get Company Profile as per domain name function company_profile($url) { $sq = "SELECT * FROM admin_company INNER JOIN plan_table ON admin_company.company_id= plan_table.company_id WHERE company_domain='$url'"; $qu = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($qu); return $row; } //Save Email Template Changes public function save_template($cid, $temp_id, $category_id) { $temp_code = $_POST['sourceCode']; $temp_code1 = preg_replace('!\s+!', ' ', $temp_code); $temp_code1 = str_replace("'", "\'", $temp_code1); $sq = "SELECT * FROM `email_template` WHERE `company_id`='$cid' AND `category_id`='$category_id'"; $qu = mysqli_query($this->conn, $sq); if (mysqli_num_rows($qu) > 0) { $sq3 = "UPDATE `email_template` SET `template_code`= '$temp_code1' WHERE `template_id`= '$temp_id' AND `company_id`='$cid'"; $qu3 = mysqli_query($this->conn, $sq3); } else { $sq3 = "INSERT INTO `email_template`(`template_id`, `template_code`, `category_id`, `company_id`) VALUES ('NULL','$temp_code1','$category_id','$cid')"; $qu3 = mysqli_query($this->conn, $sq3); $temp_id = mysqli_insert_id($this->conn); } header('location:viewemail.php?q=' . $temp_id); } //Get template Code as per Argument public function get_template_code($cid, $category_id) { $sq3 = "SELECT * FROM `email_template` WHERE company_id in( 1,$cid) AND category_id = '$category_id' ORDER BY `company_id` desc"; $qu3 = mysqli_query($this->conn, $sq3); $qu = mysqli_fetch_assoc($qu3); return $qu; } //Send Due Invoice Reminder FROM cron function reminder_email($duration) { $customer_info = $this->select_due_invioces($duration, 'false'); foreach ($customer_info as $customer_val) { $customer_id = $customer_val['customer_id']; $pid = $customer_val['planid']; $domain = $customer_val['domain']; $product_id = $customer_val['product_id']; $company_id = $customer_val['company_id']; $invoice_no = $customer_val['invoice_no']; $gen_date = $customer_val['gen_date']; $due_date = $customer_val['due_date']; $pname = $customer_val['pname']; $email = $customer_val['email']; $total = $customer_val['total_due']; $company_info = $this->company_details($company_id); $cemail = $company_info['company_email']; $logo = $company_info['clogo']; $cphone = $company_info['phone']; $cname = $company_info['name']; $cdname = $company_info['company_domain']; $rcur = $company_info['cur']; $url = 'https://' . $cdname . '/account/viewinvoice.php?q=' . $invoice_no; $email_send_url = '/assets/send_email.php?cuid=' . $company_id . '&temp_cat=12&email=' . $email . '&pname=' . $pname . '&logo=' . $logo . '&cname=' . $cname . '&cemail=' . $cemail . '&cphone=' . $cphone . '&url=' . $url . '&iid=' . $customer_id . '&invoice_no=' . $invoice_no . '&gen_date=' . $gen_date . '&due_date=' . $due_date . '&cur=' . $rcur . '&total=' . $total; exec('/usr/bin/wget -O - -q -t 1 "https://' . $_SERVER['HTTP_HOST'] . '/' . addslashes($email_send_url) . '" > /dev/null &' ); $upq = "UPDATE `cron_activity` SET `overdue_reminder`=`overdue_reminder`+1 "; $upqu = mysqli_query($this->conn, $upq); } } // day count within dates public function dayCount($from, $to) { $first_date = strtotime($from); $second_date = strtotime($to); $offset = $second_date - $first_date; return floor($offset / 60 / 60 / 24); } // Send Support Email FROM Cron function reminder_support_email($duration) { $customer_info = $this->select_customers_for_supportemail($duration); foreach ($customer_info as $customer_val) { $customer_id = $customer_val['customer_id']; $company_id = $customer_val['company_id']; $pname = $customer_val['pname']; $email = $customer_val['email']; $company_info = $this->company_details($company_id); $cemail = $company_info['company_email']; $logo = $company_info['clogo']; $cphone = $company_info['phone']; $cname = $company_info['name']; $cdname = $company_info['company_domain']; $url = 'https://' . $cdname . '/account'; $email_send_url = 'assets/send_email.php?cuid=' . $company_id . '&temp_cat=14&email=' . $email . '&pname=' . $pname . '&logo=' . $logo . '&cname=' . $cname . '&cemail=' . $cemail . '&cphone=' . $cphone . '&url=' . $url . '&iid=' . $customer_id; exec('/usr/bin/wget -O - -q -t 1 "https://' . $_SERVER['HTTP_HOST'] . '/' . addslashes($email_send_url) . '" > /dev/null &' ); } } /* * Returns rows FROM the database based ON the conditions * @param string name of the table * @param array SELECT, where, order_by, limit AND return_type conditions */ public function checkRow($conditions = array()) { $sql = 'SELECT * FROM mobile_numbers'; if (!empty($conditions) && is_array($conditions)) { $sql .= ' WHERE '; $i = 0; foreach ($conditions as $key => $value) { $pre = ($i > 0) ? ' AND ' : ''; $sql .= $pre . $key . " = '" . $value . "'"; $i++; } } $result = mysqli_query($this->conn, $sql); // $result = $this->db->query($sql); // return !empty($result->num_rows > 0)?true:false; return !empty(mysqli_num_rows($result) > 0) ? true : false; } /* * Insert data into the database * @param string name of the table * @param array the data for inserting into the table */ public function insert1($data) { if (!empty($data) && is_array($data)) { $columns = ''; $values = ''; $i = 0; foreach ($data as $key => $val) { $pre = ($i > 0) ? ', ' : ''; $columns .= $pre . $key; $values .= $pre . "'" . $val . "'"; $i++; } $query = "INSERT INTO mobile_numbers (" . $columns . ") VALUES (" . $values . ")"; $insert = mysqli_query($this->conn, $query); return $insert ? mysqli_insert_id($this->conn) : false; // $query = "INSERT INTO ".$this->tblName." (".$columns.") VALUES (".$values.")"; // $insert = $this->db->query($query); // return $insert?$this->db->insert_id:false; } else { return false; } } /* * Update data into the database * @param string name of the table * @param array the data for updating into the table * @param array WHERE condition ON updating data */ public function update($data, $conditions) { if (!empty($data) && is_array($data)) { $colvalSet = ''; $whereSql = ''; $i = 0; foreach ($data as $key => $val) { $pre = ($i > 0) ? ', ' : ''; $colvalSet .= $pre . $key . "='" . $val . "'"; $i++; } if (!empty($conditions) && is_array($conditions)) { $whereSql .= ' WHERE '; $i = 0; foreach ($conditions as $key => $value) { $pre = ($i > 0) ? ' AND ' : ''; $whereSql .= $pre . $key . " = '" . $value . "'"; $i++; } } $query = "UPDATE mobile_numbers SET " . $colvalSet . $whereSql; $update = mysqli_query($this->conn, $query); return $update ? $this->db->affected_rows : false; } else { return false; } } public function redirect_add_employee() { if (isset($_POST['fill_form'])) { $_SESSION['zone'] = $_POST['zone']; $_SESSION['s_engineer'] = $_POST['s_engineer']; $_SESSION['ex_engineer'] = $_POST['ex_engineer']; $_SESSION['electry_city'] = $_POST['electry_city']; echo "<script>location.href='forms/add_customer.php';</script>"; } } public function add_electricity_house_old() { // $zone = $_POST['zone']; // $s_engineer = $_POST['s_engineer']; $ex_engineer = $_POST['ex_engineer']; $electrycity_house = $_POST['electrycity_house']; $h_electrycity_house = $_POST['h_electrycity_house']; $kv_email = $_POST['kv_email']; // $prefix = $fruitList = ''; // foreach ($ex_engineer as $location) { // $locations .= $prefix . '"' . $location . '"'; // $prefix = ', '; // } // // echo $sq = "SELECT * FROM `executive_engineer` WHERE `ex_id` IN (SELECT ex_id FROM executive_engineer WHERE ex_name IN ($locations))"; // echo $sq = "SELECT * FROM `executive_engineer` WHERE `ex_id` IN (SELECT ex_id FROM executive_engineer WHERE ex_name='$ex_engineer')"; // $ex_res = mysqli_query($this->conn, $sq); // $result = mysqli_fetch_assoc($ex_res); $result = $this->list_executive_engineer_id($ex_engineer); if ($result) { // mysql_query('INSERT INTO `electrycity_zone`(`ez_id`, `ex_id`, `electrycity_zone_name`, `kv_email`, `h_electrycity_zone_name`) VALUES ' . implode(',', $sql)); $sql_prefix = $sql_values = ""; foreach ($result as $value) { $ex_id = $value['ex_id']; $sql_values .= $sql_prefix . "(NULL,'$ex_id','$electrycity_house','$kv_email','$h_electrycity_house')"; $sql_prefix = ', '; } $sql_values = rtrim($sql_values, ','); // foreach ($result as $row) { //// $ex_id = $row['ex_id']; // $sql_array[] = "(NULL,'".$row['ex_id']."','$electrycity_house','$kv_email','$h_electrycity_house')"; // } //echo $sq1 = 'INSERT INTO `electrycity_zone`(`ez_id`, `ex_id`, `electrycity_zone_name`, `kv_email`, `h_electrycity_zone_name`) VALUES ' . implode(',', $sql_array); $sq1 = "INSERT INTO `electrycity_zone`(`ez_id`, `ex_id`, `electrycity_zone_name`, `kv_email`, `h_electrycity_zone_name`) VALUES $sql_values"; // $sq1 = "INSERT INTO `electrycity_zone`(`ez_id`, `ex_id`, `electrycity_zone_name`, `kv_email`, `h_electrycity_zone_name`) VALUES (NULL,'$ex_id','$electrycity_house','$kv_email','$h_electrycity_house')"; // $qu = mysqli_query($this->conn, $sq1); if ($qu) { $_SESSION['msg'] = 'Electric Sub Center added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } public function add_electricity_house() { // $zone = $_POST['zone']; // $s_engineer = $_POST['s_engineer']; $ex_id = $_POST['ex_engineer']; $edsd_id = $_POST['edsd_engineer']; $electrycity_house = $_POST['electrycity_house']; $h_electrycity_house = $_POST['h_electrycity_house']; $kv_email = $_POST['kv_email']; $contact_officer_substation = $_POST['contact_officer_substation']; $contact_no_substation1 = $_POST['contact_no_substation1']; $contact_no_substation2 = $_POST['contact_no_substation2']; $contact_email_substation = $_POST['contact_email_substation']; $substation_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $substation_postal_address_1 = $_POST['substation_postal_address_1']; $substation_postal_address_2 = $_POST['substation_postal_address_2']; $substation_postal_address_3 = $_POST['substation_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_substation_hindi = $_POST['contact_officer_substation_hindi']; $contact_officer_designation = $_POST['contact_officer_designation']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi']; $ez_note_heading = $_POST['ez_note_heading']; $ez_note_1 = $_POST['ez_note_1']; $ez_note_2 = $_POST['ez_note_2']; $ez_note_heading_hindi = $_POST['ez_note_heading_hindi']; $ez_note_1_hindi = $_POST['ez_note_1_hindi']; $ez_note_2_hindi = $_POST['ez_note_2_hindi']; // $sq = "SELECT * FROM `executive_engineer` WHERE `ex_id`='$ex_id'"; // $ex_res = mysqli_query($this->conn, $sq); // $result = mysqli_fetch_assoc($ex_res); // if ($result) { // $ex_id = $result['ex_id']; $sq = "INSERT INTO `electrycity_zone`(`ez_id`, `ex_id`, `edsd_id`, `electrycity_zone_name`, `kv_email`, `h_electrycity_zone_name`, `contact_officer_substation`, `contact_no_substation1`, `contact_no_substation2`, `contact_email_substation`, `substation_added_by`, `substation_added_name`, `substation_added_date`, `electry_pincode`, `electry_post`, `electry_district`, `electry_state`, `electry_mohalla`, `electry_village`, `electry_block`, `electry_tahsil`, `electry_thana`, `substation_postal_address_1`, `substation_postal_address_2`, `substation_postal_address_3`, `print_applicable_1`, `print_applicable_2`, `print_applicable_3`, `print_language`, `print_designation_1`, `print_designation_2`, `print_designation_3`, `print_designation_hindi_1`, `print_designation_hindi_2`, `print_designation_hindi_3`, `print_heading_1`, `print_heading_2`, `print_heading_3`, `print_heading_hindi_1`, `print_heading_hindi_2`, `print_heading_hindi_3`, `contact_officer_substation_hindi`, `contact_officer_designation`, `contact_officer_designation_hindi`, `ez_note_heading`, `ez_note_1`, `ez_note_2`, `ez_note_heading_hindi`, `ez_note_1_hindi`, `ez_note_2_hindi`) VALUES (NULL,'$ex_id','$edsd_id','$electrycity_house','$kv_email','$h_electrycity_house','$contact_officer_substation','$contact_no_substation1','$contact_no_substation2','$contact_email_substation','$admin_cid','$admin_name','$substation_added_date', '$pincode', '$post', '$district', '$state', '$mohalla', '$village', '$block', '$tahsil', '$thana', '$substation_postal_address_1', '$substation_postal_address_2', '$substation_postal_address_3', '$print_applicable_1', '$print_applicable_2', '$print_applicable_3', '$print_language', '$print_designation_1', '$print_designation_2', '$print_designation_3', '$print_designation_hindi_1', '$print_designation_hindi_2', '$print_designation_hindi_3', '$print_heading_1', '$print_heading_2', '$print_heading_3', '$print_heading_hindi_1', '$print_heading_hindi_2', '$print_heading_hindi_3', '$contact_officer_substation_hindi', '$contact_officer_designation', '$contact_officer_designation_hindi', '$ez_note_heading', '$ez_note_1', '$ez_note_2', '$ez_note_heading_hindi', '$ez_note_1_hindi', '$ez_note_2_hindi')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Electric Sub Center added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // } else { // $_SESSION['err_msg'] = 'Something Went Wrong!'; // } echo '<meta http-equiv="refresh" content="0">'; } public function add_electricity_house_multi() { // $zone = $_POST['zone']; // $s_engineer = $_POST['s_engineer']; $ex_engineer = $_POST['ex_engineer']; $electrycity_house = $_POST['electrycity_house']; $h_electrycity_house = $_POST['h_electrycity_house']; $kv_email = $_POST['kv_email']; $result = $this->list_executive_engineer_id($ex_engineer); if ($result) { $sql_prefix = $sql_values = ""; foreach ($result as $value) { $ex_id = $value['ex_id']; $sql_values .= $sql_prefix . "(NULL,'$ex_id','$electrycity_house','$kv_email','$h_electrycity_house')"; $sql_prefix = ', '; } $sql_values = rtrim($sql_values, ','); // foreach ($result as $row) { //// $ex_id = $row['ex_id']; // $sql_array[] = "(NULL,'".$row['ex_id']."','$electrycity_house','$kv_email','$h_electrycity_house')"; // } //echo $sq1 = 'INSERT INTO `electrycity_zone`(`ez_id`, `ex_id`, `electrycity_zone_name`, `kv_email`, `h_electrycity_zone_name`) VALUES ' . implode(',', $sql_array); $sq1 = "INSERT INTO `electrycity_zone`(`ez_id`, `ex_id`, `electrycity_zone_name`, `kv_email`, `h_electrycity_zone_name`) VALUES $sql_values"; $qu = mysqli_query($this->conn, $sq1); if ($qu) { $_SESSION['msg'] = 'Electric Sub Center added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } public function add_dispensary() { $dispensary_name = $_POST['dispensary']; $dispensary_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $sq = "INSERT INTO `dispensary`(`d_id`, `dispensary_name`, `company_id`, `dispensary_added_by`, `dispensary_added_name`, `dispensary_added_date`) VALUES (NULL, '$dispensary_name', '$company_id', '$admin_cid', '$admin_name', '$dispensary_added_date')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New Dispensary added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } public function add_discom() { $discom_name = $_POST['discom']; $helpline_no = $_POST['helpline_no']; $discom_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $discom_name_hindi = $_POST['discom_name_hindi']; $discom_postal_address_1 = $_POST['discom_postal_address_1']; $discom_postal_address_2 = $_POST['discom_postal_address_2']; $discom_postal_address_3 = $_POST['discom_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_no_discom = $_POST['contact_no_discom']; $contact_email_discom = $_POST['contact_email_discom']; $contact_officer_discom = $_POST['contact_officer_discom']; $contact_officer_discom_hindi = $_POST['contact_officer_discom_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_discom']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_discom']; $sq = "INSERT INTO `discom`(`d_id`, `discom_name`, `helpline_no`, `company_id`, `discom_added_by`, `discom_added_name`, `discom_added_date`, `discom_name_hindi`, `discom_postal_address_1`, `discom_postal_address_2`, `discom_postal_address_3`, `print_applicable_1_discom`, `print_applicable_2_discom`, `print_applicable_3_discom`, `print_language_discom`, `print_designation_1_discom`, `print_designation_2_discom`, `print_designation_3_discom`, `print_designation_hindi_1_discom`, `print_designation_hindi_2_discom`, `print_designation_hindi_3_discom`, `print_heading_1_discom`, `print_heading_2_discom`, `print_heading_3_discom`, `print_heading_hindi_1_discom`, `print_heading_hindi_2_discom`, `print_heading_hindi_3_discom`, `contact_no_discom`, `contact_email_discom`, `contact_officer_discom`, `contact_officer_discom_hindi`, `contact_officer_designation_discom`, `contact_officer_designation_hindi_discom`) VALUES (NULL, '$discom_name', '$helpline_no', '$company_id', '$admin_cid', '$admin_name', '$discom_added_date', '$discom_name_hindi', '$discom_postal_address_1', '$discom_postal_address_2', '$discom_postal_address_3', '$print_applicable_1', '$print_applicable_2', '$print_applicable_3', '$print_language', '$print_designation_1', '$print_designation_2', '$print_designation_3', '$print_designation_hindi_1', '$print_designation_hindi_2', '$print_designation_hindi_3', '$print_heading_1', '$print_heading_2', '$print_heading_3', '$print_heading_hindi_1', '$print_heading_hindi_2', '$print_heading_hindi_3', '$contact_no_discom', '$contact_email_discom', '$contact_officer_discom', '$contact_officer_discom_hindi', '$contact_officer_designation', '$contact_officer_designation_hindi')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New Discom added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong! ' . mysqli_error($this->conn); } echo '<meta http-equiv="refresh" content="0">'; } public function add_zone() { $discom_id = $_POST['discom']; $zone_name = $_POST['zone']; $contact_officer_zone = $_POST['contact_officer_zone']; $contact_no_zone = $_POST['contact_no_zone']; $contact_email_zone = $_POST['contact_email_zone']; $zone_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $zone_name_hindi = $_POST['zone_name_hindi']; $zone_postal_address_1 = $_POST['zone_postal_address_1']; $zone_postal_address_2 = $_POST['zone_postal_address_2']; $zone_postal_address_3 = $_POST['zone_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_zone_hindi = $_POST['contact_officer_zone_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_zone']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_zone']; // $sq = "INSERT INTO `zone`(`zone_id`, `zone_name`, `company_id`, `contact_officer_zone`, `contact_no_zone`, `contact_email_zone`, `zone_added_by`, `zone_added_date`) VALUES (NULL,'$zone_name','$company_id','$contact_officer_zone','$contact_no_zone','$contact_email_zone','$admin_cid','$zone_added_date')"; $sq = "INSERT INTO `zone`(`zone_id`, `discom_id`, `zone_name`, `company_id`, `contact_officer_zone`, `contact_no_zone`, `contact_email_zone`, `zone_added_by`, `zone_added_name`, `zone_added_date`, `zone_pincode`, `zone_post`, `zone_district`, `zone_state`, `zone_mohalla`, `zone_village`, `zone_block`, `zone_tahsil`, `zone_thana`, `zone_name_hindi`, `zone_postal_address_1`, `zone_postal_address_2`, `zone_postal_address_3`, `print_applicable_1_zone`, `print_applicable_2_zone`, `print_applicable_3_zone`, `print_language_zone`, `print_designation_1_zone`, `print_designation_2_zone`, `print_designation_3_zone`, `print_designation_hindi_1_zone`, `print_designation_hindi_2_zone`, `print_designation_hindi_3_zone`, `print_heading_1_zone`, `print_heading_2_zone`, `print_heading_3_zone`, `print_heading_hindi_1_zone`, `print_heading_hindi_2_zone`, `print_heading_hindi_3_zone`, `contact_officer_zone_hindi`, `contact_officer_designation_zone`, `contact_officer_designation_hindi_zone`) VALUES (NULL,'$discom_id','$zone_name','$company_id','$contact_officer_zone','$contact_no_zone','$contact_email_zone','$admin_cid','$admin_name','$zone_added_date', '$pincode', '$post', '$district', '$state', '$mohalla', '$village', '$block', '$tahsil', '$thana', '$zone_name_hindi', '$zone_postal_address_1', '$zone_postal_address_2', '$zone_postal_address_3', '$print_applicable_1', '$print_applicable_2', '$print_applicable_3', '$print_language', '$print_designation_1', '$print_designation_2', '$print_designation_3', '$print_designation_hindi_1', '$print_designation_hindi_2', '$print_designation_hindi_3', '$print_heading_1', '$print_heading_2', '$print_heading_3', '$print_heading_hindi_1', '$print_heading_hindi_2', '$print_heading_hindi_3', '$contact_officer_zone_hindi', '$contact_officer_designation', '$contact_officer_designation_hindi')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New Zone added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } echo '<meta http-equiv="refresh" content="0">'; } public function add_super_engg() { $zone_id = $_POST['zone']; $super_name = $_POST['super_engg']; $contact_officer_super = $_POST['contact_officer_super']; $contact_no_super = $_POST['contact_no_super']; $contact_email_super = $_POST['contact_email_super']; $super_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $super_name_hindi = $_POST['super_name_hindi']; $super_postal_address_1 = $_POST['super_postal_address_1']; $super_postal_address_2 = $_POST['super_postal_address_2']; $super_postal_address_3 = $_POST['super_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_super_hindi = $_POST['contact_officer_super_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_super']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_super']; // $sq = "INSERT INTO `super_engineer`(`zone_id`, `super_name`, `contact_officer_super`, `contact_no_super`, `contact_email_super`, `super_added_by`, `super_added_date`) VALUES ('$zone_id','$super_name','$contact_officer_super','$contact_no_super','$contact_email_super','$admin_cid','$super_added_date')"; $sq = "INSERT INTO `super_engineer`(`zone_id`, `super_name`, `contact_officer_super`, `contact_no_super`, `contact_email_super`, `super_added_by`, `super_added_date`, `super_pincode`, `super_post`, `super_district`, `super_state`, `super_mohalla`, `super_village`, `super_block`, `super_tahsil`, `super_thana`, `super_name_hindi`, `super_postal_address_1`, `super_postal_address_2`, `super_postal_address_3`, `print_applicable_1_super`, `print_applicable_2_super`, `print_applicable_3_super`, `print_language_super`, `print_designation_1_super`, `print_designation_2_super`, `print_designation_3_super`, `print_designation_hindi_1_super`, `print_designation_hindi_2_super`, `print_designation_hindi_3_super`, `print_heading_1_super`, `print_heading_2_super`, `print_heading_3_super`, `print_heading_hindi_1_super`, `print_heading_hindi_2_super`, `print_heading_hindi_3_super`, `contact_officer_super_hindi`, `contact_officer_designation_super`, `contact_officer_designation_hindi_super`) VALUES ('$zone_id','$super_name','$contact_officer_super','$contact_no_super','$contact_email_super','$admin_cid','$super_added_date', '$pincode', '$post', '$district', '$state', '$mohalla', '$village', '$block', '$tahsil', '$thana', '$super_name_hindi', '$super_postal_address_1', '$super_postal_address_2', '$super_postal_address_3', '$print_applicable_1', '$print_applicable_2', '$print_applicable_3', '$print_language', '$print_designation_1', '$print_designation_2', '$print_designation_3', '$print_designation_hindi_1', '$print_designation_hindi_2', '$print_designation_hindi_3', '$print_heading_1', '$print_heading_2', '$print_heading_3', '$print_heading_hindi_1', '$print_heading_hindi_2', '$print_heading_hindi_3', '$contact_officer_super_hindi', '$contact_officer_designation', '$contact_officer_designation_hindi')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New Superitendent Engineer added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong! ' . mysqli_error($this->conn); } echo '<meta http-equiv="refresh" content="0">'; } public function add_executive_engg() { $super_id = $super_name = $_POST['s_engineer']; $ex_name = $_POST['ex_engg']; $remitt_email_id = $_POST['emailid']; $remitt_ifsc = $_POST['ifsc']; $remitt_bank_name = $_POST['bank_name']; $remitt_bank_branch = $_POST['bank_branch']; $remitt_branch_code = $_POST['branch_code']; $remitt_bank_address = $_POST['bank_address']; $remitt_acc_holder_name = $_POST['accname']; $remitt_acc_no = $_POST['accnumber']; $edd_gst_no = $_POST['edd_gst_no']; $edd_pan_no = $_POST['edd_pan_no']; $edd_code = $_POST['edd_code']; $contact_officer_executive = $_POST['contact_officer_executive']; $contact_no_executive = $_POST['contact_no_executive']; $contact_email_executive = $_POST['contact_email_executive']; $office_address = $_POST['office_address']; $office_contactno = $_POST['office_contactno']; $executive_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $whatsapp_number = $_POST['whatsapp_number']; $whatsapp_api_key = $_POST['whatsapp_api_key']; $ex_name_hindi = $_POST['ex_name_hindi']; $ex_postal_address_1 = $_POST['ex_postal_address_1']; $ex_postal_address_2 = $_POST['ex_postal_address_2']; $ex_postal_address_3 = $_POST['ex_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_executive_hindi = $_POST['contact_officer_executive_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_executive']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_executive']; // $sq = "SELECT * FROM `super_engineer` WHERE `super_id` IN (SELECT super_id FROM super_engineer WHERE super_name='$super_name')"; // $sup_res = mysqli_query($this->conn, $sq); // $result = mysqli_fetch_assoc($sup_res); // if ($result) { // $super_id = $result['super_id']; $sq = "INSERT INTO `executive_engineer`(`super_id`, `ex_name`, `remitt_email_id`, `remitt_ifsc`, `remitt_bank_name`, `remitt_bank_branch`, `remitt_branch_code`, `remitt_bank_address`, `remitt_acc_holder_name`, `remitt_acc_no`, `contact_officer_executive`, `contact_no_executive`, `contact_email_executive`, `executive_added_by`, `executive_added_date`, `office_address`, `office_contactno`, `edd_gst_no`, `edd_pan_no`, `edd_code`, `executive_pincode`, `executive_post`, `executive_district`, `executive_state`, `executive_mohalla`, `executive_village`, `executive_block`, `executive_tahsil`, `executive_thana`, `whatsapp_number`, `whatsapp_api_key`, `ex_name_hindi`, `ex_postal_address_1`, `ex_postal_address_2`, `ex_postal_address_3`, `print_applicable_1_executive`, `print_applicable_2_executive`, `print_applicable_3_executive`, `print_language_executive`, `print_designation_1_executive`, `print_designation_2_executive`, `print_designation_3_executive`, `print_designation_hindi_1_executive`, `print_designation_hindi_2_executive`, `print_designation_hindi_3_executive`, `print_heading_1_executive`, `print_heading_2_executive`, `print_heading_3_executive`, `print_heading_hindi_1_executive`, `print_heading_hindi_2_executive`, `print_heading_hindi_3_executive`, `contact_officer_executive_hindi`, `contact_officer_designation_executive`, `contact_officer_designation_hindi_executive`) VALUES ('$super_id','$ex_name','$remitt_email_id','$remitt_ifsc','$remitt_bank_name','$remitt_bank_branch','$remitt_branch_code','$remitt_bank_address','$remitt_acc_holder_name','$remitt_acc_no','$contact_officer_executive','$contact_no_executive','$contact_email_executive','$admin_cid','$executive_added_date','$office_address','$office_contactno','$edd_gst_no','$edd_pan_no','$edd_code', '$pincode', '$post', '$district', '$state', '$mohalla', '$village', '$block', '$tahsil', '$thana', '$whatsapp_number', '$whatsapp_api_key', '$ex_name_hindi', '$ex_postal_address_1', '$ex_postal_address_2', '$ex_postal_address_3', '$print_applicable_1', '$print_applicable_2', '$print_applicable_3', '$print_language', '$print_designation_1', '$print_designation_2', '$print_designation_3', '$print_designation_hindi_1', '$print_designation_hindi_2', '$print_designation_hindi_3', '$print_heading_1', '$print_heading_2', '$print_heading_3', '$print_heading_hindi_1', '$print_heading_hindi_2', '$print_heading_hindi_3', '$contact_officer_executive_hindi', '$contact_officer_designation', '$contact_officer_designation_hindi')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New Executive Engineer added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong! ' . mysqli_error($this->conn); } // } else { // $_SESSION['err_msg'] = 'Something Went Wrong!'; // } echo '<meta http-equiv="refresh" content="0">'; } public function add_edsd_engg() { // $super_id = $super_name = $_POST['s_engineer']; $ex_id = $ex_name = $_POST['ex_engineer']; $edsd_name = $_POST['edsd_name']; $remitt_email_id = $_POST['emailid']; $remitt_ifsc = $_POST['ifsc']; $remitt_bank_name = $_POST['bank_name']; $remitt_bank_branch = $_POST['bank_branch']; $remitt_branch_code = $_POST['branch_code']; $remitt_bank_address = $_POST['bank_address']; $remitt_acc_holder_name = $_POST['accname']; $remitt_acc_no = $_POST['accnumber']; $edsd_gst_no = $_POST['edsd_gst_no']; $edsd_pan_no = $_POST['edsd_pan_no']; $edsd_code = $_POST['edsd_code']; $contact_officer_edsd = $_POST['contact_officer_edsd']; $contact_no_edsd = $_POST['contact_no_edsd']; $contact_email_edsd = $_POST['contact_email_edsd']; $office_address = $_POST['office_address']; $office_contactno = $_POST['office_contactno']; $edsd_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $whatsapp_number = $_POST['whatsapp_number']; $whatsapp_api_key = $_POST['whatsapp_api_key']; $edsd_name_hindi = $_POST['edsd_name_hindi']; $edsd_postal_address_1 = $_POST['edsd_postal_address_1']; $edsd_postal_address_2 = $_POST['edsd_postal_address_2']; $edsd_postal_address_3 = $_POST['edsd_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_edsd_hindi = $_POST['contact_officer_edsd_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_edsd']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_edsd']; // $sq = "INSERT INTO `edsd_engineer`(`ex_id`, `edsd_name`, `remitt_email_id`, `remitt_ifsc`, `remitt_bank_name`, `remitt_bank_branch`, `remitt_branch_code`, `remitt_bank_address`, `remitt_acc_holder_name`, `remitt_acc_no`, `contact_officer_edsd`, `contact_no_edsd`, `contact_email_edsd`, `edsd_added_by`, `edsd_added_date`, `office_address`, `office_contactno`, `edsd_gst_no`, `edsd_pan_no`, `edsd_code`, `edsd_pincode`, `edsd_post`, `edsd_district`, `edsd_state`, `edsd_mohalla`, `edsd_village`, `edsd_block`, `edsd_tahsil`, `edsd_thana`, `whatsapp_number`, `whatsapp_api_key`) VALUES ('$ex_id','$edsd_name','$remitt_email_id','$remitt_ifsc','$remitt_bank_name','$remitt_bank_branch','$remitt_branch_code','$remitt_bank_address','$remitt_acc_holder_name','$remitt_acc_no','$contact_officer_edsd','$contact_no_edsd','$contact_email_edsd','$admin_cid','$edsd_added_date','$office_address','$office_contactno','$edsd_gst_no','$edsd_pan_no','$edsd_code', '$pincode', '$post', '$district', '$state', '$mohalla', '$village', '$block', '$tahsil', '$thana', '$whatsapp_number', '$whatsapp_api_key')"; $sq = "INSERT INTO `edsd_engineer`(`ex_id`, `edsd_name`, `remitt_email_id`, `remitt_ifsc`, `remitt_bank_name`, `remitt_bank_branch`, `remitt_branch_code`, `remitt_bank_address`, `remitt_acc_holder_name`, `remitt_acc_no`, `contact_officer_edsd`, `contact_no_edsd`, `contact_email_edsd`, `edsd_added_by`, `edsd_added_name`, `edsd_added_date`, `edsd_office_address`, `edsd_office_contactno`, `edsd_gst_no`, `edsd_pan_no`, `edsd_code`, `edsd_pincode`, `edsd_post`, `edsd_district`, `edsd_state`, `edsd_mohalla`, `edsd_village`, `edsd_block`, `edsd_tahsil`, `edsd_thana`, `edsd_whatsapp_number`, `edsd_whatsapp_api_key`, `edsd_name_hindi`, `edsd_postal_address_1`, `edsd_postal_address_2`, `edsd_postal_address_3`, `print_applicable_1_edsd`, `print_applicable_2_edsd`, `print_applicable_3_edsd`, `print_language_edsd`, `print_designation_1_edsd`, `print_designation_2_edsd`, `print_designation_3_edsd`, `print_designation_hindi_1_edsd`, `print_designation_hindi_2_edsd`, `print_designation_hindi_3_edsd`, `print_heading_1_edsd`, `print_heading_2_edsd`, `print_heading_3_edsd`, `print_heading_hindi_1_edsd`, `print_heading_hindi_2_edsd`, `print_heading_hindi_3_edsd`, `contact_officer_edsd_hindi`, `contact_officer_designation_edsd`, `contact_officer_designation_hindi_edsd`) VALUES ('$ex_id','$edsd_name','$remitt_email_id','$remitt_ifsc','$remitt_bank_name','$remitt_bank_branch','$remitt_branch_code','$remitt_bank_address','$remitt_acc_holder_name','$remitt_acc_no','$contact_officer_edsd','$contact_no_edsd','$contact_email_edsd','$admin_cid','$admin_name','$edsd_added_date','$office_address','$office_contactno','$edsd_gst_no','$edsd_pan_no','$edsd_code', '$pincode', '$post', '$district', '$state', '$mohalla', '$village', '$block', '$tahsil', '$thana', '$whatsapp_number', '$whatsapp_api_key', '$edsd_name_hindi','$edsd_postal_address_1', '$edsd_postal_address_2', '$edsd_postal_address_3', '$print_applicable_1', '$print_applicable_2', '$print_applicable_3', '$print_language', '$print_designation_1', '$print_designation_2', '$print_designation_3', '$print_designation_hindi_1', '$print_designation_hindi_2', '$print_designation_hindi_3', '$print_heading_1', '$print_heading_2', '$print_heading_3', '$print_heading_hindi_1', '$print_heading_hindi_2', '$print_heading_hindi_3', '$contact_officer_edsd_hindi', '$contact_officer_designation', '$contact_officer_designation_hindi')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New EDSD Engineer added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } echo '<meta http-equiv="refresh" content="0">'; } public function resend_otp($numbers) { $error = 'no'; $rndno = rand(10000, 99999); // $sender = "GLOBCR"; // This is who the message appears to be from. // $numbers = $_POST["phone"]; //"919120102338"; // A single number or a comma-seperated list of numbers // $message = "Your otp number for Globe India Infrastructure is : " . $rndno; // $message = urlencode($message); // $result = $this->send_msg_textlocal_withhash($numbers, $message, $sender); if ($error == 'yes') { $_SESSION['msg_err'] = 'Failed to send OTP!'; header("Location: otp.php"); } else { $_SESSION['msg_success'] = 'OTP sent successfully.'; //$_SESSION['name']=$_POST['name']; //$_SESSION['email']=$_POST['email']; $_SESSION['phone'] = $numbers; $_SESSION['otp'] = $rndno; header("Location: otp.php"); } } public function verify_otp() { $rno = $_SESSION['otp']; $phone = $_SESSION['phone']; $urno = $_POST['otpvalue']; if (!strcmp($rno, $urno)) { unset($_SESSION['otp']); session_unset(); $_SESSION['msg'] = "OTP Verified Successfully. Plase fill the form carefully."; $_SESSION['phone'] = $phone; header("Location: select_zone.php"); } else { $_SESSION['msg_err'] = "OTP does not not Match! Please enter correct otp."; header("Location: otp.php"); } } public function approve_application($status, $customer_id, $admin_cid) { $approval_date = date('Y-m-d H:i:s'); // $approved_emp_no = 'GCPL' . date('Ymd') . rand(100, 1000); $approved_emp_no = 'GCPL' . date('Ymd') . $customer_id; // $message = "Your application for Globetech Creations Pvt. Ltd. is Accepted. //NOTE: This is not a confirmation of your joining until you get a joining letter."; $message = "Your application for GLOBETECH is Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; $sq3 = "UPDATE `employee` SET `application_status`='$status',`approval_date`='$approval_date',`approved_emp_no`='$approved_emp_no',`approve_by_admin_id`='$admin_cid',`approval_msg`='$message' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); return $qu3; } public function change_special_application_status($status, $customer_id, $admin_cid, $admin_name, $reason, $remark, $date, $age_limit, $employee_status, $document_demanded, $filename) { $added_date = date('Y-m-d H:i:s'); $date1 = date('Y-m-d H:i:s', strtotime($date)); $ivr_no = '8448444631'; if ($status == 'termination') { // $message = "Your application for Globetech Creations Pvt. Ltd. is Terminated."; $message = "Your application status ON GLOBETECH has been changed to Terminated due to $reason. For detail information contact us at $ivr_no."; } else if ($status == 'discharge') { // $message = "Your application for Globetech Creations Pvt. Ltd. is Discharged. "; $message = "Your application status ON GLOBETECH has been changed to Discharged due to $reason. For detail information contact us at $ivr_no."; } else if ($status == 'notice') { // $message = "Your application for Globetech Creations Pvt. Ltd. is Discharged. "; $message = "Your application status ON GLOBETECH has been changed to Notice due to $reason. For detail information contact us at $ivr_no."; } else if ($status == 'pro_accepted') { // $message = "Your application for Globetech Creations Pvt. Ltd. is Provisional Accepted. "; $message = "Your application for GLOBETECH is Provisional Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; } $sel_query1 = "SELECT `t_id` FROM `terminated_employee` ORDER BY `t_id` DESC"; $res_query1 = $this->select_custom_query($sel_query1); if ($res_query1[0]['t_id'] != '') { $total_letter1 = $res_query1[0]['t_id']; } else { $total_letter1 = 0; } // echo $total_letter1; // $sel_query2 = "SELECT * FROM `party_payments` WHERE voucher_type='BANK' AND payment_status IN ('approved') AND unit_id='$unit_id' ORDER BY payment_authority_date DESC"; $sel_query2 = "SELECT letter_no FROM `party_payments` WHERE voucher_type='BANK' ORDER BY letter_no DESC"; $res_query2 = $this->select_custom_query($sel_query2); if ($res_query2[0]['letter_no'] != '') { $total_letter2 = $res_query2[0]['letter_no']; } else { $total_letter2 = 0; } // echo $total_letter2; $total_letter = max($total_letter1, $total_letter2); $inc_no = $total_letter + 1; // $inc_no_padd = str_pad($inc_no, 4, 0, STR_PAD_LEFT); // $voucher_no = $unit_code . '-' . $inc_no_padd; $letter_no = $inc_no; $sq = "INSERT INTO `terminated_employee`(`t_id`, `emp_id`, `status_before_change`, `age_limit`, `terminated_date`, `terminated_date1`, `process_type`, `process_status`, `added_reason`, `added_remark`, `added_by`, `added_by_name`, `added_date`, `document_demanded`, `upload_doc`) VALUES ('$letter_no','$customer_id','$employee_status','$age_limit','$date','$date1','$status','generated','$reason','$remark','$admin_cid','$admin_name','$added_date','$document_demanded','$filename')"; $qu = mysqli_query($this->conn, $sq); if ($status == 'pro_accepted') { $sq3 = "UPDATE `employee` SET emp_joining_date='$date' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); } $this->send_bulk_message($customer_id, $message); return $qu; } public function change_application_status_27($status, $customer_id, $admin_cid, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); $extra_date = date('Y-m-d H:i:s'); $ivr_no = '8448444631'; if ($status == 'accepted') { $message = "Your application for GLOBETECH is Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; } else if ($status == 'rejected') { $message = "Your application status ON GLOBETECH has been changed to HOLD due to $reason. For detail information contact us at $ivr_no."; } else if ($status == 'waiting') { $message = "Your application status ON GLOBETECH has been changed to Waiting due to $reason. For detail information contact us at $ivr_no."; } else if ($status == 'pro_accepted') { $message = "Your application for GLOBETECH is Provisional Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; } else if ($status == 'extra_emp') { $message = "Your application status ON GLOBETECH has been changed to Extra due to $reason. For detail information contact us at $ivr_no."; } if ($status == 'accepted') { $sq3 = "UPDATE `employee` SET `application_status`='$status',`updated_date`='$updated_date',`extra_date`='$extra_date',`approve_by_admin_id`='$admin_cid',`reason`=`reason`,`remark`=`remark` WHERE `cid`='$customer_id'"; } else { $sq3 = "UPDATE `employee` SET `application_status`='$status',`updated_date`='$updated_date',`extra_date`='$extra_date',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark' WHERE `cid`='$customer_id'"; } $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); $this->save_employee_application_status($customer_id, $status, $reason, $remark, $admin_cid); return $qu3; } public function change_application_status($status, $customer_id, $admin_cid, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); $extra_date = date('Y-m-d H:i:s'); if ($status == 'accepted') { if ($reason == 'undefined' || $reason == '') { $reason == 'ALL DOCUMENT OK'; } if ($remark == 'undefined' || $remark == '') { $remark == 'ALL DOCUMENT OK'; } $message = "Your application for GLOBETECH is Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; } else if ($status == 'rejected') { $message = "Your application status ON GLOBETECH has been changed to HOLD due to $reason. For detail information contact us at $ivr_no."; } else if ($status == 'waiting') { $message = "Your application status ON GLOBETECH has been changed to Waiting due to $reason. For detail information contact us at $ivr_no."; } else if ($status == 'pro_accepted') { $message = "Your application for GLOBETECH is Provisional Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; } else if ($status == 'extra_emp') { $message = "Your application status ON GLOBETECH has been changed to Extra due to $reason. For detail information contact us at $ivr_no."; } else if ($status == 'rejoin') { $status = 'pro_accepted'; $message = "Your application for GLOBETECH is Rejoined. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; } if ($status == 'accepted') { // $select_query = $this->view_specific_employee($customer_id); // $res_select = mysqli_fetch_assoc($select_query); // $choice_ex_id = $res_select['choice_ex_id']; // $electrycity_name = $res_select['electrycity_zone']; // $skill_category = $res_select['skilled']; // $work_type = $res_select['work_type']; $select_query = $this->employee_details($customer_id); $res_emp = mysqli_fetch_assoc($select_query); $choice_ex_id = $res_emp['choice_ex_id']; $electrycity_name = $res_emp['electrycity_zone']; $ex_name = $res_emp['ex_engineer']; $skill_category = $res_emp['skilled']; $work_type = $res_emp['work_type']; $substation_detail = $this->substation_detail($electrycity_name, $ex_name); $res_select = mysqli_fetch_assoc($substation_detail); if ($work_type == 'OPERATIONAL') { if ($skill_category == 'Skilled') { $total_emp_substation = $res_select['total_sso_skilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_skilled_emp']; } else if ($skill_category == 'Semi Skilled') { $total_emp_substation = $res_select['total_sso_semiskilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_semiskilled_emp']; } else if ($skill_category == 'Non Skilled') { $total_emp_substation = $res_select['total_sso_unskilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_unskilled_emp']; } // } else if ($work_type == 'MAINTENANCE') { } else { if ($skill_category == 'Skilled') { $total_emp_substation = $res_select['total_lm_skilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_skilled_emp']; } else if ($skill_category == 'Semi Skilled') { $total_emp_substation = $res_select['total_lm_semiskilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_semiskilled_emp']; } else if ($skill_category == 'Non Skilled') { $total_emp_substation = $res_select['total_lm_unskilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_unskilled_emp']; } } // $work_sql = "SELECT * FROM `employee` WHERE `electrycity_zone`='$electrycity_name' AND `ex_engineer` IN (SELECT `ex_name` FROM executive_engineer WHERE `ex_id` IN ($choice_ex_id)) AND application_status IN ('accepted','pro_accepted','rejected','waiting') AND work_type='$work_type' AND skilled='$skill_category'"; $work_sql = "SELECT * FROM `employee` WHERE `electrycity_zone`='$electrycity_name' AND `ex_engineer`='$ex_name' AND application_status IN ('accepted','pro_accepted','rejected','waiting') AND work_type='$work_type' AND skilled='$skill_category'"; $working_emp = $this->select_custom_query($work_sql); $working_emp_count = count($working_emp); $working_emp_count_res = ($working_emp_count + $reserved_emp_substation); if ($working_emp_count_res < $total_emp_substation) { $sq3 = "UPDATE `employee` SET `application_status`='$status',`updated_date`='$updated_date',`extra_date`='$extra_date',`approve_by_admin_id`='$admin_cid',`reason`=`reason`,`remark`=`remark` WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); $this->save_employee_application_status($customer_id, $status, $reason, $remark, $admin_cid); return $qu3; } } else { $sq3 = "UPDATE `employee` SET `application_status`='$status',`updated_date`='$updated_date',`extra_date`='$extra_date',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); $this->save_employee_application_status($customer_id, $status, $reason, $remark, $admin_cid); return $qu3; } } public function restore_employee($status, $customer_id, $admin_cid, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); $restored_date = date('Y-m-d H:i:s'); if ($reason == 'undefined' || $reason == '') { $reason == 'ALL DOCUMENT OK'; } if ($remark == 'undefined' || $remark == '') { $remark == 'ALL DOCUMENT OK'; } // $message = "Your application for Globetech Creations Pvt. Ltd. is Restored."; $message = "Your application for GLOBETECH is Restored. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; $select_query = $this->employee_details($customer_id); $res_emp = mysqli_fetch_assoc($select_query); $choice_ex_id = $res_emp['choice_ex_id']; $electrycity_name = $res_emp['electrycity_zone']; $ex_name = $res_emp['ex_engineer']; $skill_category = $res_emp['skilled']; $work_type = $res_emp['work_type']; $substation_detail = $this->substation_detail($electrycity_name, $ex_name); $res_select = mysqli_fetch_assoc($substation_detail); if ($work_type == 'OPERATIONAL') { if ($skill_category == 'Skilled') { $total_emp_substation = $res_select['total_sso_skilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_skilled_emp']; } else if ($skill_category == 'Semi Skilled') { $total_emp_substation = $res_select['total_sso_semiskilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_semiskilled_emp']; } else if ($skill_category == 'Non Skilled') { $total_emp_substation = $res_select['total_sso_unskilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_unskilled_emp']; } // } else if ($work_type == 'MAINTENANCE') { } else { if ($skill_category == 'Skilled') { $total_emp_substation = $res_select['total_lm_skilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_skilled_emp']; } else if ($skill_category == 'Semi Skilled') { $total_emp_substation = $res_select['total_lm_semiskilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_semiskilled_emp']; } else if ($skill_category == 'Non Skilled') { $total_emp_substation = $res_select['total_lm_unskilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_unskilled_emp']; } } // $work_sql = "SELECT * FROM `employee` WHERE `electrycity_zone`='$electrycity_name' AND `ex_engineer` IN (SELECT `ex_name` FROM executive_engineer WHERE `ex_id` IN ($choice_ex_id)) AND application_status IN ('accepted','pro_accepted','rejected','waiting') AND work_type='$work_type' AND skilled='$skill_category'"; $work_sql = "SELECT * FROM `employee` WHERE `electrycity_zone`='$electrycity_name' AND `ex_engineer`='$ex_name' AND application_status IN ('accepted','pro_accepted','rejected','waiting') AND work_type='$work_type' AND skilled='$skill_category'"; $working_emp = $this->select_custom_query($work_sql); $working_emp_count = count($working_emp); $working_emp_count_res = ($working_emp_count + $reserved_emp_substation); if ($working_emp_count_res < $total_emp_substation) { $sq3 = "UPDATE `employee` SET `application_status`='pro_accepted',`updated_date`='$updated_date',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); $remark = $remark . ' Restored ON ' . $restored_date; $this->save_employee_application_status($customer_id, 'pro_accepted', $reason, $remark, $admin_cid); return $qu3; } } public function accept_employee_afterprovisional_25($status, $customer_id, $admin_cid, $emp_joining_date, $basic_salary, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); if ($status == 'accepted') { $message = "Your application for GLOBETECH is Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; } $sq3 = "UPDATE `employee` SET `application_status`='$status',`basic_salary`='$basic_salary',`reason`='$reason',`remark`='$remark',`updated_date`='$updated_date',`emp_joining_date`='$emp_joining_date',`approve_by_admin_id`='$admin_cid' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); $this->save_employee_application_status($customer_id, $status, $reason, $remark, $admin_cid); return $qu3; } public function accept_employee_afterprovisional($status, $customer_id, $admin_cid, $emp_joining_date, $basic_salary, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); // $select_query = $this->view_specific_employee($customer_id); // $res_select = mysqli_fetch_assoc($select_query); // $choice_ex_id = $res_select['choice_ex_id']; // $electrycity_name = $res_select['electrycity_zone']; // $skill_category = $res_select['skilled']; // $work_type = $res_select['work_type']; $select_query = $this->employee_details($customer_id); $res_emp = mysqli_fetch_assoc($select_query); $choice_ex_id = $res_emp['choice_ex_id']; $electrycity_name = $res_emp['electrycity_zone']; $ex_name = $res_emp['ex_engineer']; $skill_category = $res_emp['skilled']; $work_type = $res_emp['work_type']; $substation_detail = $this->substation_detail($electrycity_name, $ex_name); $res_select = mysqli_fetch_assoc($substation_detail); if ($work_type == 'OPERATIONAL') { if ($skill_category == 'Skilled') { $total_emp_substation = $res_select['total_sso_skilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_skilled_emp']; } else if ($skill_category == 'Semi Skilled') { $total_emp_substation = $res_select['total_sso_semiskilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_semiskilled_emp']; } else if ($skill_category == 'Non Skilled') { $total_emp_substation = $res_select['total_sso_unskilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_unskilled_emp']; } // } else if ($work_type == 'MAINTENANCE') { } else { if ($skill_category == 'Skilled') { $total_emp_substation = $res_select['total_lm_skilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_skilled_emp']; } else if ($skill_category == 'Semi Skilled') { $total_emp_substation = $res_select['total_lm_semiskilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_semiskilled_emp']; } else if ($skill_category == 'Non Skilled') { $total_emp_substation = $res_select['total_lm_unskilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_unskilled_emp']; } } // $work_sql = "SELECT * FROM `employee` WHERE `electrycity_zone`='$electrycity_name' AND `ex_engineer` IN (SELECT `ex_name` FROM executive_engineer WHERE `ex_id` IN ($choice_ex_id)) AND application_status IN ('accepted','pro_accepted','rejected','waiting') AND work_type='$work_type' AND skilled='$skill_category'"; $work_sql = "SELECT * FROM `employee` WHERE `electrycity_zone`='$electrycity_name' AND `ex_engineer`='$ex_name' AND application_status IN ('accepted','pro_accepted','rejected','waiting') AND work_type='$work_type' AND skilled='$skill_category'"; $working_emp = $this->select_custom_query($work_sql); $working_emp_count = count($working_emp); $working_emp_count_res = ($working_emp_count + $reserved_emp_substation); if ($working_emp_count_res < $total_emp_substation) { $message = "Your application for GLOBETECH is Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; $sq3 = "UPDATE `employee` SET `application_status`='$status',`basic_salary`='$basic_salary',`reason`='$reason',`remark`='$remark',`updated_date`='$updated_date',`emp_joining_date`='$emp_joining_date',`accepted_by`='$admin_cid', `accepted_date`='$updated_date',`approve_by_admin_id`='$admin_cid' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); $this->save_employee_application_status($customer_id, $status, $reason, $remark, $admin_cid); return $qu3; } } public function substation_detail($electrycity_name, $ex_name) { // $sql_substation = "SELECT * FROM `electrycity_zone` WHERE `electrycity_zone_name`='$electrycity_name' AND`ex_id`='$choice_ex_id'"; $sql_substation = "SELECT * FROM `electrycity_zone` WHERE `electrycity_zone_name`='$electrycity_name' AND `ex_id` IN (SELECT DISTINCT(ex_id) FROM executive_engineer WHERE ex_name='$ex_name')"; $qu3 = mysqli_query($this->conn, $sql_substation); return $qu3; } public function get_substation_detail_by_edd_substation_name($ez_name, $edd_name) { $sq1 = "SELECT * FROM `electrycity_zone` ez INNER JOIN `executive_engineer` ex ON ex.`ex_id`=ez.`ex_id` WHERE `ex_name`='$edd_name' AND electrycity_zone_name='$ez_name' ORDER BY electrycity_zone_name ASC"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); return $res; } public function accept_provisionally($status, $customer_id, $admin_cid, $reason, $remark, $identity, $identity_type, $identity_end_date, $address, $address_type, $address_end_date, $pancard, $pancard_end_date, $skill, $skill_end_date, $bank, $bank_end_date, $epf, $epf_end_date, $photo, $photo_end_date, $empsign, $empsign_end_date, $recommended_by) { $updated_date = date('Y-m-d H:i:s'); $company_id = $_SESSION['company_id']; // $message = "You have to upload the following required documents $msg_doc due to $reason."; // $message = "Your application for Globetech is Provisional Accepted. $reason"; $message = "Your application for GLOBETECH is Provisional Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; // $max_id = $customer_id; // $max_id_last_three_digit = substr($max_id, -3); // if ($max_id_last_three_digit < 100) { // $max_id_last_three_digit = str_pad($max_id_last_three_digit, 3, '0', STR_PAD_LEFT); // } // $approved_emp_no = 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only // $approved_emp_no = 'GCPL' . date('Ymd') . $max_id_last_three_digit; //for file name only $approved_emp_no = 'GCPL' . date('Ymd') . $customer_id; //for file name only $select_query = $this->employee_details($customer_id); $res_emp = mysqli_fetch_assoc($select_query); $choice_ex_id = $res_emp['choice_ex_id']; $electrycity_name = $res_emp['electrycity_zone']; $ex_name = $res_emp['ex_engineer']; $skill_category = $res_emp['skilled']; $work_type = $res_emp['work_type']; $substation_detail = $this->substation_detail($electrycity_name, $ex_name); $res_select = mysqli_fetch_assoc($substation_detail); if ($work_type == 'OPERATIONAL') { if ($skill_category == 'Skilled') { $total_emp_substation = $res_select['total_sso_skilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_skilled_emp']; } else if ($skill_category == 'Semi Skilled') { $total_emp_substation = $res_select['total_sso_semiskilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_semiskilled_emp']; } else if ($skill_category == 'Non Skilled') { $total_emp_substation = $res_select['total_sso_unskilled_emp']; $reserved_emp_substation = $res_select['total_res_sso_unskilled_emp']; } // } else if ($work_type == 'MAINTENANCE') { } else { if ($skill_category == 'Skilled') { $total_emp_substation = $res_select['total_lm_skilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_skilled_emp']; } else if ($skill_category == 'Semi Skilled') { $total_emp_substation = $res_select['total_lm_semiskilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_semiskilled_emp']; } else if ($skill_category == 'Non Skilled') { $total_emp_substation = $res_select['total_lm_unskilled_emp']; $reserved_emp_substation = $res_select['total_res_lm_unskilled_emp']; } } // $work_sql = "SELECT * FROM `employee` WHERE `electrycity_zone`='$electrycity_name' AND `ex_engineer` IN (SELECT `ex_name` FROM executive_engineer WHERE `ex_id` IN ($choice_ex_id)) AND application_status IN ('accepted','pro_accepted','rejected','waiting') AND work_type='$work_type' AND skilled='$skill_category'"; $work_sql = "SELECT * FROM `employee` WHERE `electrycity_zone`='$electrycity_name' AND `ex_engineer`='$ex_name' AND application_status IN ('accepted','pro_accepted','rejected','waiting') AND work_type='$work_type' AND skilled='$skill_category'"; $working_emp = $this->select_custom_query($work_sql); $working_emp_count = count($working_emp); $working_emp_count_res = ($working_emp_count + $reserved_emp_substation); if ($working_emp_count_res < $total_emp_substation) { $sq3 = "UPDATE `employee` SET `application_status`='$status',`updated_date`='$updated_date',`approved_emp_no`='$approved_emp_no', `accepted_by`='$admin_cid', `accepted_date`='$updated_date',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark',`recommended_by`='$recommended_by',`company_id`='$company_id' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); $sq_check = "SELECT * FROM `provisional_table` WHERE `emp_id`='$customer_id'"; $qu_check = mysqli_query($this->conn, $sq_check); if (mysqli_num_rows($qu_check) > 0) { $sq = "UPDATE `provisional_table` SET `emp_id`='$customer_id',`photo_checkbox`='$photo',`photo_end_date`='$photo_end_date',`empsign_checkbox`='$empsign',`empsign_end_date`='$empsign_end_date',`identity_checkbox`='$identity',`identity_upload_type`='$identity_type',`identity_end_date`='$identity_end_date',`address_checkbox`='$address',`address_upload_type`='$address_type',`address_end_date`='$address_end_date',`pancard_checkbox`='$pancard',`pancard_end_date`='$pancard_end_date',`skill_checkbox`='$skill',`skill_end_date`='$skill_end_date',`bank_checkbox`='$bank',`bank_end_date`='$bank_end_date',`epf_checkbox`='$epf',`epf_end_date`='$epf_end_date',`added_time`='$updated_date',`updated_time`='$updated_date',`added_by`='$admin_cid',`status`='un_approved' WHERE `emp_id`='$customer_id'"; } else { $sq = "INSERT INTO `provisional_table`(`emp_id`, `identity_checkbox`, `identity_upload_type`, `identity_end_date`, `address_checkbox`, `address_upload_type`, `address_end_date`, `pancard_checkbox`, `pancard_end_date`, `skill_checkbox`, `skill_end_date`, `bank_checkbox`, `bank_end_date`, `epf_checkbox`, `epf_end_date`, `photo_checkbox`, `photo_end_date`, `empsign_checkbox`, `empsign_end_date`, `added_time`, `updated_time`, `added_by`) VALUES ('$customer_id', '$identity', '$identity_type', '$identity_end_date', '$address', '$address_type', '$address_end_date', '$pancard', '$pancard_end_date', '$skill', '$skill_end_date', '$bank', '$bank_end_date', '$epf', '$epf_end_date', '$photo', '$photo_end_date', '$empsign', '$empsign_end_date', '$updated_date', '$updated_date', '$admin_cid')"; } $qu = mysqli_query($this->conn, $sq); $this->save_employee_application_status($customer_id, $status, $reason, $remark, $admin_cid); return $qu; } } public function accept_provisionally_25($status, $customer_id, $admin_cid, $reason, $remark, $identity, $identity_type, $identity_end_date, $address, $address_type, $address_end_date, $pancard, $pancard_end_date, $skill, $skill_end_date, $bank, $bank_end_date, $epf, $epf_end_date, $photo, $photo_end_date, $empsign, $empsign_end_date) { $updated_date = date('Y-m-d H:i:s'); $approved_emp_no = 'GCPL' . date('Ymd') . rand(100, 1000); $message = "Your application for GLOBETECH is Provisional Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; $sq3 = "UPDATE `employee` SET `application_status`='$status',`updated_date`='$updated_date',`approved_emp_no`='$approved_emp_no',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $this->send_bulk_message($customer_id, $message); $sq = "INSERT INTO `provisional_table`(`emp_id`, `identity_checkbox`, `identity_upload_type`, `identity_end_date`, `address_checkbox`, `address_upload_type`, `address_end_date`, `pancard_checkbox`, `pancard_end_date`, `skill_checkbox`, `skill_end_date`, `bank_checkbox`, `bank_end_date`, `epf_checkbox`, `epf_end_date`, `photo_checkbox`, `photo_end_date`, `empsign_checkbox`, `empsign_end_date`, `added_time`, `updated_time`, `added_by`) VALUES ('$customer_id', '$identity', '$identity_type', '$identity_end_date', '$address', '$address_type', '$address_end_date', '$pancard', '$pancard_end_date', '$skill', '$skill_end_date', '$bank', '$bank_end_date', '$epf', '$epf_end_date', '$photo', '$photo_end_date', '$empsign', '$empsign_end_date', '$updated_date', '$updated_date', '$admin_cid')"; $qu = mysqli_query($this->conn, $sq); $this->save_employee_application_status($customer_id, $status, $reason, $remark, $admin_cid); return $qu; } public function accept_provisionally_old($status, $customer_id, $admin_cid, $reason, $remark, $skill, $identity, $bank, $pancard, $skill_end_date, $identity_end_date, $bank_end_date, $pancard_end_date) { $updated_date = date('Y-m-d H:i:s'); $message = "Your application for GLOBETECH is Provisional Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; echo $sq3 = "UPDATE `employee` SET `application_status`='$status',`updated_date`='$updated_date',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark' WHERE `cid`='$customer_id'"; // $qu3 = mysqli_query($this->conn, $sq3); // $this->send_bulk_message($customer_id, $message); echo $sq = "INSERT INTO `pro_accepted_reason`(`emp_id`, `identity`, `identity_upload`, `skill`, `skill_upload`, `pancard`, `pancard_upload`, `bank`, `bank_upload`, `added_time`, `updated_time`, `added_by`) VALUES ('$customer_id', '$identity', '$identity_end_date', '$skill', '$skill_end_date', '$pancard', '$pancard_end_date', '$bank', '$bank_end_date', '$updated_date', '$updated_date', '$admin_cid')"; // $qu = mysqli_query($this->conn, $sq); // $this->send_bulk_message($customer_id, $message); return; } public function accept_provisionally_date_change($status, $customer_id, $admin_cid, $reason, $remark, $identity, $identity_type, $identity_end_date, $address, $address_type, $address_end_date, $pancard, $pancard_end_date, $skill, $skill_end_date, $bank, $bank_end_date, $epf, $epf_end_date, $photo, $photo_end_date, $empsign, $empsign_end_date, $recommended_by) { $updated_date = date('Y-m-d H:i:s'); $admin_name = strtoupper($_SESSION['name']); $document_demanded = ""; if ($identity == 'yes') { $document_demanded .= 'Identity - ' . $address_type . ', '; } if ($empsign == 'yes') { $document_demanded .= 'Signature, '; } if ($photo == 'yes') { $document_demanded .= 'Photo, '; } if ($address == 'yes') { $document_demanded .= 'Address Proof, '; } if ($pancard == 'yes') { $document_demanded .= 'Pancard, '; } if ($bank == 'yes') { $document_demanded .= 'Bank Passbook, '; } if ($skill == 'yes') { $document_demanded .= 'Skilled Doc, '; } if ($epf == 'yes') { $document_demanded .= 'Epf Passbook, '; } if ($document_demanded) { $doc_required = 'YES'; $document_demanded = strtoupper($document_demanded); } else { $doc_required = 'NO'; $document_demanded = 'NO DOCUMENT DEMANDED'; } // $max_id = $customer_id; // $max_id_last_three_digit = substr($max_id, -3); // if ($max_id_last_three_digit < 100) { // $max_id_last_three_digit = str_pad($max_id_last_three_digit, 3, '0', STR_PAD_LEFT); // } // $approved_emp_no = 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only // $approved_emp_no = 'GCPL' . date('Ymd') . $max_id_last_three_digit; //for file name only // $approved_emp_no = 'GCPL' . date('Ymd') . $customer_id; //for file name only $message = "Your application for GLOBETECH is Provisional Accepted. Login with your registered Mobile No. NOTE:This message is not a confirmation of your joining until you get a joining letter."; // $sq3 = "UPDATE `employee` SET `application_status`='$status',`updated_date`='$updated_date',`approved_emp_no`='$approved_emp_no',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark',`recommended_by`='$recommended_by' WHERE `cid`='$customer_id'"; $sq3 = "UPDATE `employee` SET `updated_by`='$admin_cid',`reason`='$reason',`remark`='$remark' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); if ($qu3) { $this->send_bulk_message($customer_id, $message); } // $sq_check = "SELECT * FROM `provisional_table` WHERE `emp_id`='$customer_id'"; $sq_check = "SELECT * FROM `provisional_table` WHERE `emp_id`='$customer_id' ORDER BY `pro_id` DESC LIMIT 1"; $qu_check = mysqli_query($this->conn, $sq_check); if (mysqli_num_rows($qu_check) > 0) { $sq = "UPDATE `provisional_table` SET `emp_id`='$customer_id',`photo_checkbox`='$photo',`photo_end_date`='$photo_end_date',`empsign_checkbox`='$empsign',`empsign_end_date`='$empsign_end_date',`identity_checkbox`='$identity',`identity_upload_type`='$identity_type',`identity_end_date`='$identity_end_date',`address_checkbox`='$address',`address_upload_type`='$address_type',`address_end_date`='$address_end_date',`pancard_checkbox`='$pancard',`pancard_end_date`='$pancard_end_date',`skill_checkbox`='$skill',`skill_end_date`='$skill_end_date',`bank_checkbox`='$bank',`bank_end_date`='$bank_end_date',`epf_checkbox`='$epf',`epf_end_date`='$epf_end_date',`added_time`='$updated_date',`updated_time`='$updated_date',`added_by`='$admin_cid',`status`='un_approved' WHERE `emp_id`='$customer_id'"; } else { $sq = "INSERT INTO `provisional_table`(`emp_id`, `identity_checkbox`, `identity_upload_type`, `identity_end_date`, `address_checkbox`, `address_upload_type`, `address_end_date`, `pancard_checkbox`, `pancard_end_date`, `skill_checkbox`, `skill_end_date`, `bank_checkbox`, `bank_end_date`, `epf_checkbox`, `epf_end_date`, `photo_checkbox`, `photo_end_date`, `empsign_checkbox`, `empsign_end_date`, `added_time`, `updated_time`, `added_by`) VALUES ('$customer_id', '$identity', '$identity_type', '$identity_end_date', '$address', '$address_type', '$address_end_date', '$pancard', '$pancard_end_date', '$skill', '$skill_end_date', '$bank', '$bank_end_date', '$epf', '$epf_end_date', '$photo', '$photo_end_date', '$empsign', '$empsign_end_date', '$updated_date', '$updated_date', '$admin_cid')"; } $qu = mysqli_query($this->conn, $sq); if ($qu) { $sq_update = "UPDATE `terminated_employee` SET `document_demanded`='$document_demanded', `doc_required`='$doc_required', `updated_by`='$admin_cid', `updated_by_name`='$admin_name' WHERE `emp_id`='$customer_id'"; $qu_update = mysqli_query($this->conn, $sq_update); $this->save_employee_application_status($customer_id, $status, $reason, $remark, $admin_cid); } return $qu; } public function change_application_status_afteredit($status, $customer_id, $admin_cid) { $updated_date = $approval_date = date('Y-m-d H:i:s'); // $approved_emp_no = 'GCPL' . date('Ymd') . rand(100, 1000); // $sq3 = "UPDATE `employee` SET `application_status`='$status',`approval_date`='$approval_date',`approved_emp_no`='$approved_emp_no' WHERE `cid`='$customer_id'"; // $sq3 = "UPDATE `employee` SET `application_status`='$status',`approve_by_admin_id`='$admin_cid',`edit_status`='no' WHERE `cid`='$customer_id'"; $sqq = "UPDATE `employee` emp INNER JOIN `employee_edited` emp_edit USING (`cid`) SET emp.`customer_name` = emp_edit.`customer_name`,emp.`first_name` = emp_edit.`first_name`,emp.`middle_name`=emp_edit.`middle_name`,emp.`last_name`=emp_edit.`last_name`,emp.`father_name`=emp_edit.`father_name`,emp.`mother_name`=emp_edit.`mother_name`,emp.`phone`=emp_edit.`phone`,emp.`phone2`=emp_edit.`phone2`,emp.`emailid`=emp_edit.`emailid`,emp.`dob`=emp_edit.`dob`,emp.`gender`=emp_edit.`gender`,emp.`mstatus`=emp_edit.`mstatus`,emp.`wife_name`=emp_edit.`wife_name`,emp.`mohalla`=emp_edit.`mohalla`,emp.`village`=emp_edit.`village`,emp.`post`=emp_edit.`post`,emp.`state`=emp_edit.`state`,emp.`district`=emp_edit.`district`,emp.`pincode`=emp_edit.`pincode`,emp.`thana`=emp_edit.`thana`,emp.`insurance_policy_no`=emp_edit.`insurance_policy_no`,emp.`insurance_company`=emp_edit.`insurance_company`,emp.`s_price`=emp_edit.`s_price`,emp.`nominee`=emp_edit.`nominee`,emp.`nominee_relation`=emp_edit.`nominee_relation`,emp.`nominee_other`=emp_edit.`nominee_other`,emp.`epf_detail`=emp_edit.`epf_detail`,emp.`epf_reg`=emp_edit.`epf_reg`,emp.`esic_detail`=emp_edit.`esic_detail`,emp.`esic_regno`=emp_edit.`esic_regno`,emp.`acc_holder_name`=emp_edit.`acc_holder_name`,emp.`acc_no`=emp_edit.`acc_no`,emp.`ifsc`=emp_edit.`ifsc`,emp.`bank_name`=emp_edit.`bank_name`,emp.`bank_branch`=emp_edit.`bank_branch`,emp.`bank_address`=emp_edit.`bank_address`,emp.`acc_holder_name_2`=emp_edit.`acc_holder_name_2`,emp.`acc_no_2`=emp_edit.`acc_no_2`,emp.`ifsc_2`=emp_edit.`ifsc_2`,emp.`bank_name_2`=emp_edit.`bank_name_2`,emp.`bank_branch_2`=emp_edit.`bank_branch_2`,emp.`bank_address_2`=emp_edit.`bank_address_2`,emp.`pan_no`=emp_edit.`pan_no`,emp.`pan_detail`=emp_edit.`pan_detail`,emp.`block`=emp_edit.`block`,emp.`tahsil`=emp_edit.`tahsil`,emp.`childs`=emp_edit.`childs`,emp.`identity_type`=emp_edit.`identity_type`,emp.`name_on_identity`=emp_edit.`name_on_identity`,emp.`identity_no`=emp_edit.`identity_no`,emp.`zone`=emp_edit.`zone`,emp.`s_engineer`=emp_edit.`s_engineer`,emp.`ex_engineer`=emp_edit.`ex_engineer`,emp.`electrycity_zone`=emp_edit.`electrycity_zone`,emp.`prev_electricity_zone`=emp_edit.`prev_electricity_zone`,emp.`substation_changed_date`=emp_edit.`substation_changed_date`,emp.`substation_changed_by`=emp_edit.`substation_changed_by`,emp.`work_type`=emp_edit.`work_type`,emp.`ip_expiry`=emp_edit.`ip_expiry`,emp.`skilled`=emp_edit.`skilled`,emp.`emp_joining_date`=emp_edit.`emp_joining_date`,emp.`basic_salary`=emp_edit.`basic_salary`,emp.`recommended_by`=emp_edit.`recommended_by`,emp.`edit_status`='no',emp.`edit_by`=emp_edit.`edit_by`,emp.`edit_date`=emp_edit.`edit_date`,emp.`updated_date`='$updated_date',emp.`approve_by_admin_id`='$admin_cid',emp.`approval_date`='$approval_date',emp.`e_g_id`=emp_edit.`e_g_id`,emp.`e_s_g_id`=emp_edit.`e_s_g_id` WHERE `cid`='$customer_id'"; $qup = mysqli_query($this->conn, $sqq); $sq3 = "UPDATE `employee_edited` SET `approve_by_admin_id`='$admin_cid',`edit_status`='no',`approval_date`='$updated_date' WHERE `cid`='$customer_id'"; // $sq3 = "UPDATE `employee` SET `approve_by_admin_id`='$admin_cid',`edit_status`='no' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function deny_application_status_afteredit($status, $customer_id, $admin_cid) { $updated_date = $approval_date = date('Y-m-d H:i:s'); $sq3 = "UPDATE `employee_edited` SET `approve_by_admin_id`='$admin_cid',`edit_status`='no',`approval_date`='$updated_date' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); $sq33 = "UPDATE `employee` SET `approve_by_admin_id`='$admin_cid',`edit_status`='no',`approval_date`='$updated_date' WHERE `cid`='$customer_id'"; $qu33 = mysqli_query($this->conn, $sq33); return $qu33; } public function change_application_status_afteredit_bulk($status, $customer_id, $admin_cid) { // $prefix = $cid = ''; // foreach ($customer_id as $cid) { // $cid .= $prefix . '"' . $cid . '"'; // $prefix = ', '; // } $updated_date = $approval_date = date('Y-m-d H:i:s'); if ($status == 'deny') { $sq3 = "UPDATE `employee_edited` SET `approve_by_admin_id`='$admin_cid',`edit_status`='no',`approval_date`='$updated_date' WHERE `cid` IN ($customer_id)"; $sq33 = "UPDATE `employee` SET `approve_by_admin_id`='$admin_cid',`edit_status`='no',`approval_date`='$updated_date' WHERE `cid` IN ($customer_id)"; } else if ($status == 'accepted') { $sq3 = "UPDATE `employee_edited` SET `approve_by_admin_id`='$admin_cid',`edit_status`='no',`approval_date`='$updated_date' WHERE `cid` IN ($customer_id)"; $sq33 = "UPDATE `employee` SET `approve_by_admin_id`='$admin_cid',`edit_status`='no',`approval_date`='$updated_date' WHERE `cid` IN ($customer_id)"; } $qu3 = mysqli_query($this->conn, $sq3); $qu33 = mysqli_query($this->conn, $sq33); return $qu3; } public function change_application_status_afteredit_nominee_child($status, $nid, $admin_cid, $change_table_name_to, $change_table_name_from) { $updated_date = $approval_date = date('Y-m-d H:i:s'); // $query = "SELECT * FROM `$change_table_name_to` WHERE nid='$nid' AND edit_type='NEW' AND edit_txn='$edit_txn'"; $query = "SELECT * FROM `$change_table_name_to` WHERE nid='$nid'"; $nominee_res = $this->select_custom_query($query); $cid = $nominee_res[0]['cid']; $edit_txn = $nominee_res[0]['edit_txn']; $nominee_name = $nominee_res[0]['customer_name']; $nominee_relation = $nominee_res[0]['nominee_relation']; $nominee_other = $nominee_res[0]['nominee_other']; if ($status == 'accepted') { // $sqq = "UPDATE `$change_table_name_to` tbl_to INNER JOIN `$change_table_name_from` tbl_from USING (`nid`) SET tbl_to.`nid`=tbl_from.`nid`, tbl_to.`cid`=tbl_from.`cid`, tbl_to.`customer_name`=tbl_from.`customer_name`, tbl_to.`first_name`=tbl_from.`first_name`, tbl_to.`middle_name`=tbl_from.`middle_name`, tbl_to.`last_name`=tbl_from.`last_name`, tbl_to.`father_name`=tbl_from.`father_name`, tbl_to.`mother_name`=tbl_from.`mother_name`, tbl_to.`phone`=tbl_from.`phone`, tbl_to.`phone2`=tbl_from.`phone2`, tbl_to.`emailid`=tbl_from.`emailid`, tbl_to.`dob`=tbl_from.`dob`, tbl_to.`gender`=tbl_from.`gender`, tbl_to.`mstatus`=tbl_from.`mstatus`, tbl_to.`wife_name`=tbl_from.`wife_name`, tbl_to.`mohalla`=tbl_from.`mohalla`, tbl_to.`village`=tbl_from.`village`, tbl_to.`post`=tbl_from.`post`, tbl_to.`state`=tbl_from.`state`, tbl_to.`district`=tbl_from.`district`, tbl_to.`pincode`=tbl_from.`pincode`, tbl_to.`thana`=tbl_from.`thana`, tbl_to.`skilled`=tbl_from.`skilled`, tbl_to.`skilled_type`=tbl_from.`skilled_type`, tbl_to.`skilled_upload`=tbl_from.`skilled_upload`, tbl_to.`emp_no`=tbl_from.`emp_no`, tbl_to.`approved_emp_no`=tbl_from.`approved_emp_no`, tbl_to.`epf_expiry`=tbl_from.`epf_expiry`, tbl_to.`ip_detail`=tbl_from.`ip_detail`, tbl_to.`insurance_policy_no`=tbl_from.`insurance_policy_no`, tbl_to.`insurance_company`=tbl_from.`insurance_company`, tbl_to.`s_price`=tbl_from.`s_price`, tbl_to.`nominee`=tbl_from.`nominee`, tbl_to.`nominee_relation`=tbl_from.`nominee_relation`, tbl_to.`nominee_other`=tbl_from.`nominee_other`, tbl_to.`epf_detail`=tbl_from.`epf_detail`, tbl_to.`epf_reg`=tbl_from.`epf_reg`, tbl_to.`epf_upload`=tbl_from.`epf_upload`, tbl_to.`acc_holder_name`=tbl_from.`acc_holder_name`, tbl_to.`acc_no`=tbl_from.`acc_no`, tbl_to.`ifsc`=tbl_from.`ifsc`, tbl_to.`bank_name`=tbl_from.`bank_name`, tbl_to.`bank_branch`=tbl_from.`bank_branch`, tbl_to.`bank_address`=tbl_from.`bank_address`, tbl_to.`pan_no`=tbl_from.`pan_no`, tbl_to.`pan_detail`=tbl_from.`pan_detail`, tbl_to.`pan_upload`=tbl_from.`pan_upload`, tbl_to.`clogo`=tbl_from.`clogo`, tbl_to.`emp_sign`=tbl_from.`emp_sign`, tbl_to.`block`=tbl_from.`block`, tbl_to.`tahsil`=tbl_from.`tahsil`, tbl_to.`nationality`=tbl_from.`nationality`, tbl_to.`childs`=tbl_from.`childs`, tbl_to.`identity_type`=tbl_from.`identity_type`, tbl_to.`name_on_identity`=tbl_from.`name_on_identity`, tbl_to.`identity_no`=tbl_from.`identity_no`, tbl_to.`identity_upload`=tbl_from.`identity_upload`, tbl_to.`full_address`=tbl_from.`full_address`, tbl_to.`edit_status`='no', tbl_to.`edit_date`=tbl_from.`edit_date`, tbl_to.`edit_by`=tbl_from.`edit_by`, tbl_to.`reg_date`=tbl_from.`reg_date`, tbl_to.`work_type`=tbl_from.`work_type`, tbl_to.`passbook_upload`=tbl_from.`passbook_upload`, tbl_to.`form_status`=tbl_from.`form_status`, tbl_to.`ip_expiry`=tbl_from.`ip_expiry`, tbl_to.`updated_date`='$updated_date', tbl_to.`updated_by`='$admin_cid', tbl_to.`accepted_by`=tbl_from.`accepted_by`, tbl_to.`accepted_date`=tbl_from.`accepted_date`, tbl_to.`address_type`=tbl_from.`address_type`, tbl_to.`name_on_address`=tbl_from.`name_on_address`, tbl_to.`address_no`=tbl_from.`address_no`, tbl_to.`address_upload`=tbl_from.`address_upload`, tbl_to.`other_upload`=tbl_from.`other_upload`, tbl_to.`acc_holder_name_2`=tbl_from.`acc_holder_name_2`, tbl_to.`acc_no_2`=tbl_from.`acc_no_2`, tbl_to.`ifsc_2`=tbl_from.`ifsc_2`, tbl_to.`bank_name_2`=tbl_from.`bank_name_2`, tbl_to.`bank_branch_2`=tbl_from.`bank_branch_2`, tbl_to.`bank_address_2`=tbl_from.`bank_address_2`, tbl_to.`passbook_upload_2`=tbl_from.`passbook_upload_2`, tbl_to.`reg_date1`=tbl_from.`reg_date1`, tbl_to.`relation_proof_upload`=tbl_from.`relation_proof_upload`, tbl_to.`relation_proof_no`=tbl_from.`relation_proof_no`, tbl_to.`relation_proof_date`=tbl_from.`relation_proof_date`, tbl_to.`payment_status`=tbl_from.`payment_status`, tbl_to.`payment_reference_no`=tbl_from.`payment_reference_no`, tbl_to.`payment_order_id`=tbl_from.`payment_order_id`, tbl_to.`payment_trans_date`=tbl_from.`payment_trans_date`, tbl_to.`mohalla_2`=tbl_from.`mohalla_2`, tbl_to.`village_2`=tbl_from.`village_2`, tbl_to.`post_2`=tbl_from.`post_2`, tbl_to.`state_2`=tbl_from.`state_2`, tbl_to.`district_2`=tbl_from.`district_2`, tbl_to.`pincode_2`=tbl_from.`pincode_2`, tbl_to.`thana_2`=tbl_from.`thana_2`, tbl_to.`block_2`=tbl_from.`block_2`, tbl_to.`tahsil_2`=tbl_from.`tahsil_2`, tbl_to.`checkbox_alternate_address`=tbl_from.`checkbox_alternate_address`, tbl_to.`working_experience_type`=tbl_from.`working_experience_type`, tbl_to.`working_company_name`=tbl_from.`working_company_name`, tbl_to.`family_photo_upload`=tbl_from.`family_photo_upload`, tbl_to.`application_status`=tbl_from.`application_status`, tbl_to.`company_id`=tbl_from.`company_id`, tbl_to.`bank_available`=tbl_from.`bank_available` WHERE `nid`='$nid';"; $sqq = "UPDATE `$change_table_name_to` tbl_to INNER JOIN `$change_table_name_from` tbl_from USING (`nid`) SET tbl_to.`nid`=tbl_from.`nid`, tbl_to.`cid`=tbl_from.`cid`, tbl_to.`customer_name`=tbl_from.`customer_name`, tbl_to.`first_name`=tbl_from.`first_name`, tbl_to.`middle_name`=tbl_from.`middle_name`, tbl_to.`last_name`=tbl_from.`last_name`, tbl_to.`father_name`=tbl_from.`father_name`, tbl_to.`mother_name`=tbl_from.`mother_name`, tbl_to.`phone`=tbl_from.`phone`, tbl_to.`phone2`=tbl_from.`phone2`, tbl_to.`emailid`=tbl_from.`emailid`, tbl_to.`dob`=tbl_from.`dob`, tbl_to.`gender`=tbl_from.`gender`, tbl_to.`mstatus`=tbl_from.`mstatus`, tbl_to.`wife_name`=tbl_from.`wife_name`, tbl_to.`mohalla`=tbl_from.`mohalla`, tbl_to.`village`=tbl_from.`village`, tbl_to.`post`=tbl_from.`post`, tbl_to.`state`=tbl_from.`state`, tbl_to.`district`=tbl_from.`district`, tbl_to.`pincode`=tbl_from.`pincode`, tbl_to.`thana`=tbl_from.`thana`, tbl_to.`skilled`=tbl_from.`skilled`, tbl_to.`skilled_type`=tbl_from.`skilled_type`, tbl_to.`skilled_upload`=tbl_from.`skilled_upload`, tbl_to.`emp_no`=tbl_from.`emp_no`, tbl_to.`approved_emp_no`=tbl_from.`approved_emp_no`, tbl_to.`epf_expiry`=tbl_from.`epf_expiry`, tbl_to.`ip_detail`=tbl_from.`ip_detail`, tbl_to.`insurance_policy_no`=tbl_from.`insurance_policy_no`, tbl_to.`insurance_company`=tbl_from.`insurance_company`, tbl_to.`s_price`=tbl_from.`s_price`, tbl_to.`nominee`=tbl_from.`nominee`, tbl_to.`nominee_relation`=tbl_from.`nominee_relation`, tbl_to.`nominee_other`=tbl_from.`nominee_other`, tbl_to.`epf_detail`=tbl_from.`epf_detail`, tbl_to.`epf_reg`=tbl_from.`epf_reg`, tbl_to.`epf_upload`=tbl_from.`epf_upload`, tbl_to.`acc_holder_name`=tbl_from.`acc_holder_name`, tbl_to.`acc_no`=tbl_from.`acc_no`, tbl_to.`ifsc`=tbl_from.`ifsc`, tbl_to.`bank_name`=tbl_from.`bank_name`, tbl_to.`bank_branch`=tbl_from.`bank_branch`, tbl_to.`bank_address`=tbl_from.`bank_address`, tbl_to.`pan_no`=tbl_from.`pan_no`, tbl_to.`pan_detail`=tbl_from.`pan_detail`, tbl_to.`pan_upload`=tbl_from.`pan_upload`, tbl_to.`clogo`=tbl_from.`clogo`, tbl_to.`emp_sign`=tbl_from.`emp_sign`, tbl_to.`block`=tbl_from.`block`, tbl_to.`tahsil`=tbl_from.`tahsil`, tbl_to.`nationality`=tbl_from.`nationality`, tbl_to.`childs`=tbl_from.`childs`, tbl_to.`identity_type`=tbl_from.`identity_type`, tbl_to.`name_on_identity`=tbl_from.`name_on_identity`, tbl_to.`identity_no`=tbl_from.`identity_no`, tbl_to.`identity_upload`=tbl_from.`identity_upload`, tbl_to.`full_address`=tbl_from.`full_address`, tbl_to.`edit_status`='no', tbl_to.`edit_date`=tbl_from.`edit_date`, tbl_to.`edit_by`=tbl_from.`edit_by`, tbl_to.`reg_date`=tbl_from.`reg_date`, tbl_to.`work_type`=tbl_from.`work_type`, tbl_to.`passbook_upload`=tbl_from.`passbook_upload`, tbl_to.`form_status`=tbl_from.`form_status`, tbl_to.`ip_expiry`=tbl_from.`ip_expiry`, tbl_to.`updated_date`='$updated_date', tbl_to.`updated_by`='$admin_cid', tbl_to.`accepted_by`=tbl_from.`accepted_by`, tbl_to.`accepted_date`=tbl_from.`accepted_date`, tbl_to.`address_type`=tbl_from.`address_type`, tbl_to.`name_on_address`=tbl_from.`name_on_address`, tbl_to.`address_no`=tbl_from.`address_no`, tbl_to.`address_upload`=tbl_from.`address_upload`, tbl_to.`other_upload`=tbl_from.`other_upload`, tbl_to.`acc_holder_name_2`=tbl_from.`acc_holder_name_2`, tbl_to.`acc_no_2`=tbl_from.`acc_no_2`, tbl_to.`ifsc_2`=tbl_from.`ifsc_2`, tbl_to.`bank_name_2`=tbl_from.`bank_name_2`, tbl_to.`bank_branch_2`=tbl_from.`bank_branch_2`, tbl_to.`bank_address_2`=tbl_from.`bank_address_2`, tbl_to.`passbook_upload_2`=tbl_from.`passbook_upload_2`, tbl_to.`reg_date1`=tbl_from.`reg_date1`, tbl_to.`relation_proof_upload`=tbl_from.`relation_proof_upload`, tbl_to.`relation_proof_no`=tbl_from.`relation_proof_no`, tbl_to.`relation_proof_date`=tbl_from.`relation_proof_date`, tbl_to.`payment_status`=tbl_from.`payment_status`, tbl_to.`payment_reference_no`=tbl_from.`payment_reference_no`, tbl_to.`payment_order_id`=tbl_from.`payment_order_id`, tbl_to.`payment_trans_date`=tbl_from.`payment_trans_date`, tbl_to.`mohalla_2`=tbl_from.`mohalla_2`, tbl_to.`village_2`=tbl_from.`village_2`, tbl_to.`post_2`=tbl_from.`post_2`, tbl_to.`state_2`=tbl_from.`state_2`, tbl_to.`district_2`=tbl_from.`district_2`, tbl_to.`pincode_2`=tbl_from.`pincode_2`, tbl_to.`thana_2`=tbl_from.`thana_2`, tbl_to.`block_2`=tbl_from.`block_2`, tbl_to.`tahsil_2`=tbl_from.`tahsil_2`, tbl_to.`checkbox_alternate_address`=tbl_from.`checkbox_alternate_address`, tbl_to.`working_experience_type`=tbl_from.`working_experience_type`, tbl_to.`working_company_name`=tbl_from.`working_company_name`, tbl_to.`family_photo_upload`=tbl_from.`family_photo_upload`, tbl_to.`application_status`=tbl_from.`application_status`, tbl_to.`company_id`=tbl_from.`company_id`, tbl_to.`bank_available`=tbl_from.`bank_available`,tbl_to.`n_reason`=tbl_from.`n_reason`, tbl_to.`n_remark`=tbl_from.`n_remark` WHERE tbl_from.`nid`='$nid' AND tbl_from.edit_type='NEW' AND tbl_from.edit_txn='$edit_txn';"; } else { $sqq = "UPDATE `$change_table_name_to` SET `updated_by`='$admin_cid',`edit_status`='no',`updated_date`='$updated_date' WHERE `nid`='$nid'"; } // echo $sqq; $qup = mysqli_query($this->conn, $sqq); if ($qup) { $sq3 = "UPDATE `$change_table_name_from` SET `updated_by`='$admin_cid',`edit_status`='no',`updated_date`='$updated_date' WHERE `nid`='$nid'"; $qu3 = mysqli_query($this->conn, $sq3); if ($change_table_name_to == 'nominee_details') { $sq4 = "UPDATE `employee` SET `nominee`='$nominee_name',`nominee_relation`='$nominee_relation',`nominee_other`='$nominee_other' WHERE `cid`='$cid'"; $qu4 = mysqli_query($this->conn, $sq4); } } // echo mysqli_error($this->conn); return $qu3; } public function employee_phone($phone) { // $sq = "SELECT * FROM `employee` WHERE (application_status IN ('accepted','pro_accepted')) AND (phone='$phone' or phone2='$phone')"; // $sq = "SELECT * FROM `employee` WHERE (application_status IN ('accepted','pro_accepted','rejected','waiting')) AND (phone='$phone' or phone2='$phone')"; // $sq = "SELECT * FROM `employee` WHERE (application_status not IN ('unaccepted','extra_emp','emergency','old_emergency')) AND (phone='$phone' or phone2='$phone')"; $sq = "SELECT * FROM `employee` WHERE (application_status not IN ('unaccepted','extra_emp','emergency','old_emergency')) AND phone='$phone'"; $qu1 = mysqli_query($this->conn, $sq); // $res= mysqli_fetch_assoc($qu1); return $qu1; } public function employee_phone_all($phone) { // $sq = "SELECT * FROM `employee` WHERE (phone='$phone' or phone2='$phone') AND application_status NOT IN ('emergency','old_emergency')"; $sq = "SELECT * FROM `employee` WHERE phone='$phone' AND application_status NOT IN ('emergency','old_emergency')"; $qu1 = mysqli_query($this->conn, $sq); // $res= mysqli_fetch_assoc($qu1); return $qu1; } public function view_employee_byphone($phone) { $sq = "SELECT * FROM `employee` WHERE phone='$phone'"; $qu1 = mysqli_query($this->conn, $sq); $res = mysqli_fetch_assoc($qu1); return $res; } public function check_agreement_loy($name, $number) { if ($name == 'agreement') { $sq = "SELECT * FROM `employee_details_agreement` WHERE agreement_number='$number'"; } else if ($name == 'loy') { $sq = "SELECT * FROM `employee_details_agreement` WHERE loy_number='$number'"; } $qu1 = mysqli_query($this->conn, $sq); return $qu1; } public function update_employee11($emp_id) { $fname = $_POST['f_name']; $mname = $_POST['m_name']; $lname = $_POST['l_name']; $fullname = $fname . ' ' . $mname . ' ' . $lname; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; // $phone = $_POST['phone']; // $phone2 = $_POST['phone2']; // $email = $_POST['email']; $dob = $_POST['dob']; // echo $emp_no = 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $_POST['emp_no']; $emp_no = $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only if ($_FILES["emp_img"]["name"] != '') { $target_dir = "../include/uploads/"; $t_dir = "include/uploads/"; // only for url image use IN db $target_file = $target_dir . basename($_FILES["emp_img"]["name"]); $target_file1 = $t_dir . $emp_no . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["emp_img"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["emp_img"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["emp_img"]["tmp_name"], $target_dir . $emp_no . ".jpg")) { $emp_img = $target_file . $_FILES["emp_img"]["tmp_name"]; $errtext = "The images " . basename($_FILES["emp_img"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } // } if ($x == 'ok') { $sq = "UPDATE `employee` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname',`father_name`='$father_name',`mother_name`='$mother_name',`clogo`='$target_file1',`dob`='$dob' WHERE `cid`='$emp_id'"; } } } else { $x = 'ok'; if ($x == 'ok') { $sq = "UPDATE `employee` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname',`father_name`='$father_name',`mother_name`='$mother_name',`dob`='$dob' WHERE `cid`='$emp_id'"; } } if ($x == 'ok') { // echo $sq = "UPDATE `employee` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname',`father_name`='$father_name',`mother_name`='$mother_name',`clogo`='$target_file1',`dob`='$dob' WHERE `cid`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Employee Personal Details Updated Successfully.'; // $_SESSION['emp_no'] = $emp_no; echo "<script>location.href='view_employee.php?q=$emp_id';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Employee Detail Updation Failed.'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function update_employee($emp_id, $admin_cid) { $edit_date = date("Y-m-d H:i:s"); $fname = $_POST['f_name']; $mname = $_POST['m_name']; $lname = $_POST['l_name']; $fullname = $fname . ' ' . $mname . ' ' . $lname; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; $phone = $_POST['phone']; $phone2 = $_POST['phone2']; $email = $_POST['email']; $dob = $_POST['dob']; // $emp_no = $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $childs = $_POST['childs']; $zone = $_POST['zone']; $s_engineer = $_POST['s_engineer']; $ex_engineer = $_POST['ex_engineer']; $new_substation = $electry_city = $_POST['electry_city']; $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $pincode = $_POST['pincode']; $post = $_POST['post']; $city = $_POST['city']; $state = $_POST['state']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $ipno = $_POST['ipno']; $ic = $_POST['ic']; $ip_expiry = $_POST['ip_expiry']; $samprice = $_POST['samprice']; $nominee = $_POST['nominee']; $nominee_rel = $_POST['nominee_rel']; $nominee_other = $_POST['nominee_other']; $epf_detail = $_POST['epf_detail']; $epf = $_POST['epf']; $emp_joining_date = $_POST['emp_joining_date']; $basic_salary = $_POST['basic_salary']; $emp_ajency = $_POST['emp_ajency']; $esic_detail = $_POST['esic_detail']; $esic_no = $_POST['esic_no']; // $epf_expiry = $_POST['epf_expiry']; $pan_detail = $_POST['pan_detail']; $pan_no = $_POST['pan_no']; $work_type = $_POST['work_type']; $skilled = $_POST['skilled']; $gender = $_POST['gender']; $name_on_identity = $_POST['name_on_identity']; $ifsc_2 = $_POST['ifsc_2']; $bank_name_2 = $_POST['bank_name_2']; $bank_branch_2 = $_POST['bank_branch_2']; $bank_address_2 = $_POST['bank_address_2']; $accname_2 = $_POST['accname_2']; $accnumber_2 = $_POST['accnumber_2']; $group_name = $_POST['group_name']; $sub_group_name = $_POST['sub_group_name']; $nationality = $_POST['nationality']; $religion = $_POST['religion']; $community = $_POST['community']; $caste = $_POST['caste']; $edit_by = $admin_cid; $esic_uhid = $_REQUEST['esic_uhid']; $esic_registration_date = $_REQUEST['esic_registration_date']; $esic_appointment_date = $_REQUEST['esic_appointment_date']; $esic_dispensary_name_id = $_REQUEST['esic_dispensary_name_id']; $esic_dispensary_name = $_REQUEST['esic_dispensary_name']; $esic_dispensary_name_family_id = $_REQUEST['esic_dispensary_name_family_id']; $esic_dispensary_name_family = $_REQUEST['esic_dispensary_name_family']; $outsource_emp = $_REQUEST['outsource_emp']; $sel_agreement = $_REQUEST['sel_agreement']; $feeder_id = $_REQUEST['feeder_id']; // $recommended_by_id = $_REQUEST['recommended_by_id']; // $recommended_by_name = $_REQUEST['recommended_by_name']; $sq_check = "SELECT * FROM employee_edited WHERE `cid`='$emp_id'"; $qu_result = mysqli_query($this->conn, $sq_check); $num_rows = mysqli_num_rows($qu_result); //If it is not existing, create the entery $emp_result = $this->employee_details($emp_id); $emp_details = mysqli_fetch_assoc($emp_result); $prev_substation = $emp_details['electrycity_zone']; if ($prev_substation != $new_substation) { $this->change_employee_substations_edited($emp_id, $new_substation, $admin_cid); } if ($num_rows == 0) { $sq_copy = "INSERT INTO employee_edited SELECT * FROM employee WHERE `cid`='$emp_id'"; $qu_copy = mysqli_query($this->conn, $sq_copy); } else { $sq_copy = "REPLACE INTO `employee_edited` SELECT * FROM `employee` WHERE `cid`='$emp_id'"; $qu_copy = mysqli_query($this->conn, $sq_copy); } // else { // //and if existing save it as a variable // } // if ($qu_copy) { $sq = "UPDATE `employee_edited` SET `basic_salary`='$basic_salary',`customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname',`father_name`='$father_name',`mother_name`='$mother_name',`phone`='$phone',`phone2`='$phone2',`emailid`='$email',`dob`='$dob',`gender`='$gender',`mstatus`='$mstatus',`wife_name`='$wife_name',`mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`insurance_policy_no`='$ipno',`insurance_company`='$ic',`s_price`='$samprice',`nominee`='$nominee',`nominee_relation`='$nominee_rel',`nominee_other`='$nominee_other',`epf_detail`='$epf_detail',`epf_reg`='$epf',`esic_detail`='$esic_detail',`esic_regno`='$esic_no',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`acc_holder_name_2`='$accname_2',`acc_no_2`='$accnumber_2',`ifsc_2`='$ifsc_2',`bank_name_2`='$bank_name_2',`bank_branch_2`='$bank_branch_2',`bank_address_2`='$bank_address_2',`pan_no`='$pan_no',`pan_detail`='$pan_detail',`block`='$block',`tahsil`='$tahsil',`childs`='$childs',`identity_type`='$identity_type',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`zone`='$zone',`s_engineer`='$s_engineer',`ex_engineer`='$ex_engineer',`electrycity_zone`='$electry_city',`work_type`='$work_type',`ip_expiry`='$ip_expiry',`skilled`='$skilled',`emp_joining_date`='$emp_joining_date',`recommended_by`='$emp_ajency',`edit_status`='yes',`edit_date`='$edit_date',`edit_by`='$edit_by',`updated_date`='$edit_date',`approve_by_admin_id`='$admin_cid',`e_g_id`='$group_name',`e_s_g_id`='$sub_group_name' WHERE `cid`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); // $sq = "UPDATE `employee` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname',`father_name`='$father_name',`mother_name`='$mother_name',`phone`='$phone',`phone2`='$phone2',`emailid`='$email',`dob`='$dob',`gender`='$gender',`mstatus`='$mstatus',`wife_name`='$wife_name',`mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`insurance_policy_no`='$ipno',`insurance_company`='$ic',`s_price`='$samprice',`nominee`='$nominee',`nominee_relation`='$nominee_rel',`nominee_other`='$nominee_other',`epf_detail`='$epf_detail',`epf_reg`='$epf',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`pan_no`='$pan_no',`pan_detail`='$pan_detail',`block`='$block',`tahsil`='$tahsil',`childs`='$childs',`identity_type`='$identity_type',`identity_no`='$identity_no',`zone`='$zone',`s_engineer`='$s_engineer',`ex_engineer`='$ex_engineer',`electrycity_zone`='$electry_city',`work_type`='$work_type',`ip_expiry`='$ip_expiry',`skilled`='$skilled',`edit_status`='yes',`edit_date`='$edit_date',`updated_date`='$edit_date',`approve_by_admin_id`='$admin_cid' WHERE `cid`='$emp_id'"; // $sq = "UPDATE `employee` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname',`father_name`='$father_name',`mother_name`='$mother_name',`phone`='$phone',`phone2`='$phone2',`emailid`='$email',`dob`='$dob',`gender`='$gender',`mstatus`='$mstatus',`wife_name`='$wife_name',`mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`insurance_policy_no`='$ipno',`insurance_company`='$ic',`s_price`='$samprice',`nominee`='$nominee',`nominee_relation`='$nominee_rel',`nominee_other`='$nominee_other',`epf_detail`='$epf_detail',`epf_reg`='$epf',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`pan_no`='$pan_no',`pan_detail`='$pan_detail',`block`='$block',`tahsil`='$tahsil',`childs`='$childs',`identity_type`='$identity_type',`identity_no`='$identity_no',`zone`='$zone',`s_engineer`='$s_engineer',`ex_engineer`='$ex_engineer',`electrycity_zone`='$electry_city',`work_type`='$work_type',`ip_expiry`='$ip_expiry',`skilled`='$skilled',`edit_status`='yes',`edit_date`='$edit_date',`updated_date`='$edit_date',`approve_by_admin_id`='$admin_cid' WHERE `cid`='$emp_id'"; // $sq = "INSERT INTO `employee_edited`(`cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `application_status`, `edit_status`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`) VALUES ('$emp_id','$fullname','$fname','$mname','$lname','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$mohalla','$village','$post','$state','$city','$pincode','$thana','$skilled','$skilled_type','$skilled_upload','$emp_no','$approved_emp_no','$epf_expiry','$ip_detail','$ipno','$ic','$samprice','$nominee','$nominee_rel','$nominee_other','$epf_detail','$epf','$epf_upload','$accname','$accnumber','$ifsc','$bank_name','$bank_branch','$bank_address','$pan_no','$pan_detail','$pan_upload','$clogo','$block','$tahsil','$nationality','$childs','$identity_type','$identity_no','$identity_upload','$full_address','$zone','$s_engineer','$ex_engineer','$electry_city','$application_status','$edit_status','$edit_date','$reg_date','$work_type','$passbook_upload','$form_status','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','')"; if ($qu) { // $sq_emp = "UPDATE `employee` SET `edit_status`='yes',`edit_date`='$edit_date',`updated_date`='$edit_date',`approve_by_admin_id`='$admin_cid' WHERE `cid`='$emp_id'"; $sq_emp = "UPDATE `employee` SET `edit_status`='yes',`edit_date`='$edit_date',`edit_by`='$edit_by' WHERE `cid`='$emp_id'"; $qu_emp = mysqli_query($this->conn, $sq_emp); $sq_check_par = "SELECT * FROM `parents_details` WHERE `emp_id`='$emp_id'"; $qu_res = mysqli_query($this->conn, $sq_check_par); if (mysqli_num_rows($qu_res) > 0) { $sq_emp_p = "UPDATE `parents_details` SET `religion`='$religion',`caste`='$caste',`community`='$community', `outsource_emp`='$outsource_emp', `esic_uhid`='$esic_uhid', `esic_registration_date`='$esic_registration_date', `esic_appointment_date`='$esic_appointment_date', `esic_dispensary_name_id`='$esic_dispensary_name_id', `esic_dispensary_name`='$esic_dispensary_name', `esic_dispensary_name_family_id`='$esic_dispensary_name_family_id', `esic_dispensary_name_family`='$esic_dispensary_name_family', `updated_by_id`='$edit_by', `updated_date`='$edit_date', ag_id='$sel_agreement', feeder_id='$feeder_id' WHERE `emp_id`='$emp_id'"; $qu_emp_p = mysqli_query($this->conn, $sq_emp_p); } else { $sq_emp_p = "INSERT INTO `parents_details`(`p_id`, `emp_id`, `religion`, `caste`, `community`, `outsource_emp`, `esic_uhid`, `esic_registration_date`, `esic_appointment_date`, `esic_dispensary_name_id`, `esic_dispensary_name`, `esic_dispensary_name_family_id`, `esic_dispensary_name_family`, `added_by_id`, `added_by_name`, `added_by_sign`, `added_date`, `ag_id`, `feeder_id`) VALUES (NULL,'$emp_id','$religion','$caste','$community','$outsource_emp','$esic_uhid','$esic_registration_date','$esic_appointment_date','$esic_dispensary_name_id','$esic_dispensary_name','$esic_dispensary_name_family_id','$esic_dispensary_name_family','$admin_cid','','','$edit_date', '$sel_agreement', '$feeder_id')"; $qu_emp_p = mysqli_query($this->conn, $sq_emp_p); // $p_id = mysqli_insert_id($this->conn); } $_SESSION['msg'] = 'Employee Personal Details Updated Successfully.'; // $_SESSION['emp_no'] = $emp_no; echo "<script>location.href='view_employee_status.php?q=$emp_id';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Employee Detail Updation Failed.'; echo '<meta http-equiv="refresh" content="0">'; } // } else { // $_SESSION['err_msg'] = 'Oops! Employee Detail Updation Failed.'; // echo '<meta http-equiv="refresh" content="0">'; // } } public function update_employee_upload($emp_id, $added_by) { $added_time = date('Y-m-d H:i:s'); $added_date = date('Y-m-d'); $image_type = $_POST['image_type']; // echo $emp_no = 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $_POST['emp_no']; $emp_no = date('YmdHis') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only // if ($image_type == 'passbook') { // } $target_dir = "../include/temp_img_upload/"; $t_dir = "../include/temp_img_upload/"; // only for url image use IN db $target_file = $target_dir . basename($_FILES["emp_img"]["name"]); $target_file1 = $t_dir . $emp_no . $image_type . '.jpg'; $image_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["emp_img"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["emp_img"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["emp_img"]["tmp_name"], $target_dir . $emp_no . $image_type . ".jpg")) { $emp_img = $target_file . $_FILES["emp_img"]["tmp_name"]; $errtext = "The images " . basename($_FILES["emp_img"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } if ($x == 'ok') { $sq = "INSERT INTO `update_image`(`image_url`, `image_type`, `cid`, `added_by`, `added_time`, `added_date`) VALUES ('$image_url','$image_type','$emp_id','$added_by','$added_time','$added_date')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Employee Image Updated Successfully.'; // $_SESSION['emp_no'] = $emp_no; // echo "<script>location.href='view_employee.php?q=$emp_id';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Employee Detail Updation Failed.'; // echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; // echo '<meta http-equiv="refresh" content="0">'; } echo '<meta http-equiv="refresh" content="0">'; } public function change_image_status($status, $emp_id, $image_type, $admin_id, $image_id) { $DATE = date("Y-m-d H:i:s"); if ($status == 'accepted') { $sq1 = "SELECT * FROM `update_image` WHERE `img_id`='$image_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['image_url']; $sq = "UPDATE `update_image` SET `img_status`='$status',`accepted_date`='$DATE' WHERE `img_id`='$image_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; if ($image_type == 'updatephoto') { $column = 'clogo'; } else if ($image_type == 'updatesign') { $column = 'emp_sign'; } else if ($image_type == 'voterid') { $column = 'identity_upload'; } else if ($image_type == 'drivinglicence') { $column = 'identity_upload'; } else if ($image_type == 'aadhaarcard') { $column = 'identity_upload'; $cnd = " , address_upload='$image_url'"; } else if ($image_type == 'passport') { $column = 'identity_upload'; } else if ($image_type == 'pancard') { $column = 'pan_upload'; $cnd = " , pan_detail='yes'"; } else if ($image_type == 'passbook') { $column = 'passbook_upload'; } else if ($image_type == 'passbook_2') { $column = 'passbook_upload_2'; } else if ($image_type == 'Skilled') { $column = 'skilled_upload'; // $cnd = " , skilled='Skilled'"; } else if ($image_type == 'letter') { $column = 'other_upload'; } else if ($image_type == 'other') { $column = 'other_upload'; } // $sq2="SELECT * FROM `update_image` WHERE cid=$emp_id"; // echo $sq1 = "UPDATE employee e INNER JOIN update_image ui ON e.cid=ui.cid SET e.$column=ui.image_url,`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd;"; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`updated_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); } } else { $sq1 = "UPDATE `update_image` SET `img_status`='$status',`accepted_date`='$DATE' WHERE `img_id`='$image_id'"; $qu1 = mysqli_query($this->conn, $sq1); } return $qu1; } public function select_updated_upload() { // $sq = "SELECT ui.*,customer_name,phone,emp_no,approved_emp_no FROM `update_image` ui INNER JOIN employee e ON e.cid=ui.cid WHERE img_status='unaccepted'"; $sq = "SELECT ui.*,customer_name,phone,emp_no,approved_emp_no,`sub_admin`.`user_name` as admin_name FROM `update_image` ui INNER JOIN employee e ON e.cid=ui.cid INNER JOIN `sub_admin` ON ui.`added_by`=`sub_admin`.`id` WHERE img_status='unaccepted' ORDER BY ui.added_date desc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function update_insurance($emp_id) { $ipno = $_POST['ipno']; $ic = $_POST['ic']; $ip_expiry = $_POST['ip_expiry']; $samprice = $_POST['samprice']; $sq = "UPDATE `employee` SET `ip_detail`='yes',`insurance_policy_no`='$ipno',`insurance_company`='$ic',`ip_expiry`='$ip_expiry',`s_price`='$samprice' WHERE `cid` IN ($emp_id)"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Employee Insurance Details Updated Successfully.'; echo '<meta http-equiv="refresh" content="0">'; // $_SESSION['emp_no'] = $emp_no;update_epf_details // echo "<script>location.href='list_client.php';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Employee Detail Updation Failed.'; echo '<meta http-equiv="refresh" content="0">'; } } public function update_epf($emp_id) { // $ipno = $_POST['ipno']; // $ic = $_POST['ic']; // $ip_expiry = $_POST['ip_expiry']; // $samprice = $_POST['samprice']; $epf_detail = $_POST['epf_detail']; $epf = $_POST['epf']; // echo $sq = "UPDATE `employee` SET `insurance_policy_no`='$ipno',`insurance_company`='$ic',`ip_expiry`='$ip_expiry',`s_price`='$samprice',`nominee`='$nominee',`nominee_relation`='$nominee_rel',`nominee_other`='$nominee_other',`epf_detail`='$epf_detail',`epf_reg`='$epf' WHERE `cid` IN ($emp_id)"; $sq = "UPDATE `employee` SET `epf_detail`='$epf_detail',`epf_reg`='$epf' WHERE `cid` IN ($emp_id)"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Employee EPF Detail Updated Successfully.'; echo '<meta http-equiv="refresh" content="0">'; // $_SESSION['emp_no'] = $emp_no;update_epf_details // echo "<script>location.href='list_client.php';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Employee Detail Updation Failed.'; echo '<meta http-equiv="refresh" content="0">'; } } public function select_expired_insurance() { // SELECT * FROM `employee` WHERE `ip_expiry` BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 7 DAY) $sq = "SELECT * FROM `employee` WHERE `ip_expiry`<=DATE_ADD(CURDATE(), INTERVAL 7 DAY)"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function select_updated_employee() { // $sq = "SELECT * FROM `employee` WHERE `edit_status`='yes'"; $sq = "SELECT `employee`.*,`sub_admin`.`user_name` as admin_name FROM `employee` INNER JOIN `sub_admin` ON `employee`.`edit_by`=`sub_admin`.`id` WHERE `edit_status`='yes' ORDER BY edit_date desc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function select_updated_detail_of_table($table_name) { $sq = "SELECT tbl_name.*,`sub_admin`.`user_name` as admin_name FROM `$table_name` as tbl_name INNER JOIN `sub_admin` ON tbl_name.`edit_by`=`sub_admin`.`id` WHERE `edit_status`='yes' ORDER BY edit_date DESC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Update dispensary details public function update_dispensary($id) { $prev_sq = $this->select_row_query("dispensary", "d_id='$id'"); $prev_dispensary_name = $prev_sq['dispensary_name']; $dispensary_name = $_POST['dispensary']; $dispensary_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $sq11 = "UPDATE `dispensary` SET `prev_dispensary_name`=`dispensary_name`, `dispensary_name`='$dispensary_name', `dispensary_updated_by`='$admin_cid', `dispensary_updated_name`='$admin_name', `dispensary_updated_date`='$dispensary_updated_date' WHERE d_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { if ($prev_dispensary_name != $dispensary_name) { // $sq_new = "UPDATE `employee` SET `dispensary`='$dispensary_name' WHERE dispensary='$prev_dispensary_name'"; // $qu_new = mysqli_query($this->conn, $sq_new); // $sq_new_1 = "UPDATE `employee_acc_wages` SET `dispensary`='$dispensary_name' WHERE dispensary='$prev_dispensary_name'"; // $qu_new_1 = mysqli_query($this->conn, $sq_new_1); // $sq_new_2 = "UPDATE `salary_table_combined` SET `sal_dispensary`='$dispensary_name' WHERE sal_dispensary='$prev_dispensary_name'"; // $qu_new_2 = mysqli_query($this->conn, $sq_new_2); } $_SESSION['msg'] = "Dispensary Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="5">'; } // delete dispensary public function delete_dispensary($id) { $sq11 = "UPDATE dispensary SET status='0' WHERE d_id='$id'"; // $sq11 = "DELETE FROM dispensary WHERE d_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Dispensary Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo "<script> setTimeout(function () { // location.href='add_dispensary.php'; // }, 6000);</script>"; echo "<script> setTimeout(function () { window.history.back(); }, 6000);</script>"; } // Update dispensary details public function update_discom($id) { $prev_sq = $this->select_row_query("discom", "d_id='$id'"); $prev_discom_name = $prev_sq['discom_name']; $helpline_no_prev = $prev_sq['helpline_no']; $discom_name = $_POST['discom']; $helpline_no = $_POST['helpline_no']; $discom_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $discom_name_hindi = $_POST['discom_name_hindi']; $discom_postal_address_1 = $_POST['discom_postal_address_1']; $discom_postal_address_2 = $_POST['discom_postal_address_2']; $discom_postal_address_3 = $_POST['discom_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_no_discom = $_POST['contact_no_discom']; $contact_email_discom = $_POST['contact_email_discom']; $contact_officer_discom = $_POST['contact_officer_discom']; $contact_officer_discom_hindi = $_POST['contact_officer_discom_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_discom']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_discom']; $sq11 = "UPDATE `discom` SET `prev_discom_name`=`discom_name`, `discom_name`='$discom_name', `helpline_no_prev`=`helpline_no`, `helpline_no`='$helpline_no', `discom_updated_by`='$admin_cid', `discom_updated_name`='$admin_name', `discom_updated_date`='$discom_updated_date', `discom_name_hindi`='$discom_name_hindi', `discom_postal_address_1`='$discom_postal_address_1', `discom_postal_address_2`='$discom_postal_address_2', `discom_postal_address_3`='$discom_postal_address_3'" . ",`print_applicable_1_discom`='$print_applicable_1',`print_applicable_2_discom`='$print_applicable_2',`print_applicable_3_discom`='$print_applicable_3',`print_language_discom`='$print_language',`print_designation_1_discom`='$print_designation_1',`print_designation_2_discom`='$print_designation_2',`print_designation_3_discom`='$print_designation_3',`print_designation_hindi_1_discom`='$print_designation_hindi_1',`print_designation_hindi_2_discom`='$print_designation_hindi_2',`print_designation_hindi_3_discom`='$print_designation_hindi_3',`print_heading_1_discom`='$print_heading_1',`print_heading_2_discom`='$print_heading_2',`print_heading_3_discom`='$print_heading_3',`print_heading_hindi_1_discom`='$print_heading_hindi_1',`print_heading_hindi_2_discom`='$print_heading_hindi_2',`print_heading_hindi_3_discom`='$print_heading_hindi_3', `contact_no_discom`='$contact_no_discom', `contact_email_discom`='$contact_email_discom',`contact_officer_discom`='$contact_officer_discom',`contact_officer_discom_hindi`='$contact_officer_discom_hindi',`contact_officer_designation_discom`='$contact_officer_designation',`contact_officer_designation_hindi_discom`='$contact_officer_designation_hindi' WHERE d_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { if ($prev_discom_name != $discom_name) { // $sq_new = "UPDATE `employee` SET `discom`='$discom_name' WHERE discom='$prev_discom_name'"; // $qu_new = mysqli_query($this->conn, $sq_new); // $sq_new_1 = "UPDATE `employee_acc_wages` SET `discom`='$discom_name' WHERE discom='$prev_discom_name'"; // $qu_new_1 = mysqli_query($this->conn, $sq_new_1); // $sq_new_2 = "UPDATE `salary_table_combined` SET `sal_discom`='$discom_name' WHERE sal_discom='$prev_discom_name'"; // $qu_new_2 = mysqli_query($this->conn, $sq_new_2); } $_SESSION['msg'] = "Discom Updated Successfully. " . mysqli_error($this->conn); } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="5">'; } // delete discom public function delete_discom($id) { $sq11 = "UPDATE discom SET status='0' WHERE d_id='$id'"; // $sq11 = "DELETE FROM discom WHERE d_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Discom Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo "<script> setTimeout(function () { // location.href='add_discom.php'; // }, 6000);</script>"; echo "<script> setTimeout(function () { window.history.back(); }, 6000);</script>"; } public function zone_details($id) { $sq3 = "SELECT * FROM `zone` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `zone_id`='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } // Update zone details public function update_zone($id) { $prev_sq = $this->zone_details($id); $discom_id = $_POST['discom']; $prev_zone_name = $prev_sq['zone_name']; $zone_name = $_POST['zone']; $contact_officer_zone = $_POST['contact_officer_zone']; $contact_no_zone = $_POST['contact_no_zone']; $contact_email_zone = $_POST['contact_email_zone']; $zone_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $zone_name_hindi = $_POST['zone_name_hindi']; $zone_postal_address_1 = $_POST['zone_postal_address_1']; $zone_postal_address_2 = $_POST['zone_postal_address_2']; $zone_postal_address_3 = $_POST['zone_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_zone_hindi = $_POST['contact_officer_zone_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_zone']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_zone']; $sq11 = "UPDATE `zone` SET `discom_id`='$discom_id', `prev_zone_name`=`zone_name`, `zone_name`='$zone_name', `contact_officer_zone`='$contact_officer_zone', `contact_no_zone`='$contact_no_zone', `contact_email_zone`='$contact_email_zone',`zone_updated_by`='$admin_cid',`zone_updated_name`='$admin_name',`zone_updated_date`='$zone_updated_date',`zone_pincode`='$pincode',`zone_post`='$post',`zone_district`='$district',`zone_state`='$state',`zone_mohalla`='$mohalla',`zone_village`='$village',`zone_block`='$block',`zone_tahsil`='$tahsil',`zone_thana`='$thana',`zone_name_hindi`='$zone_name_hindi',`zone_postal_address_1`='$zone_postal_address_1',`zone_postal_address_2`='$zone_postal_address_2',`zone_postal_address_3`='$zone_postal_address_3'" . ",`print_applicable_1_zone`='$print_applicable_1',`print_applicable_2_zone`='$print_applicable_2',`print_applicable_3_zone`='$print_applicable_3',`print_language_zone`='$print_language',`print_designation_1_zone`='$print_designation_1',`print_designation_2_zone`='$print_designation_2',`print_designation_3_zone`='$print_designation_3',`print_designation_hindi_1_zone`='$print_designation_hindi_1',`print_designation_hindi_2_zone`='$print_designation_hindi_2',`print_designation_hindi_3_zone`='$print_designation_hindi_3',`print_heading_1_zone`='$print_heading_1',`print_heading_2_zone`='$print_heading_2',`print_heading_3_zone`='$print_heading_3',`print_heading_hindi_1_zone`='$print_heading_hindi_1',`print_heading_hindi_2_zone`='$print_heading_hindi_2',`print_heading_hindi_3_zone`='$print_heading_hindi_3',`contact_officer_zone_hindi`='$contact_officer_zone_hindi',`contact_officer_designation_zone`='$contact_officer_designation',`contact_officer_designation_hindi_zone`='$contact_officer_designation_hindi' WHERE zone_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { if ($prev_zone_name != $zone_name) { $sq_new = "UPDATE `employee` SET `zone`='$zone_name' WHERE zone='$prev_zone_name'"; $qu_new = mysqli_query($this->conn, $sq_new); $sq_new_1 = "UPDATE `employee_acc_wages` SET `zone`='$zone_name' WHERE zone='$prev_zone_name'"; $qu_new_1 = mysqli_query($this->conn, $sq_new_1); $sq_new_2 = "UPDATE `salary_table_combined` SET `sal_zone`='$zone_name' WHERE sal_zone='$prev_zone_name'"; $qu_new_2 = mysqli_query($this->conn, $sq_new_2); $sq_new_5 = "UPDATE `employee_transferred` SET `zone_name`='$zone_name' WHERE `edc_name`='$prev_zone_name'"; $qu_new_5 = mysqli_query($this->conn, $sq_new_5); $sq_new_6 = "UPDATE `employee_transferred` SET `zone_name_prev`='$zone_name' WHERE `edc_name_prev`='$prev_zone_name'"; $qu_new_6 = mysqli_query($this->conn, $sq_new_6); } $_SESSION['msg'] = "Zone Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong! ' . mysqli_error($this->conn); } echo '<meta http-equiv="refresh" content="5">'; } // delete zone public function delete_zone($id) { $sq11 = "UPDATE zone SET status='0' WHERE zone_id='$id'"; // $sq11 = "DELETE FROM zone WHERE zone_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Zone Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo "<script> setTimeout(function () { // location.href='add_zone.php'; // }, 6000);</script>"; echo "<script> setTimeout(function () { window.history.back(); }, 6000);</script>"; } //select edc using edc id public function edc_details_by_edcid($id) { $sq3 = "SELECT * FROM `super_engineer` WHERE `super_id` IN ($id)"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function get_supp_engg() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `super_engineer` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE zone.company_id='$company_id' ORDER BY super_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function super_engg_details($id) { $sq3 = "SELECT * FROM `super_engineer` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `super_id` IN ($id) ORDER BY super_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } //get super engineer using zone id public function get_super_engg_details($id) { $company_id = $_SESSION['company_id']; $sq3 = "SELECT * FROM `super_engineer` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `super_engineer`.`zone_id`='$id' AND zone.company_id='$company_id' ORDER BY super_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function update_super_engg($id) { $prev_sq = $this->super_engg_details($id); $zone_name = $prev_sq['zone_name']; $prev_super_name = $prev_sq['super_name']; $zone_id = $_POST['zone']; $super_name = $_POST['super_engg']; $contact_officer_super = $_POST['contact_officer_super']; $contact_no_super = $_POST['contact_no_super']; $contact_email_super = $_POST['contact_email_super']; $super_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $super_name_hindi = $_POST['super_name_hindi']; $super_postal_address_1 = $_POST['super_postal_address_1']; $super_postal_address_2 = $_POST['super_postal_address_2']; $super_postal_address_3 = $_POST['super_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_super_hindi = $_POST['contact_officer_super_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_super']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_super']; $sq11 = "UPDATE `super_engineer` SET `zone_id`='$zone_id', `prev_super_name`=`super_name`, `super_name`='$super_name', `contact_officer_super`='$contact_officer_super', `contact_no_super`='$contact_no_super', `contact_email_super`='$contact_email_super', `super_updated_by`='$admin_cid', `super_updated_date`='$super_updated_date',`super_pincode`='$pincode',`super_post`='$post',`super_district`='$district',`super_state`='$state',`super_mohalla`='$mohalla',`super_village`='$village',`super_block`='$block',`super_tahsil`='$tahsil',`super_thana`='$thana',`super_name_hindi`='$super_name_hindi',`super_postal_address_1`='$super_postal_address_1',`super_postal_address_2`='$super_postal_address_2',`super_postal_address_3`='$super_postal_address_3'" . ",`print_applicable_1_super`='$print_applicable_1',`print_applicable_2_super`='$print_applicable_2',`print_applicable_3_super`='$print_applicable_3',`print_language_super`='$print_language',`print_designation_1_super`='$print_designation_1',`print_designation_2_super`='$print_designation_2',`print_designation_3_super`='$print_designation_3',`print_designation_hindi_1_super`='$print_designation_hindi_1',`print_designation_hindi_2_super`='$print_designation_hindi_2',`print_designation_hindi_3_super`='$print_designation_hindi_3',`print_heading_1_super`='$print_heading_1',`print_heading_2_super`='$print_heading_2',`print_heading_3_super`='$print_heading_3',`print_heading_hindi_1_super`='$print_heading_hindi_1',`print_heading_hindi_2_super`='$print_heading_hindi_2',`print_heading_hindi_3_super`='$print_heading_hindi_3',`contact_officer_super_hindi`='$contact_officer_super_hindi',`contact_officer_designation_super`='$contact_officer_designation',`contact_officer_designation_hindi_super`='$contact_officer_designation_hindi' WHERE super_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { if ($prev_super_name != $super_name) { // $sq11 = "UPDATE `employee` SET `s_engineer`='$super_name' WHERE s_engineer='$prev_super_name' AND zone='$zone_name'"; // $qu11 = mysqli_query($this->conn, $sq11); $sq_new = "UPDATE `employee` SET `s_engineer`='$super_name' WHERE s_engineer='$prev_super_name' AND zone='$zone_name'"; $qu_new = mysqli_query($this->conn, $sq_new); $sq_new_1 = "UPDATE `employee_acc_wages` SET `s_engineer`='$super_name' WHERE s_engineer='$prev_super_name' AND zone='$zone_name'"; $qu_new_1 = mysqli_query($this->conn, $sq_new_1); $sq_new_2 = "UPDATE `salary_table_combined` SET `sal_edc`='$super_name' WHERE sal_edc='$prev_super_name' AND sal_zone='$zone_name'"; $qu_new_2 = mysqli_query($this->conn, $sq_new_2); $sq_new_5 = "UPDATE `employee_transferred` SET `edc_name`='$super_name' WHERE `edc_name`='$prev_super_name' AND `zone_name`='$zone_name'"; $qu_new_5 = mysqli_query($this->conn, $sq_new_5); $sq_new_6 = "UPDATE `employee_transferred` SET `edc_name_prev`='$super_name' WHERE `edc_name_prev`='$prev_super_name' AND `zone_name_prev`='$zone_name'"; $qu_new_6 = mysqli_query($this->conn, $sq_new_6); } $_SESSION['msg'] = "Superitendent Engineer Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong! ' . mysqli_error($this->conn); } echo '<meta http-equiv="refresh" content="5">'; } public function delete_super_engg($id) { $sq11 = "DELETE FROM super_engineer WHERE super_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Superitendent Engineer Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo "<script> setTimeout(function () { // location.href='add_superitendent_engg.php'; // }, 6000);</script>"; echo "<script> setTimeout(function () { window.history.back(); }, 6000);</script>"; } public function get_executive_engg() { $company_id = $_SESSION['company_id']; // $sq = "SELECT * FROM `executive_engineer` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id`"; $sq = "SELECT * FROM `executive_engineer` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE zone.company_id='$company_id' ORDER BY ex_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function executive_engg_details($id) { $sq3 = "SELECT * FROM `executive_engineer` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `ex_id`='$id' ORDER BY ex_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } //select edc using edd id public function edc_details($id) { // $sq3 = "SELECT * FROM `super_engineer` WHERE `super_id` IN ($id)"; $sq3 = "SELECT * FROM super_engineer WHERE super_id IN (SELECT super_id FROM executive_engineer WHERE ex_id IN ($id)) ORDER BY super_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } //select edc using edc id public function edd_details($id) { $sq3 = "SELECT * FROM `executive_engineer` WHERE `ex_id` IN ($id) ORDER BY ex_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function get_executive_engg_details($id) { $company_id = $_SESSION['company_id']; // $sq = "SELECT * FROM `executive_engineer` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id`"; $sq = "SELECT * FROM `executive_engineer` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `executive_engineer`.`super_id`='$id' AND zone.company_id='$company_id' ORDER BY ex_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function update_executive_engg($id) { $prev_sq = $this->executive_engg_details($id); $super_name = $prev_sq['super_name']; $prev_ex_name = $prev_sq['ex_name']; $ex_name = $_POST['ex_engg']; $super_id = $_POST['s_engineer']; // super id $remitt_email_id = $_POST['emailid']; $remitt_ifsc = $_POST['ifsc']; $remitt_bank_name = $_POST['bank_name']; $remitt_bank_branch = $_POST['bank_branch']; $remitt_branch_code = $_POST['branch_code']; $remitt_bank_address = $_POST['bank_address']; $remitt_acc_holder_name = $_POST['accname']; $remitt_acc_no = $_POST['accnumber']; $contact_officer_executive = $_POST['contact_officer_executive']; $contact_no_executive = $_POST['contact_no_executive']; $contact_email_executive = $_POST['contact_email_executive']; $edd_gst_no = $_POST['edd_gst_no']; $edd_pan_no = $_POST['edd_pan_no']; $edd_code = $_POST['edd_code']; $office_address = $_POST['office_address']; $office_contactno = $_POST['office_contactno']; $executive_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $whatsapp_number = $_POST['whatsapp_number']; $whatsapp_api_key = $_POST['whatsapp_api_key']; $ex_name_hindi = $_POST['ex_name_hindi']; $ex_postal_address_1 = $_POST['ex_postal_address_1']; $ex_postal_address_2 = $_POST['ex_postal_address_2']; $ex_postal_address_3 = $_POST['ex_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_executive_hindi = $_POST['contact_officer_executive_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_executive']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_executive']; // $sq = "SELECT * FROM `super_engineer` WHERE `super_id` IN (SELECT super_id FROM super_engineer WHERE super_name='$super_name')"; // $sup_res = mysqli_query($this->conn, $sq); // $result = mysqli_fetch_assoc($sup_res); // if ($result) { // $super_id = $result['super_id']; // $sq11 = "UPDATE `executive_engineer` SET `super_id`='$super_id',`ex_name`='$ex_name',`remitt_email_id`='$remitt_email_id',`remitt_ifsc`='$remitt_ifsc',`remitt_bank_name`='$remitt_bank_name',`remitt_bank_branch`='$remitt_bank_branch',`remitt_branch_code`='$remitt_branch_code',`remitt_bank_address`='$remitt_bank_address',`remitt_acc_holder_name`='$remitt_acc_holder_name',`remitt_acc_no`='$remitt_acc_no', `contact_officer_executive`='$contact_officer_executive', `contact_no_executive`='$contact_no_executive', `contact_email_executive`='$contact_email_executive', `executive_updated_by`='$admin_cid', `executive_updated_date`='$executive_updated_date', `office_address`='$office_address', `office_contactno`='$office_contactno', `edd_gst_no`='$edd_gst_no', `edd_pan_no`='$edd_pan_no', `edd_code`='$edd_code' WHERE ex_id='$id'"; $sq11 = "UPDATE `executive_engineer` SET `super_id`='$super_id', `prev_ex_name`=`ex_name`, `ex_name`='$ex_name',`remitt_email_id`='$remitt_email_id',`remitt_ifsc`='$remitt_ifsc',`remitt_bank_name`='$remitt_bank_name',`remitt_bank_branch`='$remitt_bank_branch',`remitt_branch_code`='$remitt_branch_code',`remitt_bank_address`='$remitt_bank_address',`remitt_acc_holder_name`='$remitt_acc_holder_name',`remitt_acc_no`='$remitt_acc_no', `contact_officer_executive`='$contact_officer_executive', `contact_no_executive`='$contact_no_executive', `contact_email_executive`='$contact_email_executive', `executive_updated_by`='$admin_cid', `executive_updated_date`='$executive_updated_date', `office_address`='$office_address', `office_contactno`='$office_contactno', `edd_gst_no`='$edd_gst_no', `edd_pan_no`='$edd_pan_no', `edd_code`='$edd_code',`executive_pincode`='$pincode',`executive_post`='$post',`executive_district`='$district',`executive_state`='$state',`executive_mohalla`='$mohalla',`executive_village`='$village',`executive_block`='$block',`executive_tahsil`='$tahsil',`executive_thana`='$thana', `whatsapp_number`='$whatsapp_number', `whatsapp_api_key`='$whatsapp_api_key', `ex_name_hindi`='$ex_name_hindi', `ex_postal_address_1`='$ex_postal_address_1', `ex_postal_address_2`='$ex_postal_address_2', `ex_postal_address_3`='$ex_postal_address_3'" . ",`print_applicable_1_executive`='$print_applicable_1',`print_applicable_2_executive`='$print_applicable_2',`print_applicable_3_executive`='$print_applicable_3',`print_language_executive`='$print_language',`print_designation_1_executive`='$print_designation_1',`print_designation_2_executive`='$print_designation_2',`print_designation_3_executive`='$print_designation_3',`print_designation_hindi_1_executive`='$print_designation_hindi_1',`print_designation_hindi_2_executive`='$print_designation_hindi_2',`print_designation_hindi_3_executive`='$print_designation_hindi_3',`print_heading_1_executive`='$print_heading_1',`print_heading_2_executive`='$print_heading_2',`print_heading_3_executive`='$print_heading_3',`print_heading_hindi_1_executive`='$print_heading_hindi_1',`print_heading_hindi_2_executive`='$print_heading_hindi_2',`print_heading_hindi_3_executive`='$print_heading_hindi_3',`contact_officer_executive_hindi`='$contact_officer_executive_hindi',`contact_officer_designation_executive`='$contact_officer_designation',`contact_officer_designation_hindi_executive`='$contact_officer_designation_hindi' WHERE ex_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { if ($prev_ex_name != $ex_name) { // $sq11 = "UPDATE `employee` SET `ex_engineer`='$ex_name' WHERE `ex_engineer`='$prev_ex_name' AND `s_engineer`='$super_name'"; // $qu11 = mysqli_query($this->conn, $sq11); $sq_new = "UPDATE `employee` SET `ex_engineer`='$ex_name' WHERE `ex_engineer`='$prev_ex_name' AND `s_engineer`='$super_name'"; $qu_new = mysqli_query($this->conn, $sq_new); $sq_new_1 = "UPDATE `employee_acc_wages` SET `ex_engineer`='$ex_name' WHERE `ex_engineer`='$prev_ex_name' AND `s_engineer`='$super_name'"; $qu_new_1 = mysqli_query($this->conn, $sq_new_1); $sq_new_2 = "UPDATE `salary_table_combined` SET `sal_edd`='$ex_name' WHERE `sal_edd`='$prev_ex_name' AND `sal_edc`='$super_name'"; $qu_new_2 = mysqli_query($this->conn, $sq_new_2); $sq_new_3 = "UPDATE `new_payments` SET `edd_name`='$ex_name' WHERE `edd_name`='$prev_ex_name'"; $qu_new_3 = mysqli_query($this->conn, $sq_new_3); $sq_new_5 = "UPDATE `employee_transferred` SET `edd_name`='$ex_name' WHERE `edd_name`='$prev_ex_name' AND `edc_name`='$super_name'"; $qu_new_5 = mysqli_query($this->conn, $sq_new_5); $sq_new_6 = "UPDATE `employee_transferred` SET `edd_name_prev`='$ex_name' WHERE `edd_name_prev`='$prev_ex_name' AND `edc_name_prev`='$super_name'"; $qu_new_6 = mysqli_query($this->conn, $sq_new_6); } $_SESSION['msg'] = "Executive Engineer Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong! ' . mysqli_error($this->conn); } // } else { // $_SESSION['err_msg'] = 'Something Went Wrong!'; // } echo '<meta http-equiv="refresh" content="5">'; } public function delete_executive_engg($id) { $sq11 = "DELETE FROM executive_engineer WHERE ex_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Executive Engineer Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo "<script> setTimeout(function () { // location.href='add_executive_engg.php'; // }, 6000);</script>"; echo "<script> setTimeout(function () { window.history.back(); }, 6000);</script>"; } public function get_edsd_engg() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `edsd_engineer` INNER JOIN `executive_engineer` ON `executive_engineer`.`ex_id`=`edsd_engineer`.`ex_id` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE zone.company_id='$company_id' ORDER BY edsd_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // search by edd id public function get_edsd_engg_details($id) { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `edsd_engineer` INNER JOIN `executive_engineer` ON `executive_engineer`.`ex_id`=`edsd_engineer`.`ex_id` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `edsd_engineer`.`ex_id`='$id' AND zone.company_id='$company_id' ORDER BY edsd_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // search by edsd id public function edsd_engg_details($id) { $sq3 = "SELECT * FROM `edsd_engineer` INNER JOIN `executive_engineer` ON `executive_engineer`.`ex_id`=`edsd_engineer`.`ex_id` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `edsd_id`='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function update_edsd_engg($id) { $prev_sq = $this->edsd_engg_details($id); $super_name = $prev_sq['super_name']; $prev_ex_name = $prev_sq['ex_name']; $prev_edsd_name = $prev_sq['edsd_name']; $super_id = $_POST['s_engineer']; // super id $ex_id = $ex_name = $_POST['ex_engineer']; // edd_id $edsd_name = $_POST['edsd_name']; // edsd name $remitt_email_id = $_POST['emailid']; $remitt_ifsc = $_POST['ifsc']; $remitt_bank_name = $_POST['bank_name']; $remitt_bank_branch = $_POST['bank_branch']; $remitt_branch_code = $_POST['branch_code']; $remitt_bank_address = $_POST['bank_address']; $remitt_acc_holder_name = $_POST['accname']; $remitt_acc_no = $_POST['accnumber']; $contact_officer_edsd = $_POST['contact_officer_edsd']; $contact_no_edsd = $_POST['contact_no_edsd']; $contact_email_edsd = $_POST['contact_email_edsd']; $edsd_gst_no = $_POST['edsd_gst_no']; $edsd_pan_no = $_POST['edsd_pan_no']; $edsd_code = $_POST['edsd_code']; $office_address = $_POST['office_address']; $office_contactno = $_POST['office_contactno']; $edsd_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $whatsapp_number = $_POST['whatsapp_number']; $whatsapp_api_key = $_POST['whatsapp_api_key']; $edsd_name_hindi = $_POST['edsd_name_hindi']; $edsd_postal_address_1 = $_POST['edsd_postal_address_1']; $edsd_postal_address_2 = $_POST['edsd_postal_address_2']; $edsd_postal_address_3 = $_POST['edsd_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_edsd_hindi = $_POST['contact_officer_edsd_hindi']; $contact_officer_designation = $_POST['contact_officer_designation_edsd']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi_edsd']; $sq11 = "UPDATE `edsd_engineer` SET `ex_id`='$ex_id', `prev_edsd_name`=`edsd_name`, `edsd_name`='$edsd_name',`remitt_email_id`='$remitt_email_id',`remitt_ifsc`='$remitt_ifsc',`remitt_bank_name`='$remitt_bank_name',`remitt_bank_branch`='$remitt_bank_branch',`remitt_branch_code`='$remitt_branch_code',`remitt_bank_address`='$remitt_bank_address',`remitt_acc_holder_name`='$remitt_acc_holder_name',`remitt_acc_no`='$remitt_acc_no', `contact_officer_edsd`='$contact_officer_edsd', `contact_no_edsd`='$contact_no_edsd', `contact_email_edsd`='$contact_email_edsd', `edsd_updated_by`='$admin_cid', `edsd_updated_name`='$admin_name', `edsd_updated_date`='$edsd_updated_date', `edsd_office_address`='$office_address', `edsd_office_contactno`='$office_contactno', `edsd_gst_no`='$edsd_gst_no', `edsd_pan_no`='$edsd_pan_no', `edsd_code`='$edsd_code',`edsd_pincode`='$pincode',`edsd_post`='$post',`edsd_district`='$district',`edsd_state`='$state',`edsd_mohalla`='$mohalla',`edsd_village`='$village',`edsd_block`='$block',`edsd_tahsil`='$tahsil',`edsd_thana`='$thana', `edsd_whatsapp_number`='$whatsapp_number', `edsd_whatsapp_api_key`='$whatsapp_api_key', `edsd_name_hindi`='$edsd_name_hindi', `edsd_postal_address_1`='$edsd_postal_address_1', `edsd_postal_address_2`='$edsd_postal_address_2', `edsd_postal_address_3`='$edsd_postal_address_3'" . ",`print_applicable_1_edsd`='$print_applicable_1',`print_applicable_2_edsd`='$print_applicable_2',`print_applicable_3_edsd`='$print_applicable_3',`print_language_edsd`='$print_language',`print_designation_1_edsd`='$print_designation_1',`print_designation_2_edsd`='$print_designation_2',`print_designation_3_edsd`='$print_designation_3',`print_designation_hindi_1_edsd`='$print_designation_hindi_1',`print_designation_hindi_2_edsd`='$print_designation_hindi_2',`print_designation_hindi_3_edsd`='$print_designation_hindi_3',`print_heading_1_edsd`='$print_heading_1',`print_heading_2_edsd`='$print_heading_2',`print_heading_3_edsd`='$print_heading_3',`print_heading_hindi_1_edsd`='$print_heading_hindi_1',`print_heading_hindi_2_edsd`='$print_heading_hindi_2',`print_heading_hindi_3_edsd`='$print_heading_hindi_3',`contact_officer_edsd_hindi`='$contact_officer_edsd_hindi',`contact_officer_designation_edsd`='$contact_officer_designation',`contact_officer_designation_hindi_edsd`='$contact_officer_designation_hindi' WHERE edsd_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { if ($prev_edsd_name != $edsd_name) { // $sq_new = "UPDATE `employee` SET `edsd_engineer`='$edsd_name' WHERE `ex_engineer`='$prev_ex_name' AND `edsd_engineer`='$prev_edsd_name'"; // $qu_new = mysqli_query($this->conn, $sq_new); // $sq_new_1 = "UPDATE `employee_acc_wages` SET `edsd_engineer`='$edsd_name' WHERE `ex_engineer`='$prev_ex_name' AND `edsd_engineer`='$prev_edsd_name'"; // $qu_new_1 = mysqli_query($this->conn, $sq_new_1); // $sq_new_2 = "UPDATE `salary_table_combined` SET `sal_edsd`='$edsd_name' WHERE `sal_edd`='$prev_ex_name' AND `sal_edsd`='$prev_edsd_name'"; // $qu_new_2 = mysqli_query($this->conn, $sq_new_2); // $sq_new_3 = "UPDATE `new_payments` SET `edsd_name`='$edsd_name' WHERE `edsd_name`='$prev_edsd_name'"; // $qu_new_3 = mysqli_query($this->conn, $sq_new_3); } $_SESSION['msg'] = "EDSD Engineer Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong! ' . mysqli_error($this->conn); } // } else { // $_SESSION['err_msg'] = 'Something Went Wrong!'; // } echo '<meta http-equiv="refresh" content="5">'; } public function delete_edsd_engg($id) { $sq11 = "DELETE FROM edsd_engineer WHERE edsd_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "EDSD Engineer Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo "<script> setTimeout(function () { // location.href='add_executive_engg.php'; // }, 6000);</script>"; echo "<script> setTimeout(function () { window.history.back(); }, 6000);</script>"; } public function get_electric_subcenter() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `electrycity_zone` ez INNER JOIN `executive_engineer` ex ON ex.`ex_id`=ez.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE zone.company_id='$company_id' ORDER BY electrycity_zone_name ASC"; // $sq="SELECT * FROM `electrycity_zone` ez INNER JOIN `executive_engineer` ex ON ex.`ex_id`=ez.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id`"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function electric_subcenter_details($id) { $sq3 = "SELECT * FROM `electrycity_zone` ez INNER JOIN `executive_engineer` ex ON ex.`ex_id`=ez.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `ez_id`='$id' ORDER BY electrycity_zone_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function electric_subcenter_details_with_edsd($id) { $sq3 = "SELECT * FROM `electrycity_zone` ez INNER JOIN `edsd_engineer` edsd ON edsd.`edsd_id`=ez.`edsd_id` INNER JOIN `executive_engineer` ex ON ex.`ex_id`=edsd.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `ez_id`='$id' ORDER BY electrycity_zone_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function EDDName($edd_id) { $query = "SELECT * FROM `executive_engineer` WHERE `ex_id` IN ($edd_id) ORDER BY ex_name ASC"; $result = mysqli_query($this->conn, $query); $row = mysqli_fetch_assoc($result); return strip_tags($row['ex_name']); } public function EDSDName($edsd_id) { $query = "SELECT * FROM `edsd_engineer` WHERE `edsd_id` IN ($edsd_id) ORDER BY edsd_name ASC"; $result = mysqli_query($this->conn, $query); $row = mysqli_fetch_assoc($result); return strip_tags($row['edsd_name']); } public function edsdNameBySubstationID($id) { $sq3 = "SELECT * FROM `electrycity_zone` ez INNER JOIN `edsd_engineer` edsd ON edsd.`edsd_id`=ez.`edsd_id` WHERE `ez_id`='$id' ORDER BY electrycity_zone_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12['edsd_name']; } public function SubStationName($id) { $query = "SELECT `electrycity_zone_name` FROM `electrycity_zone` WHERE `ez_id`='$id'"; $result = mysqli_query($this->conn, $query); $row = mysqli_fetch_assoc($result); return strip_tags($row['electrycity_zone_name']); } //get electric zones using executive engg id public function get_electric_subcenter_details($id) { $company_id = $_SESSION['company_id']; $sq3 = "SELECT * FROM `electrycity_zone` ez INNER JOIN `executive_engineer` ex ON ex.`ex_id`=ez.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE ez.`ex_id`='$id' AND zone.company_id='$company_id' ORDER BY electrycity_zone_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } //get electric zones using edsd id public function get_electric_subcenter_details_by_edsd($id) { $company_id = $_SESSION['company_id']; // $sq3 = "SELECT * FROM `electrycity_zone` ez INNER JOIN `edsd_engineer` edsd ON edsd.`edsd_id`=ez.`edsd_id` INNER JOIN `executive_engineer` ex ON ex.`ex_id``=edsd.`edsd_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id WHERE ez.`edsd_id`='$id' AND zone.company_id='$company_id' ORDER BY electrycity_zone_name ASC"; $sq3 = "SELECT * FROM `electrycity_zone` ez LEFT JOIN `edsd_engineer` edsd ON edsd.`edsd_id`=ez.`edsd_id` LEFT JOIN `executive_engineer` ex ON ex.`ex_id`=edsd.`ex_id` LEFT JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` LEFT JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE ez.`edsd_id`='$id' ORDER BY electrycity_zone_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function update_electric_subcenter($id) { $prev_sq = $this->electric_subcenter_details($id); $prev_electrycity_house = $prev_sq['electrycity_zone_name']; $prev_ex_name = $prev_sq['ex_name']; $ex_id = $_POST['ex_engineer']; $ex_name = $this->EDDName($ex_id); $edsd_id = $_POST['edsd_engineer']; $edsd_name = $this->EDSDName($edsd_id); $electrycity_house = $_POST['electrycity_house']; $kv_email = $_POST['kv_email']; $h_electrycity_house = $_POST['h_electrycity_house']; $contact_officer_substation = $_POST['contact_officer_substation']; $contact_no_substation1 = $_POST['contact_no_substation1']; $contact_no_substation2 = $_POST['contact_no_substation2']; $contact_email_substation = $_POST['contact_email_substation']; $substation_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $pincode = $_POST['pincode']; $post = $_POST['post']; $district = $_POST['city']; $state = $_POST['state']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $substation_postal_address_1 = $_POST['substation_postal_address_1']; $substation_postal_address_2 = $_POST['substation_postal_address_2']; $substation_postal_address_3 = $_POST['substation_postal_address_3']; $print_applicable_1 = $_POST['print_applicable_1']; $print_applicable_2 = $_POST['print_applicable_2']; $print_applicable_3 = $_POST['print_applicable_3']; $print_language = $_POST['print_language']; $print_designation_1 = $_POST['print_designation_1']; $print_designation_2 = $_POST['print_designation_2']; $print_designation_3 = $_POST['print_designation_3']; $print_designation_hindi_1 = $_POST['print_designation_hindi_1']; $print_designation_hindi_2 = $_POST['print_designation_hindi_2']; $print_designation_hindi_3 = $_POST['print_designation_hindi_3']; $print_heading_1 = $_POST['print_heading_1']; $print_heading_2 = $_POST['print_heading_2']; $print_heading_3 = $_POST['print_heading_3']; $print_heading_hindi_1 = $_POST['print_heading_hindi_1']; $print_heading_hindi_2 = $_POST['print_heading_hindi_2']; $print_heading_hindi_3 = $_POST['print_heading_hindi_3']; $contact_officer_substation_hindi = $_POST['contact_officer_substation_hindi']; $contact_officer_designation = $_POST['contact_officer_designation']; $contact_officer_designation_hindi = $_POST['contact_officer_designation_hindi']; $ez_note_heading = $_POST['ez_note_heading']; $ez_note_1 = $_POST['ez_note_1']; $ez_note_2 = $_POST['ez_note_2']; $ez_note_heading_hindi = $_POST['ez_note_heading_hindi']; $ez_note_1_hindi = $_POST['ez_note_1_hindi']; $ez_note_2_hindi = $_POST['ez_note_2_hindi']; // $sq = "SELECT * FROM `executive_engineer` WHERE `ex_id` IN (SELECT ex_id FROM executive_engineer WHERE ex_name='$ex_engineer')"; // $ex_res = mysqli_query($this->conn, $sq); // $result = mysqli_fetch_assoc($ex_res); // // if ($result) { // $ex_id = $result['ex_id']; $sq11 = "UPDATE `electrycity_zone` SET `ex_id`='$ex_id', `edsd_id`='$edsd_id', `prev_electrycity_zone_name`=`electrycity_zone_name`,`electrycity_zone_name`='$electrycity_house',`prev_h_electrycity_zone_name`=`h_electrycity_zone_name`,`h_electrycity_zone_name`='$h_electrycity_house', `kv_email`='$kv_email',`contact_officer_substation`='$contact_officer_substation',`contact_no_substation1`='$contact_no_substation1',`contact_no_substation2`='$contact_no_substation2', `contact_email_substation`='$contact_email_substation',`substation_updated_by`='$admin_cid',`substation_updated_name`='$admin_name',`substation_updated_date`='$substation_updated_date',`electry_pincode`='$pincode',`electry_post`='$post',`electry_district`='$district',`electry_state`='$state',`electry_mohalla`='$mohalla',`electry_village`='$village',`electry_block`='$block',`electry_tahsil`='$tahsil',`electry_thana`='$thana',`substation_postal_address_1`='$substation_postal_address_1',`substation_postal_address_2`='$substation_postal_address_2',`substation_postal_address_3`='$substation_postal_address_3'" . ",`print_applicable_1`='$print_applicable_1',`print_applicable_2`='$print_applicable_2',`print_applicable_3`='$print_applicable_3',`print_language`='$print_language',`print_designation_1`='$print_designation_1',`print_designation_2`='$print_designation_2',`print_designation_3`='$print_designation_3',`print_designation_hindi_1`='$print_designation_hindi_1',`print_designation_hindi_2`='$print_designation_hindi_2',`print_designation_hindi_3`='$print_designation_hindi_3',`print_heading_1`='$print_heading_1',`print_heading_2`='$print_heading_2',`print_heading_3`='$print_heading_3',`print_heading_hindi_1`='$print_heading_hindi_1',`print_heading_hindi_2`='$print_heading_hindi_2',`print_heading_hindi_3`='$print_heading_hindi_3',`contact_officer_substation_hindi`='$contact_officer_substation_hindi',`contact_officer_designation`='$contact_officer_designation',`contact_officer_designation_hindi`='$contact_officer_designation_hindi'" . ", `ez_note_heading`='$ez_note_heading',`ez_note_1`='$ez_note_1',`ez_note_2`='$ez_note_2', `ez_note_heading_hindi`='$ez_note_heading_hindi',`ez_note_1_hindi`='$ez_note_1_hindi',`ez_note_2_hindi`='$ez_note_2_hindi' WHERE ez_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { // if ($prev_electrycity_house != $electrycity_house) { $sq_new = "UPDATE `employee` SET `ex_engineer`='$ex_name',`choice_ex_id`='$ex_id',`electrycity_zone`='$electrycity_house' WHERE `electrycity_zone`='$prev_electrycity_house' AND `ex_engineer`='$prev_ex_name'"; $qu_new = mysqli_query($this->conn, $sq_new); $sq_new_1 = "UPDATE `employee_acc_wages` SET `ex_engineer`='$ex_name',`choice_ex_id`='$ex_id',`electrycity_zone`='$electrycity_house' WHERE `electrycity_zone`='$prev_electrycity_house' AND `ex_engineer`='$prev_ex_name'"; $qu_new_1 = mysqli_query($this->conn, $sq_new_1); $sq_new_2 = "UPDATE `salary_table_combined` SET `sal_edd`='$ex_name',`sal_substation`='$electrycity_house' WHERE `sal_substation`='$prev_electrycity_house' AND `sal_edd`='$prev_ex_name'"; $qu_new_2 = mysqli_query($this->conn, $sq_new_2); $sq_new_3 = "UPDATE `new_payments` SET `edd_id`='$ex_id',`edd_name`='$ex_name',`substation_id`='$id',`substation_name`='$electrycity_house' WHERE `substation_name`='$prev_electrycity_house' AND `edd_name`='$prev_ex_name'"; $qu_new_3 = mysqli_query($this->conn, $sq_new_3); $sq_new_4 = "UPDATE `basic_da_salary` SET `edd_id`='$ex_id',`ez_name`='$electrycity_house' WHERE `ez_id`='$id'"; $qu_new_4 = mysqli_query($this->conn, $sq_new_4); $sq_new_5 = "UPDATE `employee_transferred` SET `edd_name`='$ex_name',`edsd_name`='$edsd_name',`substation_name`='$electrycity_house' WHERE `substation_name`='$prev_electrycity_house' AND `edd_name`='$prev_ex_name'"; $qu_new_5 = mysqli_query($this->conn, $sq_new_5); $sq_new_6 = "UPDATE `employee_transferred` SET `edd_name_prev`='$ex_name',`edsd_name_prev`='$edsd_name',`substation_name_prev`='$electrycity_house' WHERE `substation_name_prev`='$prev_electrycity_house' AND `edd_name_prev`='$prev_ex_name'"; $qu_new_6 = mysqli_query($this->conn, $sq_new_6); // } $_SESSION['msg'] = "Electric Sub Center Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // } else { // $_SESSION['err_msg'] = 'Something Went Wrong!'; // } echo '<meta http-equiv="refresh" content="5">'; } public function delete_electric_subcenter($id) { $sq11 = "DELETE FROM electrycity_zone WHERE ez_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Electric Sub Center Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo "<script> setTimeout(function () { // location.href='add_electrycity_house.php'; // }, 6000);</script>"; echo "<script> setTimeout(function () { window.history.back(); }, 6000);</script>"; // echo '<meta http-equiv="refresh" content="5">'; } public function delete_employee($emp_id, $message, $remark, $admin_cid) { $ivr_no = '8448444631'; $message = "Your application has been rejected due to " . $message . ". For detail information contact us at $ivr_no."; $this->send_bulk_message($emp_id, $message); // $this->save_deleted_employee_single($emp_id, $message, $remark, $admin_cid); $this->save_deleted_employee($emp_id, $message, $remark, $admin_cid); // echo $sql = "INSERT INTO `employee_deleted`(`d_id`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `entry_no_main`, `prev_electricity_zone`, `substation_changed_by`, `substation_changed_date`, `application_status`, `edit_status`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`, `esic_detail`, `esic_regno`, `esic_upload`, `esic_expiry`, `salary_status`, `salary_reason`, `salary_remark`, `salary_hold_date`, `salary_release_date`, `choice_1`, `choice_2`, `choice_3`, `choice_4`, `choice_5`, `choice_6`, `choice_7`, `choice_8`, `choice_9`, `choice_10`, `entry_no_1`, `entry_no_2`, `entry_no_3`, `entry_no_4`, `entry_no_5`, `entry_no_6`, `entry_no_7`, `entry_no_8`, `entry_no_9`, `entry_no_10`, `choice_ex_id`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `emp_joining_date`) SELECT NULL, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `entry_no_main`, `prev_electricity_zone`, `substation_changed_by`, `substation_changed_date`, `application_status`, `edit_status`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`, `esic_detail`, `esic_regno`, `esic_upload`, `esic_expiry`, `salary_status`, `salary_reason`, `salary_remark`, `salary_hold_date`, `salary_release_date`, `choice_1`, `choice_2`, `choice_3`, `choice_4`, `choice_5`, `choice_6`, `choice_7`, `choice_8`, `choice_9`, `choice_10`, `entry_no_1`, `entry_no_2`, `entry_no_3`, `entry_no_4`, `entry_no_5`, `entry_no_6`, `entry_no_7`, `entry_no_8`, `entry_no_9`, `entry_no_10`, `choice_ex_id`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `emp_joining_date` FROM employee WHERE employee.cid='$emp_id'"; // echo $sql = "INSERT INTO `employee_deleted`(`d_id`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `entry_no_main`, `prev_electricity_zone`, `substation_changed_by`, `substation_changed_date`, `application_status`, `edit_status`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`, `esic_detail`, `esic_regno`, `esic_upload`, `esic_expiry`, `salary_status`, `salary_reason`, `salary_remark`, `salary_hold_date`, `salary_release_date`, `choice_1`, `choice_2`, `choice_3`, `choice_4`, `choice_5`, `choice_6`, `choice_7`, `choice_8`, `choice_9`, `choice_10`, `entry_no_1`, `entry_no_2`, `entry_no_3`, `entry_no_4`, `entry_no_5`, `entry_no_6`, `entry_no_7`, `entry_no_8`, `entry_no_9`, `entry_no_10`, `choice_ex_id`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `emp_joining_date`, `basic_salary`, `basic_salary_added_by`, `recommended_by`, `other_upload`, `import_from_edd`, `emergency_status`, `emergency_added_by`, `emergency_added_by_name`, `emergency_added_date`, `already_imported`, `ref_cid`, `company_id`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`) SELECT NULL, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `entry_no_main`, `prev_electricity_zone`, `substation_changed_by`, `substation_changed_date`, `application_status`, `edit_status`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`, `esic_detail`, `esic_regno`, `esic_upload`, `esic_expiry`, `salary_status`, `salary_reason`, `salary_remark`, `salary_hold_date`, `salary_release_date`, `choice_1`, `choice_2`, `choice_3`, `choice_4`, `choice_5`, `choice_6`, `choice_7`, `choice_8`, `choice_9`, `choice_10`, `entry_no_1`, `entry_no_2`, `entry_no_3`, `entry_no_4`, `entry_no_5`, `entry_no_6`, `entry_no_7`, `entry_no_8`, `entry_no_9`, `entry_no_10`, `choice_ex_id`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `emp_joining_date`, `basic_salary`, `basic_salary_added_by`, `recommended_by`, `other_upload`, `import_from_edd`, `emergency_status`, `emergency_added_by`, `emergency_added_by_name`, `emergency_added_date`, `already_imported`, `ref_cid`, `company_id`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2` FROM employee WHERE employee.cid='$emp_id'"; // $res = mysqli_query($this->conn, $sql); $sq1 = "DELETE FROM `employee` WHERE `cid` IN ($emp_id) AND application_status NOT IN ('accepted','pro_accepted')"; $res = mysqli_query($this->conn, $sq1); return $res; } public function save_deleted_employee_single($emp_id, $message, $remark, $admin_cid) { $deleted_date = date('Y-m-d H:i:s'); $sql = "INSERT INTO `employee_deleted`(`d_id`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `entry_no_main`, `prev_electricity_zone`, `substation_changed_by`, `substation_changed_date`, `application_status`, `edit_status`, `edit_by`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`, `esic_detail`, `esic_regno`, `esic_upload`, `esic_expiry`, `salary_status`, `salary_reason`, `salary_remark`, `salary_hold_date`, `salary_release_date`, `choice_1`, `choice_2`, `choice_3`, `choice_4`, `choice_5`, `choice_6`, `choice_7`, `choice_8`, `choice_9`, `choice_10`, `entry_no_1`, `entry_no_2`, `entry_no_3`, `entry_no_4`, `entry_no_5`, `entry_no_6`, `entry_no_7`, `entry_no_8`, `entry_no_9`, `entry_no_10`, `choice_ex_id`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `emp_joining_date`, `basic_salary`, `basic_salary_added_by`, `recommended_by`, `other_upload`, `import_from_edd`, `emergency_status`, `emergency_added_by`, `emergency_added_by_name`, `emergency_added_date`, `already_imported`, `ref_cid`, `company_id`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `e_g_id`, `e_s_g_id`) SELECT NULL, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `entry_no_main`, `prev_electricity_zone`, `substation_changed_by`, `substation_changed_date`, `application_status`, `edit_status`, `edit_by`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`, `esic_detail`, `esic_regno`, `esic_upload`, `esic_expiry`, `salary_status`, `salary_reason`, `salary_remark`, `salary_hold_date`, `salary_release_date`, `choice_1`, `choice_2`, `choice_3`, `choice_4`, `choice_5`, `choice_6`, `choice_7`, `choice_8`, `choice_9`, `choice_10`, `entry_no_1`, `entry_no_2`, `entry_no_3`, `entry_no_4`, `entry_no_5`, `entry_no_6`, `entry_no_7`, `entry_no_8`, `entry_no_9`, `entry_no_10`, `choice_ex_id`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `emp_joining_date`, `basic_salary`, `basic_salary_added_by`, `recommended_by`, `other_upload`, `import_from_edd`, `emergency_status`, `emergency_added_by`, `emergency_added_by_name`, `emergency_added_date`, `already_imported`, `ref_cid`, `company_id`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `e_g_id`, `e_s_g_id` FROM employee WHERE employee.cid='$emp_id'"; $res = mysqli_query($this->conn, $sql); $uql = "UPDATE `employee_deleted` SET `approve_by_admin_id`='$admin_cid',`reason`='$message',`remark`='$remark',`deleted_date`='$deleted_date' WHERE `cid`='$emp_id'"; $res = mysqli_query($this->conn, $uql); return $res; } public function delete_bulk_employee($emp_id, $reason, $remark, $admin_cid) { $ivr_no = '8448444631'; $message = "Your application has been rejected due to $reason. For detail information contact us at $ivr_no."; $this->send_bulk_message($emp_id, $message); $this->save_deleted_employee($emp_id, $message, $remark, $admin_cid); $sq1 = "DELETE FROM `employee` WHERE `cid` IN ($emp_id) AND application_status NOT IN ('accepted','pro_accepted')"; $res = mysqli_query($this->conn, $sq1); return $res; } public function save_deleted_employee($emp_id, $message, $remark, $admin_cid) { $myArray = explode(',', $emp_id); $deleted_date = date('Y-m-d H:i:s'); foreach ($myArray as $empid) { $emp_result = $this->employee_details($empid); $emp_details = mysqli_fetch_assoc($emp_result); $ref_cid = $emp_details['ref_cid']; $sql_2 = "UPDATE `employee` SET already_imported='' WHERE cid IN ($ref_cid)"; $res_val_2 = mysqli_query($this->conn, $sql_2); $sql = "INSERT INTO `employee_deleted`(`d_id`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `entry_no_main`, `prev_electricity_zone`, `substation_changed_by`, `substation_changed_date`, `application_status`, `edit_status`, `edit_by`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`, `esic_detail`, `esic_regno`, `esic_upload`, `esic_expiry`, `salary_status`, `salary_reason`, `salary_remark`, `salary_hold_date`, `salary_release_date`, `choice_1`, `choice_2`, `choice_3`, `choice_4`, `choice_5`, `choice_6`, `choice_7`, `choice_8`, `choice_9`, `choice_10`, `entry_no_1`, `entry_no_2`, `entry_no_3`, `entry_no_4`, `entry_no_5`, `entry_no_6`, `entry_no_7`, `entry_no_8`, `entry_no_9`, `entry_no_10`, `choice_ex_id`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `emp_joining_date`, `basic_salary`, `basic_salary_added_by`, `recommended_by`, `other_upload`, `import_from_edd`, `emergency_status`, `emergency_added_by`, `emergency_added_by_name`, `emergency_added_date`, `already_imported`, `ref_cid`, `company_id`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `e_g_id`, `e_s_g_id`) SELECT NULL, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `zone`, `s_engineer`, `ex_engineer`, `electrycity_zone`, `entry_no_main`, `prev_electricity_zone`, `substation_changed_by`, `substation_changed_date`, `application_status`, `edit_status`, `edit_by`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `approve_by_admin_id`, `reason`, `remark`, `approval_date`, `approval_msg`, `reg_date1`, `address_type`, `address_upload`, `registered_by`, `table_updated`, `extra_date`, `esic_detail`, `esic_regno`, `esic_upload`, `esic_expiry`, `salary_status`, `salary_reason`, `salary_remark`, `salary_hold_date`, `salary_release_date`, `choice_1`, `choice_2`, `choice_3`, `choice_4`, `choice_5`, `choice_6`, `choice_7`, `choice_8`, `choice_9`, `choice_10`, `entry_no_1`, `entry_no_2`, `entry_no_3`, `entry_no_4`, `entry_no_5`, `entry_no_6`, `entry_no_7`, `entry_no_8`, `entry_no_9`, `entry_no_10`, `choice_ex_id`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `emp_joining_date`, `basic_salary`, `basic_salary_added_by`, `recommended_by`, `other_upload`, `import_from_edd`, `emergency_status`, `emergency_added_by`, `emergency_added_by_name`, `emergency_added_date`, `already_imported`, `ref_cid`, `company_id`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `e_g_id`, `e_s_g_id` FROM employee WHERE employee.cid='$empid'"; $res = mysqli_query($this->conn, $sql); $uql = "UPDATE `employee_deleted` SET `approve_by_admin_id`='$admin_cid',`reason`='$message',`remark`='$remark',`deleted_date`='$deleted_date' WHERE `cid`='$empid'"; $ress = mysqli_query($this->conn, $uql); } return $ress; } public function send_message($phone, $msg) { // $sender = "GLOBCR"; // This is who the message appears to be from. $sender = urlencode('GLOBCR'); // $message = $msg; $message = urlencode($msg); $numbers = $phone; // $value['phone']; //"919120102338"; // A single number or a comma-seperated list of numbers // $this->send_msg_textlocal_withhash($numbers, $message, $sender); // $this->send_msg_textlocal($numbers, $message, $sender); $this->send_msg_2factor($numbers, $message, $sender); } public function send_bulk_message($emp_id, $msg) { $res_array = $this->list_selected_employee($emp_id); // print_r($res_array); foreach ($res_array as $value) { $emp_name = $value['first_name']; $number = $value['phone']; //"919120102338"; // A single number or a comma-seperated list of numbers $message = "Dear $emp_name, " . $msg; // $message = rawurlencode($message); // Message details $numbers = array($number); $numbers = implode(',', $numbers); $this->send_message($numbers, $message); } } public function send_msg_2factorrr($numbers, $message, $sender) { } public function send_msg_2factor($numbers, $message, $sender) { // Account details $apiKey = urlencode('d891cdee-c6d9-11f0-a6b2-0200cd936042'); $data = "module=TRANS_SMS&apikey=$apiKey&to=$numbers&from=$sender&msg=$message"; $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => 'https://2factor.in/API/R1/', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $data, )); $response = curl_exec($ch); // This is the result FROM the API //print_r($response); //Print error if any if (curl_errno($ch)) { echo $error = 'Error:' . curl_error($ch); } curl_close($ch); // Process your response here // echo $response; } public function send_msg_2factor_bulk($numbers, $message, $sender) { // Account details $apiKey = urlencode('d891cdee-c6d9-11f0-a6b2-0200cd936042'); $data = "module=TRANS_SMS&apikey=$apiKey&to=$numbers&from=$sender&msg=$message"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://2factor.in/API/R1/Bulk/', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ "module": "TRANS_SMS", "apikey": "$apiKey", "messages": [ { "smsFrom": "TFACTR", "smsTo": "+91XXXXXXXXXXX", "smsText": "First message" }, { "smsFrom": "TFACTR", "smsTo": "+91XXXXXXXXXXX", "smsText": "Second message" }, { "smsFrom": "TFACTR", "smsTo": "+91XXXXXXXXXXX", "smsText": "Third message" }] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; } public function send_msg_textlocal($numbers, $message, $sender) { // Account details $apiKey = urlencode('NGI2ZTM4NjQ0NzU1MzczNzQxNWE0NzYzNjE0YjY0MzM='); // Prepare data for POST request $data = array('apikey' => $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message); // Send the POST request with cURL $ch = curl_init('https://api.textlocal.in/send/'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); // This is the result FROM the API //print_r($response); //Print error if any if (curl_errno($ch)) { echo $error = 'Error:' . curl_error($ch); } curl_close($ch); // Process your response here // echo $response; } public function send_msg_textlocal_withhash($numbers, $message, $sender) { $username = "support@globeindia.co.in"; $hash = "e72b3e1a685c9858ed2d6cab37e06979cebd43c65014197cea8e632867391f09"; $data = "username=" . $username . "&hash=" . $hash . "&message=" . $message . "&sender=" . $sender . "&numbers=" . $numbers; $ch = curl_init('http://api.textlocal.in/send/?'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); // This is the result FROM the API //print_r($response); //Print error if any if (curl_errno($ch)) { echo $error = 'error:' . curl_error($ch); } curl_close($ch); // Process your response here // echo $response; } public function select_array($tbl, $cnd = null) { $sql = "SELECT * FROM " . $tbl; if ($cnd != null) { $sql .= " WHERE " . $cnd; } $result = $this->conn->query($sql); if ($result->num_rows > 0) { return mysqli_fetch_all($result, MYSQLI_ASSOC); } else { return array(); } } public function select_row($tbl, $cnd = null) { $sql = "SELECT * FROM " . $tbl; if ($cnd != null) { $sql .= " WHERE " . $cnd; } // $result = mysqli_query($this->conn, $sql); $result = $this->conn->query($sql); if ($result->num_rows > 0) { return mysqli_fetch_row($result); } else { return array(); } } public function select_custom($query) { // echo $query; $result = $this->conn->query($query); if ($result->num_rows > 0) { // return mysqli_fetch_assoc($result); return mysqli_fetch_all($result, MYSQLI_ASSOC); } else { return array(); } } public function insert($sql) { if ($this->conn->query($sql) === TRUE) { return mysqli_insert_id($this->conn); } } public function insert_query($sql) { // $res = $this->conn->query($sql) // if ($res === TRUE) { // return mysqli_insert_id($this->conn); // } $qu3 = mysqli_query($this->conn, $sql); return mysqli_insert_id($this->conn); } public function my_delete($sql) { if (mysqli_query($this->conn, $sql) === TRUE) { return 1; } else { return 0; } } public function delete($sql) { if ($this->conn->query($sql) === TRUE) { return 1; } else { return 0; } } public function update_query($sql) { //echo $sql; if ($this->conn->query($sql) === TRUE) { return 1; } else { return 0; } } public function select_custom_query($query) { // echo $query; $result = mysqli_query($this->conn, $query); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function select_array_query($tbl, $cnd = null) { $sql = "SELECT * FROM " . $tbl; if ($cnd != null) { $sql .= " WHERE " . $cnd; } // echo $sql; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function select_row_query($tbl, $cnd = null) { $sql = "SELECT * FROM " . $tbl; if ($cnd != null) { $sql .= " WHERE " . $cnd; } // echo $sql; $qu3 = mysqli_query($this->conn, $sql); $res = mysqli_fetch_assoc($qu3); return $res; } // Get admin Data by status public function select_admin_by_status($status) { if ($status == 'ALL') { $sq = "SELECT * FROM `sub_admin` WHERE 1 ORDER BY name asc"; } else { $sq = "SELECT * FROM `sub_admin` WHERE status='$status' ORDER BY name asc"; } $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get admin Data public function select_all_admin() { $sq = "SELECT * FROM `sub_admin` WHERE used_in_search='YES' AND status='1' ORDER BY name asc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_admin_detail($id) { $sq1 = "SELECT * FROM `sub_admin` WHERE id='$id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); return $res; } public function get_admin_detail_used_in_search($id) { $sq1 = "SELECT * FROM `sub_admin` WHERE used_in_search='YES' AND status='1' AND id IN ($id)"; $result = mysqli_query($this->conn, $sq1); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_admin_detail_used_in_search_edd($id, $edd_id) { $sq1 = "SELECT * FROM `sub_admin` WHERE used_in_search='YES' AND status='1' AND id IN ($id) AND `edds` LIKE '%\"$edd_id\"%'"; $result = mysqli_query($this->conn, $sq1); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_admin_full_detail($id) { // $sq1 = "SELECT * FROM `sub_admin` INNER JOIN employee ON employee.approved_emp_no=sub_admin.admin_emp_no WHERE id='$id'"; $sq1 = "SELECT e.*, sub_admin.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM sub_admin INNER JOIN employee e ON e.cid=sub_admin.emp_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE id='$id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); return $res; } public function view_specific_employee_byphone($phone) { // echo $sq3 = "SELECT * FROM `employee` WHERE `phone`='$phone' or `phone2`='$phone'"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `phone`='$phone' or `phone2`='$phone'"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON employee.electrycity_zone = electrycity_zone.electrycity_zone_name WHERE `phone`='$phone'"; $sq3 = "SELECT e.*,sub_admin.*,electrycity_zone.*,executive_engineer.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi,categoery_name FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ON e.electrycity_zone = electrycity_zone.electrycity_zone_name LEFT JOIN executive_engineer ON executive_engineer.ex_id=electrycity_zone.ex_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `phone`='$phone'"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } function split_name($string) { $arr = explode(' ', $string); $num = count($arr); $first_name = $middle_name = $last_name = null; if ($num == 2) { list($first_name, $last_name) = $arr; } else { list($first_name, $middle_name, $last_name) = $arr; } return (empty($first_name) || $num > 3) ? false : compact( 'first_name', 'middle_name', 'last_name' ); } public function update_provisional_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $identity_type = $_POST['identity_type']; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($identity_type != '') { $target_file = $target_dir . basename($_FILES["identity_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $identity_type . '.jpg'; $identity_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["identity_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Identity Proof is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Identity Proof was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_upload"]["tmp_name"], $target_dir . $emp_no . $identity_type . ".jpg")) { // if (move_uploaded_file($_FILES["identity_upload"]["tmp_name"], $identity_url)) { $identity_upload = $target_file . $_FILES["identity_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["identity_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Identity Proof."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { // $sq = "UPDATE `provisional_table` SET `identity_checkbox`='no',`identity_image`='$identity_url',`status`='approved' WHERE `emp_id`='$emp_id'"; $sq = "UPDATE `provisional_table` SET `identity_checkbox`='no',`identity_image`='$identity_url',`identity_approved`='no',`status`='un_approved' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Identity Proof Uploaded Successfully.'; // echo "<script>location.href='insurance_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_photo_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $photo_type = ''; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($photo_type != '') { $target_file = $target_dir . basename($_FILES["photo_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $photo_type . 'photo.jpg'; $photo_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["photo_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["photo_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Photo is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Photo was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["photo_upload"]["tmp_name"], $target_dir . $emp_no . $photo_type . "photo.jpg")) { // if (move_uploaded_file($_FILES["photo_upload"]["tmp_name"], $photo_url)) { $photo_upload = $target_file . $_FILES["photo_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["photo_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Photo."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `provisional_table` SET `photo_checkbox`='no',`photo_upload_date`='$uploaded_date',`photo_image`='$photo_url',`photo_approved`='no',`status`='un_approved' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Photo Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_empsign_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $empsign_type = ''; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($empsign_type != '') { $target_file = $target_dir . basename($_FILES["empsign_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $empsign_type . 'empsign.jpg'; $empsign_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["empsign_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["empsign_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Signature is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Signature was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["empsign_upload"]["tmp_name"], $target_dir . $emp_no . $empsign_type . "empsign.jpg")) { // if (move_uploaded_file($_FILES["empsign_upload"]["tmp_name"], $empsign_url)) { $empsign_upload = $target_file . $_FILES["empsign_upload"]["tmp_name"]; $errtext = "The image " . basename($_FILES["empsign_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Signature."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `provisional_table` SET `empsign_checkbox`='no',`empsign_upload_date`='$uploaded_date',`empsign_image`='$empsign_url',`empsign_approved`='no',`status`='un_approved' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Signature Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Signature Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_identity_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $name_on_identity = $_POST['name_on_identity']; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($identity_type != '') { $target_file = $target_dir . basename($_FILES["identity_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $identity_type . 'identity.jpg'; $identity_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["identity_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Identity Proof is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Identity Proof was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_upload"]["tmp_name"], $target_dir . $emp_no . $identity_type . "identity.jpg")) { // if (move_uploaded_file($_FILES["identity_upload"]["tmp_name"], $identity_url)) { $identity_upload = $target_file . $_FILES["identity_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["identity_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Identity Proof."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { // $sq = "UPDATE `provisional_table` SET `identity_checkbox`='no',`identity_image`='$identity_url',`status`='approved' WHERE `emp_id`='$emp_id'"; $sq = "UPDATE `provisional_table` SET `identity_checkbox`='no',`identity_upload_date`='$uploaded_date',`identity_image`='$identity_url',`pro_name_on_identity`='$name_on_identity',`pro_identity_no`='$identity_no',`identity_approved`='no',`status`='un_approved' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Identity Proof Uploaded Successfully.'; // echo "<script>location.href='insurance_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_address_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $address_type = $_POST['address_type']; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($address_type != '') { $target_file = $target_dir . basename($_FILES["address_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $address_type . 'address.jpg'; $address_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["address_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["address_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Address Proof is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Address Proof was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["address_upload"]["tmp_name"], $target_dir . $emp_no . $address_type . "address.jpg")) { // if (move_uploaded_file($_FILES["address_upload"]["tmp_name"], $address_url)) { $address_upload = $target_file . $_FILES["address_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["address_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Address Proof."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { // $sq = "UPDATE `provisional_table` SET `address_checkbox`='no',`address_image`='$address_url',`status`='approved' WHERE `emp_id`='$emp_id'"; $sq = "UPDATE `provisional_table` SET `address_checkbox`='no',`address_upload_date`='$uploaded_date',`address_image`='$address_url',`address_approved`='no',`status`='un_approved' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Address Proof Uploaded Successfully.'; // echo "<script>location.href='insurance_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Address Proof Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_pancard_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $pancard_type = ''; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($pancard_type != '') { $target_file = $target_dir . basename($_FILES["pancard_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $pancard_type . 'pancard.jpg'; $pancard_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["pancard_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["pancard_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Pancard is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Pancard was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["pancard_upload"]["tmp_name"], $target_dir . $emp_no . $pancard_type . "pancard.jpg")) { // if (move_uploaded_file($_FILES["pancard_upload"]["tmp_name"], $pancard_url)) { $pancard_upload = $target_file . $_FILES["pancard_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["pancard_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Pancard."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `provisional_table` SET `pancard_checkbox`='no',`pancard_upload_date`='$uploaded_date',`pancard_image`='$pancard_url',`pan_approved`='no',`status`='un_approved' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Pancard Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Pancard Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_skill_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $skill_type = ''; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($skill_type != '') { $target_file = $target_dir . basename($_FILES["skill_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $skill_type . 'skill.jpg'; $skill_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["skill_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["skill_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Skill Document is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Skill Document was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["skill_upload"]["tmp_name"], $target_dir . $emp_no . $skill_type . "skill.jpg")) { // if (move_uploaded_file($_FILES["skill_upload"]["tmp_name"], $skill_url)) { $skill_upload = $target_file . $_FILES["skill_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["skill_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Skill Document."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `provisional_table` SET `skill_checkbox`='no',`skill_upload_date`='$uploaded_date',`skill_image`='$skill_url',`skill_approved`='no',`status`='un_approved' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Skill Document Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Skill Document Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_bank_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $bank_type = ''; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($bank_type != '') { $target_file = $target_dir . basename($_FILES["bank_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $bank_type . 'bank.jpg'; $bank_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["bank_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["bank_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Bank Passbook is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Bank Passbook was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["bank_upload"]["tmp_name"], $target_dir . $emp_no . $bank_type . "bank.jpg")) { // if (move_uploaded_file($_FILES["bank_upload"]["tmp_name"], $bank_url)) { $bank_upload = $target_file . $_FILES["bank_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["bank_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Bank Passbook."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `provisional_table` SET `bank_checkbox`='no',`bank_upload_date`='$uploaded_date',`bank_image`='$bank_url',`pro_acc_holder_name`='$accname',`pro_acc_no`='$accnumber',`pro_ifsc`='$ifsc',`pro_bank_name`='$bank_name',`pro_bank_branch`='$bank_branch',`pro_bank_address`='$bank_address',`bank_approved`='no' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Bank Passbook Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Bank Passbook Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_epf_upload($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $epf_type = ''; $target_dir = "../include/provisional_img_upload/"; $t_dir = "../include/provisional_img_upload/"; // only for url image use IN db // if ($epf_type != '') { $target_file = $target_dir . basename($_FILES["epf_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $epf_type . 'epf.jpg'; $epf_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["epf_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["epf_upload"]["size"] > 300000) { echo $errtext = "Sorry, your EPF Passbook is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your EPF Passbook was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["epf_upload"]["tmp_name"], $target_dir . $emp_no . $epf_type . "epf.jpg")) { // if (move_uploaded_file($_FILES["epf_upload"]["tmp_name"], $epf_url)) { $epf_upload = $target_file . $_FILES["epf_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["epf_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your EPF Passbook."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `provisional_table` SET `epf_checkbox`='no',`epf_upload_date`='$uploaded_date',`epf_image`='$epf_url',`epf_approved`='no' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'EPF Passbook Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN EPF Passbook Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function select_updated_provisionals() { $sq = "SELECT * FROM `provisional_table` pro INNER JOIN employee e ON e.cid=pro.emp_id WHERE status='un_approved'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function change_updated_provisionals($status, $emp_id, $image_type, $admin_id, $image_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `update_image` WHERE `img_id`='$image_id'"; // $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['image_url']; $sq = "UPDATE `update_image` SET `img_status`='$status',`accepted_date`='$DATE' WHERE `img_id`='$image_id'"; // $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; if ($image_type == 'updatephoto') { $column = 'clogo'; } else if ($image_type == 'voterid') { $column = 'identity_upload'; } else if ($image_type == 'drivinglicence') { $column = 'identity_upload'; } else if ($image_type == 'passport') { $column = 'identity_upload'; } else if ($image_type == 'pancard') { $column = 'pan_upload'; $cnd = " , pan_detail='yes'"; } else if ($image_type == 'passbook') { $column = 'passbook_upload'; } else if ($image_type == 'Skilled') { $column = 'skilled_upload'; $cnd = " , skilled='Skilled'"; } else if ($image_type == 'other') { $column = 'other_upload'; } // $sq2="SELECT * FROM `update_image` WHERE cid=$emp_id"; // echo $sq1 = "UPDATE employee e INNER JOIN update_image ui ON e.cid=ui.cid SET e.$column=ui.image_url,`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd"; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; // $qu1 = mysqli_query($this->conn, $sq1); } return $qu1; } public function change_pro_photo($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `provisional_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['photo_image']; if ($image_url != '') { $sq = "UPDATE `provisional_table` SET `photo_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'clogo'; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Photo Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_pro_empsign($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `provisional_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['empsign_image']; if ($image_url != '') { $sq = "UPDATE `provisional_table` SET `empsign_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'emp_sign'; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Signature Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_pro_identity($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `provisional_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['identity_image']; $identity_no = $res['pro_identity_no']; $name_on_identity = $res['pro_name_on_identity']; if ($image_url != '') { $sq = "UPDATE `provisional_table` SET `identity_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'identity_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Identity Proof Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_pro_address($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `provisional_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['address_image']; $address_upload_type = $res['address_upload_type']; if ($image_url != '') { $sq = "UPDATE `provisional_table` SET `address_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'address_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`address_type`='$address_upload_type',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Address Proof Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_pro_pancard($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `provisional_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['pancard_image']; if ($image_url != '') { $sq = "UPDATE `provisional_table` SET `pan_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'pan_upload'; $cnd = " , pan_detail='yes'"; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Pan Card Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_pro_skill($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `provisional_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['skill_image']; if ($image_url != '') { $sq = "UPDATE `provisional_table` SET `skill_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $cnd = " , skilled='Skilled'"; $column = 'skilled_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Skilled Document Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_pro_bank($status, $emp_id, $image_type, $admin_id, $bank_choice) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `provisional_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['bank_image']; $ifsc = $res['pro_ifsc']; $bank_name = $res['pro_bank_name']; $bank_branch = $res['pro_bank_branch']; $bank_address = $res['pro_bank_address']; $accname = $res['pro_acc_holder_name']; $accnumber = $res['pro_acc_no']; if ($image_url != '') { $sq = "UPDATE `provisional_table` SET `bank_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; if ($bank_choice == 'bank_2') { $column = 'passbook_upload_2'; $sq1 = "UPDATE employee SET $column='$image_url',`acc_holder_name_2`='$accname',`acc_no_2`='$accnumber',`ifsc_2`='$ifsc',`bank_name_2`='$bank_name',`bank_branch_2`='$bank_branch',`bank_address_2`='$bank_address',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; } else { $column = 'passbook_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; } $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Bank Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_pro_epf($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `provisional_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['epf_image']; if ($image_url != '') { $sq = "UPDATE `provisional_table` SET `epf_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'epf_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'EPF Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function disapprove_provisional_update($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $column1 = $image_type . '_image'; $column2 = $image_type . '_checkbox'; if ($image_type == 'pancard') { $column3 = 'pan_approved'; } else { $column3 = $image_type . '_approved'; } $sq = "UPDATE `provisional_table` SET `$column1`='',`$column2`='yes',`$column3`='no',`updated_time`='$DATE',`approved_by_admin`='$admin_id' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Document Rejected Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return $qu; } public function change_req_photo($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['photo_image']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `photo_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'clogo'; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Photo Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_req_empsign($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['empsign_image']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `empsign_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'emp_sign'; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Signature Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_req_identity($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['identity_image']; $identity_no = $res['req_identity_no']; $name_on_identity = $res['req_name_on_identity']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `identity_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'identity_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Identity Proof Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_req_address($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['address_image']; $address_upload_type = $res['address_upload_type']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `address_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'address_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`address_type`='$address_upload_type',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Address Proof Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_req_pancard($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['pancard_image']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `pan_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'pan_upload'; $cnd = " , pan_detail='yes'"; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Pan Card Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_req_skill($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['skill_image']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `skill_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $cnd = " , skilled='Skilled'"; $column = 'skilled_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Skilled Document Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function change_req_bank($status, $emp_id, $image_type, $admin_id, $bank_choice) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); if ($bank_choice == 'bank_2') { $image_url = $res['bank_image_2']; $ifsc = $res['req_ifsc_2']; $bank_name = $res['req_bank_name_2']; $bank_branch = $res['req_bank_branch_2']; $bank_address = $res['req_bank_address_2']; $accname = $res['req_acc_holder_name_2']; $accnumber = $res['req_acc_no_2']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `bank_approved_2`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'passbook_upload_2'; $sq1 = "UPDATE employee SET $column='$image_url',`acc_holder_name_2`='$accname',`acc_no_2`='$accnumber',`ifsc_2`='$ifsc',`bank_name_2`='$bank_name',`bank_branch_2`='$bank_branch',`bank_address_2`='$bank_address',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Bank Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $image_url = $res['bank_image']; $ifsc = $res['req_ifsc']; $bank_name = $res['req_bank_name']; $bank_branch = $res['req_bank_branch']; $bank_address = $res['req_bank_address']; $accname = $res['req_acc_holder_name']; $accnumber = $res['req_acc_no']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `bank_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'passbook_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Bank Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } return; // return $qu1; } public function change_req_epf($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); $image_url = $res['epf_image']; if ($image_url != '') { $sq = "UPDATE `required_document_table` SET `epf_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'epf_upload'; $sq1 = "UPDATE employee SET $column='$image_url',`approval_date`='$DATE',`approve_by_admin_id`='$admin_id' $cnd WHERE cid='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'EPF Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; // return $qu1; } public function disapprove_req_doc_update($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); if ($image_type == 'bank_2') { $column1 = 'bank_image_2'; $column2 = 'bank_checkbox_2'; $column3 = 'bank_approved_2'; } else { $column1 = $image_type . '_image'; $column2 = $image_type . '_checkbox'; // $column3 = $image_type . '_approved'; if ($image_type == 'pancard') { $column3 = 'pan_approved'; } else { $column3 = $image_type . '_approved'; } } $sq = "UPDATE `required_document_table` SET `$column1`='',`$column2`='yes',`$column3`='no',`updated_time`='$DATE',`approved_by_admin`='$admin_id' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Document Rejected Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } return; } public function list_executive_engineer_id($ex_engineer) { $prefix = $fruitList = ''; foreach ($ex_engineer as $location) { $locations .= $prefix . '"' . $location . '"'; $prefix = ', '; } $sq3 = "SELECT * FROM `executive_engineer` WHERE `ex_id` IN (SELECT ex_id FROM executive_engineer WHERE ex_name IN ($locations))"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function list_executive_engineer_using_id($ex_ids) { $prefix = $fruitList = ''; foreach ($ex_ids as $location) { $locations .= $prefix . '"' . $location . '"'; $prefix = ', '; } $sq3 = "SELECT ex_name FROM `executive_engineer` WHERE `ex_id` IN ($locations)"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function check_substation_name($name, $ex_id, $area) { // echo $sq = "SELECT * FROM `electrycity_zone` WHERE electrycity_zone_name='$name' AND `ex_id` IN (SELECT ex_id FROM executive_engineer WHERE ex_name='$ex_id')"; $sq = "SELECT * FROM `electrycity_zone` WHERE electrycity_zone_name='$name' AND `ex_id` IN ($ex_id)"; $qu1 = mysqli_query($this->conn, $sq); // $res= mysqli_fetch_assoc($qu1); return $qu1; } public function check_name($name, $area) { if ($area == 'zone') { echo $sq = "SELECT * FROM `zone` WHERE zone_name='$name'"; } else if ($area == 'super_engg') { $sq = "SELECT * FROM `super_engineer` WHERE super_name='$name'"; } else if ($area == 'ex_engg') { $sq = "SELECT * FROM `executive_engineer` WHERE ex_name='$name'"; } else if ($area == 'electrycity_zone') { $sq = "SELECT * FROM `electrycity_zone` WHERE electrycity_zone_name='$name'"; } $qu1 = mysqli_query($this->conn, $sq); // $res= mysqli_fetch_assoc($qu1); return $qu1; } public function move_to_extra_bulk($emp_id, $reason, $remark, $admin_cid) { $ivr_no = '8448444631'; // $message = "Your application has been moved to extra due to $reason. For detail information contact us at $ivr_no."; $message = "Your application status ON GLOBETECH has been changed to EXTRA due to $reason. For detail information contact us at $ivr_no."; $this->send_bulk_message($emp_id, $message); $uql = "UPDATE `employee` SET `reason`='$reason',`remark`='$remark',`application_status`='extra_emp',`approve_by_admin_id`='$admin_cid' WHERE `cid` IN ($emp_id)"; $ress = mysqli_query($this->conn, $uql); return $ress; } public function move_to_emergency_old($status, $customer_id, $admin_cid, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); // $message = "Your application for Globetech Creations Pvt. Ltd. is Terminated."; if ($status == 1) { $sq3 = "UPDATE `employee` SET `application_status`='emergency',`updated_date`='$updated_date',`approved_emp_no`='',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark' WHERE `cid` IN ($customer_id)"; } else if ($status == 2) { $sq3 = "UPDATE `employee` SET `application_status`='old_emergency',`updated_date`='$updated_date',`approved_emp_no`='',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark' WHERE `cid` IN ($customer_id)"; } // echo $sq3; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function execute_query($query) { $res = mysqli_query($this->conn, $query); return $res; } public function occasional_message_bulk() { $query = "SELECT phone FROM `employee` WHERE application_status IN ('accepted','pro_accepted')"; $res = mysqli_query($this->conn, $query); $message = "ग्लोबटेक क्रिएशंस प्राइवेट लिमिटेड की तरफ से 70वें गणतंत्र दिवस की हार्दिक शुभकामनाएँ।"; // $this->send_bulk_message($emp_id, $message); // return $res; } public function required_documents($status, $customer_id, $admin_cid, $reason, $remark, $identity, $identity_type, $identity_end_date, $address, $address_type, $address_end_date, $pancard, $pancard_end_date, $skill, $skill_end_date, $bank, $bank_end_date, $bank_2, $bank_end_date_2, $epf, $epf_end_date, $photo, $photo_end_date, $empsign, $empsign_end_date, $status_change, $ifsc_2, $bank_name_2, $bank_branch_2, $bank_address_2) { $updated_date = date('Y-m-d H:i:s'); $msg_doc = $column = ''; if ($photo == 'yes') { $msg_doc .= " Photo,"; $columns .= " `photo_checkbox`='$photo',`photo_end_date`='$photo_end_date',`photo_approved`='no',"; } if ($empsign == 'yes') { $msg_doc .= " Signature,"; $columns .= " `empsign_checkbox`='$empsign',`empsign_end_date`='$empsign_end_date',`empsign_approved`='no',"; } if ($identity == 'yes') { if ($identity_type == 'aadhaarcard') { $msg_doc .= " Identity Proof of E Aadhaar Letter,"; } else if ($identity_type == 'voterid') { $msg_doc .= " Identity Proof of Voter Card,"; } else if ($identity_type == 'drivinglicence') { $msg_doc .= " Identity Proof of Driving Licence,"; } else if ($identity_type == 'passport') { $msg_doc .= " Identity Proof of Passport,"; } $columns .= " `identity_checkbox`='$identity',`identity_upload_type`='$identity_type',`identity_end_date`='$identity_end_date',`identity_approved`='no',"; } if ($address == 'yes') { if ($address_type == 'aadhaarcard') { $msg_doc .= " Address Proof of E Aadhaar Letter,"; } else if ($address_type == 'voterid') { $msg_doc .= " Address Proof of Voter Card,"; } else if ($address_type == 'drivinglicence') { $msg_doc .= " Address Proof of Driving Licence,"; } else if ($address_type == 'passport') { $msg_doc .= " Address Proof of Passport,"; } $columns .= " `address_checkbox`= '$address',`address_upload_type`= '$address_type',`address_end_date`= '$address_end_date',`address_approved`='no',"; } if ($pancard == 'yes') { $msg_doc .= " Pan Card,"; $columns .= " `pancard_checkbox`='$pancard',`pancard_end_date`='$pancard_end_date',`pan_approved`='no',"; } if ($skill == 'yes') { $msg_doc .= " Skill Document,"; $columns .= " `skill_checkbox`='$skill',`skill_end_date`='$skill_end_date',`skill_approved`='no',"; } if ($bank == 'yes') { $msg_doc .= " Bank Passbook,"; $columns .= " `bank_checkbox`='$bank',`bank_end_date`='$bank_end_date',`bank_approved`='no',"; } if ($bank_2 == 'yes') { $msg_doc .= " Bank Passbook 2,"; // $columns .= " `bank_checkbox_2`='$bank_2',`bank_end_date_2`='$bank_end_date_2',"; $columns .= " `bank_checkbox_2`='$bank_2',`bank_end_date_2`='$bank_end_date_2',`req_ifsc_2`='$ifsc_2',`req_bank_name_2`='$bank_name_2',`req_bank_branch_2`='$bank_branch_2',`req_bank_address_2`='$bank_address_2',`bank_approved_2`='no',"; } if ($epf == 'yes') { $msg_doc .= " EPF Passbook,"; $columns .= " `epf_checkbox`='$epf',`epf_end_date`='$epf_end_date',`epf_approved`='no',"; } $msg_doc = rtrim($msg_doc, ','); // $message = "You have to upload the following required documents $msg_doc due to $reason."; $message = "You have to upload the following required documents $msg_doc ON GLOBETECH."; $status_change_column = 'no'; if ($status_change == 'rejected') { $status_change_column = 'yes'; $sq_emp = "UPDATE `employee` SET `application_status`='rejected',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark',`updated_date`='$updated_date' WHERE `cid`='$customer_id'"; } else { $sq_emp = "UPDATE `employee` SET `reason`='$reason',`remark`='$remark',`updated_date`='$updated_date' WHERE `cid`='$customer_id'"; } mysqli_query($this->conn, $sq_emp); $this->send_bulk_message($customer_id, $message); $sq_sel = "SELECT * FROM `required_document_table` WHERE `emp_id`='$customer_id'"; $result = mysqli_query($this->conn, $sq_sel); $num_rows = mysqli_num_rows($result); if ($num_rows > 0) { //and if existing save it as a variable $sq = "UPDATE `required_document_table` SET $columns `reason`='$reason',`status_change`='$status_change_column',`remark`='$remark',`added_time`='$updated_date',`updated_time`='$updated_date',`added_by`='$admin_cid',`status`='un_approved' WHERE emp_id='$customer_id'"; // echo $sq = "UPDATE `required_document_table` SET `photo_checkbox`='$photo',`photo_end_date`='$epf_end_date',`identity_checkbox`='$identity',`identity_upload_type`='$identity_type',`identity_end_date`='$identity_end_date',`address_checkbox`= '$address',`address_upload_type`= '$address_type',`address_end_date`= '$address_end_date',`pancard_checkbox`='$pancard',`pancard_end_date`='$pancard_end_date',`skill_checkbox`='$skill',`skill_end_date`='$skill_end_date',`bank_checkbox`='$bank',`bank_end_date`='$bank_end_date',`epf_checkbox`='$skill',`epf_end_date`='$skill_end_date',`added_time`='$updated_date',`updated_time`='$updated_date',`added_by`='$admin_cid',`status`='un_approved' WHERE emp_id='$customer_id'"; } else { //If it is not existing, create the entery $sq = "INSERT INTO `required_document_table`(`emp_id`, `identity_checkbox`, `identity_upload_type`, `identity_end_date`, `address_checkbox`, `address_upload_type`, `address_end_date`, `pancard_checkbox`, `pancard_end_date`, `skill_checkbox`, `skill_end_date`, `bank_checkbox`, `bank_end_date`, `bank_checkbox_2`, `bank_end_date_2`, `epf_checkbox`, `epf_end_date`, `photo_checkbox`, `photo_end_date`, `empsign_checkbox`, `empsign_end_date`, `added_time`, `updated_time`, `added_by` ,`status_change`, `reason`, `remark`, `req_ifsc_2`, `req_bank_name_2`, `req_bank_branch_2`, `req_bank_address_2`) VALUES ('$customer_id', '$identity', '$identity_type', '$identity_end_date', '$address', '$address_type', '$address_end_date', '$pancard', '$pancard_end_date', '$skill', '$skill_end_date', '$bank', '$bank_end_date', '$bank_2', '$bank_end_date_2', '$epf', '$epf_end_date', '$photo', '$photo_end_date', '$empsign', '$empsign_end_date', '$updated_date', '$updated_date', '$admin_cid', '$status_change_column', '$reason', '$remark', '$ifsc_2', '$bank_name_2', '$bank_branch_2', '$bank_address_2')"; } // echo $sq; $qu = mysqli_query($this->conn, $sq); return $qu; } function nominee_required_documents($status, $customer_id, $admin_cid, $reason, $remark, $identity, $identity_type, $identity_end_date, $address, $address_type, $address_end_date, $pancard, $pancard_end_date, $skill, $skill_end_date, $bank, $bank_end_date, $bank_2, $bank_end_date_2, $epf, $epf_end_date, $photo, $photo_end_date, $empsign, $empsign_end_date, $status_change, $ifsc_2, $bank_name_2, $bank_branch_2, $bank_address_2, $relation, $relation_end_date, $family, $family_end_date, $other, $other_end_date) { $updated_date = date('Y-m-d H:i:s'); $msg_doc = $column = ''; if ($photo == 'yes') { $msg_doc .= " Photo,"; $columns .= " `photo_checkbox`='$photo',`photo_end_date`='$photo_end_date',`photo_approved`='no',"; // } else { // $columns .= " `photo_checkbox`='no',`photo_end_date`='0000-00-00 00:00:00',"; } if ($empsign == 'yes') { $msg_doc .= " Signature,"; $columns .= " `empsign_checkbox`='$empsign',`empsign_end_date`='$empsign_end_date',`empsign_approved`='no',"; // } else { // $columns .= " `empsign_checkbox`='no',`empsign_end_date`='0000-00-00 00:00:00',"; } if ($identity == 'yes') { if ($identity_type == 'aadhaarcard') { $msg_doc .= " Identity Proof of E Aadhaar Letter,"; } else if ($identity_type == 'voterid') { $msg_doc .= " Identity Proof of Voter Card,"; } else if ($identity_type == 'drivinglicence') { $msg_doc .= " Identity Proof of Driving Licence,"; } else if ($identity_type == 'passport') { $msg_doc .= " Identity Proof of Passport,"; } $columns .= " `identity_checkbox`='$identity',`identity_upload_type`='$identity_type',`identity_end_date`='$identity_end_date',`identity_approved`='no',"; // } else { // $columns .= " `identity_checkbox`='no',`identity_upload_type`= '',`identity_end_date`='0000-00-00 00:00:00',"; } if ($address == 'yes') { if ($address_type == 'aadhaarcard') { $msg_doc .= " Address Proof of E Aadhaar Letter,"; } else if ($address_type == 'voterid') { $msg_doc .= " Address Proof of Voter Card,"; } else if ($address_type == 'drivinglicence') { $msg_doc .= " Address Proof of Driving Licence,"; } else if ($address_type == 'passport') { $msg_doc .= " Address Proof of Passport,"; } $columns .= " `address_checkbox`= '$address',`address_upload_type`= '$address_type',`address_end_date`= '$address_end_date',`address_approved`='no',"; // } else { // $columns .= " `address_checkbox`='no',`address_upload_type`= '',`address_end_date`='0000-00-00 00:00:00',"; } if ($bank == 'yes') { $msg_doc .= " Bank Passbook,"; $columns .= " `bank_checkbox`='$bank',`bank_end_date`='$bank_end_date',`bank_approved`='no',"; // } else { // $columns .= " `bank_checkbox`='no',`bank_end_date`='0000-00-00 00:00:00',"; } if ($relation == 'yes') { $msg_doc .= " Relation Document,"; $columns .= " `relation_checkbox`='$relation',`relation_end_date`='$relation_end_date',`relation_approved`='no',"; // } else { // $columns .= " `relation_checkbox`='no',`relation_end_date`='0000-00-00 00:00:00',"; } if ($family == 'yes') { $msg_doc .= " Other Document,"; $columns .= " `family_checkbox`='$family',`family_end_date`='$family_end_date',`family_approved`='no',"; // } else { // $columns .= " `family_checkbox`='no',`family_end_date`='0000-00-00 00:00:00',"; } if ($other == 'yes') { $msg_doc .= " Other Document,"; $columns .= " `other_checkbox`='$other',`other_end_date`='$other_end_date',`other_approved`='no',"; // } else { // $columns .= " `other_checkbox`='no',`other_end_date`='0000-00-00 00:00:00',"; } $msg_doc = rtrim($msg_doc, ','); // $message = "You have to upload the following required documents $msg_doc due to $reason."; $message = "You have to upload the following required documents $msg_doc ON GLOBETECH."; $status_change_column = 'no'; if ($status_change == 'rejected') { $status_change_column = 'yes'; $sq_emp = "UPDATE `employee` SET `salary_status`='HOLD',`salary_reason`='Nominee Details not updated properly',`salary_remark`='Nominee Details not updated properly',`salary_hold_date`='$updated_date',`application_status`='rejected',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark',`updated_date`='$updated_date' WHERE `cid`='$customer_id'"; mysqli_query($this->conn, $sq_emp); } $sq_emp_1 = "UPDATE `nominee_details` SET `accepted_by`='$admin_cid',`accepted_date`='$updated_date',`application_status`='accepted',`n_reason`='$reason',`n_remark`='$remark' WHERE `cid`='$customer_id'"; $res_1 = mysqli_query($this->conn, $sq_emp_1); if ($res_1) { $sq_sel = "SELECT * FROM `nominee_required_document_table` WHERE `emp_id`='$customer_id'"; $result = mysqli_query($this->conn, $sq_sel); $num_rows = mysqli_num_rows($result); if ($num_rows > 0) { //and if existing save it as a variable $sq = "UPDATE `nominee_required_document_table` SET $columns `reason`='$reason',`status_change`='$status_change_column',`remark`='$remark',`added_time`='$updated_date',`updated_time`='$updated_date',`added_by`='$admin_cid',`status`='un_approved' WHERE emp_id='$customer_id'"; // echo $sq = "UPDATE `required_document_table` SET `photo_checkbox`='$photo',`photo_end_date`='$epf_end_date',`identity_checkbox`='$identity',`identity_upload_type`='$identity_type',`identity_end_date`='$identity_end_date',`address_checkbox`= '$address',`address_upload_type`= '$address_type',`address_end_date`= '$address_end_date',`pancard_checkbox`='$pancard',`pancard_end_date`='$pancard_end_date',`skill_checkbox`='$skill',`skill_end_date`='$skill_end_date',`bank_checkbox`='$bank',`bank_end_date`='$bank_end_date',`epf_checkbox`='$skill',`epf_end_date`='$skill_end_date',`added_time`='$updated_date',`updated_time`='$updated_date',`added_by`='$admin_cid',`status`='un_approved' WHERE emp_id='$customer_id'"; } else { //If it is not existing, create the entery $sq = "INSERT INTO `nominee_required_document_table`(`emp_id`, `photo_checkbox`, `photo_end_date`, `empsign_checkbox`, `empsign_end_date`, `identity_checkbox`, `identity_upload_type`, `identity_end_date`, `address_checkbox`, `address_upload_type`, `address_end_date`, `pancard_checkbox`, `pancard_end_date`, `bank_checkbox`, `bank_end_date`, `added_time`, `updated_time`, `added_by` ,`status_change`, `reason`, `remark`, `relation_checkbox`, `relation_end_date`, `family_checkbox`, `family_end_date`, `other_checkbox`, `other_end_date`) VALUES ('$customer_id', '$photo', '$photo_end_date', '$empsign', '$empsign_end_date', '$identity', '$identity_type', '$identity_end_date', '$address', '$address_type', '$address_end_date', '$pancard', '$pancard_end_date', '$bank', '$bank_end_date', '$updated_date', '$updated_date', '$admin_cid', '$status_change_column', '$reason', '$remark', '$relation', '$relation_end_date', '$family', '$family_end_date', '$other', '$other_end_date')"; } // echo $sq; $qu = mysqli_query($this->conn, $sq); if ($qu) { $this->send_bulk_message($customer_id, $message); } return $qu; } } function child_required_documents($status, $customer_id, $admin_cid, $reason, $remark, $identity, $identity_type, $identity_end_date, $address, $address_type, $address_end_date, $pancard, $pancard_end_date, $skill, $skill_end_date, $bank, $bank_end_date, $bank_2, $bank_end_date_2, $epf, $epf_end_date, $photo, $photo_end_date, $empsign, $empsign_end_date, $status_change, $ifsc_2, $bank_name_2, $bank_branch_2, $bank_address_2, $relation, $relation_end_date, $other, $other_end_date, $child_no, $child_id, $child_name) { $updated_date = date('Y-m-d H:i:s'); $msg_doc = $column = ''; if ($photo == 'yes') { $msg_doc .= " Photo,"; $columns .= " `photo_checkbox`='$photo',`photo_end_date`='$photo_end_date',`photo_approved`='no',"; // } else { // $columns .= " `photo_checkbox`='no',`photo_end_date`='0000-00-00 00:00:00',"; } if ($empsign == 'yes') { $msg_doc .= " Signature,"; $columns .= " `empsign_checkbox`='$empsign',`empsign_end_date`='$empsign_end_date',`empsign_approved`='no',"; // } else { // $columns .= " `empsign_checkbox`='no',`empsign_end_date`='0000-00-00 00:00:00',"; } if ($identity == 'yes') { if ($identity_type == 'aadhaarcard') { $msg_doc .= " Identity Proof of E Aadhaar Letter,"; } else if ($identity_type == 'voterid') { $msg_doc .= " Identity Proof of Voter Card,"; } else if ($identity_type == 'drivinglicence') { $msg_doc .= " Identity Proof of Driving Licence,"; } else if ($identity_type == 'passport') { $msg_doc .= " Identity Proof of Passport,"; } $columns .= " `identity_checkbox`='$identity',`identity_upload_type`='$identity_type',`identity_end_date`='$identity_end_date',`identity_approved`='no',"; // } else { // $columns .= " `identity_checkbox`='no',`identity_upload_type`= '',`identity_end_date`='0000-00-00 00:00:00',"; } if ($address == 'yes') { if ($address_type == 'aadhaarcard') { $msg_doc .= " Address Proof of E Aadhaar Letter,"; } else if ($address_type == 'voterid') { $msg_doc .= " Address Proof of Voter Card,"; } else if ($address_type == 'drivinglicence') { $msg_doc .= " Address Proof of Driving Licence,"; } else if ($address_type == 'passport') { $msg_doc .= " Address Proof of Passport,"; } $columns .= " `address_checkbox`= '$address',`address_upload_type`= '$address_type',`address_end_date`= '$address_end_date',"; // } else { // $columns .= " `address_checkbox`='no',`address_upload_type`= '',`address_end_date`='0000-00-00 00:00:00',"; } if ($bank == 'yes') { $msg_doc .= " Bank Passbook,"; $columns .= " `bank_checkbox`='$bank',`bank_end_date`='$bank_end_date',`bank_approved`='no',"; // } else { // $columns .= " `bank_checkbox`='no',`bank_end_date`='0000-00-00 00:00:00',"; } if ($relation == 'yes') { $msg_doc .= " Relation Document,"; $columns .= " `relation_checkbox`='$relation',`relation_end_date`='$relation_end_date',`relation_approved`='no',"; // } else { // $columns .= " `relation_checkbox`='no',`relation_end_date`='0000-00-00 00:00:00',"; } if ($other == 'yes') { $msg_doc .= " Other Document,"; $columns .= " `other_checkbox`='$other',`other_end_date`='$other_end_date',`other_approved`='no',"; // } else { // $columns .= " `other_checkbox`='no',`other_end_date`='0000-00-00 00:00:00',"; } $msg_doc = rtrim($msg_doc, ','); // $message = "You have to upload the following required documents $msg_doc due to $reason."; $message = "You have to upload the following required documents $msg_doc ON GLOBETECH."; $status_change_column = 'no'; if ($status_change == 'rejected') { $status_change_column = 'yes'; // $sq_emp = "UPDATE `employee` SET `application_status`='rejected',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark',`updated_date`='$updated_date' WHERE `cid`='$customer_id'"; $sq_emp = "UPDATE `employee` SET `salary_status`='HOLD',`salary_reason`='Child Details not updated properly',`salary_remark`='Child Details not updated properly',`salary_hold_date`='$updated_date',`application_status`='rejected',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark',`updated_date`='$updated_date' WHERE `cid`='$customer_id'"; mysqli_query($this->conn, $sq_emp); } $sq_emp_1 = "UPDATE `child_details` SET `accepted_by`='$admin_cid',`accepted_date`='$updated_date',`application_status`='accepted',`n_reason`='$reason',`n_remark`='$remark' WHERE `cid`='$customer_id'"; $res_1 = mysqli_query($this->conn, $sq_emp_1); if ($res_1) { $sq_sel = "SELECT * FROM `child_required_document_table` WHERE `nid`='$child_id'"; $result = mysqli_query($this->conn, $sq_sel); $num_rows = mysqli_num_rows($result); if ($num_rows > 0) { //and if existing save it as a variable $sq = "UPDATE `child_required_document_table` SET $columns `reason`='$reason',`status_change`='$status_change_column',`remark`='$remark',`added_time`='$updated_date',`updated_time`='$updated_date',`added_by`='$admin_cid',`status`='un_approved', `n_name`='$child_name' WHERE `nid`='$child_id'"; // echo $sq = "UPDATE `required_document_table` SET `photo_checkbox`='$photo',`photo_end_date`='$epf_end_date',`identity_checkbox`='$identity',`identity_upload_type`='$identity_type',`identity_end_date`='$identity_end_date',`address_checkbox`= '$address',`address_upload_type`= '$address_type',`address_end_date`= '$address_end_date',`pancard_checkbox`='$pancard',`pancard_end_date`='$pancard_end_date',`skill_checkbox`='$skill',`skill_end_date`='$skill_end_date',`bank_checkbox`='$bank',`bank_end_date`='$bank_end_date',`epf_checkbox`='$skill',`epf_end_date`='$skill_end_date',`added_time`='$updated_date',`updated_time`='$updated_date',`added_by`='$admin_cid',`status`='un_approved' WHERE emp_id='$customer_id'"; } else { //If it is not existing, create the entery $sq = "INSERT INTO `child_required_document_table`(`nid`, `n_name`, `emp_id`, `photo_checkbox`, `photo_end_date`, `empsign_checkbox`, `empsign_end_date`, `identity_checkbox`, `identity_upload_type`, `identity_end_date`, `address_checkbox`, `address_upload_type`, `address_end_date`, `pancard_checkbox`, `pancard_end_date`, `bank_checkbox`, `bank_end_date`, `added_time`, `updated_time`, `added_by` ,`status_change`, `reason`, `remark`, `relation_checkbox`, `relation_end_date`, `other_checkbox`, `other_end_date`) VALUES ('$child_id', '$child_name', '$customer_id', '$photo', '$photo_end_date', '$empsign', '$empsign_end_date', '$identity', '$identity_type', '$identity_end_date', '$address', '$address_type', '$address_end_date', '$pancard', '$pancard_end_date', '$bank', '$bank_end_date', '$updated_date', '$updated_date', '$admin_cid', '$status_change_column', '$reason', '$remark', '$relation', '$relation_end_date', '$other', '$other_end_date')"; } // echo $sq; $qu = mysqli_query($this->conn, $sq); if ($qu) { $this->send_bulk_message($customer_id, $message); } return $qu; } } public function update_photo_upload_req_doc($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); //echo '<script>alert("yes");</script>'; $photo_type = ''; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($photo_type != '') { $target_file = $target_dir . basename($_FILES["photo_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $photo_type . 'reqdoc_photo.jpg'; $photo_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["photo_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["photo_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Photo is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { $errtext = "Sorry, your Photo was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["photo_upload"]["tmp_name"], $target_dir . $emp_no . $photo_type . "reqdoc_photo.jpg")) { // if (move_uploaded_file($_FILES["photo_upload"]["tmp_name"], $photo_url)) { $photo_upload = $target_file . $_FILES["photo_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["photo_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Photo."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `required_document_table` SET `photo_checkbox`='no',`photo_upload_date`='$uploaded_date',`photo_image`='$photo_url' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Photo Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_empsign_upload_req_doc($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); //echo '<script>alert("yes");</script>'; $empsign_type = ''; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($empsign_type != '') { $target_file = $target_dir . basename($_FILES["empsign_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $empsign_type . 'reqdoc_empsign.jpg'; $empsign_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["empsign_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["empsign_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Signature is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { $errtext = "Sorry, your Signature was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["empsign_upload"]["tmp_name"], $target_file1)) { // if (move_uploaded_file($_FILES["empsign_upload"]["tmp_name"], $empsign_url)) { $empsign_upload = $target_file1; //$target_file . $_FILES["empsign_upload"]["tmp_name"]; // $ImageURL = $empsign_upload; //"https://globetech.org.in/globetech/cms/photo_quality/upload/" . $Photo; // $checkDocument = $this->checkDocument($ImageURL); // if ($checkDocument == 'success') { $x = 'ok'; $errtext = "The images " . basename($_FILES["empsign_upload"]["name"]) . " has been uploaded."; // } else { // unlink($target_file1); // $errtext = " Image quality poor!".$target_file1; // } } else { echo $errtext = " Sorry, there was an error IN uploading your Signature."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `required_document_table` SET `empsign_checkbox`='no',`empsign_upload_date`='$uploaded_date',`empsign_image`='$empsign_url' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Signature Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Signature Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_identity_upload_req_doc($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $name_on_identity = $_POST['name_on_identity']; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($identity_type != '') { $target_file = $target_dir . basename($_FILES["identity_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $identity_type . 'reqdoc_identity.jpg'; $identity_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["identity_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Identity Proof is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Identity Proof was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_upload"]["tmp_name"], $target_dir . $emp_no . $identity_type . "reqdoc_identity.jpg")) { // if (move_uploaded_file($_FILES["identity_upload"]["tmp_name"], $identity_url)) { $identity_upload = $target_file . $_FILES["identity_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["identity_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Identity Proof."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { // $sq = "UPDATE `provisional_table` SET `identity_checkbox`='no',`identity_image`='$identity_url',`status`='approved' WHERE `emp_id`='$emp_id'"; $sq = "UPDATE `required_document_table` SET `identity_checkbox`='no',`identity_upload_date`='$uploaded_date',`identity_image`='$identity_url',`req_name_on_identity`='$name_on_identity',`req_identity_no`='$identity_no' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Identity Proof Uploaded Successfully.'; // echo "<script>location.href='insurance_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_address_upload_req_doc($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $address_type = $_POST['address_type']; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($address_type != '') { $target_file = $target_dir . basename($_FILES["address_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $address_type . 'reqdoc_address.jpg'; $address_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["address_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["address_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Address Proof is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Address Proof was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["address_upload"]["tmp_name"], $target_dir . $emp_no . $address_type . "reqdoc_address.jpg")) { // if (move_uploaded_file($_FILES["address_upload"]["tmp_name"], $address_url)) { $address_upload = $target_file . $_FILES["address_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["address_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Address Proof."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { // $sq = "UPDATE `provisional_table` SET `address_checkbox`='no',`address_image`='$address_url',`status`='approved' WHERE `emp_id`='$emp_id'"; $sq = "UPDATE `required_document_table` SET `address_checkbox`='no',`address_upload_date`='$uploaded_date',`address_image`='$address_url' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Address Proof Uploaded Successfully.'; // echo "<script>location.href='insurance_details.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Address Proof Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_pancard_upload_req_doc($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $pancard_type = ''; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($pancard_type != '') { $target_file = $target_dir . basename($_FILES["pancard_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $pancard_type . 'reqdoc_pancard.jpg'; $pancard_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["pancard_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["pancard_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Pancard is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Pancard was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["pancard_upload"]["tmp_name"], $target_dir . $emp_no . $pancard_type . "reqdoc_pancard.jpg")) { // if (move_uploaded_file($_FILES["pancard_upload"]["tmp_name"], $pancard_url)) { $pancard_upload = $target_file . $_FILES["pancard_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["pancard_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Pancard."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `required_document_table` SET `pancard_checkbox`='no',`pancard_upload_date`='$uploaded_date',`pancard_image`='$pancard_url' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Pancard Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Pancard Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_skill_upload_req_doc($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $skill_type = ''; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($skill_type != '') { $target_file = $target_dir . basename($_FILES["skill_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $skill_type . 'reqdoc_skill.jpg'; $skill_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["skill_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["skill_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Skill Document is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Skill Document was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["skill_upload"]["tmp_name"], $target_dir . $emp_no . $skill_type . "reqdoc_skill.jpg")) { // if (move_uploaded_file($_FILES["skill_upload"]["tmp_name"], $skill_url)) { $skill_upload = $target_file . $_FILES["skill_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["skill_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Skill Document."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `required_document_table` SET `skill_checkbox`='no',`skill_upload_date`='$uploaded_date',`skill_image`='$skill_url' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Skill Document Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Skill Document Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_bank_upload_req_doc($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $bank_type = ''; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($bank_type != '') { $target_file = $target_dir . basename($_FILES["bank_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $bank_type . 'reqdoc_bank.jpg'; $bank_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["bank_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["bank_upload"]["size"] > 300000) { echo $errtext = "Sorry, your Bank Passbook is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Bank Passbook was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["bank_upload"]["tmp_name"], $target_dir . $emp_no . $bank_type . "reqdoc_bank.jpg")) { // if (move_uploaded_file($_FILES["bank_upload"]["tmp_name"], $bank_url)) { $bank_upload = $target_file . $_FILES["bank_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["bank_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Bank Passbook."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `required_document_table` SET `bank_checkbox`='no',`bank_upload_date`='$uploaded_date',`bank_image`='$bank_url',`req_acc_holder_name`='$accname',`req_acc_no`='$accnumber',`req_ifsc`='$ifsc',`req_bank_name`='$bank_name',`req_bank_branch`='$bank_branch',`req_bank_address`='$bank_address' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Bank Passbook Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Bank Passbook Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_bank_upload_req_doc_any($emp_id, $row_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $ifsc = $_POST['ifsc_' . $row_id]; $bank_name = $_POST['bank_name_' . $row_id]; $bank_branch = $_POST['bank_branch_' . $row_id]; $bank_address = $_POST['bank_address_' . $row_id]; $accname = $_POST['accname_' . $row_id]; $accnumber = $_POST['accnumber_' . $row_id]; $bank_type = ''; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($bank_type != '') { $target_file = $target_dir . basename($_FILES["bank_upload_$row_id"]["name"]); $target_file1 = $t_dir . $emp_no . $bank_type . 'reqdoc_bank_' . $row_id . '.jpg'; $bank_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["bank_upload_$row_id"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["bank_upload_$row_id"]["size"] > 300000) { echo $errtext = "Sorry, your Bank Passbook is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Bank Passbook was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["bank_upload_$row_id"]["tmp_name"], $target_file1)) { // if (move_uploaded_file($_FILES["bank_upload"]["tmp_name"], $bank_url)) { $bank_upload = $target_file . $_FILES["bank_upload_$row_id"]["tmp_name"]; $errtext = "The images " . basename($_FILES["bank_upload_$row_id"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Bank Passbook."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `required_document_table` SET `bank_checkbox_$row_id`='no',`bank_upload_date_$row_id`='$uploaded_date',`bank_image_$row_id`='$bank_url',`req_acc_holder_name_$row_id`='$accname',`req_acc_no_$row_id`='$accnumber',`req_ifsc_$row_id`='$ifsc',`req_bank_name_$row_id`='$bank_name',`req_bank_branch_$row_id`='$bank_branch',`req_bank_address_$row_id`='$bank_address' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Bank Passbook 2 Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Bank Passbook Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function update_epf_upload_req_doc($emp_id) { $emp_no = date('Ymd') . '_' . $_POST['emp_no']; // 'GCPL' . date('Ymd') . rand(100, 1000); //for file name only $uploaded_date = date("Y-m-d H:i:s"); $epf_type = ''; $target_dir = "../include/required_documents/"; $t_dir = "../include/required_documents/"; // only for url image use IN db // if ($epf_type != '') { $target_file = $target_dir . basename($_FILES["epf_upload"]["name"]); $target_file1 = $t_dir . $emp_no . $epf_type . 'reqdoc_epf.jpg'; $epf_url = $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["epf_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["epf_upload"]["size"] > 300000) { echo $errtext = "Sorry, your EPF Passbook is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your EPF Passbook was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["epf_upload"]["tmp_name"], $target_dir . $emp_no . $epf_type . "reqdoc_epf.jpg")) { // if (move_uploaded_file($_FILES["epf_upload"]["tmp_name"], $epf_url)) { $epf_upload = $target_file . $_FILES["epf_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["epf_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your EPF Passbook."; } } // } else { // $x = 'ok'; // } if ($x == 'ok') { $sq = "UPDATE `required_document_table` SET `epf_checkbox`='no',`epf_upload_date`='$uploaded_date',`epf_image`='$epf_url' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'EPF Passbook Uploaded Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN EPF Passbook Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function hold_salary($status, $customer_id, $admin_cid, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); $salary_hold_date = date('Y-m-d H:i:s'); $sq3 = "UPDATE `employee` SET `salary_status`='$status',`salary_hold_date`='$salary_hold_date',`updated_date`='$updated_date',`approve_by_admin_id`='$admin_cid',`salary_reason`='$reason',`salary_remark`='$remark' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); // $this->send_bulk_message($customer_id, $message); $this->save_salary_status($status, $customer_id, $admin_cid, $reason, $remark); return $qu3; } public function release_salary($status, $customer_id, $admin_cid, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); $salary_release_date = date('Y-m-d H:i:s'); $sq3 = "UPDATE `employee` SET `salary_status`='$status',`salary_release_date`='$salary_release_date',`updated_date`='$updated_date',`approve_by_admin_id`='$admin_cid',`salary_reason`='$reason',`salary_remark`='$remark' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); // $this->send_bulk_message($customer_id, $message); $this->save_salary_status($status, $customer_id, $admin_cid, $reason, $remark); return $qu3; } public function save_salary_status($status, $customer_id, $admin_cid, $reason, $remark) { $myArray = explode(',', $customer_id); $added_date = date('Y-m-d H:i:s'); $added_date1 = date('Y-m-d H:i:s'); $admin_name = strtoupper($_SESSION['name']); if ($status == 'HOLD') { $prev_status = 'OK'; } else { $prev_status = 'HOLD'; } foreach ($myArray as $empid) { $sel_query1 = "SELECT `t_id` FROM `terminated_employee` ORDER BY `t_id` DESC"; $res_query1 = $this->select_custom_query($sel_query1); if ($res_query1[0]['t_id'] != '') { $total_letter1 = $res_query1[0]['t_id']; } else { $total_letter1 = 0; } // echo $total_letter1; // $sel_query2 = "SELECT * FROM `party_payments` WHERE voucher_type='BANK' AND payment_status IN ('approved') AND unit_id='$unit_id' ORDER BY payment_authority_date DESC"; $sel_query2 = "SELECT letter_no FROM `party_payments` WHERE voucher_type='BANK' ORDER BY letter_no DESC"; $res_query2 = $this->select_custom_query($sel_query2); if ($res_query2[0]['letter_no'] != '') { $total_letter2 = $res_query2[0]['letter_no']; } else { $total_letter2 = 0; } // echo $total_letter2; $total_letter = max($total_letter1, $total_letter2); $inc_no = $total_letter + 1; // $inc_no_padd = str_pad($inc_no, 4, 0, STR_PAD_LEFT); // $voucher_no = $unit_code . '-' . $inc_no_padd; $letter_no = $inc_no; $sql = "INSERT INTO `employee_status_salary`(`es_id`, `es_cid`, `status`, `reason`, `remark`, `added_date`, `added_by_admin`, `added_by_admin_name`) VALUES (NULL, '$empid','$status','$reason','$remark','$added_date','$admin_cid','$admin_name')"; $res = mysqli_query($this->conn, $sql); $sq = "INSERT INTO `terminated_employee`(`t_id`, `emp_id`, `status_before_change`, `terminated_date`, `terminated_date1`, `process_type`, `process_status`, `added_reason`, `added_remark`, `added_by`, `added_by_name`, `added_date`) VALUES ('$letter_no','$customer_id','$prev_status','$added_date1','$added_date','$status','approved','$reason','$remark','$admin_cid','$admin_name','$added_date')"; $qu = mysqli_query($this->conn, $sq); } return $qu; } public function view_specific_substation($substation_id) { $sq3 = "SELECT * FROM `electrycity_zone` WHERE `ez_id`='$substation_id'"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } //Get ElectriCity Zone IN emp table public function emp_electrycity_with_substationname_and_exid($substation_name, $ex_id) { $sq = "SELECT * FROM `electrycity_zone` WHERE `electrycity_zone_name`='$substation_name' AND `ex_id`=$ex_id"; $result = mysqli_query($this->conn, $sq); return $result; } public function change_employee_substations_edited($customer_id, $new_substation, $admin_cid) { $current_date = date('Y-m-d H:i:s'); $message = "Your Working Substation is changed to $new_substation."; $sq3 = "UPDATE `employee_edited` SET `prev_electricity_zone`=`electrycity_zone`,`electrycity_zone`='$new_substation',`substation_changed_by`='$admin_cid',`substation_changed_date`='$current_date',`approve_by_admin_id`='$admin_cid' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); // $this->send_bulk_message($customer_id, $message); return $qu3; } public function change_employee_substations($customer_id, $new_substation, $admin_cid) { $current_date = date('Y-m-d H:i:s'); $message = "Your Working Substation is changed to $new_substation."; $sq3 = "UPDATE `employee` SET `prev_electricity_zone`=`electrycity_zone`,`electrycity_zone`='$new_substation',`substation_changed_by`='$admin_cid',`substation_changed_date`='$current_date',`approve_by_admin_id`='$admin_cid' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); // $this->send_bulk_message($customer_id, $message); return $qu3; } //Get Employee using electrycity zone AND ex_id IN emp table public function total_emp_electrycity($city_id, $ex_id, $skilled_type, $worktype) { $sq = "SELECT * FROM `employee` WHERE `skilled`='$skilled_type' AND `work_type`='$worktype' AND `electrycity_zone`='$city_id' AND `ex_engineer` IN (SELECT `ex_name` FROM executive_engineer WHERE `ex_id` IN ($ex_id))"; $result = mysqli_query($this->conn, $sq); return $result; } //Get Employee using electrycity zone AND ex_id IN emp table public function total_emp_electrycity_using_application_status($city_id, $ex_id, $skilled_type, $work_type, $application_status, $ag_id) { $sq = "SELECT * FROM `employee` e LEFT JOIN parents_details p ON p.emp_id=e.cid WHERE `application_status` IN ($application_status) AND `ex_engineer` IN (SELECT `ex_name` FROM executive_engineer WHERE `ex_id` IN ('$ex_id')) AND ag_id='$ag_id'"; if ($city_id) { $sq .= " AND `electrycity_zone`='$city_id'"; } if ($skilled_type) { $sq .= " AND `skilled`='$skilled_type'"; } if ($work_type) { $sq .= " AND `work_type`='$work_type'"; } // echo $sq; $result = mysqli_query($this->conn, $sq); return $result; } public function save_employee_application_status($cid, $application_status, $reason, $remark, $admin_cid) { $current_date = date('Y-m-d H:i:s'); $admin_name = $_SESSION['name']; $sq = "INSERT INTO `employee_status`(`es_cid`, `status`, `reason`, `remark`, `added_date`, `added_by_admin`) VALUES ('$cid', '$application_status', '$reason', '$remark', '$current_date', '$admin_cid')"; $result = mysqli_query($this->conn, $sq); return $result; } public function add_ajency() { $account_opening_date = $_POST['account_opening_date']; $ep_name = $_POST['ep_name']; $ep_contact_person = $_POST['ep_contact_person']; $ep_contact_no = $_POST['ep_contact_no']; $ep_contact_emailid = $_POST['ep_contact_emailid']; $ep_address = $_POST['ep_address']; $ep_pincode = $_POST['ep_pincode']; $ep_post = $_POST['post']; $ep_district = $_POST['city']; $ep_state = $_POST['state']; // $ep_upload_document = $_POST['ep_upload_document']; $ep_gst_no = $_POST['ep_gst_no']; $ep_pan_no = $_POST['ep_pan_no']; $ep_ifsc_code = $_POST['ep_ifsc_code']; $ep_bank_name = $_POST['bank_name']; $ep_bank_branch = $_POST['bank_branch']; $ep_bank_address = $_POST['bank_address']; $ep_account_name = $_POST['ep_account_name']; $ep_account_no = $_POST['ep_account_no']; $ep_entity_type = $_POST['ep_entity_type']; $ep_account_type = json_encode($_POST['ep_account_type']); // $ep_account_type = $_POST['ep_account_type']; $ep_cif_no = $_POST['ep_cif_no']; $ep_display_type = json_encode($_POST['ep_display_type']); $transaction_type = $_POST['transaction_type']; $opening_balance = $_POST['opening_balance']; $ep_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $company_id = $_SESSION['company_id']; $group_name = $_POST['group_name']; $sub_group_name = $_POST['sub_group_name']; if (isset($_FILES['ep_upload_document']) && !empty($_FILES['ep_upload_document']['name'])) { $targetfolder = "../include/ajency_upload/"; $targetfile = $targetfolder . basename($_FILES['ep_upload_document']['name']); $target_file1 = $targetfolder . $ep_contact_no . '_' . date('YmdHis') . '.pdf'; $target_file1 = str_replace(' ', '+', $target_file1); $ok = 1; // Check file size // if ($_FILES["ep_upload_document"]["size"] > 300000) { // echo $errtext = "Sorry, your image size is larger than 1 MB."; // $ok = 0; // } if (file_exists($targetfile)) { chmod($targetfile, 0755); //Change the file permissions if allowed unlink($targetfile); //remove the file } // Check file type $file_type = $_FILES['ep_upload_document']['type']; // if ($file_type == "application/pdf" || $file_type == "image/gif" || $file_type == "image/jpeg") { if ($file_type == "application/pdf") { if (move_uploaded_file($_FILES['ep_upload_document']['tmp_name'], $targetfolder . $ep_contact_no . '_' . date('YmdHis') . '.pdf')) { echo "The file " . basename($_FILES['ep_upload_document']['name']) . " is uploaded"; } else { $ok = 0; echo "Problem IN uploading your file"; } } else { $ok = 0; echo "You may only upload PDFs files.<br>"; } if ($ok == 1) { $sq = "INSERT INTO `employee_providers`(`ep_id`, `company_id`, `ep_name`, `ep_contact_person`, `ep_contact_no`, `ep_contact_emailid`, `ep_address`, `ep_pincode`, `ep_post_office`, `ep_district`, `ep_state`, `doc_upload`, `ep_gst_no`, `ep_pan_no`, `ep_ifsc_code`, `ep_bank_name`, `ep_bank_branch`, `ep_bank_address`, `ep_account_name`, `ep_account_no`, `ep_entity_type`, `ep_added_by`, `ep_added_date`, `balance_amount`, `transaction_type`, `account_opening_date`, `ep_display_type`, `g_id`, `s_g_id`, `ep_account_type`, `ep_cif_no`) VALUES (NULL,'$company_id','$ep_name','$ep_contact_person','$ep_contact_no','$ep_contact_emailid','$ep_address','$ep_pincode','$ep_post','$ep_district','$ep_state','$target_file1','$ep_gst_no','$ep_pan_no','$ep_ifsc_code','$ep_bank_name','$ep_bank_branch','$ep_bank_address','$ep_account_name','$ep_account_no','$ep_entity_type','$admin_cid','$ep_added_date','$opening_balance','$transaction_type','$account_opening_date','$ep_display_type','$group_name','$sub_group_name','$ep_account_type','$ep_cif_no')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New Ajency added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $_SESSION['err_msg'] = 'Error IN uploading File!'; } } else { $sq = "INSERT INTO `employee_providers`(`ep_id`, `company_id`, `ep_name`, `ep_contact_person`, `ep_contact_no`, `ep_contact_emailid`, `ep_address`, `ep_pincode`, `ep_post_office`, `ep_district`, `ep_state`, `ep_gst_no`, `ep_pan_no`, `ep_ifsc_code`, `ep_bank_name`, `ep_bank_branch`, `ep_bank_address`, `ep_account_name`, `ep_account_no`, `ep_entity_type`, `ep_added_by`, `ep_added_date`, `balance_amount`, `transaction_type`, `account_opening_date`, `ep_display_type`, `g_id`, `s_g_id`, `ep_account_type`) VALUES (NULL,'$company_id','$ep_name','$ep_contact_person','$ep_contact_no','$ep_contact_emailid','$ep_address','$ep_pincode','$ep_post','$ep_district','$ep_state','$ep_gst_no','$ep_pan_no','$ep_ifsc_code','$ep_bank_name','$ep_bank_branch','$ep_bank_address','$ep_account_name','$ep_account_no','$ep_entity_type','$admin_cid','$ep_added_date','$opening_balance','$transaction_type','$account_opening_date','$ep_display_type','$group_name','$sub_group_name','$ep_account_type')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New Ajency added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } // echo '<meta http-equiv="refresh" content="0">'; echo '<script>window.location.href="add_ajency_mobile.php"</script>'; } public function add_company() { $company_creation_date = $_POST['company_creation_date']; $ep_name = $_POST['ep_name']; $ep_contact_person = $_POST['ep_contact_person']; $ep_contact_no = $_POST['ep_contact_no']; $ep_contact_emailid = $_POST['ep_contact_emailid']; $ep_address = $_POST['ep_address']; $ep_pincode = $_POST['ep_pincode']; $ep_post = $_POST['post']; $ep_district = $_POST['city']; $ep_state = $_POST['state']; // $ep_upload_document = $_POST['ep_upload_document']; $ep_gst_no = $_POST['ep_gst_no']; $ep_pan_no = $_POST['ep_pan_no']; $ep_ifsc_code = $_POST['ep_ifsc_code']; $ep_bank_name = $_POST['bank_name']; $ep_bank_branch = $_POST['bank_branch']; $ep_bank_address = $_POST['bank_address']; $ep_account_name = $_POST['ep_account_name']; $ep_account_no = $_POST['ep_account_no']; $ep_entity_type = $_POST['ep_entity_type']; $ep_account_type = $_POST['ep_account_type']; $ep_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $ep_reg_address = $_POST['ep_reg_address']; $ep_upload_doc = $_POST['cheque_doc_upload_new_1']; $ep_upload_logo = $_POST['cheque_doc_upload_new_2']; $ep_upload_head_img = $_POST['cheque_doc_upload_new_3']; $ep_upload_dashboard_img = $_POST['cheque_doc_upload_new_4']; $ep_upload_gst = $_POST['cheque_doc_upload_new_5']; $ep_upload_pan = $_POST['cheque_doc_upload_new_6']; $roc_number = $_POST['ep_roc_no']; $ep_upload_roc = $_POST['cheque_doc_upload_new_7']; $ep_epf_no = $_POST['ep_epf_no']; $ep_upload_epf = $_POST['cheque_doc_upload_new_8']; $ep_esic_no = $_POST['ep_esic_no']; $ep_upload_esic = $_POST['cheque_doc_upload_new_9']; $ep_export_import = $_POST['ep_export_import']; $ep_upload_export_import = $_POST['cheque_doc_upload_new_10']; $sq = "INSERT INTO `company_details`(`ep_id`, `ep_name`, `ep_contact_person`, `ep_contact_no`, `ep_contact_emailid`, `ep_address`, `ep_pincode`, `ep_post_office`, `ep_district`, `ep_state`, `doc_upload`, `ep_gst_no`, `ep_pan_no`, `ep_ifsc_code`, `ep_bank_name`, `ep_bank_branch`, `ep_bank_address`, `ep_account_name`, `ep_account_no`, `ep_entity_type`, `ep_added_by`, `ep_added_date`, `ep_reg_address`,`ep_upload_logo`,`ep_upload_head_img`,`ep_upload_dashboard_img`, `roc_number`, `ep_upload_roc`, `esi_no`, `ep_upload_esic`, `epf_no`, `ep_upload_epf`, `export_import_no`, `ep_upload_export_import`, `ep_upload_gst`, `ep_upload_pan`, `company_creation_date`) VALUES (NULL,'$ep_name','$ep_contact_person','$ep_contact_no','$ep_contact_emailid','$ep_address','$ep_pincode','$ep_post','$ep_district','$ep_state','$ep_upload_doc','$ep_gst_no','$ep_pan_no','$ep_ifsc_code','$ep_bank_name','$ep_bank_branch','$ep_bank_address','$ep_account_name','$ep_account_no','$ep_entity_type','$admin_cid','$ep_added_date','$ep_reg_address','$ep_upload_logo','$ep_upload_head_img','$ep_upload_dashboard_img', '$roc_number', '$ep_upload_roc', '$ep_esic_no', '$ep_upload_esic', '$ep_epf_no', '$ep_upload_epf', '$ep_export_import', '$ep_upload_export_import', '$ep_upload_gst', '$ep_upload_pan', '$company_creation_date')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'New Company added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo '<meta http-equiv="refresh" content="0">'; // echo '<script>window.location.href="add_company_mobile.php"</script>'; echo '<script>window.location.href="add_company.php"</script>'; } // Get all Ajency Details public function getajency() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `employee_providers` WHERE company_id='$company_id' ORDER BY ep_name ASC,ep_added_date ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get company Details public function get_party_details($id) { $sq3 = "SELECT * FROM `employee_providers` WHERE ep_id IN ($id)"; $result = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function employee_provider($recommended_by) { $sq = "SELECT * FROM `employee_providers` WHERE ep_id='$recommended_by'"; $row = mysqli_query($this->conn, $sq); $result = mysqli_fetch_array($row); return $result; } // Get Ajency Details by id public function ajency_details($ep_id) { $sq3 = "SELECT * FROM `employee_providers` WHERE ep_id='$ep_id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } // Get Ref Ajency Details by id public function ref_ajency_details($ep_id) { $sq3 = "SELECT * FROM `employee_providers` WHERE ref_ep_id='$ep_id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function company_details_using_ep_id($company_id, $ep_id) { $sq3 = "SELECT * FROM employee_providers WHERE ep_id='$ep_id' AND company_id='$company_id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } // Get all Ajency Details by account status OPEN/CLOSE public function getajency_account_status($account_status) { $company_id = $_SESSION['company_id']; if ($account_status == 'ALL') { $sq = "SELECT * FROM `employee_providers` WHERE company_id='$company_id' ORDER BY ep_id asc,ep_added_date asc"; } else if ($account_status == 'OPEN') { $sq = "SELECT * FROM `employee_providers` WHERE company_id='$company_id' AND account_status IN ('ACTIVE') ORDER BY ep_id asc,ep_added_date asc"; } else { $sq = "SELECT * FROM `employee_providers` WHERE company_id='$company_id' AND account_status IN ('$account_status') ORDER BY ep_id asc,ep_added_date asc"; } $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get all Vendor Details public function getvendor() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `vendor_details` vd LEFT JOIN mstr_vendor_type vt ON vt.vt_id=vd.ep_entity_type WHERE company_id='$company_id' ORDER BY ep_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Vendor Details by id public function vendor_details($id) { $sq3 = "SELECT * FROM `vendor_details` vd LEFT JOIN mstr_vendor_type vt ON vt.vt_id=vd.ep_entity_type WHERE ep_id='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } // Get all Vendor Details by status ACTIVE/INACTIVE public function getvendor_status($account_status) { $company_id = $_SESSION['company_id']; if ($account_status == 'ALL') { $sq = "SELECT * FROM `vendor_details` vd LEFT JOIN mstr_vendor_type vt ON vt.vt_id=vd.ep_entity_type WHERE company_id='$company_id' ORDER BY ep_name ASC"; } else if ($account_status == 'ACTIVE') { $sq = "SELECT * FROM `vendor_details` vd LEFT JOIN mstr_vendor_type vt ON vt.vt_id=vd.ep_entity_type WHERE company_id='$company_id' AND vd.status IN ('ACTIVE') ORDER BY ep_name ASC"; } else { $sq = "SELECT * FROM `vendor_details` vd LEFT JOIN mstr_vendor_type vt ON vt.vt_id=vd.ep_entity_type WHERE company_id='$company_id' AND vd.status IN ('$account_status') ORDER BY ep_name ASC"; } $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function getvendor_type($type) { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `vendor_details` vd LEFT JOIN mstr_vendor_type vt ON vt.vt_id=vd.ep_entity_type WHERE company_id='$company_id' AND vd.status IN ('ACTIVE') AND ep_entity_type='$type' ORDER BY ep_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Company role Details public function get_company_roles() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `admin_roles` WHERE `company_id`='$company_id' AND `status`='1' ORDER BY r_display_no ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Company role Details by id public function get_role_detail($id) { $sq3 = "SELECT * FROM `admin_roles` INNER JOIN `company_details` ON `company_details`.`ep_id`=`admin_roles`.`company_id` WHERE `admin_roles`.`id` IN ($id)"; $result = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Company role Details by id public function get_role_detail_search($id) { $sq3 = "SELECT * FROM `admin_roles` INNER JOIN `company_details` ON `company_details`.`ep_id`=`admin_roles`.`company_id` WHERE `admin_roles`.`id` IN ($id) AND used_for_search='YES'"; $result = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //get get_role_designation public function get_role_designation($id, $column_value) { $sq = "SELECT $column_value as role_designation FROM `admin_roles` WHERE id='" . $id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['role_designation']; } //get get_role_name public function get_role_name($id) { $sq = "SELECT role_name FROM `admin_roles` WHERE id='" . $id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['role_name']; } // Get Company Details public function getcompany_account() { $sq = "SELECT * FROM `company_account_numbers`"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Ajency entry_status Details by fy_id public function get_ajency_entry_status($ep_id, $fy_id, $process_type) { $sq3 = "SELECT * FROM `tbl_party_entry_status` WHERE pes_ep_id='$ep_id' AND pes_fy_id='$fy_id' AND pes_process_type='$process_type' ORDER BY pes_id DESC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } // Get Company Details public function getcompany() { $sq = "SELECT * FROM `company_details` ORDER BY ep_name asc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function company_details_using_edd($company_id, $edd_id) { $sq3 = "SELECT * FROM company_details INNER JOIN company_account_numbers ON company_details.`ep_id`=company_account_numbers.`company_id` WHERE ep_id='$company_id' AND edd='$edd_id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function company_details($id) { $sq3 = "SELECT * FROM `company_details` WHERE ep_id='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } // Get company Details public function get_company_details($id) { $sq3 = "SELECT * FROM `company_details` WHERE ep_id IN ($id)"; $result = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_company_details_by_id_account($company_id, $account_no) { $sq3 = "SELECT * FROM `company_details` WHERE ep_id='$company_id' AND ep_account_no='$account_no'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function get_company_account_details_by_id_account($company_id, $account_no) { $sq3 = "SELECT * FROM `company_account_numbers` WHERE company_id='$company_id' AND account_no='$account_no'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } // Get Ajency Details after edit public function ajency_details_afteredit($ep_id) { $sq3 = "SELECT * FROM `employee_providers_edited` WHERE ep_id='$ep_id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function company_details_afteredit($id) { $sq3 = "SELECT * FROM `company_details_edited` WHERE ep_id='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } // Update Ajency details public function update_ajency($ep_id) { $account_opening_date = $_POST['account_opening_date']; $ep_name = $_POST['ep_name']; $ep_contact_person = $_POST['ep_contact_person']; $ep_contact_no = $_POST['ep_contact_no']; $ep_contact_emailid = $_POST['ep_contact_emailid']; $ep_address = $_POST['ep_address']; $ep_pincode = $_POST['ep_pincode']; $ep_post = $_POST['post']; $ep_district = $_POST['city']; $ep_state = $_POST['state']; // $ep_upload_document = $_POST['ep_upload_document']; $ep_gst_no = $_POST['ep_gst_no']; $ep_pan_no = $_POST['ep_pan_no']; $ep_ifsc_code = $_POST['ep_ifsc_code']; $ep_bank_name = $_POST['bank_name']; $ep_bank_branch = $_POST['bank_branch']; $ep_bank_address = $_POST['bank_address']; $ep_account_name = strtoupper($_POST['ep_account_name']); $ep_account_no = $_POST['ep_account_no']; $ep_entity_type = $_POST['ep_entity_type']; $transaction_type = $_POST['transaction_type']; $opening_balance = $_POST['opening_balance']; $group_name = $_POST['group_name']; $sub_group_name = $_POST['sub_group_name']; $account_status = $_POST['account_status']; $account_status_date = $_POST['account_status_date']; $account_status_reason = $_POST['account_status_reason']; $check_account_status = $_POST['check_account_status']; $account_status_amount = $_POST['account_status_amount']; $account_status_amount_type = $_POST['account_status_amount_type']; $status = $_POST['status']; $status_date = $_POST['status_date']; $status_reason = $_POST['status_reason']; $check_status = $_POST['check_status']; $ep_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $updated_in = 'Edited in'; // $ep_account_type = $_POST['ep_account_type']; $check_account_type = $_POST['check_account_type']; $ep_cif_no = $_POST['ep_cif_no']; if ($check_account_type) { $ep_account_type = json_encode($_POST['ep_account_type']); // $ep_account_type = $_POST['ep_account_type']; $updated_in .= ' Account Type or CIF No.,'; } // $ep_display_type = $_POST['ep_display_type']; $check_display_type = $_POST['check_display_type']; if ($check_display_type) { $ep_display_type = json_encode($_POST['ep_display_type']); $updated_in .= ' Account Display Type,'; } //Check if checkbox is checked if (!empty($_POST['check_name'])) { $ep_checkbox_name = 'checked'; $updated_in .= ' Ajency Name,'; } else { $ep_checkbox_name = 'unchecked'; } if (!empty($_POST['ep_account_type'])) { $ep_checkbox_account_type = 'checked'; $updated_in .= ' Ajency Account Type,'; } else { $ep_checkbox_account_type = 'unchecked'; } if (!empty($_POST['ep_display_type'])) { $ep_checkbox_display_type = 'checked'; $updated_in .= ' Ajency Display Name,'; } else { $ep_checkbox_display_type = 'unchecked'; } if (!empty($_POST['check_contact_person'])) { $ep_checkbox_contact_person = 'checked'; $updated_in .= ' Contact Person,'; } else { $ep_checkbox_contact_person = 'unchecked'; } if (!empty($_POST['check_contact_no'])) { $ep_checkbox_contact_no = 'checked'; $updated_in .= ' Contact No.,'; } else { $ep_checkbox_contact_no = 'unchecked'; } if (!empty($_POST['check_contact_emailid'])) { $ep_checkbox_contact_emailid = 'checked'; $updated_in .= ' Emailid,'; } else { $ep_checkbox_contact_emailid = 'unchecked'; } if (!empty($_POST['check_address'])) { $ep_checkbox_address = 'checked'; $updated_in .= ' Address,'; } else { $ep_checkbox_address = 'unchecked'; } if (!empty($_POST['check_pincode'])) { $ep_checkbox_pincode = 'checked'; $updated_in .= ' Pincode,'; } else { $ep_checkbox_pincode = 'unchecked'; } if (!empty($_POST['check_post'])) { $ep_checkbox_post = 'checked'; $updated_in .= ' Post,'; } else { $ep_checkbox_post = 'unchecked'; } if (!empty($_POST['check_district'])) { $ep_checkbox_district = 'checked'; $updated_in .= ' District,'; } else { $ep_checkbox_district = 'unchecked'; } if (!empty($_POST['check_state'])) { $ep_checkbox_state = 'checked'; $updated_in .= ' State,'; } else { $ep_checkbox_state = 'unchecked'; } if (!empty($_POST['check_gst_no'])) { $ep_checkbox_gst_no = 'checked'; $updated_in .= ' GSTIN No.,'; } else { $ep_checkbox_gst_no = 'unchecked'; } if (!empty($_POST['check_pan_no'])) { $ep_checkbox_pan_no = 'checked'; $updated_in .= ' PAN No.,'; } else { $ep_checkbox_pan_no = 'unchecked'; } if (!empty($_POST['check_ifsc_code'])) { $ep_checkbox_ifsc_code = 'checked'; $updated_in .= ' IFSC Code,'; } else { $ep_checkbox_ifsc_code = 'unchecked'; } if (!empty($_POST['check_bank_name'])) { $ep_checkbox_bank_name = 'checked'; $updated_in .= ' Bank Name,'; } else { $ep_checkbox_bank_name = 'unchecked'; } if (!empty($_POST['check_bank_branch'])) { $ep_checkbox_bank_branch = 'checked'; $updated_in .= ' Bank Branch,'; } else { $ep_checkbox_bank_branch = 'unchecked'; } if (!empty($_POST['check_bank_address'])) { $ep_checkbox_bank_address = 'checked'; $updated_in .= ' Bank Address,'; } else { $ep_checkbox_bank_address = 'unchecked'; } if (!empty($_POST['check_account_name'])) { $ep_checkbox_account_name = 'checked'; $updated_in .= ' Account Name,'; } else { $ep_checkbox_account_name = 'unchecked'; } if (!empty($_POST['check_account_no'])) { $ep_checkbox_account_no = 'checked'; $updated_in .= ' Account No.,'; } else { $ep_checkbox_account_no = 'unchecked'; } if (!empty($_POST['check_entity_type'])) { $ep_checkbox_entity_type = 'checked'; $updated_in .= ' Entity Type,'; } else { $ep_checkbox_entity_type = 'unchecked'; } if (!empty($_POST['check_transaction_type'])) { $ep_checkbox_transaction_type = 'checked'; $updated_in .= ' Transaction Type,'; } else { $ep_checkbox_transaction_type = 'unchecked'; } if (!empty($_POST['check_opening_balance'])) { $ep_checkbox_opening_balance = 'checked'; $updated_in .= ' Opening Balance and Transaction Type,'; } else { $ep_checkbox_opening_balance = 'unchecked'; } if (!empty($_POST['check_account_opening_date'])) { $ep_checkbox_account_opening_date = 'checked'; $updated_in .= ' Opening Account Date,'; } else { $ep_checkbox_account_opening_date = 'unchecked'; } if (!empty($_POST['check_group_name'])) { $ep_check_group_name = 'checked'; $updated_in .= ' Group Name,'; } else { $ep_check_group_name = 'unchecked'; } if (!empty($_POST['check_sub_group_name'])) { $ep_check_sub_group_name = 'checked'; $updated_in .= ' Sub Group Name,'; } else { $ep_check_sub_group_name = 'unchecked'; } if (!empty($check_account_status)) { $ep_checkbox_account_status = 'checked'; $updated_in .= 'Ajency Account Status/Amount/date/Reason due to ' . $account_status_reason; } else { $ep_checkbox_account_status = 'unchecked'; } if (!empty($check_status)) { $ep_checkbox_status = 'checked'; $updated_in .= 'Ajency Status/Date/Reason due to ' . $status_reason; } else { $ep_checkbox_status = 'unchecked'; } $ep_vendor_code = $_POST['ep_vendor_code']; if (!empty($_POST['check_ep_vendor_code'])) { $ep_checkbox_vendor_code = 'checked'; $updated_in .= ' Vendor Code,'; } else { $ep_checkbox_vendor_code = 'unchecked'; } $ok = 1; if (!empty($_POST['check_upload_document'])) { $ep_checkbox_doc_upload = 'checked'; $targetfolder = "../include/ajency_upload_edit/"; $targetfile = $targetfolder . basename($_FILES['ep_upload_document']['name']); $target_file1 = $targetfolder . $ep_id . '_' . date('YmdHis') . '.pdf'; $target_file1 = str_replace(' ', '+', $target_file1); // $ok = 1; // Check file size // if ($_FILES["ep_upload_document"]["size"] > 300000) { // echo $errtext = "Sorry, your image size is larger than 1 MB."; // $ok = 0; // } if (file_exists($targetfile)) { chmod($targetfile, 0755); //Change the file permissions if allowed unlink($targetfile); //remove the file } // Check file type $file_type = $_FILES['ep_upload_document']['type']; // if ($file_type == "application/pdf" || $file_type == "image/gif" || $file_type == "image/jpeg") { if ($file_type == "application/pdf") { if (move_uploaded_file($_FILES['ep_upload_document']['tmp_name'], $targetfolder . $ep_id . '_' . date('YmdHis') . '.pdf')) { "The file " . basename($_FILES['ep_upload_document']['name']) . " is uploaded"; } else { $ok = 0; echo "Problem IN uploading your file"; } } else { $ok = 0; echo "You may only upload PDF files.<br>"; } } else { $ep_checkbox_doc_upload = 'unchecked'; } $result = mysqli_query($this->conn, "SELECT * FROM `employee_providers_edited` WHERE ep_id='$ep_id'"); if ($ok == 1) { if (mysqli_num_rows($result) > 0) { // $sql="UPDATE `employee_providers_edited` SET `ep_checkbox_name`='$',`ep_name`='$ep_name',`ep_checkbox_contact_person`='$',`ep_contact_person`='$ep_contact_person',`ep_checkbox_contact_no`=[value-7],`ep_contact_no`='$ep_contact_no',`ep_checkbox_contact_emailid`=[value-9],`ep_contact_emailid`='$ep_contact_emailid'," // . "`ep_checkbox_address`=[value-11],`ep_address`='$ep_address',`ep_checkbox_pincode`=[value-13],`ep_pincode`='$ep_pincode',`ep_checkbox_post_office`=[value-15],`ep_post_office`='$ep_post',`ep_checkbox_district`=[value-17],`ep_district`='$ep_district'" // . ",`ep_checkbox_state`=[value-19],`ep_state`='$ep_state',`ep_checkbox_doc_upload`=[value-21],`doc_upload`='$',`ep_checkbox_gst_no`=[value-23],`ep_gst_no`='$ep_gst_no',`ep_checkbox_pan_no`=[value-25],`ep_pan_no`='$ep_pan_no',`ep_checkbox_ifsc_code`=[value-27],`ep_ifsc_code`='$ep_ifsc_code',`ep_checkbox_bank_name`=[value-29],`ep_bank_name`='$ep_bank_name',`ep_checkbox_bank_branch`=[value-31],`ep_bank_branch`=[value-32],`ep_checkbox_bank_address`=[value-33],`ep_bank_address`=[value-34],`ep_checkbox_account_name`=[value-35],`ep_account_name`=[value-36],`ep_checkbox_account_no`=[value-37],`ep_account_no`=[value-38],`ep_checkbox_entity_type`=[value-39],`ep_entity_type`=[value-40],`ep_added_by`=[value-41],`ep_added_date`=[value-42],`ep_updated_by`=[value-43],`ep_updated_date`=[value-44],`ep_db_time`=[value-45] WHERE 1"; $sql = "UPDATE `employee_providers_edited` SET `ep_name`='$ep_name',`ep_contact_person`='$ep_contact_person',`ep_contact_no`='$ep_contact_no',`ep_contact_emailid`='$ep_contact_emailid', `ep_address`='$ep_address', `ep_pincode`='$ep_pincode', `ep_post_office`='$ep_post', `ep_district`='$ep_district',`ep_state`='$ep_state',`doc_upload`='$target_file1',`ep_gst_no`='$ep_gst_no',`ep_pan_no`='$ep_pan_no',`ep_ifsc_code`='$ep_ifsc_code',`ep_bank_name`='$ep_bank_name',`ep_bank_branch`='$ep_bank_branch',`ep_bank_address`='$ep_bank_address',`ep_account_name`='$ep_account_name',`ep_account_no`='$ep_account_no',`ep_entity_type`='$ep_entity_type',`ep_updated_by`='$admin_cid',`ep_updated_date`='$ep_updated_date',`ep_edit_status`='yes',`balance_amount`='$opening_balance',`transaction_type`='$transaction_type',`account_opening_date`='$account_opening_date',`ep_display_type`='$ep_display_type',`g_id`='$group_name',`s_g_id`='$sub_group_name',`ep_account_type`='$ep_account_type',`ep_cif_no`='$ep_cif_no',`account_status`='$account_status',`account_status_by`='$admin_cid',`account_status_date`='$account_status_date',`account_status_amount`='$account_status_amount',`account_status_amount_type`='$account_status_amount_type',`account_status_reason`='$account_status_reason',`status`='$status',`status_by`='$admin_cid',`status_date`='$status_date',`status_reason`='$status_reason', `ep_vendor_code`='$ep_vendor_code' WHERE ep_id='$ep_id'"; } else { $sql = "INSERT INTO `employee_providers_edited`(`ep_id`, `ep_checkbox_name`, `ep_name`, `ep_checkbox_contact_person`, `ep_contact_person`, `ep_checkbox_contact_no`, `ep_contact_no`, `ep_checkbox_contact_emailid`, `ep_contact_emailid`, `ep_checkbox_address`, `ep_address`, `ep_checkbox_pincode`, `ep_pincode`, `ep_checkbox_post_office`, `ep_post_office`, `ep_checkbox_district`, `ep_district`, `ep_checkbox_state`, `ep_state`, `ep_checkbox_doc_upload`, `doc_upload`, `ep_checkbox_gst_no`, `ep_gst_no`, `ep_checkbox_pan_no`, `ep_pan_no`, `ep_checkbox_ifsc_code`, `ep_ifsc_code`, `ep_checkbox_bank_name`, `ep_bank_name`, `ep_checkbox_bank_branch`, `ep_bank_branch`, `ep_checkbox_bank_address`, `ep_bank_address`, `ep_checkbox_account_name`, `ep_account_name`, `ep_checkbox_account_no`, `ep_account_no`, `ep_checkbox_entity_type`, `ep_entity_type`, `ep_updated_by`, `ep_updated_date`, `ep_edit_status`, `balance_amount`, `transaction_type`, `account_opening_date`, `ep_display_type`, `g_id`, `s_g_id`, `ep_account_type`, `ep_cif_no`, `account_status`, `account_status_by`, `account_status_date`, `account_status_amount`, `account_status_amount_type`, `account_status_reason`, `status`, `status_by`, `status_date`, `status_reason`, `ep_checkbox_vendor_code`, `ep_vendor_code`) VALUES ('$ep_id','','$ep_name','','$ep_contact_person','','$ep_contact_no','','$ep_contact_emailid','','$ep_address','','$ep_pincode','','$ep_post','','$ep_district','','$ep_state','','$target_file1','','$ep_gst_no','','$ep_pan_no','','$ep_ifsc_code','','$ep_bank_name','','$ep_bank_branch','','$ep_bank_address','','$ep_account_name','','$ep_account_no','','$ep_entity_type','$admin_cid','$ep_updated_date','yes','$opening_balance','$transaction_type','$account_opening_date','$ep_display_type','$group_name','$sub_group_name','$ep_account_type','$ep_cif_no','$account_status','$admin_cid','$account_status_date','$account_status_amount','$account_status_amount_type','$account_status_reason','$status','$admin_cid','$status_date','$status_reason', '', '$ep_vendor_code')"; } $qu = mysqli_query($this->conn, $sql); $sq33 = "UPDATE `employee_providers` SET `ep_updated_by`='$admin_cid',`ep_edit_status`='yes',`ep_updated_date`='$ep_updated_date' WHERE `ep_id`='$ep_id'"; $qu33 = mysqli_query($this->conn, $sq33); } //echo $sql; if ($qu) { $_SESSION['msg'] = "Ajency Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } $this->save_ajency_update_details($ep_id, $updated_in, $admin_cid); echo '<meta http-equiv="refresh" content="5">'; } public function update_company_details($ep_id) { $ep_name = $_POST['ep_name']; $ep_contact_person = $_POST['ep_contact_person']; $ep_contact_no = $_POST['ep_contact_no']; $ep_contact_emailid = $_POST['ep_contact_emailid']; $ep_address = $_POST['ep_address']; $ep_pincode = $_POST['ep_pincode']; $ep_post = $_POST['post']; $ep_district = $_POST['city']; $ep_state = $_POST['state']; // $ep_upload_document = $_POST['ep_upload_document']; $ep_gst_no = $_POST['ep_gst_no']; $ep_pan_no = $_POST['ep_pan_no']; $ep_ifsc_code = $_POST['ep_ifsc_code']; $ep_bank_name = $_POST['bank_name']; $ep_bank_branch = $_POST['bank_branch']; $ep_bank_address = $_POST['bank_address']; $ep_account_name = strtoupper($_POST['ep_account_name']); $ep_account_no = $_POST['ep_account_no']; $ep_entity_type = $_POST['ep_entity_type']; $ep_account_type = $_POST['ep_account_type']; $ep_reg_address = $_POST['ep_reg_address']; $ep_upload_document = $_POST['cheque_doc_upload_new_16']; $ep_upload_logo = $_POST['cheque_doc_upload_new_22']; $ep_upload_head_img = $_POST['cheque_doc_upload_new_23']; $ep_upload_dashboard_img = $_POST['cheque_doc_upload_new_24']; $roc_number = $_POST['roc_number']; $ep_upload_roc = $_POST['cheque_doc_upload_new_26']; $ep_esic_no = $_POST['esi_no']; $ep_upload_esic = $_POST['cheque_doc_upload_new_27']; $ep_epf_no = $_POST['epf_no']; $ep_upload_epf = $_POST['cheque_doc_upload_new_28']; $ep_export_import = $_POST['export_import_no']; $ep_upload_export_import = $_POST['cheque_doc_upload_new_29']; $ep_upload_gst = $_POST['cheque_doc_upload_new_30']; $ep_upload_pan = $_POST['cheque_doc_upload_new_31']; $company_creation_date = $_POST['company_creation_date']; $ep_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $updated_in = 'Edited IN '; //Check if checkbox is checked if (!empty($_POST['check_name'])) { $ep_checkbox_name = 'checked'; $updated_in .= 'Company Name '; } else { $ep_checkbox_name = 'unchecked'; } if (!empty($_POST['check_company_creation_date'])) { $ep_company_creation_date = 'checked'; $updated_in .= 'Company Creation Date '; } else { $ep_company_creation_date = 'unchecked'; } if (!empty($_POST['check_contact_person'])) { $ep_checkbox_contact_person = 'checked'; $updated_in .= 'Contact Person '; } else { $ep_checkbox_contact_person = 'unchecked'; } if (!empty($_POST['check_contact_no'])) { $ep_checkbox_contact_no = 'checked'; $updated_in .= 'Contact No. '; } else { $ep_checkbox_contact_no = 'unchecked'; } if (!empty($_POST['check_contact_emailid'])) { $ep_checkbox_contact_emailid = 'checked'; $updated_in .= 'Emailid '; } else { $ep_checkbox_contact_emailid = 'unchecked'; } if (!empty($_POST['check_address'])) { $ep_checkbox_address = 'checked'; $updated_in .= 'Address '; } else { $ep_checkbox_address = 'unchecked'; } if (!empty($_POST['check_pincode'])) { $ep_checkbox_pincode = 'checked'; $updated_in .= 'Pincode '; } else { $ep_checkbox_pincode = 'unchecked'; } if (!empty($_POST['check_post'])) { $ep_checkbox_post = 'checked'; $updated_in .= 'Post '; } else { $ep_checkbox_post = 'unchecked'; } if (!empty($_POST['check_district'])) { $ep_checkbox_district = 'checked'; $updated_in .= 'District '; } else { $ep_checkbox_district = 'unchecked'; } if (!empty($_POST['check_state'])) { $ep_checkbox_state = 'checked'; $updated_in .= 'State '; } else { $ep_checkbox_state = 'unchecked'; } if (!empty($_POST['check_gst_no'])) { $ep_checkbox_gst_no = 'checked'; $updated_in .= 'GSTIN No. '; } else { $ep_checkbox_gst_no = 'unchecked'; } if (!empty($_POST['check_pan_no'])) { $ep_checkbox_pan_no = 'checked'; $updated_in .= 'PAN No. '; } else { $ep_checkbox_pan_no = 'unchecked'; } if (!empty($_POST['check_ifsc_code'])) { $ep_checkbox_ifsc_code = 'checked'; $updated_in .= 'IFSC Code '; } else { $ep_checkbox_ifsc_code = 'unchecked'; } if (!empty($_POST['check_bank_name'])) { $ep_checkbox_bank_name = 'checked'; $updated_in .= 'Bank Name '; } else { $ep_checkbox_bank_name = 'unchecked'; } if (!empty($_POST['check_bank_branch'])) { $ep_checkbox_bank_branch = 'checked'; $updated_in .= 'Bank Branch '; } else { $ep_checkbox_bank_branch = 'unchecked'; } if (!empty($_POST['check_bank_address'])) { $ep_checkbox_bank_address = 'checked'; $updated_in .= 'Bank Address '; } else { $ep_checkbox_bank_address = 'unchecked'; } if (!empty($_POST['check_account_name'])) { $ep_checkbox_account_name = 'checked'; $updated_in .= 'Account Name '; } else { $ep_checkbox_account_name = 'unchecked'; } if (!empty($_POST['check_account_no'])) { $ep_checkbox_account_no = 'checked'; $updated_in .= 'Account No. '; } else { $ep_checkbox_account_no = 'unchecked'; } if (!empty($_POST['check_entity_type'])) { $ep_checkbox_entity_type = 'checked'; $updated_in .= 'Entity Type '; } else { $ep_checkbox_entity_type = 'unchecked'; } if (!empty($_POST['check_upload_document'])) { $ep_check_upload_document = 'checked'; $updated_in .= 'Company Document '; } else { $ep_check_upload_document = 'unchecked'; } if (!empty($_POST['check_upload_logo'])) { $ep_check_upload_logo = 'checked'; $updated_in .= 'Company Logo'; } else { $ep_check_upload_logo = 'unchecked'; } if (!empty($_POST['check_upload_header_img'])) { $ep_check_upload_header_img = 'checked'; $updated_in .= 'Company Header Image'; } else { $ep_check_upload_header_img = 'unchecked'; } if (!empty($_POST['check_upload_dashboard_img'])) { $ep_check_upload_dashboard_img = 'checked'; $updated_in .= 'Company Dashboard Image'; } else { $ep_check_upload_dashboard_img = 'unchecked'; } if (!empty($_POST['check_reg_address'])) { $ep_checkbox_reg_address = 'checked'; $updated_in .= 'Registered Address '; } else { $ep_checkbox_reg_address = 'unchecked'; } // $targetfolder = "../include/company_upload_edit/"; if (!empty($_POST['check_roc_no'])) { $ep_check_roc_no = 'checked'; $updated_in .= 'ROC No. '; } else { $ep_check_roc_no = 'unchecked'; } if (!empty($_POST['check_upload_roc'])) { $ep_checkbox_reg_address = 'checked'; $updated_in .= 'ROC Upload '; } else { $ep_checkbox_reg_address = 'unchecked'; } if (!empty($_POST['check_esic_no'])) { $ep_check_esic_no = 'checked'; $updated_in .= 'ESIC No. '; } else { $ep_check_esic_no = 'unchecked'; } if (!empty($_POST['check_upload_esic'])) { $ep_check_upload_esic = 'checked'; $updated_in .= 'ESIC Upload '; } else { $ep_check_upload_esic = 'unchecked'; } if (!empty($_POST['check_epf_no'])) { $ep_check_epf_no = 'checked'; $updated_in .= 'EPF NO. '; } else { $ep_check_epf_no = 'unchecked'; } if (!empty($_POST['check_upload_epf'])) { $ep_check_upload_epf = 'checked'; $updated_in .= 'EPF Upload '; } else { $ep_check_upload_epf = 'unchecked'; } if (!empty($_POST['check_export_import_no'])) { $ep_check_export_import_no = 'checked'; $updated_in .= 'Export/Import No. '; } else { $ep_check_export_import_no = 'unchecked'; } if (!empty($_POST['check_upload_export_import'])) { $ep_check_upload_export_import = 'checked'; $updated_in .= 'Export/Import Upload '; } else { $ep_check_upload_export_import = 'unchecked'; } if (!empty($_POST['check_upload_gst'])) { $ep_check_upload_gst = 'checked'; $updated_in .= 'GST Upload '; } else { $ep_check_upload_gst = 'unchecked'; } if (!empty($_POST['check_upload_pan'])) { $ep_check_upload_pan = 'checked'; $updated_in .= 'PANCARD Upload '; } else { $ep_check_upload_pan = 'unchecked'; } $result = mysqli_query($this->conn, "SELECT * FROM `company_details_edited` WHERE ep_id='$ep_id'"); if (mysqli_num_rows($result) > 0) { // $sql="UPDATE `employee_providers_edited` SET `ep_checkbox_name`='$',`ep_name`='$ep_name',`ep_checkbox_contact_person`='$',`ep_contact_person`='$ep_contact_person',`ep_checkbox_contact_no`=[value-7],`ep_contact_no`='$ep_contact_no',`ep_checkbox_contact_emailid`=[value-9],`ep_contact_emailid`='$ep_contact_emailid'," // . "`ep_checkbox_address`=[value-11],`ep_address`='$ep_address',`ep_checkbox_pincode`=[value-13],`ep_pincode`='$ep_pincode',`ep_checkbox_post_office`=[value-15],`ep_post_office`='$ep_post',`ep_checkbox_district`=[value-17],`ep_district`='$ep_district'" // . ",`ep_checkbox_state`=[value-19],`ep_state`='$ep_state',`ep_checkbox_doc_upload`=[value-21],`doc_upload`='$',`ep_checkbox_gst_no`=[value-23],`ep_gst_no`='$ep_gst_no',`ep_checkbox_pan_no`=[value-25],`ep_pan_no`='$ep_pan_no',`ep_checkbox_ifsc_code`=[value-27],`ep_ifsc_code`='$ep_ifsc_code',`ep_checkbox_bank_name`=[value-29],`ep_bank_name`='$ep_bank_name',`ep_checkbox_bank_branch`=[value-31],`ep_bank_branch`=[value-32],`ep_checkbox_bank_address`=[value-33],`ep_bank_address`=[value-34],`ep_checkbox_account_name`=[value-35],`ep_account_name`=[value-36],`ep_checkbox_account_no`=[value-37],`ep_account_no`=[value-38],`ep_checkbox_entity_type`=[value-39],`ep_entity_type`=[value-40],`ep_added_by`=[value-41],`ep_added_date`=[value-42],`ep_updated_by`=[value-43],`ep_updated_date`=[value-44],`ep_db_time`=[value-45] WHERE 1"; $sql = "UPDATE `company_details_edited` SET `ep_name`='$ep_name',`ep_contact_person`='$ep_contact_person',`ep_contact_no`='$ep_contact_no',`ep_contact_emailid`='$ep_contact_emailid', `ep_address`='$ep_address', `ep_pincode`='$ep_pincode', `ep_post_office`='$ep_post', `ep_district`='$ep_district',`ep_state`='$ep_state',`doc_upload`='$ep_upload_document',`ep_gst_no`='$ep_gst_no',`ep_pan_no`='$ep_pan_no',`ep_ifsc_code`='$ep_ifsc_code',`ep_bank_name`='$ep_bank_name',`ep_bank_branch`='$ep_bank_branch',`ep_bank_address`='$ep_bank_address',`ep_account_name`='$ep_account_name',`ep_account_no`='$ep_account_no',`ep_entity_type`='$ep_entity_type',`ep_updated_by`='$admin_cid',`ep_updated_date`='$ep_updated_date',`ep_edit_status`='yes', `ep_reg_address`='$ep_reg_address', `ep_upload_logo`='$ep_upload_logo', `ep_upload_head_img`='$ep_upload_head_img', `ep_upload_dashboard_img`='$ep_upload_dashboard_img',`roc_number`='$roc_number',`ep_upload_roc`='$ep_upload_roc',`esi_no`='$ep_esic_no',`ep_upload_esic`='$ep_upload_esic',`epf_no`='$ep_epf_no',`ep_upload_epf`='$ep_upload_epf',`export_import_no`='$ep_export_import',`ep_upload_export_import`='$ep_upload_export_import',`ep_upload_gst`='$ep_upload_pan',`ep_upload_pan`='$ep_upload_pan',`company_creation_date`='$company_creation_date' WHERE ep_id='$ep_id'"; } else { $sql = "INSERT INTO `company_details_edited`(`ep_id`, `ep_checkbox_name`, `ep_name`, `ep_checkbox_contact_person`, `ep_contact_person`, `ep_checkbox_contact_no`, `ep_contact_no`, `ep_checkbox_contact_emailid`, `ep_contact_emailid`, `ep_checkbox_address`, `ep_address`, `ep_checkbox_pincode`, `ep_pincode`, `ep_checkbox_post_office`, `ep_post_office`, `ep_checkbox_district`, `ep_district`, `ep_checkbox_state`, `ep_state`, `ep_checkbox_doc_upload`, `doc_upload`, `ep_checkbox_gst_no`, `ep_gst_no`, `ep_checkbox_pan_no`, `ep_pan_no`, `ep_checkbox_ifsc_code`, `ep_ifsc_code`, `ep_checkbox_bank_name`, `ep_bank_name`, `ep_checkbox_bank_branch`, `ep_bank_branch`, `ep_checkbox_bank_address`, `ep_bank_address`, `ep_checkbox_account_name`, `ep_account_name`, `ep_checkbox_account_no`, `ep_account_no`, `ep_checkbox_entity_type`, `ep_entity_type`, `ep_updated_by`, `ep_updated_date`, `ep_edit_status`, `ep_checkbox_reg_address`, `ep_reg_address`, `ep_checkbox_upload_logo`, `ep_upload_logo`, `ep_checkbox_upload_head_img`, `ep_upload_head_img`, `ep_checkbox_upload_dashboard_img`, `ep_upload_dashboard_img`, `roc_number`, `ep_upload_roc`, `esi_no`, `ep_upload_esic`, `epf_no`, `ep_upload_epf`, `export_import_no`, `ep_upload_export_import`, `ep_upload_gst`, `ep_upload_pan`, `company_creation_date`) VALUES ('$ep_id','','$ep_name','','$ep_contact_person','','$ep_contact_no','','$ep_contact_emailid','','$ep_address','','$ep_pincode','','$ep_post','','$ep_district','','$ep_state','','$ep_upload_document','','$ep_gst_no','','$ep_pan_no','','$ep_ifsc_code','','$ep_bank_name','','$ep_bank_branch','','$ep_bank_address','','$ep_account_name','','$ep_account_no','','$ep_entity_type','$admin_cid','$ep_updated_date','yes','', '$ep_reg_address','', '$ep_upload_logo','', '$ep_upload_head_img','', '$ep_upload_dashboard_img', '$roc_number', '$ep_upload_roc', '$ep_esic_no', '$ep_upload_esic', '$ep_epf_no', '$ep_upload_epf', '$ep_export_import', '$ep_upload_export_import', '$ep_upload_gst', '$ep_upload_pan', '$company_creation_date')"; } // echo $sql; $qu = mysqli_query($this->conn, $sql); if ($qu) { $sq33 = "UPDATE `company_details` SET `ep_updated_by`='$admin_cid',`ep_edit_status`='yes',`ep_updated_date`='$ep_updated_date' WHERE `ep_id`='$ep_id'"; $qu33 = mysqli_query($this->conn, $sq33); $_SESSION['msg'] = "Company Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } $this->save_company_update_details($ep_id, $updated_in, $admin_cid); echo '<meta http-equiv="refresh" content="2">'; } // Delete Ajency public function delete_ajency($id) { $sq11 = "DELETE FROM `employee_providers` WHERE ep_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Ajency Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo "<script> setTimeout(function () { location.href='view_ajency.php'; }, 5000);</script>"; // echo '<meta http-equiv="refresh" content="5">'; } // Delete Vendor public function delete_vendor($id) { $sq11 = "DELETE FROM `vendor_details` WHERE ep_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Vendor Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong! ' . mysqli_error($this->conn); } echo "<script> setTimeout(function () { location.href='view_vendor.php'; }, 5000);</script>"; // echo '<meta http-equiv="refresh" content="5">'; } public function delete_company($id) { $sq11 = "DELETE FROM `company_details` WHERE ep_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Company Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo "<script> setTimeout(function () { location.href='add_company.php'; }, 6000);</script>"; // echo '<meta http-equiv="refresh" content="5">'; } public function select_updated_ajency() { $sq = "SELECT `employee_providers_edited`.*,`sub_admin`.`user_name` as admin_name FROM `employee_providers_edited` INNER JOIN `sub_admin` ON `employee_providers_edited`.`ep_updated_by`=`sub_admin`.`id` WHERE `ep_edit_status`='yes' ORDER BY ep_updated_date desc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function select_updated_company() { $sq = "SELECT `company_details_edited`.*,`sub_admin`.`user_name` as admin_name FROM `company_details_edited` INNER JOIN `sub_admin` ON `company_details_edited`.`ep_updated_by`=`sub_admin`.`id` WHERE `ep_edit_status`='yes' ORDER BY ep_updated_date desc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function validate_ajency_phone($phone) { $sq = "SELECT * FROM `employee_providers` WHERE `ep_contact_no`='$phone'"; $qu1 = mysqli_query($this->conn, $sq); // $res= mysqli_fetch_assoc($qu1); return $qu1; } public function validate_company_phone($phone) { $sq = "SELECT * FROM `company_details` WHERE `ep_contact_no`='$phone'"; $qu1 = mysqli_query($this->conn, $sq); // $res= mysqli_fetch_assoc($qu1); return $qu1; } public function move_to_new($status, $customer_id, $admin_cid, $admin_name, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); // $message = "Your application for Globetech Creations Pvt. Ltd. is Terminated."; $sq3 = "UPDATE `employee` SET `application_status`='unaccepted',`updated_date`='$updated_date',`approved_emp_no`='',`approve_by_admin_id`='$admin_cid',`reason`='$reason',`remark`='$remark',`recommended_by`='0' WHERE `cid`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); // $this->send_bulk_message($customer_id, $message); $this->save_employee_application_status($customer_id, 'unaccepted', $reason, $remark, $admin_cid); return $qu3; } public function change_ajency_details_afteredit($status1, $ep_id, $admin_cid) { $admin_name = $_SESSION['name']; $updated_date = $approval_date = date('Y-m-d H:i:s'); $sql_sel = "SELECT * FROM `employee_providers_edited` WHERE `ep_id`='$ep_id'"; $qu_sel = mysqli_query($this->conn, $sql_sel); $res_sel = mysqli_fetch_assoc($qu_sel); $sqq = ''; if ($res_sel['account_opening_date'] != '0000-00-00') { $account_opening_date = $res_sel['account_opening_date']; $sqq .= "UPDATE `employee_providers` SET `account_opening_date`='$account_opening_date' WHERE `ep_id`='$ep_id';"; }if ($res_sel['transaction_type'] != '') { $transaction_type = $res_sel['transaction_type']; $sqq .= "UPDATE `employee_providers` SET `transaction_type`='$transaction_type' WHERE `ep_id`='$ep_id';"; } if ($res_sel['balance_amount'] != '') { $balance_amount = $res_sel['balance_amount']; $sqq .= "UPDATE `employee_providers` SET `balance_amount`='$balance_amount' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_name'] != '') { $ep_name = $res_sel['ep_name']; $sqq .= "UPDATE `employee_providers` SET `ep_name`='$ep_name' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_contact_person'] != '') { $ep_contact_person = $res_sel['ep_contact_person']; $sqq .= "UPDATE `employee_providers` SET `ep_contact_person`='$ep_contact_person' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_contact_no'] != '') { $ep_contact_no = $res_sel['ep_contact_no']; $sqq .= "UPDATE `employee_providers` SET `ep_contact_no`='$ep_contact_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_contact_emailid'] != '') { $ep_contact_emailid = $res_sel['ep_contact_emailid']; $sqq .= "UPDATE `employee_providers` SET `ep_contact_emailid`='$ep_contact_emailid' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_address'] != '') { $ep_address = $res_sel['ep_address']; $sqq .= "UPDATE `employee_providers` SET `ep_address`='$ep_address' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_pincode'] != '') { $ep_pincode = $res_sel['ep_pincode']; $sqq .= "UPDATE `employee_providers` SET `ep_pincode`='$ep_pincode' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_post_office'] != '') { $ep_post_office = $res_sel['ep_post_office']; $sqq .= "UPDATE `employee_providers` SET `ep_post_office`='$ep_post_office' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_district'] != '') { $ep_district = $res_sel['ep_district']; $sqq .= "UPDATE `employee_providers` SET `ep_district`='$ep_district' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_state'] != '') { $ep_state = $res_sel['ep_state']; $sqq .= "UPDATE `employee_providers` SET `ep_state`='$ep_state' WHERE `ep_id`='$ep_id';"; } if ($res_sel['doc_upload'] != '') { $doc_upload = $res_sel['doc_upload']; $sqq .= "UPDATE `employee_providers` SET `doc_upload`='$doc_upload' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_gst_no'] != '') { $ep_gst_no = $res_sel['ep_gst_no']; $sqq .= "UPDATE `employee_providers` SET `ep_gst_no`='$ep_gst_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_pan_no'] != '') { $ep_pan_no = $res_sel['ep_pan_no']; $sqq .= "UPDATE `employee_providers` SET `ep_pan_no`='$ep_pan_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_ifsc_code'] != '') { $ep_ifsc_code = $res_sel['ep_ifsc_code']; $sqq .= "UPDATE `employee_providers` SET `ep_ifsc_code`='$ep_ifsc_code' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_bank_name'] != '') { $ep_bank_name = $res_sel['ep_bank_name']; $sqq .= "UPDATE `employee_providers` SET `ep_bank_name`='$ep_bank_name' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_bank_branch'] != '') { $ep_bank_branch = $res_sel['ep_bank_branch']; $sqq .= "UPDATE `employee_providers` SET `ep_bank_branch`='$ep_bank_branch' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_bank_address'] != '') { $ep_bank_address = $res_sel['ep_bank_address']; $sqq .= "UPDATE `employee_providers` SET `ep_bank_address`='$ep_bank_address' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_account_name'] != '') { $ep_account_name = $res_sel['ep_account_name']; $sqq .= "UPDATE `employee_providers` SET `ep_account_name`='$ep_account_name' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_account_no'] != '') { $ep_account_no = $res_sel['ep_account_no']; $sqq .= "UPDATE `employee_providers` SET `ep_account_no`='$ep_account_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_entity_type'] != '') { $ep_entity_type = $res_sel['ep_entity_type']; $sqq .= "UPDATE `employee_providers` SET `ep_entity_type`='$ep_entity_type' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_account_type']) { $ep_account_type = $res_sel['ep_account_type']; $sqq .= "UPDATE `employee_providers` SET `ep_account_type`='$ep_account_type' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_cif_no']) { $ep_cif_no = $res_sel['ep_cif_no']; $sqq .= "UPDATE `employee_providers` SET `ep_cif_no`='$ep_cif_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_display_type']) { $ep_display_type = $res_sel['ep_display_type']; $sqq .= "UPDATE `employee_providers` SET `ep_display_type`='$ep_display_type' WHERE `ep_id`='$ep_id';"; } if ($res_sel['g_id']) { $g_id = $res_sel['g_id']; $sqq .= "UPDATE `employee_providers` SET `g_id`='$g_id' WHERE `ep_id`='$ep_id';"; } if ($res_sel['s_g_id']) { $s_g_id = $res_sel['s_g_id']; $sqq .= "UPDATE `employee_providers` SET `s_g_id`='$s_g_id' WHERE `ep_id`='$ep_id';"; } $account_status = $res_sel['account_status']; $account_status_by = $res_sel['account_status_by']; $account_status_date = $res_sel['account_status_date']; $account_status_reason = $res_sel['account_status_reason']; $account_status_amount = $res_sel['account_status_amount']; $account_status_amount_type = $res_sel['account_status_amount_type']; if ($res_sel['ep_vendor_code'] != '') { $ep_vendor_code = $res_sel['ep_vendor_code']; $sqq .= "UPDATE `employee_providers` SET `ep_vendor_code`='$ep_vendor_code' WHERE `ep_id`='$ep_id';"; } if ($account_status) { $sqq .= "UPDATE `employee_providers` SET `account_status`='$account_status',`account_status_amount`='$account_status_amount',`account_status_amount_type`='$account_status_amount_type' WHERE `ep_id`='$ep_id';"; $entry_for = 'account_status_ajency'; $this->save_all_status($ep_id, $account_status, $account_status_date, $account_status_reason, $account_status_amount, $account_status_amount_type, $admin_cid, $admin_name, $updated_date, $entry_for); } if ($account_status_by) { $sqq .= "UPDATE `employee_providers` SET `account_status_by`='$account_status_by' WHERE `ep_id`='$ep_id';"; } if ($account_status_date) { $sqq .= "UPDATE `employee_providers` SET `account_status_date`='$account_status_date' WHERE `ep_id`='$ep_id';"; } if ($account_status_reason) { $sqq .= "UPDATE `employee_providers` SET `account_status_reason`='$account_status_reason' WHERE `ep_id`='$ep_id';"; } $status = $res_sel['status']; $status_by = $res_sel['status_by']; $status_date = $res_sel['status_date']; $status_reason = $res_sel['status_reason']; if ($status) { $sqq .= "UPDATE `employee_providers` SET `status`='$status' WHERE `ep_id`='$ep_id';"; $entry_for = 'status_ajency'; $this->save_all_status($ep_id, $status, $status_date, $status_reason, '', '', $admin_cid, $admin_name, $updated_date, $entry_for); } if ($status_by) { $sqq .= "UPDATE `employee_providers` SET `status_by`='$status_by' WHERE `ep_id`='$ep_id';"; } if ($status_date) { $sqq .= "UPDATE `employee_providers` SET `status_date`='$status_date' WHERE `ep_id`='$ep_id';"; } if ($status_reason) { $sqq .= "UPDATE `employee_providers` SET `status_reason`='$status_reason' WHERE `ep_id`='$ep_id';"; } $sqq .= "UPDATE `employee_providers` SET `ep_approved_by`='$admin_cid',`ep_approved_date`='$updated_date',`ep_edit_status`='no' WHERE `ep_id`='$ep_id';"; $sqq .= "UPDATE `employee_providers_edited` SET `ep_approved_by`='$admin_cid',`ep_approved_date`='$updated_date',`ep_edit_status`='no' WHERE `ep_id`='$ep_id';"; $qu3 = mysqli_multi_query($this->conn, $sqq); return $qu3; } public function save_all_status($ep_id, $status, $status_date, $status_reason, $amount, $amount_type, $admin_cid, $admin_name, $updated_date, $entry_for) { $sql = "INSERT INTO `all_status_change`(`ep_id`, `status`, `status_date`, `reason`, `amount`, `amount_type`, `added_by`, `added_by_name`, `added_date`, `status_type`) VALUES ('$ep_id','$status','$status_date','$status_reason','$amount','$amount_type','$admin_cid','$admin_name','$updated_date','$entry_for')"; $result = mysqli_query($this->conn, $sql); return $result; } public function change_company_details_afteredit($status, $ep_id, $admin_cid) { $updated_date = $approval_date = date('Y-m-d H:i:s'); $sql_sel = "SELECT * FROM `company_details_edited` WHERE `ep_id`='$ep_id'"; $qu_sel = mysqli_query($this->conn, $sql_sel); $res_sel = mysqli_fetch_assoc($qu_sel); $sqq = ''; if ($res_sel['transaction_type'] != '') { $transaction_type = $res_sel['transaction_type']; $sqq .= "UPDATE `company_details` SET `transaction_type`='$transaction_type' WHERE `ep_id`='$ep_id';"; } if ($res_sel['balance_amount'] != '') { $balance_amount = $res_sel['balance_amount']; $sqq .= "UPDATE `company_details` SET `balance_amount`='$balance_amount' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_name'] != '') { $ep_name = $res_sel['ep_name']; $sqq .= "UPDATE `company_details` SET `ep_name`='$ep_name' WHERE `ep_id`='$ep_id';"; } if ($res_sel['company_creation_date'] != '0000-00-00') { $company_creation_date = $res_sel['company_creation_date']; $sqq .= "UPDATE `company_details` SET `company_creation_date`='$company_creation_date' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_contact_person'] != '') { $ep_contact_person = $res_sel['ep_contact_person']; $sqq .= "UPDATE `company_details` SET `ep_contact_person`='$ep_contact_person' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_contact_no'] != '') { $ep_contact_no = $res_sel['ep_contact_no']; $sqq .= "UPDATE `company_details` SET `ep_contact_no`='$ep_contact_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_contact_emailid'] != '') { $ep_contact_emailid = $res_sel['ep_contact_emailid']; $sqq .= "UPDATE `company_details` SET `ep_contact_emailid`='$ep_contact_emailid' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_address'] != '') { $ep_address = $res_sel['ep_address']; $sqq .= "UPDATE `company_details` SET `ep_address`='$ep_address' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_reg_address'] != '') { $ep_reg_address = $res_sel['ep_reg_address']; $sqq .= "UPDATE `company_details` SET `ep_reg_address`='$ep_reg_address' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_pincode'] != '') { $ep_pincode = $res_sel['ep_pincode']; $sqq .= "UPDATE `company_details` SET `ep_pincode`='$ep_pincode' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_post_office'] != '') { $ep_post_office = $res_sel['ep_post_office']; $sqq .= "UPDATE `company_details` SET `ep_post_office`='$ep_post_office' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_district'] != '') { $ep_district = $res_sel['ep_district']; $sqq .= "UPDATE `company_details` SET `ep_district`='$ep_district' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_state'] != '') { $ep_state = $res_sel['ep_state']; $sqq .= "UPDATE `company_details` SET `ep_state`='$ep_state' WHERE `ep_id`='$ep_id';"; } if ($res_sel['doc_upload'] != '') { $doc_upload = $res_sel['doc_upload']; $sqq .= "UPDATE `company_details` SET `doc_upload`='$doc_upload' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_ifsc_code'] != '') { $ep_ifsc_code = $res_sel['ep_ifsc_code']; $sqq .= "UPDATE `company_details` SET `ep_ifsc_code`='$ep_ifsc_code' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_bank_name'] != '') { $ep_bank_name = $res_sel['ep_bank_name']; $sqq .= "UPDATE `company_details` SET `ep_bank_name`='$ep_bank_name' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_bank_branch'] != '') { $ep_bank_branch = $res_sel['ep_bank_branch']; $sqq .= "UPDATE `company_details` SET `ep_bank_branch`='$ep_bank_branch' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_bank_address'] != '') { $ep_bank_address = $res_sel['ep_bank_address']; $sqq .= "UPDATE `company_details` SET `ep_bank_address`='$ep_bank_address' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_account_name'] != '') { $ep_account_name = $res_sel['ep_account_name']; $sqq .= "UPDATE `company_details` SET `ep_account_name`='$ep_account_name' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_account_no'] != '') { $ep_account_no = $res_sel['ep_account_no']; $sqq .= "UPDATE `company_details` SET `ep_account_no`='$ep_account_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_entity_type'] != '') { $ep_entity_type = $res_sel['ep_entity_type']; $sqq .= "UPDATE `company_details` SET `ep_entity_type`='$ep_entity_type' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_logo'] != '') { $ep_upload_logo = $res_sel['ep_upload_logo']; $sqq .= "UPDATE `company_details` SET `ep_upload_logo`='$ep_upload_logo' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_head_img'] != '') { $ep_upload_head_img = $res_sel['ep_upload_head_img']; $sqq .= "UPDATE `company_details` SET `ep_upload_head_img`='$ep_upload_head_img' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_dashboard_img'] != '') { $ep_upload_dashboard_img = $res_sel['ep_upload_dashboard_img']; $sqq .= "UPDATE `company_details` SET `ep_upload_dashboard_img`='$ep_upload_dashboard_img' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_gst_no'] != '') { $ep_gst_no = $res_sel['ep_gst_no']; $sqq .= "UPDATE `company_details` SET `ep_gst_no`='$ep_gst_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_gst'] != '') { $ep_upload_gst = $res_sel['ep_upload_gst']; $sqq .= "UPDATE `company_details` SET `ep_upload_gst`='$ep_upload_gst' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_pan_no'] != '') { $ep_pan_no = $res_sel['ep_pan_no']; $sqq .= "UPDATE `company_details` SET `ep_pan_no`='$ep_pan_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_pan'] != '') { $ep_upload_pan = $res_sel['ep_upload_pan']; $sqq .= "UPDATE `company_details` SET `ep_upload_pan`='$ep_upload_pan' WHERE `ep_id`='$ep_id';"; } if ($res_sel['roc_number'] != '') { $roc_number = $res_sel['roc_number']; $sqq .= "UPDATE `company_details` SET `roc_number`='$roc_number' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_roc'] != '') { $ep_upload_roc = $res_sel['ep_upload_roc']; $sqq .= "UPDATE `company_details` SET `ep_upload_roc`='$ep_upload_roc' WHERE `ep_id`='$ep_id';"; } if ($res_sel['esi_no'] != '') { $esi_no = $res_sel['esi_no']; $sqq .= "UPDATE `company_details` SET `esi_no`='$esi_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_esic'] != '') { $ep_upload_esic = $res_sel['ep_upload_esic']; $sqq .= "UPDATE `company_details` SET `ep_upload_esic`='$ep_upload_esic' WHERE `ep_id`='$ep_id';"; } if ($res_sel['epf_no'] != '') { $epf_no = $res_sel['epf_no']; $sqq .= "UPDATE `company_details` SET `epf_no`='$epf_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_epf'] != '') { $ep_upload_epf = $res_sel['ep_upload_epf']; $sqq .= "UPDATE `company_details` SET `ep_upload_epf`='$ep_upload_epf' WHERE `ep_id`='$ep_id';"; } if ($res_sel['export_import_no'] != '') { $export_import_no = $res_sel['export_import_no']; $sqq .= "UPDATE `company_details` SET `export_import_no`='$export_import_no' WHERE `ep_id`='$ep_id';"; } if ($res_sel['ep_upload_export_import'] != '') { $ep_upload_export_import = $res_sel['ep_upload_export_import']; $sqq .= "UPDATE `company_details` SET `ep_upload_export_import`='$ep_upload_export_import' WHERE `ep_id`='$ep_id';"; } $sqq .= "UPDATE `company_details` SET `ep_approved_by`='$admin_cid',`ep_approved_date`='$updated_date',`ep_edit_status`='no' WHERE `ep_id`='$ep_id';"; $sqq .= "UPDATE `company_details_edited` SET `ep_approved_by`='$admin_cid',`ep_approved_date`='$updated_date',`ep_edit_status`='no' WHERE `ep_id`='$ep_id';"; $qu3 = mysqli_multi_query($this->conn, $sqq); return $qu3; } public function deny_ajency_details_afteredit($status, $ep_id, $admin_cid) { $updated_date = $approval_date = date('Y-m-d H:i:s'); $sq3 = "UPDATE `employee_providers_edited` SET `ep_approved_by`='$admin_cid',`ep_edit_status`='no',`ep_approved_date`='$updated_date' WHERE `ep_id`='$ep_id'"; $qu3 = mysqli_query($this->conn, $sq3); $sq33 = "UPDATE `employee_providers` SET `ep_approved_by`='$admin_cid',`ep_edit_status`='no',`ep_approved_date`='$updated_date' WHERE `ep_id`='$ep_id'"; $qu33 = mysqli_query($this->conn, $sq33); return $qu33; } public function deny_company_details_afteredit($status, $ep_id, $admin_cid) { $updated_date = $approval_date = date('Y-m-d H:i:s'); $sq3 = "UPDATE `company_details_edited` SET `ep_approved_by`='$admin_cid',`ep_edit_status`='no',`ep_approved_date`='$updated_date' WHERE `ep_id`='$ep_id'"; $qu3 = mysqli_query($this->conn, $sq3); $sq33 = "UPDATE `company_details` SET `ep_approved_by`='$admin_cid',`ep_edit_status`='no',`ep_approved_date`='$updated_date' WHERE `ep_id`='$ep_id'"; $qu33 = mysqli_query($this->conn, $sq33); return $qu33; } public function save_ajency_update_details($ep_id, $updated_in, $admin_cid) { $updated_date = date('Y-m-d H:i:s'); $sq = "INSERT INTO `employee_provider_updated_details`(`ep_id`, `updated_in`, `updated_by`, `updated_date`) VALUES ('$ep_id', '$updated_in', '$admin_cid', '$updated_date')"; $result = mysqli_query($this->conn, $sq); return $result; } public function save_company_update_details($ep_id, $updated_in, $admin_cid) { $updated_date = date('Y-m-d H:i:s'); $sq = "INSERT INTO `company_details_updated_details`(`ep_id`, `updated_in`, `updated_by`, `updated_date`) VALUES ('$ep_id', '$updated_in', '$admin_cid', '$updated_date')"; $result = mysqli_query($this->conn, $sq); return $result; } public function same_status($status, $customer_id, $admin_cid, $reason, $remark) { $updated_date = date('Y-m-d H:i:s'); $reason = $reason . ' ON ' . $updated_date; $sq2 = "UPDATE `employee` SET reason= CONCAT(reason, ' ($reason)') WHERE `cid`='$customer_id'"; $qu2 = mysqli_query($this->conn, $sq2); $sq3 = "UPDATE `provisional_table` SET `status`='$status',`updated_time`='$updated_date',`approved_by_admin`='$admin_cid' WHERE `emp_id`='$customer_id'"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function getagreements() { $app_status = 'approved'; $order_by = 'ORDER BY agreement_approved_date ASC'; $order_by_new = 'ORDER BY approved_date ASC'; // $sq3 = "SELECT * FROM `agreement_details_skilled` WHERE `agreement_status`='$app_status' GROUP BY `enter_agreement_number`"; $sq3_mix = "SELECT `id` as id, `enter_agreement_number`, `enter_agreement_date`, 'YES' as `loy`, `loy_number`, `loy_dated`, `work_start`, `work_end`, `agreement_status`, `added_by`, `added_date`, `agreement_checked_by`, `agreement_checked_date`, `agreement_approved_by`, `agreement_approved_date`, `agreement_rejected_by`, `agreement_rejected_date`,'agreement_details_skilled' as t_name,superitendent_engineer as under_edc FROM `agreement_details_skilled` WHERE `agreement_status` IN ('$app_status') GROUP BY `enter_agreement_number` UNION ALL SELECT `am_id` as id, `agreement_number` as `enter_agreement_number`, `agreement_date` as `enter_agreement_date`, `loy`, `loy_number`, `loy_dated`, '', '', `agreement_status`, `added_by`, `added_date`, `checked_by` as agreement_checked_by, `checked_date` as agreement_checked_date, `approved_by` as agreement_approved_by, `approved_date` as agreement_approved_date, `rejected_by` as agreement_rejected_by, `rejected_date` as agreement_rejected_date,'tbl_agmt' as t_name,under_super_eng as under_edc FROM `tbl_agmt` WHERE `agreement_status` IN ('$app_status') GROUP BY `agreement_number` $order_by"; $sq3 = "SELECT `am_id` as id, `agreement_number` as `enter_agreement_number`, `agreement_date` as `enter_agreement_date`, `loy`, `loy_number`, `loy_dated`, '', '', `agreement_status`, `added_by`, `added_date`, `checked_by` as agreement_checked_by, `checked_date` as agreement_checked_date, `approved_by` as agreement_approved_by, `approved_date` as agreement_approved_date, `rejected_by` as agreement_rejected_by, `rejected_date` as agreement_rejected_date,'tbl_agmt' as t_name,under_super_eng as under_edc, `closed_status`, `closed_date_from`, `closed_remark`, `closed_upload`, `closed_updated_by`, `closed_updated_by_name`, `closed_updated_date` FROM `tbl_agmt` WHERE `agreement_status` IN ('$app_status') GROUP BY `agreement_number` $order_by"; $result = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function getagreements_new() { $app_status = 'approved'; $order_by = 'ORDER BY agreement_approved_date ASC'; $order_by_new = 'ORDER BY approved_date ASC'; // $sq3 = "SELECT * FROM `agreement_details_skilled` WHERE `agreement_status`='$app_status' GROUP BY `enter_agreement_number`"; $sq3 = "SELECT `am_id` as id, `agreement_number` as `enter_agreement_number`, `agreement_date` as `enter_agreement_date`, `loy`, `loy_number`, `loy_dated`, '', '', `agreement_status`, `added_by`, `added_date`, `checked_by` as agreement_checked_by, `checked_date` as agreement_checked_date, `approved_by` as agreement_approved_by, `approved_date` as agreement_approved_date, `rejected_by` as agreement_rejected_by, `rejected_date` as agreement_rejected_date,'tbl_agmt' as t_name,under_super_eng as under_edc, `closed_status`, `closed_date_from`, `closed_remark`, `closed_upload`, `closed_updated_by`, `closed_updated_by_name`, `closed_updated_date` FROM `tbl_agmt` WHERE `agreement_status` IN ('$app_status') GROUP BY `agreement_number` $order_by"; $result = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //List all agreements public function list_agreements() { // $sq3 = "SELECT * FROM `agreement_details_skilled` GROUP BY `enter_agreement_number` ORDER BY id ASC"; $sq3_mix = "SELECT `id` as id, `enter_agreement_number`, `enter_agreement_date`, 'YES' as `loy`, `loy_number`, `loy_dated`, `work_start`, `work_end`, `agreement_status`, `added_by`, `added_date`, `agreement_checked_by`, `agreement_checked_date`, `agreement_approved_by`, `agreement_approved_date`, `agreement_rejected_by`, `agreement_rejected_date`,'agreement_details_skilled' as t_name,superitendent_engineer as under_edc FROM `agreement_details_skilled` WHERE 1 GROUP BY `enter_agreement_number` UNION ALL SELECT `am_id` as id, `agreement_number` as `enter_agreement_number`, `agreement_date` as `enter_agreement_date`, `loy`, `loy_number`, `loy_dated`, '', '', `agreement_status`, `added_by`, `added_date`, `checked_by` as agreement_checked_by, `checked_date` as agreement_checked_date, `approved_by` as agreement_approved_by, `approved_date` as agreement_approved_date, `rejected_by` as agreement_rejected_by, `rejected_date` as agreement_rejected_date,'tbl_agmt' as t_name,under_super_eng as under_edc FROM `tbl_agmt` WHERE 1 GROUP BY `agreement_number`"; $sq3 = "SELECT `am_id` as id, `agreement_number` as `enter_agreement_number`, `agreement_date` as `enter_agreement_date`, `loy`, `loy_number`, `loy_dated`, '', '', `agreement_status`, `added_by`, `added_date`, `checked_by` as agreement_checked_by, `checked_date` as agreement_checked_date, `approved_by` as agreement_approved_by, `approved_date` as agreement_approved_date, `rejected_by` as agreement_rejected_by, `rejected_date` as agreement_rejected_date,'tbl_agmt' as t_name,under_super_eng as under_edc, `closed_status`, `closed_date_from`, `closed_remark`, `closed_upload`, `closed_updated_by`, `closed_updated_by_name`, `closed_updated_date` FROM `tbl_agmt` WHERE 1 GROUP BY `agreement_number`"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function list_agreements_bystatus($app_status) { $order_by = ''; // $order_by = 'ORDER BY id ASC'; if ($app_status == 'pending') { $order_by = 'ORDER BY added_date ASC'; $order_by_new = 'ORDER BY added_date ASC'; } else if ($app_status == 'checked') { $order_by = 'ORDER BY agreement_checked_date ASC'; $order_by_new = 'ORDER BY checked_date ASC'; } else if ($app_status == 'approved') { $order_by = 'ORDER BY agreement_approved_date ASC'; $order_by_new = 'ORDER BY approved_date ASC'; } else if ($app_status == 'rejected') { $order_by = 'ORDER BY agreement_rejected_date ASC'; $order_by_new = 'ORDER BY rejected_date ASC'; } // $sq3 = "SELECT * FROM `agreement_details_skilled` WHERE `agreement_status` IN ('$app_status') GROUP BY `enter_agreement_number` $order_by"; $sq3_mix = "SELECT `id` as id, `enter_agreement_number`, `enter_agreement_date`, 'YES' as `loy`, `loy_number`, `loy_dated`, `work_start`, `work_end`, `agreement_status`, `added_by`, `added_date`, `agreement_checked_by`, `agreement_checked_date`, `agreement_approved_by`, `agreement_approved_date`, `agreement_rejected_by`, `agreement_rejected_date`,'agreement_details_skilled' as t_name,superitendent_engineer as under_edc FROM `agreement_details_skilled` WHERE `agreement_status` IN ('$app_status') GROUP BY `enter_agreement_number` UNION ALL SELECT `am_id` as id, `agreement_number` as `enter_agreement_number`, `agreement_date` as `enter_agreement_date`, `loy`, `loy_number`, `loy_dated`, '', '', `agreement_status`, `added_by`, `added_date`, `checked_by` as agreement_checked_by, `checked_date` as agreement_checked_date, `approved_by` as agreement_approved_by, `approved_date` as agreement_approved_date, `rejected_by` as agreement_rejected_by, `rejected_date` as agreement_rejected_date,'tbl_agmt' as t_name,under_super_eng as under_edc FROM `tbl_agmt` WHERE `agreement_status` IN ('$app_status') GROUP BY `agreement_number` $order_by"; $sq3 = "SELECT `am_id` as id, `agreement_number` as `enter_agreement_number`, `agreement_date` as `enter_agreement_date`, `loy`, `loy_number`, `loy_dated`, '', '', `agreement_status`, `added_by`, `added_date`, `checked_by` as agreement_checked_by, `checked_date` as agreement_checked_date, `approved_by` as agreement_approved_by, `approved_date` as agreement_approved_date, `rejected_by` as agreement_rejected_by, `rejected_date` as agreement_rejected_date,'tbl_agmt' as t_name,under_super_eng as under_edc, `closed_status`, `closed_date_from`, `closed_remark`, `closed_upload`, `closed_updated_by`, `closed_updated_by_name`, `closed_updated_date` FROM `tbl_agmt` WHERE `agreement_status` IN ('$app_status') GROUP BY `agreement_number` $order_by"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function change_bill_status($bill_id, $bill_status, $admin_cid) { $current_date = date('Y-m-d H:i:s'); if ($bill_status == 'checked') { $sql = "UPDATE `billing_table` SET `bill_checked_by`='$admin_cid',`bill_checked_date`='$current_date',`bill_status`='$bill_status' WHERE `bill_id`='$bill_id'"; } else if ($bill_status == 'approved') { $sql = "UPDATE `billing_table` SET `bill_approved_by`='$admin_cid',`bill_approved_date`='$current_date',`bill_status`='$bill_status' WHERE `bill_id`='$bill_id'"; } else if ($bill_status == 'rejected') { $sql = "UPDATE `billing_table` SET `bill_rejected_by`='$admin_cid',`bill_rejected_date`='$current_date',`bill_status`='$bill_status' WHERE `bill_id`='$bill_id'"; } $qu3 = mysqli_query($this->conn, $sql); return $qu3; } //List all bills public function list_bills() { $company_id = $_SESSION['company_id']; // $sq3 = "SELECT * FROM `billing_table` ORDER BY billing_to_id asc,bill_uploaded_date desc"; $sq3 = "SELECT * FROM `billing_table` WHERE bill_company_id='$company_id' ORDER BY billing_date desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function list_bills_bystatus($app_status) { $company_id = $_SESSION['company_id']; $order_by = ''; if ($app_status == 'pending') { // $order_by = 'ORDER BY billing_to_id asc,bill_uploaded_date desc,billing_date desc'; $order_by = 'ORDER BY billing_date desc'; $sq3 = "SELECT * FROM `billing_table` WHERE bill_company_id='$company_id' AND `bill_status` IN ('$app_status') $order_by"; } else if ($app_status == 'checked') { $order_by = 'ORDER BY billing_date desc'; $sq3 = "SELECT * FROM `billing_table` WHERE bill_company_id='$company_id' AND `bill_status` IN ('$app_status') $order_by"; } else if ($app_status == 'approved') { $order_by = 'ORDER BY billing_date desc'; $sq3 = "SELECT * FROM `billing_table` WHERE bill_company_id='$company_id' AND `bill_status` IN ('$app_status') $order_by"; } else if ($app_status == 'rejected') { $order_by = 'ORDER BY billing_date desc'; $sq3 = "SELECT * FROM `billing_table` WHERE bill_company_id='$company_id' AND `bill_status` IN ('$app_status') $order_by"; } // echo $sq3; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function change_agreement_status($agreement_number, $agreement_status, $admin_cid) { $current_date = date('Y-m-d H:i:s'); if ($agreement_status == 'checked') { $sq1 = "UPDATE `agreement_details_skilled` SET `agreement_checked_by`='$admin_cid',`agreement_checked_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; $sq2 = "UPDATE `agreement_details_semi_skilled` SET `agreement_checked_by`='$admin_cid',`agreement_checked_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; $sq3 = "UPDATE `agreement_details_un_skilled` SET `agreement_checked_by`='$admin_cid',`agreement_checked_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; } else if ($agreement_status == 'approved') { $sq1 = "UPDATE `agreement_details_skilled` SET `agreement_approved_by`='$admin_cid',`agreement_approved_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; $sq2 = "UPDATE `agreement_details_semi_skilled` SET `agreement_approved_by`='$admin_cid',`agreement_approved_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; $sq3 = "UPDATE `agreement_details_un_skilled` SET `agreement_approved_by`='$admin_cid',`agreement_approved_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; } else if ($agreement_status == 'rejected') { $sq1 = "UPDATE `agreement_details_skilled` SET `agreement_rejected_by`='$admin_cid',`agreement_rejected_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; $sq2 = "UPDATE `agreement_details_semi_skilled` SET `agreement_rejected_by`='$admin_cid',`agreement_rejected_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; $sq3 = "UPDATE `agreement_details_un_skilled` SET `agreement_rejected_by`='$admin_cid',`agreement_rejected_date`='$current_date',`agreement_status`='$agreement_status' WHERE `enter_agreement_number` IN ('$agreement_number')"; } $qu1 = mysqli_query($this->conn, $sq1); $qu2 = mysqli_query($this->conn, $sq2); $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function change_agreement_status_new($agreement_number, $agreement_status, $admin_cid, $am_id) { $current_date = date('Y-m-d H:i:s'); if ($agreement_status == 'checked') { $sq1 = "UPDATE tbl_agmt SET agreement_status='$agreement_status',checked_remark='" . $checked_remark . "',checked_date='$current_date',checked_by='$admin_cid' WHERE am_id='" . $am_id . "'"; } else if ($agreement_status == 'approved') { $sq1 = "UPDATE tbl_agmt SET agreement_status='$agreement_status',approved_remark='" . $approved_remark . "',approved_date='$current_date',approved_by='$admin_cid' WHERE am_id='" . $am_id . "'"; } else if ($agreement_status == 'rejected') { // $sq1 = "UPDATE tbl_agmt SET agreement_status='$agreement_status',rejected_remark='" . $rejected_remark . "',rejected_date='$current_date',rejected_by='$admin_cid' WHERE am_id='" . $am_id . "'"; $sq1 = "DELETE FROM `tbl_agmt` WHERE `am_id`='" . $am_id . "'"; $tbl_ag_empqty = "DELETE FROM `tbl_agmt_empqty` WHERE `am_id`='" . $am_id . "'"; mysqli_query($this->conn, $tbl_ag_empqty); $tbl_ag_empqty_org = "DELETE FROM `tbl_agmt_empqty_original` WHERE `am_id`='" . $am_id . "'"; mysqli_query($this->conn, $tbl_ag_empqty_org); $tbl_ag_da = "DELETE FROM `tbl_agmt_da` WHERE am_id='" . $am_id . "'"; mysqli_query($this->conn, $tbl_ag_da); $tbl_ag_da_org = "DELETE FROM `tbl_agmt_da_original` WHERE am_id='" . $am_id . "'"; mysqli_query($this->conn, $tbl_ag_da_org); } $qu1 = mysqli_query($this->conn, $sq1); return $qu1; } public function add_emp_quantity($ez_id, $type, $row_id, $esi_radioValue, $lm_skilled_emp_qu, $lm_semiskilled_emp_qu, $lm_unskilled_emp_qu, $sso_skilled_emp_qu, $sso_semiskilled_emp_qu, $sso_unskilled_emp_qu, $agreement_number, $admin_cid, $substation_name, $executive_all, $electric_all, $under_zone, $under_edc, $work_type, $edd_id, $lm_overtime_radioValue, $sso_overtime_radioValue, $month, $year) { $updated_date = date('Y-m-d H:i:s'); $sql_bill = "SELECT * FROM `billing_table` WHERE `agreement_number`='$agreement_number' AND `under_edd`='$edd_id' AND `work_start_date`='$year-$month-01'"; $result_bill = mysqli_query($this->conn, $sql_bill); if (mysqli_num_rows($result_bill) > 0) { echo 'Bill already generated for this month AND year. If you want to update employee quantity please delete previously generated bill for this month AND year.'; } else { $sel = "SELECT * FROM `employee_details_agreement` WHERE `agreement_number`='$agreement_number' AND `electric_sub_station`='$ez_id'"; $result = mysqli_query($this->conn, $sel); if (mysqli_num_rows($result) > 0) { $sql = "UPDATE `employee_details_agreement` SET `agreement_number`='$agreement_number',`skilled_maintenance`='$lm_skilled_emp_qu',`unskilled_maintenance`='$lm_unskilled_emp_qu',`semiskilled_maintenance`='$lm_semiskilled_emp_qu',`skilled_operational`='$sso_skilled_emp_qu',`unskilled_operational`='$sso_unskilled_emp_qu',`semiskilled_operational`='$sso_semiskilled_emp_qu',`esi_applicable`='$esi_radioValue',`updated_by`='$admin_cid',`updated_date`='$updated_date', `substation_name`='$substation_name', `under_edd`='$executive_all', `under_substation`='$electric_all', `under_zone`='$under_zone', `under_edc`='$under_edc', `work_type`='$work_type', `edd_id`='$edd_id',`lm_overtime_applicable`='$lm_overtime_radioValue', `sso_overtime_applicable`='$sso_overtime_radioValue' WHERE `agreement_number`='$agreement_number' AND `electric_sub_station`='$ez_id'"; } else { $sql = "INSERT INTO `employee_details_agreement`(`agreement_number`, `electric_sub_station`, `skilled_maintenance`, `unskilled_maintenance`, `semiskilled_maintenance`, `skilled_operational`, `unskilled_operational`, `semiskilled_operational`, `esi_applicable`, `added_by`, `added_date`, `substation_name`, `under_edd`, `under_substation`, `under_zone`, `under_edc`, `work_type`, `edd_id`, `lm_overtime_applicable`, `sso_overtime_applicable`) VALUES ('$agreement_number','$ez_id','$lm_skilled_emp_qu','$lm_unskilled_emp_qu','$lm_semiskilled_emp_qu','$sso_skilled_emp_qu','$sso_unskilled_emp_qu','$sso_semiskilled_emp_qu','$esi_radioValue','$admin_cid','$updated_date','$substation_name','$executive_all','$electric_all','$under_zone','$under_edc','$work_type','$edd_id','$lm_overtime_radioValue','$sso_overtime_radioValue')"; } // echo $sql; $qu = mysqli_query($this->conn, $sql); if ($qu) { $sel_1 = "SELECT * FROM `employee_details_agreement_monthly` WHERE `agreement_number`='$agreement_number' AND `electric_sub_station`='$ez_id' AND `month`='$month' AND `year`='$year'"; $result_1 = mysqli_query($this->conn, $sel_1); if (mysqli_num_rows($result_1) > 0) { $sql_1 = "UPDATE `employee_details_agreement_monthly` SET `agreement_number`='$agreement_number',`skilled_maintenance`='$lm_skilled_emp_qu',`unskilled_maintenance`='$lm_unskilled_emp_qu',`semiskilled_maintenance`='$lm_semiskilled_emp_qu',`skilled_operational`='$sso_skilled_emp_qu',`unskilled_operational`='$sso_unskilled_emp_qu',`semiskilled_operational`='$sso_semiskilled_emp_qu',`esi_applicable`='$esi_radioValue',`updated_by`='$admin_cid',`updated_date`='$updated_date', `substation_name`='$substation_name', `under_edd`='$executive_all', `under_substation`='$electric_all', `under_zone`='$under_zone', `under_edc`='$under_edc', `work_type`='$work_type', `edd_id`='$edd_id',`lm_overtime_applicable`='$lm_overtime_radioValue', `sso_overtime_applicable`='$sso_overtime_radioValue' WHERE `agreement_number`='$agreement_number' AND `electric_sub_station`='$ez_id' AND `month`='$month' AND `year`='$year'"; } else { $sql_1 = "INSERT INTO `employee_details_agreement_monthly`(`agreement_number`, `electric_sub_station`, `skilled_maintenance`, `unskilled_maintenance`, `semiskilled_maintenance`, `skilled_operational`, `unskilled_operational`, `semiskilled_operational`, `esi_applicable`, `added_by`, `added_date`, `substation_name`, `under_edd`, `under_substation`, `under_zone`, `under_edc`, `work_type`, `edd_id`, `lm_overtime_applicable`, `sso_overtime_applicable`, `month`, `year`) VALUES ('$agreement_number','$ez_id','$lm_skilled_emp_qu','$lm_unskilled_emp_qu','$lm_semiskilled_emp_qu','$sso_skilled_emp_qu','$sso_unskilled_emp_qu','$sso_semiskilled_emp_qu','$esi_radioValue','$admin_cid','$updated_date','$substation_name','$executive_all','$electric_all','$under_zone','$under_edc','$work_type','$edd_id','$lm_overtime_radioValue','$sso_overtime_radioValue','$month','$year')"; } // echo $sql_1; $qu_res = mysqli_query($this->conn, $sql_1); $sql_all = "UPDATE `employee_details_agreement` SET `under_edd`='$executive_all', `under_substation`='$electric_all' WHERE `agreement_number`='$agreement_number'"; $qu_all = mysqli_query($this->conn, $sql_all); $sql_all_m = "UPDATE `employee_details_agreement_monthly` SET `under_edd`='$executive_all', `under_substation`='$electric_all' WHERE `agreement_number`='$agreement_number' AND `month`='$month' AND `year`='$year'"; $qu_all_m = mysqli_query($this->conn, $sql_all_m); } } return $qu_res; } public function add_rate_schedule($edc_id, $ez_id, $type, $row_id, $agreement_number, $admin_cid, $substation_name, $executive_all, $electric_all, $under_zone, $under_edc, $under_work_type, $edd_id, $work_start, $work_end, $da_effective_date, $pf_13_employer_percentage, $esi_insurance_ac_percentage, $esi_insurance_ac_percentage_1, $contractor_profit_in, $basic, $da, $total_amount, $pf_13_employer, $esi_insurance_ac, $esi_insurance_ac_1, $minimum_wages, $over_time, $pay_mimimum_wages_to_employee, $contractor_profit_in_rs, $grand_total_monthly, $quantity, $grand_total_per_month, $semi_skill_basic, $semi_skill_da, $semi_skill_total_amount, $semi_skill_pf_13_employer, $semi_skill_esi_insurance_ac, $semi_skill_esi_insurance_ac_1, $semi_skill_minimum_wages, $semi_skill_over_time, $semi_skill_pay_mimimum_wages_to_employee, $semi_skill_contractor_profit_in_rs, $semi_skill_grand_total_monthly, $semi_skill_quantity, $semi_skill_grand_total_per_month, $un_skilled_basic, $un_skilled_da, $un_skilled_total_amount, $un_skilled_pf_13_employer, $un_skilled_esi_insurance_ac, $un_skilled_esi_insurance_ac_1, $un_skilled_minimum_wages, $un_skilled_over_time, $un_skilled_pay_mimimum_wages_to_employee, $un_skilled_contractor_profit_in_rs, $un_skilled_grand_total_monthly, $un_skilled_quantity, $un_skilled_grand_total_per_month, $upload_agreement_path, $enter_agreement_date, $loy_number, $loy_upload_path, $loy_dated, $txn_no) { $updated_date = date('Y-m-d H:i:s'); $added_date = date('Y-m-d H:i:s'); $added_by = $admin_cid; $sel_skilled = "SELECT * FROM `agreement_details_skilled` WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no'"; $result_skilled = mysqli_query($this->conn, $sel_skilled); if (mysqli_num_rows($result_skilled) > 0) { $skilled_values_update .= "UPDATE `agreement_details_skilled` SET `select_zone`='$under_zone',`superitendent_engineer`='$under_edc',`excutive_engineer`='$executive_all',`electric_sub_station`='$electric_all',`under_edc`='$edc_id',`enter_agreement_number`='$agreement_number',`enter_agreement_date`='$enter_agreement_date',`loy_number`='$loy_number',`loy_upload_path`='$loy_upload_path',`loy_dated`='$loy_dated',`work_start`='$work_start',`work_end`='$work_end',`da_effective_date`='$da_effective_date',`basic`='$basic',`da`='$da',`total_amount`='$total_amount',`pf_ac_employer`='$pf_13_employer',`esi_inssurance_ac`='$esi_insurance_ac',`esi_inssurance_ac_1`='$esi_insurance_ac_1',`pf_13_employer_percentage`='$pf_13_employer_percentage',`esi_insurance_ac_percentage`='$esi_insurance_ac_percentage',`esi_insurance_ac_percentage_1`='$esi_insurance_ac_percentage_1',`minimum_wages`='$minimum_wages',`over_time`='$over_time',`pay_mimimum_wages_to_employee`='$pay_mimimum_wages_to_employee',`contractor_profit_in`='$contractor_profit_in',`contractor_profit_in_rs`='$contractor_profit_in_rs',`grand_total_monthly`='$grand_total_monthly',`quantity`='$quantity',`grand_total_per_month`='$grand_total_per_month',`upload_agreement_path`='$upload_agreement_path',`work_type`='$under_work_type',`updated_by`='$admin_cid',`updated_date`='$updated_date' WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no';"; } else { $skilled_values .= "('$under_zone', '$under_edc', '$executive_all', '$electric_all', '$edc_id', '$agreement_number', '$enter_agreement_date', '$loy_number', '$loy_upload_path', '$loy_dated', '$work_start', '$work_end', '$da_effective_date', '$category', '$basic', '$da', '$total_amount', '$pf_13_employer', '$esi_insurance_ac', '$esi_insurance_ac_1', '$pf_13_employer_percentage', '$esi_insurance_ac_percentage', '$esi_insurance_ac_percentage_1', '$minimum_wages', '$over_time', '$pay_mimimum_wages_to_employee', '$contractor_profit_in', '$contractor_profit_in_rs', '$grand_total_monthly', '$quantity', '$grand_total_per_month', '$upload_agreement_path', '$added_by', '$added_date', '$under_work_type', '$txn_no')" . ','; } $sel_semiskilled = "SELECT * FROM `agreement_details_semi_skilled` WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no'"; $result_semiskilled = mysqli_query($this->conn, $sel_semiskilled); if (mysqli_num_rows($result_semiskilled) > 0) { $semiskilled_values_update .= "UPDATE `agreement_details_semi_skilled` SET `select_zone`='$under_zone',`superitendent_engineer`='$under_edc',`excutive_engineer`='$executive_all',`electric_sub_station`='$electric_all',`under_edc`='$edc_id',`enter_agreement_number`='$agreement_number',`enter_agreement_date`='$enter_agreement_date',`loy_number`='$loy_number',`loy_upload_path`='$loy_upload_path',`loy_dated`='$loy_dated',`work_start`='$work_start',`work_end`='$work_end',`da_effective_date`='$da_effective_date',`basic`='$semi_skill_basic',`da`='$semi_skill_da',`total_amount`='$semi_skill_total_amount',`pf_ac_employer`='$semi_skill_pf_13_employer',`esi_inssurance_ac`='$semi_skill_esi_insurance_ac',`esi_inssurance_ac_1`='$semi_skill_esi_insurance_ac_1',`pf_13_employer_percentage`='$pf_13_employer_percentage',`esi_insurance_ac_percentage`='$esi_insurance_ac_percentage',`esi_insurance_ac_percentage_1`='$esi_insurance_ac_percentage_1',`minimum_wages`='$semi_skill_minimum_wages',`over_time`='$semi_skill_over_time',`pay_mimimum_wages_to_employee`='$semi_skill_pay_mimimum_wages_to_employee',`contractor_profit_in`='$contractor_profit_in',`contractor_profit_in_rs`='$semi_skill_contractor_profit_in_rs',`grand_total_monthly`='$semi_skill_grand_total_monthly',`quantity`='$semi_skill_quantity',`grand_total_per_month`='$semi_skill_grand_total_per_month',`upload_agreement_path`='$upload_agreement_path',`work_type`='$under_work_type',`updated_by`='$admin_cid',`updated_date`='$updated_date' WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no';"; } else { $semiskilled_values .= "('$under_zone', '$under_edc', '$executive_all', '$electric_all', '$edc_id', '$agreement_number', '$enter_agreement_date', '$loy_number', '$loy_upload_path', '$loy_dated', '$work_start', '$work_end', '$da_effective_date', '$category', '$semi_skill_basic', '$semi_skill_da', '$semi_skill_total_amount', '$semi_skill_pf_13_employer', '$semi_skill_esi_insurance_ac', '$semi_skill_esi_insurance_ac_1', '$pf_13_employer_percentage', '$esi_insurance_ac_percentage', '$esi_insurance_ac_percentage_1', '$semi_skill_minimum_wages', '$semi_skill_over_time', '$semi_skill_pay_mimimum_wages_to_employee', '$contractor_profit_in', '$semi_skill_contractor_profit_in_rs', '$semi_skill_grand_total_monthly', '$semi_skill_quantity', '$semi_skill_grand_total_per_month', '$upload_agreement_path', '$added_by', '$added_date', '$under_work_type', '$txn_no')" . ','; } $sel_unskilled = "SELECT * FROM `agreement_details_un_skilled` WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no'"; $result_unskilled = mysqli_query($this->conn, $sel_unskilled); if (mysqli_num_rows($result_unskilled) > 0) { $unskilled_values_update .= "UPDATE `agreement_details_un_skilled` SET `select_zone`='$under_zone',`superitendent_engineer`='$under_edc',`excutive_engineer`='$executive_all',`electric_sub_station`='$electric_all',`under_edc`='$edc_id',`enter_agreement_number`='$agreement_number',`enter_agreement_date`='$enter_agreement_date',`loy_number`='$loy_number',`loy_upload_path`='$loy_upload_path',`loy_dated`='$loy_dated',`work_start`='$work_start',`work_end`='$work_end',`da_effective_date`='$da_effective_date',`basic`='$un_skilled_basic',`da`='$un_skilled_da',`total_amount`='$un_skilled_total_amount',`pf_ac_employer`='$un_skilled_pf_13_employer',`esi_inssurance_ac`='$un_skilled_esi_insurance_ac',`esi_inssurance_ac_1`='$un_skilled_esi_insurance_ac_1',`pf_13_employer_percentage`='$pf_13_employer_percentage',`esi_insurance_ac_percentage`='$esi_insurance_ac_percentage',`esi_insurance_ac_percentage_1`='$esi_insurance_ac_percentage_1',`minimum_wages`='$un_skilled_minimum_wages',`over_time`='$un_skilled_over_time',`pay_mimimum_wages_to_employee`='$un_skilled_pay_mimimum_wages_to_employee',`contractor_profit_in`='$contractor_profit_in',`contractor_profit_in_rs`='$un_skilled_contractor_profit_in_rs',`grand_total_monthly`='$un_skilled_grand_total_monthly',`quantity`='$un_skilled_quantity',`grand_total_per_month`='$un_skilled_grand_total_per_month',`upload_agreement_path`='$upload_agreement_path',`work_type`='$under_work_type',`updated_by`='$admin_cid',`updated_date`='$updated_date' WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no';"; } else { $unskilled_values .= "('$under_zone', '$under_edc', '$executive_all', '$electric_all', '$edc_id', '$agreement_number', '$enter_agreement_date', '$loy_number', '$loy_upload_path', '$loy_dated', '$work_start', '$work_end', '$da_effective_date', '$category', '$un_skilled_basic', '$un_skilled_da', '$un_skilled_total_amount', '$un_skilled_pf_13_employer', '$un_skilled_esi_insurance_ac', '$un_skilled_esi_insurance_ac_1', '$pf_13_employer_percentage', '$esi_insurance_ac_percentage', '$esi_insurance_ac_percentage_1', '$un_skilled_minimum_wages', '$un_skilled_over_time', '$un_skilled_pay_mimimum_wages_to_employee', '$contractor_profit_in', '$un_skilled_contractor_profit_in_rs', '$un_skilled_grand_total_monthly', '$un_skilled_quantity', '$un_skilled_grand_total_per_month', '$upload_agreement_path', '$added_by', '$added_date', '$under_work_type', '$txn_no')" . ','; } $skilled_values = rtrim($skilled_values, ','); $semiskilled_values = rtrim($semiskilled_values, ','); $unskilled_values = rtrim($unskilled_values, ','); if ($skilled_values != '') { $sql = "INSERT INTO agreement_details_skilled (select_zone, superitendent_engineer, excutive_engineer, electric_sub_station, under_edc, enter_agreement_number, enter_agreement_date, loy_number, loy_upload_path, loy_dated, work_start, work_end, da_effective_date, catagory, basic, da, total_amount, pf_ac_employer, esi_inssurance_ac, esi_inssurance_ac_1, `pf_13_employer_percentage`, `esi_insurance_ac_percentage`, `esi_insurance_ac_percentage_1`, minimum_wages, over_time, pay_mimimum_wages_to_employee, contractor_profit_in, contractor_profit_in_rs, grand_total_monthly, quantity, grand_total_per_month, upload_agreement_path, added_by, added_date, work_type, txn_no) VALUES $skilled_values"; $qu1 = mysqli_query($this->conn, $sql); if ($qu1) { $_SESSION["favcolor"] = "Agreement created successfully"; } else { $_SESSION["favcolor"] = mysqli_error($this->conn); // header("Location: add_new_agreement.php"); // echo '<script>window.location.href="add_new_agreement.php"</script>'; } } if ($skilled_values_update != '') { // echo $skilled_values_update; $qu1 = mysqli_query($this->conn, $skilled_values_update); if ($qu1) { $_SESSION["favcolor"] = "Employee added IN Substation"; //header("Location: add_new_agreement.php"); } } if ($semiskilled_values != '') { $sql1 = "INSERT INTO agreement_details_semi_skilled (select_zone, superitendent_engineer, excutive_engineer, electric_sub_station, under_edc, enter_agreement_number, enter_agreement_date, loy_number, loy_upload_path, loy_dated, work_start, work_end, da_effective_date, catagory, basic, da, total_amount, pf_ac_employer, esi_inssurance_ac, esi_inssurance_ac_1, `pf_13_employer_percentage`, `esi_insurance_ac_percentage`, `esi_insurance_ac_percentage_1`, minimum_wages, over_time, pay_mimimum_wages_to_employee, contractor_profit_in, contractor_profit_in_rs, grand_total_monthly, quantity, grand_total_per_month, upload_agreement_path, added_by, added_date, work_type, txn_no) VALUES $semiskilled_values"; $qu11 = mysqli_query($this->conn, $sql1); if ($qu11) { $_SESSION["favcolor"] = "Agreement created successfully"; //header("Location: add_new_agreement.php"); } else { $_SESSION["favcolor"] = mysqli_error($this->conn); // header("Location: add_new_agreement.php"); // echo '<script>window.location.href="add_new_agreement.php"</script>'; } } if ($semiskilled_values_update != '') { // echo $semiskilled_values_update; $qu11 = mysqli_query($this->conn, $semiskilled_values_update); if ($qu11) { $_SESSION["favcolor"] = "Employee added IN Substation"; //header("Location: add_new_agreement.php"); } } if ($unskilled_values != '') { $sql2 = "INSERT INTO agreement_details_un_skilled (select_zone, superitendent_engineer, excutive_engineer, electric_sub_station, under_edc, enter_agreement_number, enter_agreement_date, loy_number, loy_upload_path, loy_dated, work_start, work_end, da_effective_date, catagory, basic, da, total_amount, pf_ac_employer, esi_inssurance_ac, esi_inssurance_ac_1, `pf_13_employer_percentage`, `esi_insurance_ac_percentage`, `esi_insurance_ac_percentage_1`, minimum_wages, over_time, pay_mimimum_wages_to_employee, contractor_profit_in, contractor_profit_in_rs, grand_total_monthly, quantity, grand_total_per_month, upload_agreement_path, added_by, added_date, work_type, txn_no) VALUES $unskilled_values"; $qu12 = mysqli_query($this->conn, $sql2); if ($qu12) { $_SESSION["favcolor"] = "Agreement created successfully"; //header("Location: add_new_agreement.php"); } else { $_SESSION["favcolor"] = mysqli_error($this->conn); // header("Location: add_new_agreement.php"); // echo '<script>window.location.href="add_new_agreement.php"</script>'; } } if ($unskilled_values_update != '') { // echo $unskilled_values_update; $qu12 = mysqli_query($this->conn, $unskilled_values_update); if ($qu12) { $_SESSION["favcolor"] = "Employee added IN Substation"; //header("Location: add_new_agreement.php"); } } return $qu12; } public function delete_rate_schedule($edc_id, $ez_id, $type, $row_id, $agreement_number, $admin_cid, $substation_name, $executive_all, $electric_all, $under_zone, $under_edc, $under_work_type, $edd_id, $work_start, $work_end, $da_effective_date, $pf_13_employer_percentage, $esi_insurance_ac_percentage, $esi_insurance_ac_percentage_1, $contractor_profit_in, $basic, $da, $total_amount, $pf_13_employer, $esi_insurance_ac, $esi_insurance_ac_1, $minimum_wages, $over_time, $pay_mimimum_wages_to_employee, $contractor_profit_in_rs, $grand_total_monthly, $quantity, $grand_total_per_month, $semi_skill_basic, $semi_skill_da, $semi_skill_total_amount, $semi_skill_pf_13_employer, $semi_skill_esi_insurance_ac, $semi_skill_esi_insurance_ac_1, $semi_skill_minimum_wages, $semi_skill_over_time, $semi_skill_pay_mimimum_wages_to_employee, $semi_skill_contractor_profit_in_rs, $semi_skill_grand_total_monthly, $semi_skill_quantity, $semi_skill_grand_total_per_month, $un_skilled_basic, $un_skilled_da, $un_skilled_total_amount, $un_skilled_pf_13_employer, $un_skilled_esi_insurance_ac, $un_skilled_esi_insurance_ac_1, $un_skilled_minimum_wages, $un_skilled_over_time, $un_skilled_pay_mimimum_wages_to_employee, $un_skilled_contractor_profit_in_rs, $un_skilled_grand_total_monthly, $un_skilled_quantity, $un_skilled_grand_total_per_month, $upload_agreement_path, $enter_agreement_date, $loy_number, $loy_upload_path, $loy_dated, $txn_no) { $updated_date = date('Y-m-d H:i:s'); $added_date = date('Y-m-d H:i:s'); $added_by = $admin_cid; $sel_skilled = "DELETE FROM `agreement_details_skilled` WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no'"; $result_skilled = mysqli_query($this->conn, $sel_skilled); $sel_semiskilled = "DELETE FROM `agreement_details_semi_skilled` WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no'"; $result_semiskilled = mysqli_query($this->conn, $sel_semiskilled); $sel_unskilled = "DELETE FROM `agreement_details_un_skilled` WHERE `under_edc`='$edc_id' AND `enter_agreement_number`='$agreement_number' AND `txn_no`='$txn_no'"; $result_unskilled = mysqli_query($this->conn, $sel_unskilled); $_SESSION["favcolor"] = "Rate Schedule Deleted Successfully"; return $result_skilled; } public function check_leaves_details($id) { $sq3 = "SELECT * FROM `check_leaves` WHERE `check_leaves_id`='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function update_check_leaves_prev1($id) { $chekleaves_details = $this->check_leaves_details($id); $total_leaves_start_prev = $chekleaves_details['check_leaves_starting_from']; $total_leaves_end_prev = $chekleaves_details['check_leaves_end_from']; $company_name = $_POST['company_name']; $account_no = $_POST['account_no']; $check_leaves = $_POST['check_leaves']; $check_type = $_POST['check_type']; $added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; // $total_leaves_start = $total_leaves_start_prev + $check_leaves; $total_leaves_end = $total_leaves_start_prev + $check_leaves; $check_leaves_starting_from = str_pad($total_leaves_start_prev, 6, "0", STR_PAD_LEFT); $check_leaves_end_from = str_pad($total_leaves_end, 6, "0", STR_PAD_LEFT); if (empty($check_leaves)) { $sq11 = "UPDATE `check_leaves` SET `check_leaves_company_id`='$company_name',`check_leaves_account_no`='$account_no',`check_leaves_updated_by`='$admin_cid',`check_leaves_updated_date`='$added_date' WHERE `check_leaves_id`='$id'"; } else { $sq11 = "UPDATE `check_leaves` SET `check_leaves_company_id`='$company_name',`check_leaves_account_no`='$account_no',`check_leaves_starting_from`='$check_leaves_starting_from',`check_leaves_end_from`='$check_leaves_end_from',`prev_check_leaves_end_from`='$total_leaves_end_prev',`check_leaves_updated_by`='$admin_cid',`check_leaves_updated_date`='$added_date' WHERE `check_leaves_id`='$id'"; } $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { $_SESSION['msg'] = "Cheque Leaves Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="5">'; } public function update_check_leaves($id) { $chekleaves_details = $this->check_leaves_details($id); $total_leaves_end_prev = $chekleaves_details['check_leaves_end_from']; $company_name = $_POST['company_name']; $account_no = $_POST['account_no']; $check_leaves = $_POST['check_leaves']; $check_type = $_POST['check_type']; $added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $requested_bank_branch = $_POST['requested_bank_branch']; if ($requested_bank_branch == 'OTHER') { $requested_bank_branch = $_POST['other_branch_name']; } else { $requested_bank_branch = $_POST['requested_bank_branch']; } $other_branch_name = $_POST['other_branch_name']; $checkbook_no_prev = $_POST['chequebook_no']; $checkbook_requested_date = $_POST['checkbook_requested_date']; $prev_last_leave = $_POST['last_leave']; $sel_query = "SELECT * FROM `check_leaves` WHERE `check_leaves_company_id`='$company_name' AND `check_leaves_account_no`='$account_no' ORDER BY check_leaves_id desc"; $sel_res = mysqli_query($this->conn, $sel_query); $row_result = mysqli_fetch_assoc($sel_res); // print_r($row_result); //$sel_res=$this->get_company_details_by_id_account($company_name,$account_no); // $checkrows = mysqli_num_rows($sel_res); // $checkbook_no_prev = $row_result['checkbook_no']; $checkbook_no = $checkbook_no_prev + 1; // $cl_starting_from = $row_result['check_leaves_starting_from']; // $cl_end_from = $row_result['check_leaves_end_from']; $cl_starting_from = ($prev_last_leave + 1); $cl_end_from = ($prev_last_leave + $check_leaves); $check_leaves_starting_from = str_pad($cl_starting_from, 6, "0", STR_PAD_LEFT); $check_leaves_end_from = str_pad($cl_end_from, 6, "0", STR_PAD_LEFT); $sq11 = "UPDATE `check_leaves` SET `check_leaves_company_id`='$company_name',`check_leaves_account_no`='$account_no',`check_leaves_starting_from`='$check_leaves_starting_from',`check_leaves_end_from`='$check_leaves_end_from',`prev_check_leaves_end_from`='$total_leaves_end_prev',`check_leaves_updated_by`='$admin_cid',`check_leaves_updated_date`='$added_date',`checkbook_no`='$checkbook_no',`requested_bank_branch`='$requested_bank_branch',`prev_checkbook_no`='$checkbook_no_prev',`prev_last_leave`='$prev_last_leave',`checkbook_requested_date`='$checkbook_requested_date',`checkbook_status`='pending',`total_leaves`='$check_leaves' WHERE `check_leaves_id`='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { $_SESSION['msg'] = "Cheque Leaves Updated Successfully."; echo "<script>location.href='search_chequebook.php'</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="2">'; } public function update_check_leaves_prev($id) { $chekleaves_details = $this->check_leaves_details($id); $total_leaves_end_prev = $chekleaves_details['check_leaves_end_from']; $company_name = $_POST['company_name']; $account_no = $_POST['account_no']; $check_leaves = $_POST['check_leaves']; $check_type = $_POST['check_type']; $added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $requested_bank_branch = $_POST['requested_bank_branch']; if ($requested_bank_branch == 'OTHER') { $requested_bank_branch = $_POST['other_branch_name']; } else { $requested_bank_branch = $_POST['requested_bank_branch']; } $other_branch_name = $_POST['other_branch_name']; $checkbook_no_prev = $_POST['chequebook_no']; $checkbook_requested_date = $_POST['checkbook_requested_date']; $prev_last_leave = $_POST['last_leave']; $sel_query = "SELECT * FROM `check_leaves` WHERE `check_leaves_company_id`='$company_name' AND `check_leaves_account_no`='$account_no' ORDER BY check_leaves_id desc"; $sel_res = mysqli_query($this->conn, $sel_query); $row_result = mysqli_fetch_assoc($sel_res); // print_r($row_result); //$sel_res=$this->get_company_details_by_id_account($company_name,$account_no); // $checkrows = mysqli_num_rows($sel_res); // $checkbook_no_prev = $row_result['checkbook_no']; $checkbook_no = $checkbook_no_prev + 1; // $cl_starting_from = $row_result['check_leaves_starting_from']; // $cl_end_from = $row_result['check_leaves_end_from']; $cl_starting_from = ($prev_last_leave + 1); $cl_end_from = ($prev_last_leave + $check_leaves); $check_leaves_starting_from = str_pad($cl_starting_from, 6, "0", STR_PAD_LEFT); $check_leaves_end_from = str_pad($cl_end_from, 6, "0", STR_PAD_LEFT); $sq11 = "UPDATE `check_leaves` SET `check_leaves_company_id`='$company_name',`check_leaves_account_no`='$account_no',`check_leaves_starting_from`='$check_leaves_starting_from',`check_leaves_end_from`='$check_leaves_end_from',`prev_check_leaves_end_from`='$total_leaves_end_prev',`check_leaves_updated_by`='$admin_cid',`check_leaves_updated_date`='$added_date',`checkbook_no`='$checkbook_no',`requested_bank_branch`='$requested_bank_branch',`prev_checkbook_no`='$checkbook_no_prev',`prev_last_leave`='$total_leaves_end_prev',`checkbook_requested_date`='$checkbook_requested_date',`checkbook_status`='pending',`total_leaves`='$check_leaves' WHERE `check_leaves_id`='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { $_SESSION['msg'] = "Cheque Leaves Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="5">'; } public function delete_check_leaves($id) { $sq11 = "DELETE FROM `check_leaves` WHERE `check_leaves_id`='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Cheque Leaves Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="5">'; } public function change_chequebook_status($status, $chequebook_id, $admin_cid) { $updated_date = date('Y-m-d H:i:s'); if ($status == 'requested' || $status == 'received') { $sq3 = "UPDATE `check_leaves` SET `checkbook_status`='$status',`check_leaves_updated_by`='$admin_cid',`check_leaves_updated_date`='$updated_date' WHERE `check_leaves_id`='$chequebook_id'"; } else if ($status == 'deleted') { $sq3 = "DELETE FROM `check_leaves` WHERE `check_leaves_id`='$chequebook_id'"; } $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function receive_chequebook_status($status, $chequebook_id, $admin_cid, $chequebook_received_mode, $post_received_by, $post_received_date, $post_reference_no) { $chekleaves_details = $this->check_leaves_details($chequebook_id); $check_leaves_starting_from = $chekleaves_details['check_leaves_starting_from']; $check_leaves_end_from = $chekleaves_details['check_leaves_end_from']; $updated_date = date('Y-m-d H:i:s'); $sq3 = "UPDATE `check_leaves` SET `checkbook_status`='$status',`check_leaves_updated_by`='$admin_cid',`check_leaves_updated_date`='$updated_date',`chequebook_received_mode`='$chequebook_received_mode',`post_received_by`='$post_received_by',`post_received_date`='$post_received_date',`post_reference_no`='$post_reference_no' WHERE `check_leaves_id`='$chequebook_id'"; $qu3 = mysqli_query($this->conn, $sq3); if ($qu3) { $values = ''; for ($i = $check_leaves_starting_from; $i <= $check_leaves_end_from; $i++) { $values .= "('$chequebook_id', '$i', '$post_received_by', '$post_received_date', '$admin_cid', '$updated_date')"; if ($i < ($check_leaves_end_from - 1 )) { $values .= ","; } } $chq_insert = "INSERT INTO `received_chequebooks`(`cheque_leave_id`, `cheque_no`, `cheque_received_by`, `cheque_received_date`, `added_by`, `added_time`) VALUES $values"; } $qu4 = mysqli_query($this->conn, $chq_insert); return $qu3; } function getIndianCurrency(float $number) { $decimal = round($number - ($no = floor($number)), 2) * 100; $hundred = null; $digits_length = strlen($no); $i = 0; $str = array(); $words = array(0 => '', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety'); $digits = array('', 'hundred', 'thousand', 'lakh', 'crore'); while ($i < $digits_length) { $divider = ($i == 2) ? 10 : 100; $number = floor($no % $divider); $no = floor($no / $divider); $i += $divider == 10 ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 9) ? 's' : null; $hundred = ($counter == 1 && $str[0]) ? ' AND ' : null; $str [] = ($number < 21) ? $words[$number] . ' ' . $digits[$counter] . $plural . ' ' . $hundred : $words[floor($number / 10) * 10] . ' ' . $words[$number % 10] . ' ' . $digits[$counter] . $plural . ' ' . $hundred; } else $str[] = null; } $rupees = implode('', array_reverse($str)); if ($number == 0) { $rupees = 'Zero '; } $paise = ''; if ($decimal) { if ($number > 0) { $paise = 'and '; } $decimal_length = strlen($decimal); if ($decimal_length == 2) { if ($decimal >= 20) { $dc = $decimal % 10; $td = $decimal - $dc; $ps = ($dc == 0) ? '' : '-' . $words[$dc]; $paise .= $words[$td] . $ps; } else { $paise .= $words[$decimal]; } } else { $paise .= $words[$decimal % 10]; } $paise .= ' paise'; } return strtoupper(($rupees ? $rupees . 'rupees ' : '') . $paise . ' only'); } function get_ledger_details_salary($emp_cid) { $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND `ledger_des` IN ('Salary Credit','Salary Debit','Reverse Salary Credit','Other Amount Credit','Other Amount Debit')"; $result = mysqli_query($this->conn, $sql); // while ($row = mysqli_fetch_assoc($result)) { // $row1[] = $row; // } $row1 = mysqli_fetch_assoc($result); return $row1; } function get_ledger_details_epf($emp_cid) { $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND `ledger_des` IN ('EPF Credit','EPF Debit','Reverse EPF Credit')"; $result = mysqli_query($this->conn, $sql); // while ($row = mysqli_fetch_assoc($result)) { // $row1[] = $row; // } $row1 = mysqli_fetch_assoc($result); return $row1; } function get_ledger_details_esic($emp_cid) { $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND `ledger_des` IN ('ESIC Credit','ESIC Debit','Reverse ESIC Credit')"; $result = mysqli_query($this->conn, $sql); // while ($row = mysqli_fetch_assoc($result)) { // $row1[] = $row; // } $row1 = mysqli_fetch_assoc($result); return $row1; } function get_ledger_details($emp_cid) { $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid'"; $result = mysqli_query($this->conn, $sql); // while ($row = mysqli_fetch_assoc($result)) { // $row1[] = $row; // } $row1 = mysqli_fetch_assoc($result); return $row1; } function get_ledger_details_date($emp_cid, $date_from, $date_to) { $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND `txn_date` >= '$date_from' AND `txn_date` <= '$date_to'"; $result = mysqli_query($this->conn, $sql); // while ($row = mysqli_fetch_assoc($result)) { // $row1[] = $row; // } $row1 = mysqli_fetch_assoc($result); return $row1; } function get_ledger_view($emp_cid) { $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' ORDER BY sal_year ASC,sal_month ASC,db_time ASC,txn_type ASC"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_ledger_view_date__prev($emp_cid, $date_from, $date_to) { // $month_from = date('m', strtotime($date_from)); // $year_from = date('Y', strtotime($date_from)); // $month_to = date('m', strtotime($date_to)); // $year_to = date('Y', strtotime($date_to)); // $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND `sal_month` >= '$month_from' AND `sal_year` >= '$year_from' AND `sal_month` <= '$month_to' AND `sal_year` <= '$year_to' ORDER BY sal_year ASC,sal_month ASC,txn_type ASC"; // $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND (sal_year * 100 + sal_month) between ($year_from * 100 + $month_from) AND ($year_to * 100 + $month_to) ORDER BY sal_year ASC,sal_month ASC,txn_type ASC"; $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND `txn_date` >= '$date_from' AND `txn_date` <= '$date_to' ORDER BY sal_year ASC,sal_month ASC,db_time ASC,txn_type ASC"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_ledger_view_date($emp_cid, $date_from, $date_to) { $month_from = date('m', strtotime($date_from)); $year_from = date('Y', strtotime($date_from)); $month_to = date('m', strtotime($date_to)); $year_to = date('Y', strtotime($date_to)); // echo $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND `sal_month` >= '$month_from' AND `sal_year` >= '$year_from' AND `sal_month` <= '$month_to' AND `sal_year` <= '$year_to' ORDER BY sal_year ASC,sal_month ASC,txn_type ASC"; // $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND `txn_date` >= '$date_from' AND `txn_date` <= '$date_to' ORDER BY sal_year ASC,sal_month ASC,txn_type ASC"; $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' AND (sal_year * 100 + sal_month) between ($year_from * 100 + $month_from) AND ($year_to * 100 + $month_to) ORDER BY sal_year ASC,sal_month ASC,db_time ASC,txn_type ASC"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_ledger_view_latest($emp_cid) { // $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' ORDER BY txn_date DESC LIMIT 10"; $sql = "SELECT * FROM `account_ledger_all` WHERE `account_edd_id`='$emp_cid' ORDER BY `sal_year` DESC,`sal_month` DESC,txn_type ASC,txn_date ASC LIMIT 12"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_unit() { $sq = "SELECT * FROM unit ORDER BY unit_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_company_unit($id) { $sq = "SELECT * FROM unit WHERE unit.unit_company_id='$id' ORDER BY unit_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_party_ledger_details($edd_id, $table_name) { $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `$table_name` WHERE `account_edd_id`='$edd_id' ORDER BY txn_date ASC"; $result = mysqli_query($this->conn, $sql); // while ($row = mysqli_fetch_assoc($result)) { // $row1[] = $row; // } $row1 = mysqli_fetch_assoc($result); return $row1; } function get_party_ledger_details_date($edd_id, $date_from, $date_to, $table_name) { $date_to = date('Y-m-d', strtotime("+1 day", strtotime($date_to))); $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `$table_name` WHERE `account_edd_id`='$edd_id' AND `txn_date` >= '$date_from' AND `txn_date` < '$date_to' ORDER BY txn_date ASC"; // echo $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `$table_name` WHERE `account_edd_id`='$edd_id' AND BETWEEN '$date_from' AND '$date_to' "; $result = mysqli_query($this->conn, $sql); // $sql="SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `purchase_table` as pp INNER JOIN $table_name as al ON pp.`transaction_no`=al.txn_no WHERE `account_edd_id`='$edd_id' AND `purchase_date` >= '$date_from' AND `purchase_date` <= '$date_to'"; // $result = mysqli_query($this->conn, $sql); // $sql_1="SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `party_payments` as pp INNER JOIN $table_name as al ON pp.`transaction_no`=al.txn_no WHERE `account_edd_id`='$edd_id' AND `purchase_date` >= '$date_from' AND `purchase_date` <= '$date_to'"; // // $result_1 = mysqli_query($this->conn, $sql_1); // while ($row = mysqli_fetch_assoc($result)) { // $row1[] = $row; // } // $row1 = mysqli_fetch_assoc($result.$result_1); $row1 = mysqli_fetch_assoc($result); return $row1; } function get_party_ledger_view($edd_id, $table_name) { $sql = "SELECT * FROM `$table_name` WHERE `account_edd_id`='$edd_id' ORDER BY txn_date ASC"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_edd_ledger_view($edd_id, $table_name) { $sql = "SELECT * FROM `$table_name` WHERE `account_edd_id`='$edd_id' ORDER BY txn_date ASC,sal_year asc,sal_month asc"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_party_ledger_latest($edd_id, $table_name) { $sql = "SELECT * FROM `$table_name` WHERE `account_edd_id`='$edd_id' ORDER BY txn_date DESC LIMIT 10"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_party_ledger_view_date($edd_id, $date_from, $date_to, $table_name) { $date_to = date('Y-m-d', strtotime("+1 day", strtotime($date_to))); // $sql = "SELECT SUM(`total_balance`) as total_amount_combined,`account_ledger_all`.* FROM `$table_name` WHERE `account_edd_id`='$edd_id' AND `txn_date` >= '$date_from' AND `txn_date` < '$date_to' GROUP BY `txn_no` ORDER BY txn_date ASC"; $sql = "SELECT * FROM `$table_name` WHERE `account_edd_id`='$edd_id' AND `ledger_of`='PARTY' AND `txn_date` >= '$date_from' AND `txn_date` < '$date_to' ORDER BY txn_date ASC"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_opening_balance($account_edd_id, $date_to, $ledger_of) { $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `account_ledger_all` WHERE `account_edd_id`='$account_edd_id' AND `ledger_of`='$ledger_of' AND`txn_date` < '$date_to'"; $result = mysqli_query($this->conn, $sql); $row1 = mysqli_fetch_assoc($result); return $row1; } function get_closing_balance($account_edd_id, $date_to, $ledger_of) { $sql = "SELECT sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance FROM `account_ledger_all` WHERE `account_edd_id`='$account_edd_id' AND `ledger_of`='$ledger_of' AND`txn_date` <= '$date_to'"; $result = mysqli_query($this->conn, $sql); $row1 = mysqli_fetch_assoc($result); return $row1; } public function get_total_balance($account_edd_id, $ledger_of) { $sql = "SELECT * FROM `account_ledger_all` WHERE account_edd_id='$account_edd_id' AND `ledger_of`='$ledger_of' ORDER BY ledger_id DESC"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_party_ledger_view_date_total_voucher($edd_id, $date_from, $date_to, $table_name) { $date_to = date('Y-m-d', strtotime("+1 day", strtotime($date_to))); $sql = "SELECT SUM(`total_balance`) as total_amount_combined,`$table_name`.* FROM `$table_name` WHERE `account_edd_id`='$edd_id' AND `ledger_of`='PARTY' AND `txn_date` >= '$date_from' AND `txn_date` < '$date_to' GROUP BY `txn_no` ORDER BY txn_date ASC"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_ledger_detail_groupby_date($edd_id, $date_from, $date_to, $table_name) { $date_to = date('Y-m-d', strtotime("+1 day", strtotime($date_to))); $sql = "SELECT COUNT(*) as total_records,DATE(txn_date) as txn_date,sum(`credit_balance`) as credit_balance, sum(`debit_balance`) as debit_balance,sum(`credit_balance`)-sum(`debit_balance`) as payable_balance, SUM(total_balance) FROM `$table_name` WHERE `account_edd_id`='$edd_id' AND `txn_date` >= '$date_from' AND `txn_date` < '$date_to' GROUP BY DATE(txn_date) ORDER BY txn_date ASC"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_products() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `products` WHERE `product_company_id`='$company_id' AND `status`='active'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function product_details($id) { $sq3 = "SELECT * FROM `products` WHERE `p_id`='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function product_company_details($id) { $sq3 = "SELECT * FROM `products` INNER JOIN `company_details` ON `company_details`.`ep_id`=`products`.`product_company_id` WHERE `products`.`p_id`='$id'"; $result = $this->select_custom_query($sq3); return $result; } // Update product details public function update_products($id) { $prev_sq = $this->product_details($id); $prev_product_name = $prev_sq['p_name']; $new_product_name = $_POST['product_name']; $product_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $sq11 = "UPDATE `zone` SET `p_name`='$new_product_name', `prev_p_name`='$prev_product_name',`product_updated_by`='$admin_cid',`product_updated_date`='$product_updated_date' WHERE `p_id`='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { $_SESSION['msg'] = "Product Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="5">'; } public function get_product_locations() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `product_locations` WHERE `pl_company_id`='$company_id' AND `pl_status`='active'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_product_location_details_by_id($id) { $sq = "SELECT * FROM `product_locations` WHERE `pl_id` IN ($id)"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_product_location_details($id) { $sq3 = "SELECT * FROM `product_locations` WHERE `pl_id`='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function get_product_location_details_by_product($product_id) { $sq = "SELECT * FROM `product_locations` WHERE `pl_p_id` IN ($product_id)"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_product_quality_details_by_product($product_id) { $query_q = "SELECT * FROM `product_quality` WHERE `q_product_id`='$product_id' ORDER BY q_id ASC"; $result = mysqli_query($this->conn, $query_q); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_brands() { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `brands` WHERE `company_id`='$company_id' AND `status`='active'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_brand_by_id($id) { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `brands` WHERE `b_id` IN ($id)"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function brand_details($id) { $sq3 = "SELECT * FROM `brands` WHERE `b_id`='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function initial_nominee_registration() { $company_id = $_POST['company_id']; $cid = $_POST['cid']; $nid = $_POST['nid']; $fullname = $_POST['nominee_name']; $nominee_rel = $_POST['nominee_rel']; $nominee_other = $_POST['nominee_other']; $result_fullname = explode(" ", $fullname); $fname = $result_fullname[0]; //$_POST['f_name']; $lname = $result_fullname[1]; //$_POST['l_name']; $mname = $result_fullname[2]; //$_POST['m_name']; // $fullname = $fname . ' ' . $mname . ' ' . $lname; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; $phone = $_POST['phone']; $phone2 = $_POST['phone2']; $email = $_POST['email']; $dob = $_POST['dob']; $gender = $_POST['gender']; // $fulladdress = $_POST['fulladdress']; $nationality = $_POST['nationality']; $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $childs = $_POST['childs']; // $identity_type = $_POST['identity_type']; // $zone = $_POST['zone']; // $s_engineer = $_POST['s_engineer']; // $ex_engineer = $_POST['ex_engineer']; // $electry_city = $_POST['electry_city']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); $relation_proof_upload = $_POST['relation_proof_upload']; $relation_proof_no = $_POST['relation_proof_no']; $relation_proof_date = $_POST['relation_proof_date']; // $emp_no = date('YmdHis') . rand(100, 1000); //for file name only $emp_no = $_POST['emp_no']; //for file name only $edit_txn = date('YmdHis'); $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $name_on_identity = $_POST['name_on_identity']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $target_dir = '../nominee/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } if (isset($_FILES['clogo']) && !empty($_FILES['clogo']['name'])) { $target_file = $target_dir . basename($_FILES["clogo"]["name"]); $target_file1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_photo.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_file1)) { // if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_dir . $emp_no . '_' . date('ymdHis') . ".jpg")) { // $clogo = $target_file . $_FILES["clogo"]["tmp_name"]; $errtext = "The images " . basename($_FILES["clogo"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your photo images." . $_FILES["file"]["error"]; } } } else { $x = 'ok'; $target_file1 = $_POST['clogo_uploaded']; } /* image upload for emp_sign proof start */ if (isset($_FILES['emp_sign_upload']) && !empty($_FILES['emp_sign_upload']['name'])) { $target_dir_emp_sign = $target_dir; $target_file_emp_sign = $target_dir_emp_sign . basename($_FILES["emp_sign_upload"]["name"]); $target_file_emp_sign1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_sign.jpg'; $target_file_emp_sign1 = str_replace(' ', '+', $target_file_emp_sign1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_emp_sign, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["emp_sign_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["emp_sign_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_emp_sign)) { chmod($target_file_emp_sign, 0755); //Change the file permissions if allowed unlink($target_file_emp_sign); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["emp_sign_upload"]["tmp_name"], $target_file_emp_sign1)) { $emp_sign_upload = $target_file_emp_sign . $_FILES["emp_sign_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["emp_sign_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your Sign images."; } } } else { $y = 'ok'; $target_file_emp_sign1 = $_POST['emp_sign_uploaded']; } /* image upload for emp_sign proof end */ /* image upload for nominee relation proof start */ if (isset($_FILES['relation_proof_upload']) && !empty($_FILES['relation_proof_upload']['name'])) { $target_dir_relation_proof = $target_dir; $target_file_relation_proof = $target_dir_relation_proof . basename($_FILES["relation_proof_upload"]["name"]); $target_file_relation_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_relation.jpg'; $target_file_relation_proof1 = str_replace(' ', '+', $target_file_relation_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_relation_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtextz; $check = getimagesize($_FILES["relation_proof_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtextz = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["relation_proof_upload"]["size"] > 600000) { echo $errtextz = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtextz = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_relation_proof)) { chmod($target_file_relation_proof, 0755); //Change the file permissions if allowed unlink($target_file_relation_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["relation_proof_upload"]["tmp_name"], $target_file_relation_proof1)) { $relation_proof_upload = $target_file_relation_proof . $_FILES["relation_proof_upload"]["tmp_name"]; $errtextz = "The images " . basename($_FILES["relation_proof_upload"]["name"]) . " has been uploaded."; $z = 'ok'; } else { echo $errtextz = "Sorry, there was an error uploading your Relation Certificate images."; } } } else { $z = 'ok'; $target_file_relation_proof1 = $_POST['relation_proof_uploaded']; } /* image upload for nominee relation proof end */ /* image upload for identity proof start */ if (isset($_FILES['identity_proof']) && !empty($_FILES['identity_proof']['name'])) { $target_file_identity_proof = $target_dir . basename($_FILES["identity_proof"]["name"]); $target_file_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_identity.jpg'; $target_file_identity_proof1 = str_replace(' ', '+', $target_file_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_proof"]["size"] > 300000) { echo $errtext = "Sorry, your image size is larger than 300 KB."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_identity_proof)) { chmod($target_file_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_proof"]["tmp_name"], $target_file_identity_proof1)) { $identity_proof = $target_file_identity_proof . $_FILES["identity_proof"]["tmp_name"]; $errtext = "The images " . basename($_FILES["identity_proof"]["name"]) . " has been uploaded."; $x_id = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x_id = 'ok'; $target_file_identity_proof1 = $_POST['identity_uploaded']; } /* image upload for identity proof end */ /* image upload for passbook start */ if (isset($_FILES['passbook']) && !empty($_FILES['passbook']['name'])) { $target_file_passbook = $target_dir . basename($_FILES["passbook"]["name"]); $target_file_passbook1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_passbook.jpg'; $target_file_passbook1 = str_replace(' ', '+', $target_file_passbook1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_passbook, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["passbook"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["passbook"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_passbook)) { chmod($target_file_passbook, 0755); //Change the file permissions if allowed unlink($target_file_passbook); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["passbook"]["tmp_name"], $target_file_passbook1)) { $passbook = $target_file_passbook . $_FILES["passbook"]["tmp_name"]; $errtext = "The images " . basename($_FILES["passbook"]["name"]) . " has been uploaded."; $x_pass = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x_pass = 'ok'; $target_file_passbook1 = $_POST['passbook_uploaded']; } /* image upload for passbook end */ if ($x == 'ok' && $y == 'ok' && $z == 'ok' && $x_id == 'ok' && $x_pass == 'ok') { if ($nid > 0) { // $sq = "UPDATE `nominee_details` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname', `nominee_relation`='$nominee_rel', `nominee_other`='$nominee_other', `father_name`='$father_name', `mother_name`='$mother_name', `phone`='$phone', `phone2`='$phone2', `emailid`='$email', `dob`='$dob', `gender`='$gender', `mstatus`='$mstatus', `wife_name`='$wife_name', `clogo`='$target_file1', `emp_sign`='$target_file_emp_sign1', `nationality`='$nationality',`childs`='$childs', `emp_no`='$emp_no', `reg_date`='$reg_date', `reg_date1`='$reg_date1', `form_status`='1', `relation_proof_upload`='$target_file_relation_proof1', `relation_proof_no`='$relation_proof_no', `relation_proof_date`='$relation_proof_date' WHERE `nid`='$nid'"; // $sq = "UPDATE `nominee_details` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname', `nominee_relation`='$nominee_rel', `nominee_other`='$nominee_other', `father_name`='$father_name', `mother_name`='$mother_name', `phone`='$phone', `phone2`='$phone2', `emailid`='$email', `dob`='$dob', `gender`='$gender', `mstatus`='$mstatus', `wife_name`='$wife_name', `clogo`='$target_file1', `emp_sign`='$target_file_emp_sign1', `nationality`='$nationality',`childs`='$childs', `emp_no`='$emp_no', `form_status`='1', `relation_proof_upload`='$target_file_relation_proof1', `relation_proof_no`='$relation_proof_no', `relation_proof_date`='$relation_proof_date', `edit_type`='NEW', `edit_txn`='$edit_txn' WHERE `nid`='$nid'"; // $sq_edit = "UPDATE `nominee_details_edited` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname', `nominee_relation`='$nominee_rel', `nominee_other`='$nominee_other', `father_name`='$father_name', `mother_name`='$mother_name', `phone`='$phone', `phone2`='$phone2', `emailid`='$email', `dob`='$dob', `gender`='$gender', `mstatus`='$mstatus', `wife_name`='$wife_name', `clogo`='$target_file1', `emp_sign`='$target_file_emp_sign1', `nationality`='$nationality',`childs`='$childs', `emp_no`='$emp_no', `form_status`='1', `relation_proof_upload`='$target_file_relation_proof1', `relation_proof_no`='$relation_proof_no', `relation_proof_date`='$relation_proof_date',`identity_type`='$identity_type',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`identity_upload`='$target_file_identity_proof1',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`passbook_upload`='$target_file_passbook1',`company_id`='$company_id' WHERE `nid`='$nid'"; $sq_edit = "UPDATE `nominee_details` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname', `nominee_relation`='$nominee_rel', `nominee_other`='$nominee_other', `father_name`='$father_name', `mother_name`='$mother_name', `phone`='$phone', `phone2`='$phone2', `emailid`='$email', `dob`='$dob', `gender`='$gender', `mstatus`='$mstatus', `wife_name`='$wife_name', `clogo`='$target_file1', `emp_sign`='$target_file_emp_sign1', `nationality`='$nationality',`childs`='$childs', `emp_no`='$emp_no', `form_status`='1', `relation_proof_upload`='$target_file_relation_proof1', `relation_proof_no`='$relation_proof_no', `relation_proof_date`='$relation_proof_date',`identity_type`='$identity_type',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`identity_upload`='$target_file_identity_proof1',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`passbook_upload`='$target_file_passbook1',`company_id`='$company_id' WHERE `nid`='$nid'"; $qu_edit = mysqli_query($this->conn, $sq_edit); $nid = $nid; } else { $sq_edit = "INSERT INTO `nominee_details`(`nid`, `cid`, `customer_name`,`first_name` ,`middle_name` ,`last_name` , `nominee_relation`, `nominee_other`,`father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `emp_sign`, `nationality`,`childs`, `emp_no`, `reg_date`, `reg_date1`, `form_status`, `relation_proof_upload`, `relation_proof_no`, `relation_proof_date`,`identity_type`,`name_on_identity`,`identity_no`,`identity_upload`,`acc_holder_name`,`acc_no`,`ifsc`,`bank_name`,`bank_branch`,`bank_address`,`passbook_upload`, `company_id`) VALUES (NULL,'$cid','$fullname','$fname','$mname','$lname','$nominee_rel','$nominee_other','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$target_file1','$target_file_emp_sign1','$nationality','$childs','$emp_no','$reg_date','$reg_date1','1','$target_file_relation_proof1','$relation_proof_no','$relation_proof_date','$identity_type','$name_on_identity','$identity_no','$target_file_identity_proof1','$accname','$accnumber','$ifsc','$bank_name','$bank_branch','$bank_address','$target_file_passbook1','$company_id')"; $qu_edit = mysqli_query($this->conn, $sq_edit); $nid = mysqli_insert_id($this->conn); } if ($qu_edit) { $_SESSION['msg'] = 'Nominee Personal Details Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; $_SESSION['nid'] = $nid; $_SESSION['edit_txn'] = $edit_txn; echo "<script>location.href='address_detail_nominee.php?nid=$nid';</script>"; // echo "<script>location.href='print_after_registration.php?q=$nid';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Nominee Registration Failed.' . mysqli_error($this->conn); echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo or Sign or Relation Certificate Upload due to ' . $errtext . $errtexty . $errtextz; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function add_nominee_address($emp_no, $nid) { $cid = $_POST['cid']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $pincode = $_POST['pincode']; $post = $_POST['post']; $city = $_POST['city']; $state = $_POST['state']; // $country = $_POST['country']; $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $name_on_identity = $_POST['name_on_identity']; $address_type = $_POST['address_type']; $address_no = $_POST['address_no']; $name_on_address = $_POST['name_on_address']; $checkbox_alternate_address = $_POST['checkbox_alternate_address']; $mohalla_2 = $_POST['mohalla_2']; $village_2 = $_POST['village_2']; $block_2 = $_POST['block_2']; $tahsil_2 = $_POST['tahsil_2']; $thana_2 = $_POST['thana_2']; $pincode_2 = $_POST['pincode_2']; $post_2 = $_POST['post_2']; $city_2 = $_POST['city_2']; $state_2 = $_POST['state_2']; $edit_txn = $_POST['edit_txn']; $working_experience_type = $_POST['working_experience_type']; $working_company_name = $_POST['working_company_name']; $target_dir = '../nominee/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } /* image upload for identity proof start */ if (isset($_FILES['identity_proof']) && !empty($_FILES['identity_proof']['name'])) { $target_file = $target_dir . basename($_FILES["identity_proof"]["name"]); $target_file1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_identity.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_proof"]["size"] > 300000) { echo $errtext = "Sorry, your image size is larger than 300 KB."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_proof"]["tmp_name"], $target_file1)) { $identity_proof = $target_file . $_FILES["identity_proof"]["tmp_name"]; $errtext = "The images " . basename($_FILES["identity_proof"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x = 'ok'; $target_file1 = $_POST['identity_uploaded']; } /* image upload for identity proof end */ /* image upload for address proof start */ if (isset($_FILES['address_upload']) && !empty($_FILES['address_upload']['name'])) { $target_dir_address = $target_dir; $target_file_address = $target_dir_address . basename($_FILES["address_upload"]["name"]); $target_file_address1 = $target_dir_address . $emp_no . '_' . date('ymdHis') . '_address.jpg'; $target_file_address1 = str_replace(' ', '+', $target_file_address1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_address, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["address_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["address_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_address)) { chmod($target_file_address, 0755); //Change the file permissions if allowed unlink($target_file_address); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["address_upload"]["tmp_name"], $target_file_address1)) { $address_upload = $target_file_address . $_FILES["address_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["address_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y = 'ok'; $target_file_address1 = $_POST['address_uploaded']; } /* image upload for address proof end */ /* image upload for family_photo proof start */ if (isset($_FILES['family_photo_upload']) && !empty($_FILES['family_photo_upload']['name'])) { $target_dir_family_photo = $target_dir; $target_file_family_photo = $target_dir_family_photo . basename($_FILES["family_photo_upload"]["name"]); $target_file_family_photo1 = $target_dir_family_photo . $emp_no . '_' . date('ymdHis') . '_family_photo.jpg'; $target_file_family_photo1 = str_replace(' ', '+', $target_file_family_photo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_family_photo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["family_photo_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["family_photo_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_family_photo)) { chmod($target_file_family_photo, 0755); //Change the file permissions if allowed unlink($target_file_family_photo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["family_photo_upload"]["tmp_name"], $target_file_family_photo1)) { $family_photo_upload = $target_file_family_photo . $_FILES["family_photo_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["family_photo_upload"]["name"]) . " has been uploaded."; $y_fam = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y_fam = 'ok'; $target_file_family_photo1 = $_POST['family_photo_uploaded']; } /* image upload for family_photo proof end */ /* image upload for other start */ if (isset($_FILES['other_upload']) && !empty($_FILES['other_upload']['name'])) { $target_dir_other_upload = $target_dir . basename($_FILES["other_upload"]["name"]); $target_dir_other_upload1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_other_upload.jpg'; $target_dir_other_upload1 = str_replace(' ', '+', $target_dir_other_upload1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_dir_other_upload, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["other_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["other_upload"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_dir_other_upload)) { chmod($target_dir_other_upload, 0755); //Change the file permissions if allowed unlink($target_dir_other_upload); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["other_upload"]["tmp_name"], $target_dir_other_upload1)) { $other_upload = $target_dir_other_upload . $_FILES["other_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["other_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x = 'ok'; $target_dir_other_upload1 = $_POST['other_uploaded']; } /* image upload for other end */ if ($x == 'ok' && $y == 'ok' && $y_fam == 'ok') { // $sq = "UPDATE `nominee_details` SET `mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`block`='$block',`tahsil`='$tahsil',`identity_type`='$identity_type',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`identity_upload`='$target_file1',`form_status`='2',`mohalla_2`='$mohalla_2',`village_2`='$village_2',`post_2`='$post_2',`state_2`='$state_2',`district_2`='$city_2',`pincode_2`='$pincode_2',`thana_2`='$thana_2',`block_2`='$block_2',`tahsil_2`='$tahsil_2',`checkbox_alternate_address`='$checkbox_alternate_address', `address_type`='$address_type', `name_on_address`='$name_on_address', `address_no`='$address_no', `address_upload`='$target_file_address1' WHERE `nid`='$nid'"; // $sq = "UPDATE `nominee_details_edited` SET `mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`block`='$block',`tahsil`='$tahsil',`identity_type`='$identity_type',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`identity_upload`='$target_file1',`form_status`='2',`mohalla_2`='$mohalla_2',`village_2`='$village_2',`post_2`='$post_2',`state_2`='$state_2',`district_2`='$city_2',`pincode_2`='$pincode_2',`thana_2`='$thana_2',`block_2`='$block_2',`tahsil_2`='$tahsil_2',`checkbox_alternate_address`='$checkbox_alternate_address', `address_type`='$address_type', `name_on_address`='$name_on_address', `address_no`='$address_no', `address_upload`='$target_file_address1',`working_experience_type`='$working_experience_type',`working_company_name`='$working_company_name',`other_upload`='$target_dir_other_upload1' WHERE `nid`='$nid' AND `edit_type`='NEW' AND `edit_txn`='$edit_txn'"; $sq = "UPDATE `nominee_details` SET `mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`block`='$block',`tahsil`='$tahsil',`form_status`='2',`mohalla_2`='$mohalla_2',`village_2`='$village_2',`post_2`='$post_2',`state_2`='$state_2',`district_2`='$city_2',`pincode_2`='$pincode_2',`thana_2`='$thana_2',`block_2`='$block_2',`tahsil_2`='$tahsil_2',`checkbox_alternate_address`='$checkbox_alternate_address', `address_type`='$address_type', `name_on_address`='$name_on_address', `address_no`='$address_no', `address_upload`='$target_file_address1',`working_experience_type`='$working_experience_type',`working_company_name`='$working_company_name',`other_upload`='$target_dir_other_upload1',`family_photo_upload`='$target_file_family_photo1' WHERE `nid`='$nid'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Nominee Address Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; $_SESSION['nid'] = $nid; $_SESSION['edit_txn'] = $edit_txn; // echo "<script>location.href='account_details_nominee.php?nid=$nid';</script>"; echo "<script>location.href='../nominee/preview_nominee_details.php?nid=$nid';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function add_nominee_bank_details($emp_no, $nid) { $cid = $_POST['cid']; $skilled = $_POST['skilled']; $skilled_type = $_POST['skilled_type']; // $skilled_upload = $_POST['skilled_upload']; $work_type = $_POST['work_type']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; // $pan = $_POST['pan']; $working_experience_type = $_POST['working_experience_type']; $working_company_name = $_POST['working_company_name']; $edit_txn = $_POST['edit_txn']; /* image upload for passbook start */ $target_dir = '../nominee/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } /* image upload for passbook start */ if (isset($_FILES['passbook']) && !empty($_FILES['passbook']['name'])) { $target_file = $target_dir . basename($_FILES["passbook"]["name"]); $target_file1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_passbook.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["passbook"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["passbook"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["passbook"]["tmp_name"], $target_file1)) { $passbook = $target_file . $_FILES["passbook"]["tmp_name"]; $errtext = "The images " . basename($_FILES["passbook"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x = 'ok'; $target_file1 = $_POST['passbook_uploaded']; } /* image upload for passbook end */ /* image upload for skill start */ if ($skilled == 'Skilled') { $target_dir_skill = $target_dir; $target_file_skill = $target_dir_skill . basename($_FILES["skilled_upload"]["name"]); $target_file_skill1 = $target_dir_skill . $emp_no . '_' . date('ymdHis') . '_skill.jpg'; $target_file_skill1 = str_replace(' ', '+', $target_file_skill1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_skill, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["skilled_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["skilled_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_skill)) { chmod($target_file_skill, 0755); //Change the file permissions if allowed unlink($target_file_skill); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["skilled_upload"]["tmp_name"], $target_file_skill1)) { $skilled_upload = $target_file_skill . $_FILES["skilled_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["skilled_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y = 'ok'; } /* image upload for skill end */ /* image upload for other start */ if (isset($_FILES['other_upload']) && !empty($_FILES['other_upload']['name'])) { $target_dir_other_upload = $target_dir . basename($_FILES["other_upload"]["name"]); $target_dir_other_upload1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_other_upload.jpg'; $target_dir_other_upload1 = str_replace(' ', '+', $target_dir_other_upload1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_dir_other_upload, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["other_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["other_upload"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_dir_other_upload)) { chmod($target_dir_other_upload, 0755); //Change the file permissions if allowed unlink($target_dir_other_upload); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["other_upload"]["tmp_name"], $target_dir_other_upload1)) { $other_upload = $target_dir_other_upload . $_FILES["other_upload"]["tmp_name"]; $errtext = "The images " . basename($_FILES["other_upload"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your images."; } } } else { $x = 'ok'; $target_dir_other_upload1 = $_POST['other_uploaded']; } /* image upload for other end */ if ($x == 'ok' && $y == 'ok') { // $sq = "UPDATE `nominee_details` SET `skilled`='$skilled',`skilled_type`='$skilled_type',`skilled_upload`='$target_file_skill1',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`work_type`='$work_type',`passbook_upload`='$target_file1',`form_status`='3',`working_experience_type`='$working_experience_type',`working_company_name`='$working_company_name',`other_upload`='$target_dir_other_upload1' WHERE `nid`='$nid'"; $sq = "UPDATE `nominee_details_edited` SET `skilled`='$skilled',`skilled_type`='$skilled_type',`skilled_upload`='$target_file_skill1',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`passbook_upload`='$target_file1',`work_type`='$work_type',`form_status`='3',`working_experience_type`='$working_experience_type',`working_company_name`='$working_company_name',`other_upload`='$target_dir_other_upload1' WHERE `nid`='$nid' AND `edit_type`='NEW' AND `edit_txn`='$edit_txn'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Nominee Bank Detail Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; $_SESSION['nid'] = $nid; $_SESSION['edit_txn'] = $edit_txn; // echo "<script>location.href='insurance_details_nominee.php';</script>"; echo "<script>location.href='../nominee/preview_nominee_details.php?nid=$nid';</script>"; // echo "<script>location.href='../CCavenue-payment-gateway/index.php';</script>"; // echo "<script>location.href='../PaytmKit/nominee_fees.php';</script>"; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo Upload due to ' . $errtext . $errtexty; echo '<meta http-equiv="refresh" content="0">'; } } public function initial_child_registration() { $cid = $_POST['cid']; $nid = $_POST['nid']; $fullname = $_POST['nominee_name']; $nominee_rel = $_POST['nominee_rel']; $nominee_other = $_POST['nominee_other']; $result_fullname = explode(" ", $fullname); $fname = $result_fullname[0]; //$_POST['f_name']; $lname = $result_fullname[1]; //$_POST['l_name']; $mname = $result_fullname[2]; //$_POST['m_name']; // $fullname = $fname . ' ' . $mname . ' ' . $lname; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; $phone = $_POST['phone']; $phone2 = $_POST['phone2']; $email = $_POST['email']; $dob = $_POST['dob']; $gender = $_POST['gender']; // $fulladdress = $_POST['fulladdress']; $nationality = $_POST['nationality']; $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $childs = $_POST['childs']; // $identity_type = $_POST['identity_type']; // $zone = $_POST['zone']; // $s_engineer = $_POST['s_engineer']; // $ex_engineer = $_POST['ex_engineer']; // $electry_city = $_POST['electry_city']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); // $relation_proof_upload = $_POST['relation_proof_upload']; $relation_proof_no = $_POST['relation_proof_no']; $relation_proof_date = $_POST['relation_proof_date']; // $emp_no = date('YmdHis') . rand(100, 1000); //for file name only $emp_no = $_POST['emp_no']; //for file name only $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $pincode = $_POST['pincode']; $post = $_POST['post']; $city = $_POST['city']; $state = $_POST['state']; // $country = $_POST['country']; $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $name_on_identity = $_POST['name_on_identity']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $target_dir = '../child/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } if (isset($_FILES['clogo']) && !empty($_FILES['clogo']['name'])) { $target_file = $target_dir . basename($_FILES["clogo"]["name"]); $target_file1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_photo.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_file1)) { // if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_dir . $emp_no . '_' . date('ymdHis') . ".jpg")) { // $clogo = $target_file . $_FILES["clogo"]["tmp_name"]; $errtext = "The images " . basename($_FILES["clogo"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your photo images." . $_FILES["file"]["error"]; } } } else { $x = 'ok'; $target_file1 = $_POST['clogo_uploaded']; } /* image upload for emp_sign proof start */ if (isset($_FILES['emp_sign_upload']) && !empty($_FILES['emp_sign_upload']['name'])) { $target_dir_emp_sign = $target_dir; $target_file_emp_sign = $target_dir_emp_sign . basename($_FILES["emp_sign_upload"]["name"]); $target_file_emp_sign1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_sign.jpg'; $target_file_emp_sign1 = str_replace(' ', '+', $target_file_emp_sign1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_emp_sign, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["emp_sign_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["emp_sign_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_emp_sign)) { chmod($target_file_emp_sign, 0755); //Change the file permissions if allowed unlink($target_file_emp_sign); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["emp_sign_upload"]["tmp_name"], $target_file_emp_sign1)) { $emp_sign_upload = $target_file_emp_sign . $_FILES["emp_sign_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["emp_sign_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your Sign images."; } } } else { $y = 'ok'; $target_file_emp_sign1 = $_POST['emp_sign_uploaded']; } /* image upload for emp_sign proof end */ /* image upload for identity proof start */ if (isset($_FILES['identity_proof']) && !empty($_FILES['identity_proof']['name'])) { $target_file_identity_proof = $target_dir . basename($_FILES["identity_proof"]["name"]); $target_file_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_identity.jpg'; $target_file_identity_proof1 = str_replace(' ', '+', $target_file_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtextz; $check = getimagesize($_FILES["identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtextz = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_proof"]["size"] > 300000) { echo $errtextz = "Sorry, your image size is larger than 300 KB."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtextz = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_identity_proof)) { chmod($target_file_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_proof"]["tmp_name"], $target_file_identity_proof1)) { $identity_proof = $target_file_identity_proof . $_FILES["identity_proof"]["tmp_name"]; $errtextz = "The images " . basename($_FILES["identity_proof"]["name"]) . " has been uploaded."; $z = 'ok'; } else { echo $errtextz = "Sorry, there was an error uploading your images."; } } } else { $z = 'ok'; $target_file_identity_proof1 = $_POST['identity_uploaded']; } /* image upload for identity proof end */ /* image upload for passbook start */ if (isset($_FILES['passbook']) && !empty($_FILES['passbook']['name'])) { $target_file_passbook = $target_dir . basename($_FILES["passbook"]["name"]); $target_file_passbook1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_passbook.jpg'; $target_file_passbook1 = str_replace(' ', '+', $target_file_passbook1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_passbook, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtextzz; $check = getimagesize($_FILES["passbook"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtextzz = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["passbook"]["size"] > 300000) { echo $errtextzz = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtextzz = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_passbook)) { chmod($target_file_passbook, 0755); //Change the file permissions if allowed unlink($target_file_passbook); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["passbook"]["tmp_name"], $target_file_passbook1)) { $passbook = $target_file_passbook . $_FILES["passbook"]["tmp_name"]; $errtextzz = "The images " . basename($_FILES["passbook"]["name"]) . " has been uploaded."; $zz = 'ok'; } else { echo $errtextzz = "Sorry, there was an error uploading your images."; } } } else { $zz = 'ok'; $target_file_passbook1 = $_POST['passbook_uploaded']; } /* image upload for passbook end */ if ($x == 'ok' && $y == 'ok' && $z == 'ok' && $zz == 'ok') { if ($nid > 0) { $sq = "UPDATE `child_details` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname',`father_name`='$father_name', `mother_name`='$mother_name', `phone`='$phone', `phone2`='$phone2', `emailid`='$email', `dob`='$dob', `gender`='$gender', `mstatus`='$mstatus', `wife_name`='$wife_name', `clogo`='$target_file1', `emp_sign`='$target_file_emp_sign1', `nationality`='$nationality',`childs`='$childs', `emp_no`='$emp_no', `form_status`='1', `mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode', `thana`='$thana', `block`='$block', `tahsil`='$tahsil', `identity_type`='$identity_type', `name_on_identity`='$name_on_identity', `identity_no`='$identity_no', `identity_upload`='$target_file_identity_proof1', `acc_holder_name`='$accname', `acc_no`='$accnumber', `ifsc`='$ifsc', `bank_name`='$bank_name', `bank_branch`='$bank_branch', `bank_address`='$bank_address', `passbook_upload`='$target_file_passbook1' WHERE `nid`='$nid'"; $qu = mysqli_query($this->conn, $sq); $nid = $nid; } else { // $sq = "INSERT INTO `child_details`(`nid`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `nominee`, `nominee_relation`, `nominee_other`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `edit_status`, `edit_date`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `address_type`, `name_on_address`, `address_no`, `address_upload`, `other_upload`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `reg_date1`, `relation_proof_upload`, `relation_proof_no`, `relation_proof_date`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `mohalla_2`, `village_2`, `post_2`, `state_2`, `district_2`, `pincode_2`, `thana_2`, `block_2`, `tahsil_2`, `checkbox_alternate_address`, `working_experience_type`, `working_company_name`) VALUES (NULL,'$cid','$fullname','$fname','$mname','$lname','$nominee_rel','$nominee_other','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name')"; $sq = "INSERT INTO `child_details`(`nid`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `clogo`, `emp_sign`, `nationality`, `childs`, `emp_no`, `reg_date`, `reg_date1`, `form_status`,`mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `block`, `tahsil`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `passbook_upload`) VALUES (NULL,'$cid','$fullname','$fname','$mname','$lname','$father_name','$mother_name','$phone','$phone2','$email','$dob','$gender','$mstatus','$wife_name','$target_file1','$target_file_emp_sign1','$nationality','$childs','$emp_no','$reg_date','$reg_date1','1','$mohalla','$village','$post','$state','$city','$pincode','$thana','$block','$tahsil','$identity_type','$name_on_identity','$identity_no','$target_file_identity_proof1','$accname','$accnumber','$ifsc','$bank_name','$bank_branch','$bank_address','$target_file_passbook1')"; $qu = mysqli_query($this->conn, $sq); $nid = mysqli_insert_id($this->conn); } if ($qu) { $_SESSION['msg'] = 'Child Details Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; $_SESSION['nid'] = $nid; // echo "<script>location.href='../child/address_detail_child.php?nid=$nid';</script>"; echo "<script>location.href='../child/preview_child_details.php?nid=$nid';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Child Registration Failed.' . mysqli_error($this->conn); echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo or Sign or Other documrnt Upload due to ' . $errtext . $errtexty . $errtextz . $errtextzz; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function update_nominee_req_doc($emp_id, $upload_doc_type) { $emp_no = $_POST['emp_no']; $uploaded_date = date("Y-m-d H:i:s"); $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $name_on_identity = $_POST['name_on_identity']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $target_dir = '../nominee/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file = $target_dir . basename($_FILES["$upload_doc_type"]["name"]); $target_file1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_' . $upload_doc_type . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["$upload_doc_type"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["$upload_doc_type"]["size"] > 300000) { echo $errtext = "Sorry, your Image file is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Image file was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["$upload_doc_type"]["tmp_name"], $target_file1)) { // if (move_uploaded_file($_FILES["$upload_doc_type"]["tmp_name"], $pancard_url)) { $$upload_doc_type_upload = $target_file . $_FILES["$upload_doc_type"]["tmp_name"]; $errtext = "The images " . basename($_FILES["$upload_doc_type"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Image file."; } } if ($x == 'ok') { if ($upload_doc_type == 'photo_upload') { $msg_success = 'Nominee Photo Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `photo_checkbox`='no', `photo_upload_date`='$uploaded_date',`photo_image`='$target_file1' WHERE `emp_id`='$emp_id'"; } else if ($upload_doc_type == 'empsign_upload') { $msg_success = 'Nominee Sign Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `empsign_checkbox`='no', `empsign_upload_date`='$uploaded_date',`empsign_image`='$target_file1' WHERE `emp_id`='$emp_id'"; } else if ($upload_doc_type == 'identity_upload') { $msg_success = 'Nominee Identity Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `identity_checkbox`='no', `identity_upload_date`='$uploaded_date',`identity_image`='$target_file1',`req_name_on_identity`='$name_on_identity',`req_identity_no`='$identity_no' WHERE `emp_id`='$emp_id'"; } else if ($upload_doc_type == 'address_upload') { $msg_success = 'Nominee Address Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `address_checkbox`='no', `address_upload_date`='$uploaded_date',`address_image`='$target_file1' WHERE `emp_id`='$emp_id'"; } else if ($upload_doc_type == 'pancard_upload') { $msg_success = 'Nominee Pancard Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `pancard_checkbox`='no', `pancard_upload_date`='$uploaded_date',`pancard_image`='$target_file1' WHERE `emp_id`='$emp_id'"; } else if ($upload_doc_type == 'bank_upload') { $msg_success = 'Nominee Bank Passbook Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `bank_checkbox`='no', `bank_upload_date`='$uploaded_date',`bank_image`='$target_file1',`req_acc_holder_name`='$accname',`req_acc_no`='$accnumber',`req_ifsc`='$ifsc',`req_bank_name`='$bank_name',`req_bank_branch`='$bank_branch',`req_bank_address`='$bank_address' WHERE `emp_id`='$emp_id'"; } else if ($upload_doc_type == 'relation_upload') { $msg_success = 'Nominee Relation Document Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `relation_checkbox`='no', `relation_upload_date`='$uploaded_date',`relation_image`='$target_file1' WHERE `emp_id`='$emp_id'"; } else if ($upload_doc_type == 'family_upload') { $msg_success = 'Nominee Family Photo Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `family_checkbox`='no', `family_upload_date`='$uploaded_date',`family_image`='$target_file1' WHERE `emp_id`='$emp_id'"; } else if ($upload_doc_type == 'other_upload') { $msg_success = 'Nominee Other Document Uploaded Successfully.'; $sq = "UPDATE `nominee_required_document_table` SET `other_checkbox`='no', `other_upload_date`='$uploaded_date',`other_image`='$target_file1' WHERE `emp_id`='$emp_id'"; } $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = $msg_success; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Image File Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function nominee_change_req_bank($status, $emp_id, $image_type, $admin_id, $bank_choice) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `nominee_required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); if ($bank_choice == 'bank_2') { $image_url = $res['bank_image_2']; $ifsc = $res['req_ifsc_2']; $bank_name = $res['req_bank_name_2']; $bank_branch = $res['req_bank_branch_2']; $bank_address = $res['req_bank_address_2']; $accname = $res['req_acc_holder_name_2']; $accnumber = $res['req_acc_no_2']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `bank_approved_2`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'passbook_upload_2'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`acc_holder_name_2`='$accname',`acc_no_2`='$accnumber',`ifsc_2`='$ifsc',`bank_name_2`='$bank_name',`bank_branch_2`='$bank_branch',`bank_address_2`='$bank_address',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Bank Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $image_url = $res['bank_image']; $ifsc = $res['req_ifsc']; $bank_name = $res['req_bank_name']; $bank_branch = $res['req_bank_branch']; $bank_address = $res['req_bank_address']; $accname = $res['req_acc_holder_name']; $accnumber = $res['req_acc_no']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `bank_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'passbook_upload'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Bank Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } // echo $image_url . $sq . $sq1; return; // return $qu1; } public function nominee_change_req_doc($status, $emp_id, $image_type, $admin_id) { $DATE = date("Y-m-d H:i:s"); // echo $status, $emp_id, $image_type, $admin_id, $image_type; $sq1 = "SELECT * FROM `nominee_required_document_table` WHERE `emp_id`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); if ($image_type == 'photo_upload') { $image_url = $res['photo_image']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `photo_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'clogo'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Photo Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'empsign_upload') { $image_url = $res['empsign_image']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `empsign_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'emp_sign'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Signature Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'identity_upload') { $image_url = $res['identity_image']; $identity_no = $res['req_identity_no']; $name_on_identity = $res['req_name_on_identity']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `identity_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'identity_upload'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Identity Proof Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'address_upload') { $image_url = $res['address_image']; $address_upload_type = $res['address_upload_type']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `address_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'address_upload'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`address_type`='$address_upload_type',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Address Proof Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'pancard_upload') { $image_url = $res['pancard_image']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `pan_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'pan_upload'; $cnd = " , pan_detail='yes'"; $sq1 = "UPDATE nominee_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Pan Card Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'epf_upload') { $image_url = $res['epf_image']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `epf_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'epf_upload'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'EPF Passbook Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'relation_upload') { $image_url = $res['relation_image']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `relation_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'relation_proof_upload'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Relation Document Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'family_upload') { $image_url = $res['family_image']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `family_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'family_photo_upload'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Family Photo Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'other_upload') { $image_url = $res['other_image']; if ($image_url != '') { $sq = "UPDATE `nominee_required_document_table` SET `other_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'other_upload'; $sq1 = "UPDATE nominee_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `cid`='$emp_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Other Document Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } // echo $image_url . $sq . $sq1; return; // return $qu1; } public function nominee_disapprove_req_doc_update($status, $emp_id, $image_type, $admin_id, $table_name) { $DATE = date("Y-m-d H:i:s"); if ($image_type == 'bank_2') { $column1 = 'bank_image_2'; $column2 = 'bank_checkbox_2'; $column3 = 'bank_approved_2'; } else { $column1 = $image_type . '_image'; $column2 = $image_type . '_checkbox'; // $column3 = $image_type . '_approved'; if ($image_type == 'pancard') { $column3 = 'pan_approved'; } else { $column3 = $image_type . '_approved'; } } $sq = "UPDATE `$table_name` SET `$column1`='',`$column2`='yes',`$column3`='no',`updated_time`='$DATE',`updated_by`='$admin_id' WHERE `emp_id`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Document Rejected Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } return; } public function update_child_req_doc($emp_id, $upload_doc_type, $child_id) { $emp_no = $_POST['emp_no']; $uploaded_date = date("Y-m-d H:i:s"); $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $name_on_identity = $_POST['name_on_identity']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; $target_dir = '../child/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } $target_file = $target_dir . basename($_FILES["$upload_doc_type"]["name"]); $target_file1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_' . $upload_doc_type . '.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["$upload_doc_type"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["$upload_doc_type"]["size"] > 300000) { echo $errtext = "Sorry, your Image file is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your Image file was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["$upload_doc_type"]["tmp_name"], $target_file1)) { // if (move_uploaded_file($_FILES["$upload_doc_type"]["tmp_name"], $pancard_url)) { $$upload_doc_type_upload = $target_file . $_FILES["$upload_doc_type"]["tmp_name"]; $errtext = "The images " . basename($_FILES["$upload_doc_type"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error IN uploading your Image file."; } } if ($x == 'ok') { if ($upload_doc_type == 'photo_upload') { $msg_success = 'Child Photo Uploaded Successfully.'; $sq = "UPDATE `child_required_document_table` SET `photo_checkbox`='no', `photo_upload_date`='$uploaded_date',`photo_image`='$target_file1' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; } else if ($upload_doc_type == 'empsign_upload') { $msg_success = 'Child Sign Uploaded Successfully.'; $sq = "UPDATE `child_required_document_table` SET `empsign_checkbox`='no', `empsign_upload_date`='$uploaded_date',`empsign_image`='$target_file1' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; } else if ($upload_doc_type == 'identity_upload') { $msg_success = 'Child Identity Uploaded Successfully.'; $sq = "UPDATE `child_required_document_table` SET `identity_checkbox`='no', `identity_upload_date`='$uploaded_date',`identity_image`='$target_file1',`req_name_on_identity`='$name_on_identity',`req_identity_no`='$identity_no' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; } else if ($upload_doc_type == 'address_upload') { $msg_success = 'Child Address Uploaded Successfully.'; $sq = "UPDATE `child_required_document_table` SET `address_checkbox`='no', `address_upload_date`='$uploaded_date',`address_image`='$target_file1' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; } else if ($upload_doc_type == 'pancard_upload') { $msg_success = 'Child Pancard Uploaded Successfully.'; $sq = "UPDATE `child_required_document_table` SET `pancard_checkbox`='no', `pancard_upload_date`='$uploaded_date',`pancard_image`='$target_file1' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; } else if ($upload_doc_type == 'bank_upload') { $msg_success = 'Child Bank Passbook Uploaded Successfully.'; $sq = "UPDATE `child_required_document_table` SET `bank_checkbox`='no', `bank_upload_date`='$uploaded_date',`bank_image`='$target_file1',`req_acc_holder_name`='$accname',`req_acc_no`='$accnumber',`req_ifsc`='$ifsc',`req_bank_name`='$bank_name',`req_bank_branch`='$bank_branch',`req_bank_address`='$bank_address' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; } else if ($upload_doc_type == 'relation_upload') { $msg_success = 'Child Relation Document Uploaded Successfully.'; $sq = "UPDATE `child_required_document_table` SET `relation_checkbox`='no', `relation_upload_date`='$uploaded_date',`relation_image`='$target_file1' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; } else if ($upload_doc_type == 'other_upload') { $msg_success = 'Child Other Document Uploaded Successfully.'; $sq = "UPDATE `child_required_document_table` SET `other_checkbox`='no', `other_upload_date`='$uploaded_date',`other_image`='$target_file1' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; } $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = $msg_success; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Error IN Image File Upload due to ' . $errtext; echo '<meta http-equiv="refresh" content="0">'; } } public function child_change_req_bank($status, $emp_id, $image_type, $admin_id, $bank_choice, $child_id) { $DATE = date("Y-m-d H:i:s"); $sq1 = "SELECT * FROM `child_required_document_table` WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); if ($bank_choice == 'bank_2') { $image_url = $res['bank_image_2']; $ifsc = $res['req_ifsc_2']; $bank_name = $res['req_bank_name_2']; $bank_branch = $res['req_bank_branch_2']; $bank_address = $res['req_bank_address_2']; $accname = $res['req_acc_holder_name_2']; $accnumber = $res['req_acc_no_2']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `bank_approved_2`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'passbook_upload_2'; $sq1 = "UPDATE child_details SET $column='$image_url',`acc_holder_name_2`='$accname',`acc_no_2`='$accnumber',`ifsc_2`='$ifsc',`bank_name_2`='$bank_name',`bank_branch_2`='$bank_branch',`bank_address_2`='$bank_address',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Bank Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else { $image_url = $res['bank_image']; $ifsc = $res['req_ifsc']; $bank_name = $res['req_bank_name']; $bank_branch = $res['req_bank_branch']; $bank_address = $res['req_bank_address']; $accname = $res['req_acc_holder_name']; $accnumber = $res['req_acc_no']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `bank_approved`='yes',`updated_time`='$DATE' WHERE `emp_id`='$emp_id' AND `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'passbook_upload'; $sq1 = "UPDATE child_details SET $column='$image_url',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Bank Passbook Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } // echo $image_url . $sq . $sq1; return; // return $qu1; } public function child_change_req_doc($status, $emp_id, $image_type, $admin_id) { $child_id = $emp_id; $DATE = date("Y-m-d H:i:s"); // echo $status, $emp_id, $image_type, $admin_id, $image_type; $sq1 = "SELECT * FROM `child_required_document_table` WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); if ($image_type == 'photo_upload') { $image_url = $res['photo_image']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `photo_approved`='yes',`updated_time`='$DATE' WHERE `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'clogo'; $sq1 = "UPDATE child_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Photo Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'empsign_upload') { $image_url = $res['empsign_image']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `empsign_approved`='yes',`updated_time`='$DATE' WHERE `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'emp_sign'; $sq1 = "UPDATE child_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Signature Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'identity_upload') { $image_url = $res['identity_image']; $identity_no = $res['req_identity_no']; $name_on_identity = $res['req_name_on_identity']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `identity_approved`='yes',`updated_time`='$DATE' WHERE `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'identity_upload'; $sq1 = "UPDATE child_details SET $column='$image_url',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Identity Proof Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'address_upload') { $image_url = $res['address_image']; $address_upload_type = $res['address_upload_type']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `address_approved`='yes',`updated_time`='$DATE' WHERE `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'address_upload'; $sq1 = "UPDATE child_details SET $column='$image_url',`address_type`='$address_upload_type',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Address Proof Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'pancard_upload') { $image_url = $res['pancard_image']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `pan_approved`='yes',`updated_time`='$DATE' WHERE `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'pan_upload'; $cnd = " , pan_detail='yes'"; $sq1 = "UPDATE child_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Pan Card Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'epf_upload') { $image_url = $res['epf_image']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `epf_approved`='yes',`updated_time`='$DATE' WHERE `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'epf_upload'; $sq1 = "UPDATE child_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'EPF Passbook Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'relation_upload') { $image_url = $res['relation_image']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `relation_approved`='yes',`updated_time`='$DATE' WHERE `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'relation_proof_upload'; $sq1 = "UPDATE child_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Relation Document Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } else if ($image_type == 'other_upload') { $image_url = $res['other_image']; if ($image_url != '') { $sq = "UPDATE `child_required_document_table` SET `other_approved`='yes',`updated_time`='$DATE' WHERE `nid`='$child_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $cnd = ""; $column = 'other_upload'; $sq1 = "UPDATE child_details SET $column='$image_url',`updated_date`='$DATE',`updated_by`='$admin_id' $cnd WHERE `nid`='$child_id'"; $qu1 = mysqli_query($this->conn, $sq1); if ($qu1) { $_SESSION['msg'] = 'Other Document Approved Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } } // echo $image_url . $sq . $sq1; return; // return $qu1; } public function child_disapprove_req_doc_update($status, $emp_id, $image_type, $admin_id, $table_name) { $DATE = date("Y-m-d H:i:s"); if ($image_type == 'bank_2') { $column1 = 'bank_image_2'; $column2 = 'bank_checkbox_2'; $column3 = 'bank_approved_2'; } else { $column1 = $image_type . '_image'; $column2 = $image_type . '_checkbox'; // $column3 = $image_type . '_approved'; if ($image_type == 'pancard') { $column3 = 'pan_approved'; } else { $column3 = $image_type . '_approved'; } } $sq = "UPDATE `$table_name` SET `$column1`='',`$column2`='yes',`$column3`='no',`updated_time`='$DATE',`updated_by`='$admin_id' WHERE `nid`='$emp_id'"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $_SESSION['msg'] = 'Document Rejected Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!' . mysqli_error($this->conn); } return; } public function modify_nominee_details_by_admin($emp_no, $nid) { // echo $emp_no . ' ' . $nid; $admin_cid = $_POST['admin_cid']; // $emp_no = date('YmdHis') . rand(100, 1000); //for file name only $emp_no = $_POST['emp_no']; //for file name only $cid = $_POST['cid']; $nid = $_POST['nid']; // echo $cid . ' ' . $emp_no . ' ' . $nid; $fullname = $_POST['nominee_name']; $nominee_rel = $_POST['nominee_rel']; $nominee_other = $_POST['nominee_other']; $result_fullname = explode(" ", $fullname); $fname = $result_fullname[0]; //$_POST['f_name']; $lname = $result_fullname[1]; //$_POST['l_name']; $mname = $result_fullname[2]; //$_POST['m_name']; // $fullname = $fname . ' ' . $mname . ' ' . $lname; $father_name = $_POST['father_name']; $mother_name = $_POST['mother_name']; $phone = $_POST['phone']; $phone2 = $_POST['phone2']; $email = $_POST['email']; $dob = $_POST['dob']; $gender = $_POST['gender']; // $fulladdress = $_POST['fulladdress']; $nationality = $_POST['nationality']; $mstatus = $_POST['mstatus']; $wife_name = $_POST['wife_name']; $childs = $_POST['childs']; // $identity_type = $_POST['identity_type']; // $zone = $_POST['zone']; // $s_engineer = $_POST['s_engineer']; // $ex_engineer = $_POST['ex_engineer']; // $electry_city = $_POST['electry_city']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); $relation_proof_upload = $_POST['relation_proof_upload']; $relation_proof_no = $_POST['relation_proof_no']; $relation_proof_date = $_POST['relation_proof_date']; /* image upload SET directory start */ $target_dir = '../nominee/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } /* image upload SET directory end */ /* image upload for photo start */ if (isset($_FILES['clogo']) && !empty($_FILES['clogo']['name'])) { $target_file = $target_dir . basename($_FILES["clogo"]["name"]); $target_file1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_photo.jpg'; $target_file1 = str_replace(' ', '+', $target_file1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext; $check = getimagesize($_FILES["clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["clogo"]["size"] > 300000) { echo $errtext = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file)) { chmod($target_file, 0755); //Change the file permissions if allowed unlink($target_file); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_file1)) { // if (move_uploaded_file($_FILES["clogo"]["tmp_name"], $target_dir . $emp_no . '_' . date('ymdHis') . ".jpg")) { // $clogo = $target_file . $_FILES["clogo"]["tmp_name"]; $errtext = "The images " . basename($_FILES["clogo"]["name"]) . " has been uploaded."; $x = 'ok'; } else { echo $errtext = "Sorry, there was an error uploading your photo images." . $_FILES["file"]["error"]; } } } else { $x = 'ok'; $target_file1 = $_POST['clogo_uploaded']; } /* image upload for photo end */ /* image upload for emp_sign proof start */ if (isset($_FILES['emp_sign_upload']) && !empty($_FILES['emp_sign_upload']['name'])) { $target_dir_emp_sign = $target_dir; $target_file_emp_sign = $target_dir_emp_sign . basename($_FILES["emp_sign_upload"]["name"]); $target_file_emp_sign1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_sign.jpg'; $target_file_emp_sign1 = str_replace(' ', '+', $target_file_emp_sign1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_emp_sign, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["emp_sign_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["emp_sign_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_emp_sign)) { chmod($target_file_emp_sign, 0755); //Change the file permissions if allowed unlink($target_file_emp_sign); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["emp_sign_upload"]["tmp_name"], $target_file_emp_sign1)) { $emp_sign_upload = $target_file_emp_sign . $_FILES["emp_sign_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["emp_sign_upload"]["name"]) . " has been uploaded."; $y = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your Sign images."; } } } else { $y = 'ok'; $target_file_emp_sign1 = $_POST['emp_sign_uploaded']; } /* image upload for emp_sign proof end */ /* image upload for nominee relation proof start */ if (isset($_FILES['relation_proof_upload']) && !empty($_FILES['relation_proof_upload']['name'])) { $target_dir_relation_proof = $target_dir; $target_file_relation_proof = $target_dir_relation_proof . basename($_FILES["relation_proof_upload"]["name"]); $target_file_relation_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_relation.jpg'; $target_file_relation_proof1 = str_replace(' ', '+', $target_file_relation_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_relation_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtextz; $check = getimagesize($_FILES["relation_proof_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtextz = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["relation_proof_upload"]["size"] > 600000) { echo $errtextz = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtextz = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_relation_proof)) { chmod($target_file_relation_proof, 0755); //Change the file permissions if allowed unlink($target_file_relation_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["relation_proof_upload"]["tmp_name"], $target_file_relation_proof1)) { $relation_proof_upload = $target_file_relation_proof . $_FILES["relation_proof_upload"]["tmp_name"]; $errtextz = "The images " . basename($_FILES["relation_proof_upload"]["name"]) . " has been uploaded."; $z = 'ok'; } else { echo $errtextz = "Sorry, there was an error uploading your Relation Certificate images."; } } } else { $z = 'ok'; $target_file_relation_proof1 = $_POST['relation_proof_uploaded']; } /* image upload for nominee relation proof end */ // $cid = $_POST['cid']; $mohalla = $_POST['mohalla']; $village = $_POST['village']; $block = $_POST['block']; $tahsil = $_POST['tahsil']; $thana = $_POST['thana']; $pincode = $_POST['pincode']; $post = $_POST['post']; $city = $_POST['city']; $state = $_POST['state']; // $country = $_POST['country']; $identity_type = $_POST['identity_type']; $identity_no = $_POST['identity_no']; $name_on_identity = $_POST['name_on_identity']; $address_type = $_POST['address_type']; $address_no = $_POST['address_no']; $name_on_address = $_POST['name_on_address']; $checkbox_alternate_address = $_POST['checkbox_alternate_address']; $mohalla_2 = $_POST['mohalla_2']; $village_2 = $_POST['village_2']; $block_2 = $_POST['block_2']; $tahsil_2 = $_POST['tahsil_2']; $thana_2 = $_POST['thana_2']; $pincode_2 = $_POST['pincode_2']; $post_2 = $_POST['post_2']; $city_2 = $_POST['city_2']; $state_2 = $_POST['state_2']; /* image upload for identity proof start */ if (isset($_FILES['identity_proof']) && !empty($_FILES['identity_proof']['name'])) { $target_file_identity_proof = $target_dir . basename($_FILES["identity_proof"]["name"]); $target_file_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_identity.jpg'; $target_file_identity_proof1 = str_replace(' ', '+', $target_file_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexti; $check = getimagesize($_FILES["identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexti = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["identity_proof"]["size"] > 300000) { echo $errtexti = "Sorry, your image size is larger than 300 KB."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexti = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_identity_proof)) { chmod($target_file_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["identity_proof"]["tmp_name"], $target_file_identity_proof1)) { $identity_proof = $target_file_identity_proof . $_FILES["identity_proof"]["tmp_name"]; $errtexti = "The images " . basename($_FILES["identity_proof"]["name"]) . " has been uploaded."; $xi = 'ok'; } else { echo $errtexti = "Sorry, there was an error uploading your images."; } } } else { $xi = 'ok'; $target_file_identity_proof1 = $_POST['identity_uploaded']; } /* image upload for identity proof end */ /* image upload for address proof start */ if (isset($_FILES['address_upload']) && !empty($_FILES['address_upload']['name'])) { $target_dir_address = $target_dir; $target_file_address = $target_dir_address . basename($_FILES["address_upload"]["name"]); $target_file_address1 = $target_dir_address . $emp_no . '_' . date('ymdHis') . '_address.jpg'; $target_file_address1 = str_replace(' ', '+', $target_file_address1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_address, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtextya; $check = getimagesize($_FILES["address_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtextya = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["address_upload"]["size"] > 300000) { echo $errtextya = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtextya = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_address)) { chmod($target_file_address, 0755); //Change the file permissions if allowed unlink($target_file_address); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["address_upload"]["tmp_name"], $target_file_address1)) { $address_upload = $target_file_address . $_FILES["address_upload"]["tmp_name"]; $errtextya = "The images " . basename($_FILES["address_upload"]["name"]) . " has been uploaded."; $ya = 'ok'; } else { echo $errtextya = "Sorry, there was an error uploading your images."; } } } else { $ya = 'ok'; $target_file_address1 = $_POST['address_uploaded']; } /* image upload for address proof end */ // $cid = $_POST['cid']; $skilled = $_POST['skilled']; $skilled_type = $_POST['skilled_type']; // $skilled_upload = $_POST['skilled_upload']; $work_type = $_POST['work_type']; $ifsc = $_POST['ifsc']; $bank_name = $_POST['bank_name']; $bank_branch = $_POST['bank_branch']; $bank_address = $_POST['bank_address']; $accname = $_POST['accname']; $accnumber = $_POST['accnumber']; // $pan = $_POST['pan']; $working_experience_type = $_POST['working_experience_type']; $working_company_name = $_POST['working_company_name']; /* image upload for passbook start */ if (isset($_FILES['passbook']) && !empty($_FILES['passbook']['name'])) { $target_file_passbook = $target_dir . basename($_FILES["passbook"]["name"]); $target_file_passbook1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_passbook.jpg'; $target_file_passbook1 = str_replace(' ', '+', $target_file_passbook1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_passbook, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtextp; $check = getimagesize($_FILES["passbook"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtextp = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["passbook"]["size"] > 300000) { echo $errtextp = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtextp = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_passbook)) { chmod($target_file_passbook, 0755); //Change the file permissions if allowed unlink($target_file_passbook); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["passbook"]["tmp_name"], $target_file_passbook1)) { $passbook = $target_file_passbook . $_FILES["passbook"]["tmp_name"]; $errtextp = "The images " . basename($_FILES["passbook"]["name"]) . " has been uploaded."; $xp = 'ok'; } else { echo $errtextp = "Sorry, there was an error uploading your images."; } } } else { $xp = 'ok'; $target_file_passbook1 = $_POST['passbook_uploaded']; } /* image upload for passbook end */ /* image upload for skill start */ if ($skilled == 'Skilled') { $target_dir_skill = $target_dir; $target_file_skill = $target_dir_skill . basename($_FILES["skilled_upload"]["name"]); $target_file_skill1 = $target_dir_skill . $emp_no . '_' . date('ymdHis') . '_skill.jpg'; $target_file_skill1 = str_replace(' ', '+', $target_file_skill1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_skill, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtextys; $check = getimagesize($_FILES["skilled_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtextys = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["skilled_upload"]["size"] > 300000) { echo $errtextys = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtextys = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_skill)) { chmod($target_file_skill, 0755); //Change the file permissions if allowed unlink($target_file_skill); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["skilled_upload"]["tmp_name"], $target_file_skill1)) { $skilled_upload = $target_file_skill . $_FILES["skilled_upload"]["tmp_name"]; $errtextys = "The images " . basename($_FILES["skilled_upload"]["name"]) . " has been uploaded."; $ys = 'ok'; } else { echo $errtextys = "Sorry, there was an error uploading your images."; } } } else { $ys = 'ok'; } /* image upload for skill end */ /* image upload for family_photo proof start */ if (isset($_FILES['family_photo_upload']) && !empty($_FILES['family_photo_upload']['name'])) { $target_dir_family_photo = $target_dir; $target_file_family_photo = $target_dir_family_photo . basename($_FILES["family_photo_upload"]["name"]); $target_file_family_photo1 = $target_dir_family_photo . $emp_no . '_' . date('ymdHis') . '_family_photo.jpg'; $target_file_family_photo1 = str_replace(' ', '+', $target_file_family_photo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_family_photo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexty; $check = getimagesize($_FILES["family_photo_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexty = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["family_photo_upload"]["size"] > 300000) { echo $errtexty = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexty = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_family_photo)) { chmod($target_file_family_photo, 0755); //Change the file permissions if allowed unlink($target_file_family_photo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["family_photo_upload"]["tmp_name"], $target_file_family_photo1)) { $family_photo_upload = $target_file_family_photo . $_FILES["family_photo_upload"]["tmp_name"]; $errtexty = "The images " . basename($_FILES["family_photo_upload"]["name"]) . " has been uploaded."; $y_fam = 'ok'; } else { echo $errtexty = "Sorry, there was an error uploading your images."; } } } else { $y_fam = 'ok'; $target_file_family_photo1 = $_POST['family_photo_uploaded']; } /* image upload for family_photo proof end */ /* image upload for other start */ if (isset($_FILES['other_upload']) && !empty($_FILES['other_upload']['name'])) { $target_dir_other_upload = $target_dir . basename($_FILES["other_upload"]["name"]); $target_dir_other_upload1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_other_upload.jpg'; $target_dir_other_upload1 = str_replace(' ', '+', $target_dir_other_upload1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_dir_other_upload, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtexto; $check = getimagesize($_FILES["other_upload"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtexto = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["other_upload"]["size"] > 300000) { echo $errtexto = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtexto = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_dir_other_upload)) { chmod($target_dir_other_upload, 0755); //Change the file permissions if allowed unlink($target_dir_other_upload); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["other_upload"]["tmp_name"], $target_dir_other_upload1)) { $other_upload = $target_dir_other_upload . $_FILES["other_upload"]["tmp_name"]; $errtexto = "The images " . basename($_FILES["other_upload"]["name"]) . " has been uploaded."; $xo = 'ok'; } else { echo $errtexto = "Sorry, there was an error uploading your images."; } } } else { $xo = 'ok'; $target_dir_other_upload1 = $_POST['other_uploaded']; } /* image upload for other end */ if ($x == 'ok' && $y == 'ok' && $z == 'ok' && $xi == 'ok' && $ya == 'ok' && $xp == 'ok' && $ys == 'ok' && $xo == 'ok' && $y_fam == 'ok') { $edit_txn = date('YmdHis'); // $query = "SELECT * FROM nominee_details_edited WHERE `nid`='$nid'"; // $num_rows = mysqli_num_rows($query); ////If it is not existing, create the entery // if ($num_rows == 0) { // $sq_copy = "INSERT INTO nominee_details_edited SELECT * FROM nominee_details WHERE `nid`='$nid'"; // $qu_copy = mysqli_query($this->conn, $sq_copy); // } $sq_prev = "INSERT INTO `nominee_details_edited`(`nid`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `edit_status`, `edit_date`, `edit_by`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `address_type`, `name_on_address`, `address_no`, `address_upload`, `other_upload`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `reg_date1`, `relation_proof_upload`, `relation_proof_no`, `relation_proof_date`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `mohalla_2`, `village_2`, `post_2`, `state_2`, `district_2`, `pincode_2`, `thana_2`, `block_2`, `tahsil_2`, `checkbox_alternate_address`, `working_experience_type`, `working_company_name`, `edit_type`, `edit_txn`, `family_photo_upload`, `application_status`, `company_id`) SELECT `nid`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `edit_status`, `edit_date`, `edit_by`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `address_type`, `name_on_address`, `address_no`, `address_upload`, `other_upload`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `reg_date1`, `relation_proof_upload`, `relation_proof_no`, `relation_proof_date`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `mohalla_2`, `village_2`, `post_2`, `state_2`, `district_2`, `pincode_2`, `thana_2`, `block_2`, `tahsil_2`, `checkbox_alternate_address`, `working_experience_type`, `working_company_name`, 'PREV', '$edit_txn', `family_photo_upload`, `application_status`, `company_id` FROM `nominee_details` WHERE `nominee_details`.nid='$nid'"; $qu_prev = mysqli_query($this->conn, $sq_prev); $sq_new = "INSERT INTO `nominee_details_edited`(`nid`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `edit_status`, `edit_date`, `edit_by`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `address_type`, `name_on_address`, `address_no`, `address_upload`, `other_upload`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `reg_date1`, `relation_proof_upload`, `relation_proof_no`, `relation_proof_date`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `mohalla_2`, `village_2`, `post_2`, `state_2`, `district_2`, `pincode_2`, `thana_2`, `block_2`, `tahsil_2`, `checkbox_alternate_address`, `working_experience_type`, `working_company_name`, `edit_type`, `edit_txn`, `family_photo_upload`, `application_status`, `company_id`) SELECT `nid`, `cid`, `customer_name`, `first_name`, `middle_name`, `last_name`, `father_name`, `mother_name`, `phone`, `phone2`, `emailid`, `dob`, `gender`, `mstatus`, `wife_name`, `mohalla`, `village`, `post`, `state`, `district`, `pincode`, `thana`, `skilled`, `skilled_type`, `skilled_upload`, `emp_no`, `approved_emp_no`, `epf_expiry`, `ip_detail`, `insurance_policy_no`, `insurance_company`, `s_price`, `nominee`, `nominee_relation`, `nominee_other`, `epf_detail`, `epf_reg`, `epf_upload`, `acc_holder_name`, `acc_no`, `ifsc`, `bank_name`, `bank_branch`, `bank_address`, `pan_no`, `pan_detail`, `pan_upload`, `clogo`, `emp_sign`, `block`, `tahsil`, `nationality`, `childs`, `identity_type`, `name_on_identity`, `identity_no`, `identity_upload`, `full_address`, `edit_status`, `edit_date`, `edit_by`, `reg_date`, `work_type`, `passbook_upload`, `form_status`, `ip_expiry`, `updated_date`, `updated_by`, `accepted_by`, `accepted_date`, `address_type`, `name_on_address`, `address_no`, `address_upload`, `other_upload`, `acc_holder_name_2`, `acc_no_2`, `ifsc_2`, `bank_name_2`, `bank_branch_2`, `bank_address_2`, `passbook_upload_2`, `reg_date1`, `relation_proof_upload`, `relation_proof_no`, `relation_proof_date`, `payment_status`, `payment_reference_no`, `payment_order_id`, `payment_trans_date`, `mohalla_2`, `village_2`, `post_2`, `state_2`, `district_2`, `pincode_2`, `thana_2`, `block_2`, `tahsil_2`, `checkbox_alternate_address`, `working_experience_type`, `working_company_name`, 'NEW', '$edit_txn', `family_photo_upload`, `application_status`, `company_id` FROM `nominee_details` WHERE `nominee_details`.nid='$nid'"; $qu_new = mysqli_query($this->conn, $sq_new); $sq = "UPDATE `nominee_details_edited` SET `customer_name`='$fullname',`first_name`='$fname',`middle_name`='$mname',`last_name`='$lname', `nominee_relation`='$nominee_rel', `nominee_other`='$nominee_other',`father_name`='$father_name', `mother_name`='$mother_name', `phone`='$phone', `phone2`='$phone2', `emailid`='$email', `dob`='$dob', `gender`='$gender', `mstatus`='$mstatus', `wife_name`='$wife_name', `clogo`='$target_file1', `emp_sign`='$target_file_emp_sign1', `nationality`='$nationality',`childs`='$childs', `emp_no`='$emp_no', `relation_proof_upload`='$target_file_relation_proof1', `relation_proof_no`='$relation_proof_no', `relation_proof_date`='$relation_proof_date', `skilled`='$skilled',`skilled_type`='$skilled_type',`skilled_upload`='$target_file_skill1',`acc_holder_name`='$accname',`acc_no`='$accnumber',`ifsc`='$ifsc',`bank_name`='$bank_name',`bank_branch`='$bank_branch',`bank_address`='$bank_address',`work_type`='$work_type',`passbook_upload`='$target_file_passbook1',`working_experience_type`='$working_experience_type',`working_company_name`='$working_company_name',`other_upload`='$target_dir_other_upload1', `mohalla`='$mohalla',`village`='$village',`post`='$post',`state`='$state',`district`='$city',`pincode`='$pincode',`thana`='$thana',`block`='$block',`tahsil`='$tahsil',`identity_type`='$identity_type',`name_on_identity`='$name_on_identity',`identity_no`='$identity_no',`identity_upload`='$target_file_identity_proof1',`mohalla_2`='$mohalla_2',`village_2`='$village_2',`post_2`='$post_2',`state_2`='$state_2',`district_2`='$city_2',`pincode_2`='$pincode_2',`thana_2`='$thana_2',`block_2`='$block_2',`tahsil_2`='$tahsil_2',`checkbox_alternate_address`='$checkbox_alternate_address', `address_type`='$address_type', `name_on_address`='$name_on_address', `address_no`='$address_no', `address_upload`='$target_file_address1', `family_photo_upload`='$target_file_family_photo1', `edit_status`='yes', `edit_date`='$reg_date1', `edit_by`='$admin_cid' WHERE `nid`='$nid' AND `edit_type`='NEW' AND `edit_txn`='$edit_txn';"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $sq_emp = "UPDATE `nominee_details` SET `edit_status`='yes',`edit_date`='$reg_date1',`edit_by`='$admin_cid',`edit_txn`='$edit_txn' WHERE `nid`='$nid'"; $qu_emp = mysqli_query($this->conn, $sq_emp); $_SESSION['msg'] = 'Nominee Personal Details Modified Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; $_SESSION['nid'] = $nid; // echo "<script>location.href='view_nominee_details_admin.php?nid=$nid';</script>"; echo '<meta http-equiv="refresh" content="0">'; } else { $_SESSION['err_msg'] = 'Oops! Nominee Modification Failed due to ' . mysqli_error($this->conn); echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Image Upload due to ' . $errtext . $errtexty . $errtextz . $errtextxi . $errtextya . $errtextxp . $errtextys . $errtextxo; echo '<meta http-equiv="refresh" content="0">'; } } public function get_work_type_detail($work_type) { $sq1 = "SELECT * FROM posts WHERE post_name='$work_type'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); return $res; } public function get_posts_detail($p_id) { $sq3 = "SELECT * FROM `posts` INNER JOIN `company_details` ON `company_details`.`ep_id`=`posts`.`company_id` WHERE `posts`.`p_id`='$p_id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function get_category_detail_by_name($skilled) { $sq1 = "SELECT * FROM `categoery` WHERE `categoery_name`='$skilled'"; $qu1 = mysqli_query($this->conn, $sq1); $res = mysqli_fetch_assoc($qu1); return $res; } public function get_categoery_detail($cat_id) { $sq3 = "SELECT * FROM `categoery` INNER JOIN `company_details` ON `company_details`.`ep_id`=`categoery`.`company_id` WHERE `categoery`.`cat_id`='$cat_id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function initial_parent_registration() { $cid = $_POST['cid']; // employee id $p_id = $_POST['p_id']; // parent id $father_name = $_POST['father_name']; $father_status = $_POST['father_status']; $father_dob = $_POST['father_dob']; $father_identity_type = $_POST['father_identity_type']; $father_identity_no = $_POST['father_identity_no']; $father_name_on_identity = $_POST['father_name_on_identity']; $father_identity_proof = $_POST['father_identity_proof']; // $father_clogo = $_POST['father_clogo']; $mother_name = $_POST['mother_name']; $mother_status = $_POST['mother_status']; $mother_dob = $_POST['mother_dob']; $mother_identity_type = $_POST['mother_identity_type']; $mother_identity_no = $_POST['mother_identity_no']; $mother_name_on_identity = $_POST['mother_name_on_identity']; $mother_identity_proof = $_POST['mother_identity_proof']; // $mother_clogo = $_POST['mother_clogo']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); $emp_no = $_POST['emp_no']; //for file name only $target_dir = '../parents/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } if (isset($_FILES['father_clogo']) && !empty($_FILES['father_clogo']['name'])) { $target_file_father_clogo = $target_dir . basename($_FILES["father_clogo"]["name"]); $target_file_father_clogo1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_father_photo.jpg'; $target_file_father_clogo1 = str_replace(' ', '+', $target_file_father_clogo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_father_clogo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_fp; $check = getimagesize($_FILES["father_clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_fp = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["father_clogo"]["size"] > 300000) { echo $errtext_fp = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_fp = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_father_clogo)) { chmod($target_file_father_clogo, 0755); //Change the file permissions if allowed unlink($target_file_father_clogo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["father_clogo"]["tmp_name"], $target_file_father_clogo1)) { // if (move_uploaded_file($_FILES["father_clogo"]["tmp_name"], $target_dir . $emp_no . '_' . date('ymdHis') . ".jpg")) { // $father_clogo = $target_file_father_clogo . $_FILES["father_clogo"]["tmp_name"]; $errtext_fp = "The images " . basename($_FILES["father_clogo"]["name"]) . " has been uploaded."; $x_father_clogo = 'ok'; } else { echo $errtext_fp = "Sorry, there was an error uploading your Father photo." . $_FILES["file"]["error"]; } } } else { $x_father_clogo = 'ok'; $target_file_father_clogo1 = $_POST['father_clogo_uploaded']; } /* image upload for father_identity_proof start */ if (isset($_FILES['father_identity_proof']) && !empty($_FILES['father_identity_proof']['name'])) { $target_dir_father_identity_proof = $target_dir; $target_file_father_identity_proof = $target_dir_father_identity_proof . basename($_FILES["father_identity_proof"]["name"]); $target_file_father_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_father_identity_proof.jpg'; $target_file_father_identity_proof1 = str_replace(' ', '+', $target_file_father_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_father_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_fi; $check = getimagesize($_FILES["father_identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_fi = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["father_identity_proof"]["size"] > 300000) { echo $errtext_fi = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_fi = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_father_identity_proof)) { chmod($target_file_father_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_father_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["father_identity_proof"]["tmp_name"], $target_file_father_identity_proof1)) { $father_identity_proof = $target_file_father_identity_proof . $_FILES["father_identity_proof"]["tmp_name"]; $errtext_fi = "The images " . basename($_FILES["father_identity_proof"]["name"]) . " has been uploaded."; $y_father_identity_proof = 'ok'; } else { echo $errtext_fi = "Sorry, there was an error uploading your Father identity Proof."; } } } else { $y_father_identity_proof = 'ok'; $target_file_father_identity_proof1 = $_POST['father_identity_uploaded']; } /* image upload for father_identity_proof end */ /* image upload for mother photo start */ if (isset($_FILES['mother_clogo']) && !empty($_FILES['mother_clogo']['name'])) { $target_file_mother_clogo = $target_dir . basename($_FILES["mother_clogo"]["name"]); $target_file_mother_clogo1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_mother_photo.jpg'; $target_file_mother_clogo1 = str_replace(' ', '+', $target_file_mother_clogo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_mother_clogo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_mp; $check = getimagesize($_FILES["mother_clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_mp = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["mother_clogo"]["size"] > 300000) { echo $errtext_mp = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_mp = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_mother_clogo)) { chmod($target_file_mother_clogo, 0755); //Change the file permissions if allowed unlink($target_file_mother_clogo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["mother_clogo"]["tmp_name"], $target_file_mother_clogo1)) { // if (move_uploaded_file($_FILES["mother_clogo"]["tmp_name"], $target_dir . $emp_no . '_' . date('ymdHis') . ".jpg")) { // $mother_clogo = $target_file_mother_clogo . $_FILES["mother_clogo"]["tmp_name"]; $errtext_mp = "The images " . basename($_FILES["mother_clogo"]["name"]) . " has been uploaded."; $x_mother_clogo = 'ok'; } else { echo $errtext_mp = "Sorry, there was an error uploading your Mother photo." . $_FILES["file"]["error"]; } } } else { $x_mother_clogo = 'ok'; $target_file_mother_clogo1 = $_POST['mother_clogo_uploaded']; } /* image upload for mother photo proof end */ /* image upload for mother_identity_proof start */ if (isset($_FILES['mother_identity_proof']) && !empty($_FILES['mother_identity_proof']['name'])) { $target_dir_mother_identity_proof = $target_dir; $target_file_mother_identity_proof = $target_dir_mother_identity_proof . basename($_FILES["mother_identity_proof"]["name"]); $target_file_mother_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_mother_identity_proof.jpg'; $target_file_mother_identity_proof1 = str_replace(' ', '+', $target_file_mother_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_mother_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_mi; $check = getimagesize($_FILES["mother_identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_mi = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["mother_identity_proof"]["size"] > 300000) { echo $errtext_mi = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_mi = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_mother_identity_proof)) { chmod($target_file_mother_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_mother_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["mother_identity_proof"]["tmp_name"], $target_file_mother_identity_proof1)) { $mother_identity_proof = $target_file_mother_identity_proof . $_FILES["mother_identity_proof"]["tmp_name"]; $errtext_mi = "The images " . basename($_FILES["mother_identity_proof"]["name"]) . " has been uploaded."; $y_mother_identity_proof = 'ok'; } else { echo $errtext_mi = "Sorry, there was an error uploading your Mother identity Proof."; } } } else { $y_mother_identity_proof = 'ok'; $target_file_mother_identity_proof1 = $_POST['mother_identity_uploaded']; } /* image upload for mother_identity_proof end */ if ($x_father_clogo == 'ok' && $y_father_identity_proof == 'ok' && $x_mother_clogo == 'ok' && $y_mother_identity_proof == 'ok') { if ($p_id > 0) { $sq = "UPDATE `parents_details` SET `father_name`='$father_name',`father_status`='$father_status',`father_dob`='$father_dob',`father_clogo_prev`=`father_clogo`,`father_clogo`='$target_file_father_clogo1',`father_identity_type`='$father_identity_type',`father_identity_no`='$father_identity_no',`father_name_on_identity`='$father_name_on_identity',`father_identity_upload_prev`=`father_identity_upload`,`father_identity_upload`='$target_file_father_identity_proof1',`mother_name`='$mother_name',`mother_status`='$mother_status',`mother_dob`='$mother_dob',`mother_clogo_prev`=`mother_clogo`,`mother_clogo`='$target_file_mother_clogo1',`mother_identity_type`='$mother_identity_type',`mother_identity_no`='$mother_identity_no',`mother_name_on_identity`='$mother_name_on_identity',`mother_identity_upload_prev`=`mother_identity_upload`,`mother_identity_upload`='$target_file_mother_identity_proof1',`updated_by_id`='$cid',`updated_by_name`='',`updated_by_sign`='',`updated_date`='$reg_date1' WHERE `p_id`='$p_id'"; $qu = mysqli_query($this->conn, $sq); $p_id = $p_id; } else { $sq = "INSERT INTO `parents_details`(`p_id`, `emp_id`, `father_name`, `father_status`, `father_dob`, `father_clogo`, `father_clogo_prev`, `father_identity_type`, `father_identity_no`, `father_name_on_identity`, `father_identity_upload`, `father_identity_upload_prev`, `mother_name`, `mother_status`, `mother_dob`, `mother_clogo`, `mother_clogo_prev`, `mother_identity_type`, `mother_identity_no`, `mother_name_on_identity`, `mother_identity_upload`, `mother_identity_upload_prev`, `added_by_id`, `added_by_name`, `added_by_sign`, `added_date`) VALUES (NULL,'$cid','$father_name','$father_status','$father_dob','$target_file_father_clogo1','$target_file_father_clogo1','$father_identity_type','$father_identity_no','$father_name_on_identity','$target_file_father_identity_proof1','$target_file_father_identity_proof1','$mother_name','$mother_status','$mother_dob','$target_file_mother_clogo1','$target_file_mother_clogo1','$mother_identity_type','$mother_identity_no','$mother_name_on_identity','$target_file_mother_identity_proof1','$target_file_mother_identity_proof1','$cid','','','$reg_date1')"; $qu = mysqli_query($this->conn, $sq); $p_id = mysqli_insert_id($this->conn); } if ($qu) { $sq_1 = "UPDATE `employee` SET `father_name`='$father_name', `mother_name`='$mother_name' WHERE `cid`='$cid'"; $qu_1 = mysqli_query($this->conn, $sq_1); $_SESSION['msg'] = 'Employee Parent Details Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; $_SESSION['parent_id'] = $p_id; echo "<script>location.href='add_parent_detail.php?p_id=$p_id';</script>"; // echo "<script>location.href='print_after_registration.php?q=$p_id';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Employee Parent Details Failed due to' . mysqli_error($this->conn); echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo or Identity Upload of Employee Parent due to ' . $errtext_fp . $errtext_fi . $errtext_mp . $errtext_mi; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } public function initial_wife_registration() { $cid = $_POST['cid']; // employee id $w_id = $_POST['w_id']; // wife id $wife_name = $_POST['wife_name']; $wife_status = $_POST['wife_status']; $wife_dob = $_POST['wife_dob']; $wife_identity_type = $_POST['wife_identity_type']; $wife_identity_no = $_POST['wife_identity_no']; $wife_name_on_identity = $_POST['wife_name_on_identity']; $wife_identity_proof = $_POST['wife_identity_proof']; // $wife_clogo = $_POST['wife_clogo']; $reg_date = date('Y-m-d'); $reg_date1 = date('Y-m-d H:i:s'); $emp_no = $_POST['emp_no']; //for file name only $target_dir = '../wife/uploads' . '/' . date('Y/m/'); // # create directory if not exists IN admin_files/ directory // if (!is_dir($target_dir)) { // mkdir($target_dir, 0755); // } or // #Check if directory exists if not create it // if (!is_dir($target_dir)) { // mkdir($target_dir); // } $tags = explode('/', $target_dir); // explode the full path $mkDir = ""; foreach ($tags as $folder) { $mkDir = $mkDir . $folder . "/"; // make one directory join one other for the nest directory to make // echo '"' . $mkDir . '"<br/>'; // this will show the directory created each time if (!is_dir($mkDir)) { // check if directory exist or not mkdir($mkDir, 0777); // if not exist then make the directory } } if (isset($_FILES['wife_clogo']) && !empty($_FILES['wife_clogo']['name'])) { $target_file_wife_clogo = $target_dir . basename($_FILES["wife_clogo"]["name"]); $target_file_wife_clogo1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_wife_photo.jpg'; $target_file_wife_clogo1 = str_replace(' ', '+', $target_file_wife_clogo1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_wife_clogo, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_fp; $check = getimagesize($_FILES["wife_clogo"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_fp = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["wife_clogo"]["size"] > 300000) { echo $errtext_fp = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_fp = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_wife_clogo)) { chmod($target_file_wife_clogo, 0755); //Change the file permissions if allowed unlink($target_file_wife_clogo); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["wife_clogo"]["tmp_name"], $target_file_wife_clogo1)) { // if (move_uploaded_file($_FILES["wife_clogo"]["tmp_name"], $target_dir . $emp_no . '_' . date('ymdHis') . ".jpg")) { // $wife_clogo = $target_file_wife_clogo . $_FILES["wife_clogo"]["tmp_name"]; $errtext_fp = "The images " . basename($_FILES["wife_clogo"]["name"]) . " has been uploaded."; $x_wife_clogo = 'ok'; } else { echo $errtext_fp = "Sorry, there was an error uploading your Father photo." . $_FILES["file"]["error"]; } } } else { $x_wife_clogo = 'ok'; $target_file_wife_clogo1 = $_POST['wife_clogo_uploaded']; } /* image upload for wife_identity_proof start */ if (isset($_FILES['wife_identity_proof']) && !empty($_FILES['wife_identity_proof']['name'])) { $target_dir_wife_identity_proof = $target_dir; $target_file_wife_identity_proof = $target_dir_wife_identity_proof . basename($_FILES["wife_identity_proof"]["name"]); $target_file_wife_identity_proof1 = $target_dir . $emp_no . '_' . date('ymdHis') . '_wife_identity_proof.jpg'; $target_file_wife_identity_proof1 = str_replace(' ', '+', $target_file_wife_identity_proof1); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file_wife_identity_proof, PATHINFO_EXTENSION)); // Check if image images is a actual image or fake image global $errtext_fi; $check = getimagesize($_FILES["wife_identity_proof"]["tmp_name"]); if ($check !== false) { "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { $errtext_fi = "File is not an image."; $uploadOk = 0; } // Check images size if ($_FILES["wife_identity_proof"]["size"] > 300000) { echo $errtext_fi = "Sorry, your images is too large."; $uploadOk = 0; } // Allow certain images formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" && $imageFileType != "JPG" && $imageFileType != "PNG" && $imageFileType != "JPEG" && $imageFileType != "GIF") { echo $errtext_fi = "Sorry, only JPG, JPEG, PNG & GIF images are allowed."; $uploadOk = 0; } if (file_exists($target_file_wife_identity_proof)) { chmod($target_file_wife_identity_proof, 0755); //Change the file permissions if allowed unlink($target_file_wife_identity_proof); //remove the file } // Check if $uploadOk is SET to 0 by an error if ($uploadOk == 0) { "Sorry, your images was not uploaded."; // if everything is ok, try to upload images } else { if (move_uploaded_file($_FILES["wife_identity_proof"]["tmp_name"], $target_file_wife_identity_proof1)) { $wife_identity_proof = $target_file_wife_identity_proof . $_FILES["wife_identity_proof"]["tmp_name"]; $errtext_fi = "The images " . basename($_FILES["wife_identity_proof"]["name"]) . " has been uploaded."; $y_wife_identity_proof = 'ok'; } else { echo $errtext_fi = "Sorry, there was an error uploading your Father identity Proof."; } } } else { $y_wife_identity_proof = 'ok'; $target_file_wife_identity_proof1 = $_POST['wife_identity_uploaded']; } /* image upload for wife_identity_proof end */ if ($x_wife_clogo == 'ok' && $y_wife_identity_proof == 'ok') { if ($w_id > 0) { $sq = "UPDATE `wife_details` SET `wife_name`='$wife_name',`wife_status`='$wife_status',`wife_dob`='$wife_dob',`wife_clogo_prev`=`wife_clogo`,`wife_clogo`='$target_file_wife_clogo1',`wife_identity_type`='$wife_identity_type',`wife_identity_no`='$wife_identity_no',`wife_name_on_identity`='$wife_name_on_identity',`wife_identity_upload_prev`=`wife_identity_upload`,`wife_identity_upload`='$target_file_wife_identity_proof1',`updated_by_id`='$cid',`updated_by_name`='',`updated_by_sign`='',`updated_date`='$reg_date1' WHERE `w_id`='$w_id'"; $qu = mysqli_query($this->conn, $sq); $w_id = $w_id; } else { $sq = "INSERT INTO `wife_details`(`w_id`, `emp_id`, `wife_name`, `wife_status`, `wife_dob`, `wife_clogo`, `wife_clogo_prev`, `wife_identity_type`, `wife_identity_no`, `wife_name_on_identity`, `wife_identity_upload`, `wife_identity_upload_prev`, `added_by_id`, `added_by_name`, `added_by_sign`, `added_date`) VALUES (NULL,'$cid','$wife_name','$wife_status','$wife_dob','$target_file_wife_clogo1','$target_file_wife_clogo1','$wife_identity_type','$wife_identity_no','$wife_name_on_identity','$target_file_wife_identity_proof1','$target_file_wife_identity_proof1','$cid','','','$reg_date1')"; $qu = mysqli_query($this->conn, $sq); $w_id = mysqli_insert_id($this->conn); } if ($qu) { $sq_1 = "UPDATE `employee` SET `wife_name`='$wife_name' WHERE `cid`='$cid'"; $qu_1 = mysqli_query($this->conn, $sq_1); $_SESSION['msg'] = 'Employee Wife Details Added Successfully.'; $_SESSION['emp_no'] = $emp_no; $_SESSION['cid'] = $cid; $_SESSION['wife_id'] = $w_id; echo "<script>location.href='add_wife_detail.php?w_id=$w_id';</script>"; } else { $_SESSION['err_msg'] = 'Oops! Employee Wife Details Failed due to' . mysqli_error($this->conn); echo '<meta http-equiv="refresh" content="0">'; } } else { $_SESSION['err_msg'] = 'Error IN Photo or Identity Upload of Employee Wife due to ' . $errtext_fp . $errtext_fi; echo '<meta http-equiv="refresh" content="0">'; } // echo '<meta http-equiv="refresh" content="0">'; } //List all relatives public function list_accepted_relatives($app_status, $list_of) { $company_id = $_SESSION['company_id']; $order_by = ''; $table_name = $list_of . '_details'; if ($app_status == 'accepted') { // SELECT * FROM `nominee_details` as rel_table INNER JOIN `employee` as emp_table ON emp_table.`cid`=rel_table.`cid` WHERE rel_table.`application_status`='unaccepted' if ($list_of == 'nominee' || $list_of == 'child') { $order_by = 'ORDER BY accepted_date desc'; $sq3 = "SELECT `$table_name`.*,`sub_admin`.`user_name` as admin_name FROM `$table_name` INNER JOIN `sub_admin` ON `$table_name`.`accepted_by`=`sub_admin`.`id` WHERE application_status IN ('$app_status') AND company_id='$company_id' AND emp_sign!='' $order_by"; } else { $order_by = 'ORDER BY added_date desc'; $sq3 = "SELECT `$table_name`.*,`sub_admin`.`user_name` as admin_name FROM `$table_name` INNER JOIN `sub_admin` ON `$table_name`.`accepted_by`=`sub_admin`.`id` $order_by"; } } else if ($app_status == 'unaccepted') { if ($list_of == 'nominee' || $list_of == 'child') { $order_by = 'ORDER BY reg_date1 desc'; $sq3 = "SELECT * FROM `$table_name` WHERE application_status='$app_status' AND company_id='$company_id' AND emp_sign!='' $order_by"; } else { $order_by = 'ORDER BY added_date desc'; $sq3 = "SELECT * FROM `$table_name` $order_by"; } } else { if ($list_of == 'nominee' || $list_of == 'child') { $order_by = 'ORDER BY reg_date1 desc'; $sq3 = "SELECT * FROM `$table_name` WHERE company_id='$company_id' $order_by"; } else { $order_by = 'ORDER BY added_date desc'; $sq3 = "SELECT * FROM `$table_name` $order_by"; } } // echo $sq3; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } // Get all financial_year by status OPEN/CLOSE/INACTIVE public function get_financial_year_status($status) { $company_id = $_SESSION['company_id']; if ($status == 'ALL') { $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' ORDER BY start_date DESC"; } else { $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' AND `financial_year`.status IN ('$status') ORDER BY start_date DESC"; } // echo $sq; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //Get all get_financial_year_employee public function get_financial_year_employee($status, $company_id) { if ($status == 'ALL') { $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' ORDER BY start_date DESC"; } else { $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' AND `financial_year`.status IN ('$status') ORDER BY start_date DESC"; } //echo $sq; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //Get all get_current_financial_year public function get_current_financial_year($company_id, $current_date) { $sq = "SELECT f_id FROM `financial_year` WHERE status='OPEN' AND company_id='" . $company_id . "' AND '" . $current_date . "' BETWEEN start_date AND end_date"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['f_id']; } //Get all get_financial_name public function get_financial_name($f_id) { $sq = "SELECT * FROM `financial_year` WHERE f_id='" . $f_id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); $FYName = date('Y', strtotime($row['start_date'])) . '-' . date('y', strtotime($row['end_date'])); return $FYName; } public function get_selected_financial_year_name($id) { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' AND `financial_year`.`f_id` IN ($id) ORDER BY start_date ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { // $row1[] = $row; $fy_names .= $this->get_financial_name($row['f_id']) . ', '; } $fy_names = rtrim($fy_names, ','); return $fy_names; } public function get_not_selected_financial_year_name($id) { $company_id = $_SESSION['company_id']; if ($id) { $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' AND `financial_year`.`f_id` NOT IN ($id) ORDER BY start_date DESC LIMIT 5"; } else { $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' ORDER BY start_date DESC LIMIT 5"; } $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } sort($row1); foreach ($row1 as $row) { $fy_names .= $this->get_financial_name($row['f_id']) . ', '; } $fy_names = rtrim($fy_names, ','); return $fy_names; } // Get all financial_year by ID OPEN/CLOSE/INACTIVE public function get_financial_year_byid($id) { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' AND `financial_year`.`f_id` IN ('$id') ORDER BY start_date DESC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get selected financial_year public function get_selected_financial_year($id) { $company_id = $_SESSION['company_id']; $sq = "SELECT * FROM `financial_year` INNER JOIN `company_details` ON `company_details`.`ep_id`=`financial_year`.`company_id` WHERE `financial_year`.`company_id`='$company_id' AND `financial_year`.`f_id` IN ($id) ORDER BY start_date ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function numberBetween($varToCheck, $high, $low) { if ($varToCheck < $low) return false; if ($varToCheck > $high) return false; return true; } public function checkDocument($ImageURL) { $params = array( 'url' => $ImageURL, 'models' => 'properties', 'api_user' => '1525005396', 'api_secret' => 'x7s3uR8EqJJ5cYKsYeyh', ); // this example uses cURL $ch = curl_init('https://api.sightengine.com/1.0/check.json?' . http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $output = json_decode($response, true); $resStatus = $output['status']; $sharpness = $output['sharpness']; $sharpnessRes = $this->numberBetween($sharpness, '0.99', '0.89'); $brightness = $output['brightness']; $brightnessRes = $this->numberBetween($brightness, '0.99', '0.97'); $contrast = $output['contrast']; $contrastRes = $this->numberBetween($contrast, '0.99', '0.77'); if ($resStatus == 'success' && $sharpnessRes == true && $brightnessRes == true && $contrastRes == true) { $result = 'success'; } else { $result = 'error'; } return $result; } // search reg fees by edd id public function get_edd_reg_fees_details($edd_id) { $company_id = $_SESSION['company_id']; if ($edd_id) { $sq = "SELECT * FROM `reg_fees_new` INNER JOIN `executive_engineer` ON `executive_engineer`.`ex_id`=`reg_fees`.`ex_id` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` WHERE `executive_engineer`.`ex_id`='$edd_id' AND zone.company_id='$company_id' ORDER BY ex_name ASC, effective_date DESC"; } else { $sq = "SELECT * FROM `reg_fees_new` INNER JOIN `executive_engineer` ON `executive_engineer`.`ex_id`=`reg_fees`.`ex_id` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` WHERE zone.company_id='$company_id' ORDER BY ex_name ASC, effective_date DESC"; } // echo $sq; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // search edd id by reg fees id public function get_edd_reg_fees_details_by_id($id) { $sq3 = "SELECT * FROM `reg_fees_new` INNER JOIN `executive_engineer` ON `executive_engineer`.`ex_id`=`reg_fees`.`ex_id` INNER JOIN `super_engineer` ON `super_engineer`.`super_id`=`executive_engineer`.`super_id` INNER JOIN `zone` ON `super_engineer`.`zone_id`=`zone`.`zone_id` WHERE q_id='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function view_specific_employee_all_join($cid, $application_status) { // echo $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON electrycity_zone.electrycity_zone_name=employee.electrycity_zone INNER JOIN edsd_engineer on edsd_engineer.edsd_id=electrycity_zone.edsd_id INNER JOIN executive_engineer on executive_engineer.ex_id=edsd_engineer.ex_id INNER JOIN super_engineer ON super_engineer.super_id=executive_engineer.super_id INNER JOIN zone ON zone.zone_id=super_engineer.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id WHERE `cid` IN ($cid) AND application_status IN ($application_status) ORDER BY electrycity_zone asc,work_type asc,skilled desc"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON electrycity_zone.electrycity_zone_name=employee.electrycity_zone INNER JOIN edsd_engineer on edsd_engineer.edsd_id=electrycity_zone.edsd_id INNER JOIN executive_engineer on executive_engineer.ex_id=edsd_engineer.ex_id INNER JOIN super_engineer ON super_engineer.super_id=executive_engineer.super_id INNER JOIN zone ON zone.zone_id=super_engineer.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,work_type asc,skilled desc"; $sq3 = "SELECT e.*,sub_admin.*,ez.*,edsd.*,ex.*,sup.*,zone.*,discom.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ez ON ez.electrycity_zone_name=e.electrycity_zone INNER JOIN edsd_engineer edsd on edsd.edsd_id=ez.edsd_id INNER JOIN executive_engineer ex on ex.ex_id=edsd.ex_id INNER JOIN super_engineer sup ON sup.super_id=ex.super_id INNER JOIN zone ON zone.zone_id=sup.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,e.work_type asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); return $qu3; } public function view_selected_employee_all_join($cid, $application_status) { // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON electrycity_zone.electrycity_zone_name=employee.electrycity_zone INNER JOIN edsd_engineer on edsd_engineer.edsd_id=electrycity_zone.edsd_id INNER JOIN executive_engineer on executive_engineer.ex_id=edsd_engineer.ex_id INNER JOIN super_engineer ON super_engineer.super_id=executive_engineer.super_id INNER JOIN zone ON zone.zone_id=super_engineer.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id WHERE `cid` IN ($cid) AND application_status IN ($application_status) ORDER BY electrycity_zone asc,work_type asc,skilled desc"; // $sq3 = "SELECT * FROM `employee` LEFT JOIN sub_admin ON sub_admin.id=employee.`accepted_by` LEFT JOIN electrycity_zone ON electrycity_zone.electrycity_zone_name=employee.electrycity_zone INNER JOIN edsd_engineer on edsd_engineer.edsd_id=electrycity_zone.edsd_id INNER JOIN executive_engineer on executive_engineer.ex_id=edsd_engineer.ex_id INNER JOIN super_engineer ON super_engineer.super_id=executive_engineer.super_id INNER JOIN zone ON zone.zone_id=super_engineer.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,work_type asc,skilled desc"; $sq3 = "SELECT e.*,sub_admin.*,ez.*,edsd.*,ex.*,sup.*,zone.*,discom.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` e LEFT JOIN sub_admin ON sub_admin.id=e.`accepted_by` LEFT JOIN electrycity_zone ez ON ez.electrycity_zone_name=e.electrycity_zone INNER JOIN edsd_engineer edsd on edsd.edsd_id=ez.edsd_id INNER JOIN executive_engineer ex on ex.ex_id=edsd.ex_id INNER JOIN super_engineer sup ON sup.super_id=ex.super_id INNER JOIN zone ON zone.zone_id=sup.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE `cid` IN ($cid) ORDER BY electrycity_zone asc,e.work_type asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } public function view_selected_employee_monthly_all_join($cid, $select_month, $select_year, $application_status) { // $sq3 = "SELECT * FROM `employee_acc_wages` INNER JOIN electrycity_zone ON electrycity_zone.electrycity_zone_name = employee_acc_wages.electrycity_zone INNER JOIN edsd_engineer on edsd_engineer.edsd_id=electrycity_zone.edsd_id INNER JOIN executive_engineer on executive_engineer.ex_id=edsd_engineer.ex_id INNER JOIN super_engineer ON super_engineer.super_id=executive_engineer.super_id INNER JOIN zone ON zone.zone_id=super_engineer.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id WHERE list_status IN ('approved') AND exit_status!='yes' AND emergency_status!='generated' AND `cid` IN ($cid) AND wages_month='$select_month' AND wages_year='$select_year' AND application_status IN ($application_status) ORDER BY electrycity_zone asc,work_type asc,skilled desc"; // $sq3 = "SELECT * FROM `employee_acc_wages` INNER JOIN electrycity_zone ON electrycity_zone.electrycity_zone_name = employee_acc_wages.electrycity_zone INNER JOIN edsd_engineer on edsd_engineer.edsd_id=electrycity_zone.edsd_id INNER JOIN executive_engineer on executive_engineer.ex_id=edsd_engineer.ex_id INNER JOIN super_engineer ON super_engineer.super_id=executive_engineer.super_id INNER JOIN zone ON zone.zone_id=super_engineer.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id WHERE list_status IN ('approved') AND exit_status!='yes' AND emergency_status!='generated' AND `cid` IN ($cid) AND wages_month='$select_month' AND wages_year='$select_year' ORDER BY electrycity_zone asc,work_type asc,skilled desc"; $sq3 = "SELECT e.*,ez.*,edsd.*,ex.*,sup.*,zone.*,discom.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee_acc_wages` e LEFT JOIN electrycity_zone ez ON ez.electrycity_zone_name=e.electrycity_zone INNER JOIN edsd_engineer edsd on edsd.edsd_id=ez.edsd_id INNER JOIN executive_engineer ex on ex.ex_id=edsd.ex_id INNER JOIN super_engineer sup ON sup.super_id=ex.super_id INNER JOIN zone ON zone.zone_id=sup.zone_id INNER JOIN discom ON discom.d_id=zone.discom_id LEFT JOIN posts ON posts.p_id=e.work_type LEFT JOIN categoery ON categoery.cat_id=e.skilled WHERE list_status IN ('approved') AND exit_status!='yes' AND emergency_status!='generated' AND `cid` IN ($cid) AND wages_month='$select_month' AND wages_year='$select_year' ORDER BY electrycity_zone asc,e.work_type asc,e.skilled desc"; $qu3 = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($qu3)) { $row1[] = $row; } return $row1; } // Get CSC User Details by id public function csc_details($id) { $sq3 = "SELECT * FROM `csc_user` WHERE csc_id='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function login_csc_reg() { // $company_name = $_POST['company_name']; // $company_id = $_POST['company_id']; $uname = strtoupper($_POST['name']); $pass = $_POST['password']; $dec_pass = md5($pass); $cnd = "csc_user_name='$uname' AND csc_password='$dec_pass' AND csc_user_status='ACTIVE'"; // $checklogin = $db->select_row('sub_admin',$cnd); $sq = "SELECT * FROM csc_user WHERE $cnd"; $qu = mysqli_query($this->conn, $sq); if (mysqli_num_rows($qu) > 0) { $row = mysqli_fetch_array($qu); // $_SESSION['company_id'] = $company_id; // $_SESSION['company_name'] = $company_name; // $_SESSION['dashboard_img'] = $dashboard_img; $_SESSION['csc_id'] = $row['csc_id']; $_SESSION['csc_login'] = 'CSC123'; $_SESSION['csc_name'] = $uname; $_SESSION['csc_full_name'] = $row['csc_full_name']; // $companys = json_decode($row['csc_companys']); ////print_r($companys); // if (in_array(1, $companys)) { // $_SESSION['subadminedit'] = TRUE; // } // if (in_array(2, $companys)) { // $_SESSION['subadminverify'] = TRUE; // } if (isset($_SESSION['csc_login'])) { // echo $_SESSION['csc_login'].$_SESSION['csc_name']; // echo "<script type='text/javascript'> document.location = 'admin/dashboard.php'; </script>"; echo "<script type='text/javascript'> document.location = 'instructions_csc_reg.php'; </script>"; } // echo "<script>location.href='admin/dashboard.php';</script>"; // echo '<script type="text/javascript"> window.location = "admin/dashboard.php" </script>'; // header("Location:admin/dashboard.php"); } else { $_SESSION['err_login'] = "CSC Username or Password is Wrong!"; } } // Get Late Reason Details public function get_late_reasons($working_from = '', $late_cat = '') { $working_from_cnd = ""; $late_cat_cnd = ""; // if ($working_from & $working_from==1) { // $working_from_cnd = " AND `working_from`='$working_from' "; // } if ($working_from) { $working_from_cnd = " AND FIND_IN_SET('$working_from', working_from) "; } if ($late_cat) { $late_cat_cnd = " AND FIND_IN_SET('$late_cat', show_in) "; } $sq = "SELECT * FROM `late_reasons` WHERE l_status='1' $working_from_cnd $late_cat_cnd ORDER BY l_id asc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Late time Details public function get_late_timing($company_id) { $current_date = date('Y-m-d H:i:s'); $c_cnd = ""; if ($company_id) { $c_cnd = " AND s_company_id='$company_id' "; } $sq = "SELECT * FROM `late_timing` WHERE s_is_status='Active' AND `s_effective_from`<='$current_date' $c_cnd ORDER BY `s_effective_from` DESC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Late get_authority_permissions public function get_authority_permissions($status = '') { if ($status) { $status_cnd = " AND is_status IN ('$status') "; } $sq = "SELECT * FROM `authority_permission` WHERE 1 $working_from_cnd ORDER BY ap_id ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function getOS() { $user_agent = $_SERVER['HTTP_USER_AGENT']; $os_platform = "Unknown"; $os_array = array( '/windows nt 10/i' => 'Windows 10', '/windows nt 6.3/i' => 'Windows 8.1', '/windows nt 6.2/i' => 'Windows 8', '/windows nt 6.1/i' => 'Windows 7', '/windows nt 6.0/i' => 'Windows Vista', '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', '/windows nt 5.1/i' => 'Windows XP', '/windows xp/i' => 'Windows XP', '/windows nt 5.0/i' => 'Windows 2000', '/windows me/i' => 'Windows ME', '/win98/i' => 'Windows 98', '/win95/i' => 'Windows 95', '/win16/i' => 'Windows 3.11', '/macintosh|mac os x/i' => 'Mac OS X', '/mac_powerpc/i' => 'Mac OS 9', '/linux/i' => 'Linux', '/ubuntu/i' => 'Ubuntu', '/iphone/i' => 'iPhone', '/ipod/i' => 'iPod', '/ipad/i' => 'iPad', '/android/i' => 'Android', '/blackberry/i' => 'BlackBerry', '/webos/i' => 'Mobile' ); foreach ($os_array as $regex => $value) if (preg_match($regex, $user_agent)) $os_platform = $value; return $os_platform; } function getBrowser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $bname = 'Unknown'; $platform = 'Unknown'; $version = ""; // Next get the name of the useragent yes seperately and for good reason if (preg_match('/MSIE/i', $u_agent) && !preg_match('/Opera/i', $u_agent)) { $bname = 'Internet Explorer'; $ub = "MSIE"; } elseif (preg_match('/Firefox/i', $u_agent)) { $bname = 'Mozilla Firefox'; $ub = "Firefox"; } elseif (preg_match('/Chrome/i', $u_agent)) { $bname = 'Google Chrome'; $ub = "Chrome"; } elseif (preg_match('/Safari/i', $u_agent)) { $bname = 'Apple Safari'; $ub = "Safari"; } elseif (preg_match('/Opera/i', $u_agent)) { $bname = 'Opera'; $ub = "Opera"; } elseif (preg_match('/Netscape/i', $u_agent)) { $bname = 'Netscape'; $ub = "Netscape"; } // finally get the correct version number $known = array('Version', $ub, 'other'); $pattern = '#(?<browser>' . join('|', $known) . ')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#'; if (!preg_match_all($pattern, $u_agent, $matches)) { // we have no matching number just continue } // see how many we have $i = count($matches['browser']); if ($i != 1) { //we will have two since we are not using 'other' argument yet //see if version is before or after the name if (strripos($u_agent, "Version") < strripos($u_agent, $ub)) { $version = $matches['version'][0]; } else { $version = $matches['version'][1]; } } else { $version = $matches['version'][0]; } // check if we have a number if ($version == null || $version == "") { $version = "?"; } $browserDet = $ub . " " . $version; return $browserDet; } function getCountry($ip_address) { $geopluginURL = 'http://www.geoplugin.net/php.gp?ip=' . $ip_address; $addrDetailsArr = unserialize(file_get_contents($geopluginURL)); /* Get City name by return array */ $city = $addrDetailsArr['geoplugin_city']; /* Get Country name by return array */ $country = $addrDetailsArr['geoplugin_countryName']; /* Comment out these line to see all the posible details */ /* echo '<pre>'; print_r($addrDetailsArr); die(); */ if (!$city) { $city = 'None'; } if (!$country) { $country = 'None'; } $res['city'] = $city; $res['country'] = $country; return $res; } function ip_info($ip = NULL, $purpose = "location", $deep_detect = TRUE) { $output = NULL; if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) { $ip = $_SERVER["REMOTE_ADDR"]; if ($deep_detect) { if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) $ip = $_SERVER['HTTP_CLIENT_IP']; } } $purpose = str_replace(array("name", "\n", "\t", " ", "-", "_"), NULL, strtolower(trim($purpose))); $support = array("country", "countrycode", "state", "region", "city", "location", "address"); $continents = array( "AF" => "Africa", "AN" => "Antarctica", "AS" => "Asia", "EU" => "Europe", "OC" => "Australia (Oceania)", "NA" => "North America", "SA" => "South America" ); if (filter_var($ip, FILTER_VALIDATE_IP) && in_array($purpose, $support)) { $ipdat = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip)); if (@strlen(trim($ipdat->geoplugin_countryCode)) == 2) { switch ($purpose) { case "location": $output = array( "city" => @$ipdat->geoplugin_city, "state" => @$ipdat->geoplugin_regionName, "country" => @$ipdat->geoplugin_countryName, "country_code" => @$ipdat->geoplugin_countryCode, "continent" => @$continents[strtoupper($ipdat->geoplugin_continentCode)], "continent_code" => @$ipdat->geoplugin_continentCode ); break; case "address": $address = array($ipdat->geoplugin_countryName); if (@strlen($ipdat->geoplugin_regionName) >= 1) $address[] = $ipdat->geoplugin_regionName; if (@strlen($ipdat->geoplugin_city) >= 1) $address[] = $ipdat->geoplugin_city; $output = implode(", ", array_reverse($address)); break; case "city": $output = @$ipdat->geoplugin_city; break; case "state": $output = @$ipdat->geoplugin_regionName; break; case "region": $output = @$ipdat->geoplugin_regionName; break; case "country": $output = @$ipdat->geoplugin_countryName; break; case "countrycode": $output = @$ipdat->geoplugin_countryCode; break; } } } return $output; } public function get_admin_edd_default($page_name, $admin_cid) { $role_id = $this->get_role_id_detail($page_name); $admin_detail = $this->get_admin_detail($admin_cid); $admin_role_edd_detail = $this->get_admin_role_edd_detail($admin_cid, $role_id); //print_r($admin_role_edd_detail); $role_edd_saved = json_decode($admin_role_edd_detail[0]['role_edds']); //print_r($role_edd_saved); if ($role_edd_saved) { $edds = $role_edd_saved; } else { $edds = json_decode($admin_detail['edds']); } // print_r($edds); return $edds; } function curPageName() { return substr($_SERVER["SCRIPT_NAME"], strrpos($_SERVER["SCRIPT_NAME"], "/") + 1); } public function get_admin_role_edd_detail($admin_id, $role_id) { $sql = "SELECT * FROM `admin_roles_edds` WHERE `role_id` IN ($role_id) AND `admin_id`='$admin_id'"; $result = mysqli_query($this->conn, $sql); // $res = mysqli_fetch_assoc($result); // return $res; while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_admins_by_role($role_id) { $sql = "SELECT * FROM `admin_roles_edds` WHERE `role_id` IN ($role_id)"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_admin_by_role_edd_detail($edd_id, $role_id) { // echo $edd_id.$role_id; $admin_details = $this->get_admins_by_role($role_id); // print_r($admin_details); $arr_admin = array_column($admin_details, "admin_id"); $List_admin_id = implode(",", $arr_admin); $avail_admin_details = $this->get_admin_detail_used_in_search_edd($List_admin_id, $edd_id); // print_r($avail_admin_details); return $avail_admin_details; } function get_role_id_detail($page_name) { // echo $page_name; if (strstr($page_name, 'aao') || strstr($page_name, 'bulk_wages') || strstr($page_name, 'check')) { $role_id = '7'; } else if (strstr($page_name, 'incharge') || strstr($page_name, 'sideincharge') || strstr($page_name, 'approve')) { $role_id = '13'; } else if (strstr($page_name, 'cashier')) { $role_id = '13'; } else if (strstr($page_name, 'authority') || strstr($page_name, 'signing')) { $role_id = '6'; } // echo $role_id; return $role_id; } public function get_admin_attendence_detail($a_id) { $sql = "SELECT * FROM `admin_attendence` WHERE `a_id`='$a_id'"; $result = mysqli_query($this->conn, $sql); // $res = mysqli_fetch_assoc($result); // return $res; while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_admin_attendence_detail_by_date($emp_id, $date) { $sql = "SELECT * FROM `admin_attendence` WHERE `date`='$date' AND `emp_id`='$emp_id' AND `log_type`='LOGIN'"; $result = mysqli_query($this->conn, $sql); $res = mysqli_fetch_assoc($result); return $res; } public function get_admin_logout_detail($a_id) { $sql = "SELECT * FROM `admin_logouts` WHERE `a_id`='$a_id'"; $result = mysqli_query($this->conn, $sql); // $res = mysqli_fetch_assoc($result); // return $res; while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_api_bank_detail() { $sql = "SELECT * FROM `api_bank_details` WHERE `status`='1'"; $result = mysqli_query($this->conn, $sql); // $res = mysqli_fetch_assoc($result); // return $res; while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function no_of_months($date1, $date2) { $ts1 = strtotime($date1); $ts2 = strtotime($date2); $year1 = date('Y', $ts1); $year2 = date('Y', $ts2); $month1 = date('m', $ts1); $month2 = date('m', $ts2); $no_of_month = (($year2 - $year1) * 12) + ($month2 - $month1); $no_of_month = $no_of_month + 1; return $no_of_month; } public function redirect($url, $permanent = false) { if (headers_sent() === false) { header('Location: ' . $url, true, ($permanent === true) ? 301 : 302); } exit(); } public function getPrevDemandQty($cat_id, $edc_id, $edd_id, $am_id, $prev_month_year, $org_id) { $sq = "SELECT * FROM employee_acc_wages WHERE exit_status!='YES' AND list_status='APPROVED' AND s_engineer='$edc_id' AND `ex_engineer`='$edd_id' AND `month_year`='$prev_month_year' AND `company_id`='$org_id' AND `skilled`='$cat_id' AND `ag_id`='$am_id'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_assoc($result); $count = count($row); return $count; } function getTotalDemandQty($cat_id, $work_type, $edd_id, $am_id, $electry = '', $month_year, $org_id) { $query = "SELECT SUM(wages_qty) AS ttlqty FROM wagesqty WHERE 1"; if ($am_id != '' && $am_id != NULL) { $query .= " AND `am_id`='" . strip_tags($am_id) . "'"; } if ($electry != '' && $electry != NULL) { $query .= " AND `ez_id`='" . strip_tags($electry) . "'"; } // $query .= " AND `ex_id`='$edd_id' AND `month_year`='$month_year' AND `org_id`='$org_id' AND `cat_id`='$cat_id' AND `post_id`IN ('$work_type') AND `am_id`='$am_id'"; $query .= " AND `ex_id`='$edd_id' AND `month_year`='$month_year' AND `cat_id`='$cat_id'"; //echo $query; $result = mysqli_query($this->conn, $query); $row = mysqli_fetch_assoc($result); if ($row['ttlqty'] != NULL) { $ttlqty = $row['ttlqty']; } else { $ttlqty = 0; } return $ttlqty; } function getPresenQty($cat_id, $post_id, $edd_id, $am_id, $ez_id, $month_year, $org_id, $edd_name, $electry = '') { // echo $month_year; $prev_month = date('m', strtotime("$month_year-01")); $prev_year = date('Y', strtotime("$month_year-01")); $query = "SELECT * FROM employee_acc_wages WHERE exit_status!='yes' AND list_status IN ('approved') AND `wages_month`='$prev_month' AND `wages_year`='$prev_year'"; if ($am_id != '' && $am_id != NULL) { $query .= " AND `ag_id`='" . strip_tags($am_id) . "'"; } if ($electry != '' && $electry != NULL) { $query .= " AND electrycity_zone='" . strip_tags($electry) . "'"; } // $query .= " AND work_type='" . $post_id . "' AND skilled='" . $cat_id . "' AND ex_engineer='" . $edd_name . "' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; $query .= " AND skilled='" . $cat_id . "' AND ex_engineer='$edd_name' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; //echo $query; $result = $this->select_custom_query($query); $NumRows = count($result); return $NumRows; } // function getPresenQtyOld($cat_id, $work_type, $edd_id, $am_id, $electry = '', $org_id, $month_year) { // $query = "SELECT * FROM employee_acc_wages WHERE 1"; // if ($electry != '' && $electry != NULL) { // $query .= " AND electrycity_zone='" . strip_tags($electry) . "'"; // } // $query .= " AND skilled='$cat_id' AND work_type IN ('$work_type') AND ex_engineer='$edd_id' AND month_year='$month_year' AND company_id='$org_id' AND `ag_id`='$am_id' AND list_status IN ('APPROVED') AND exit_status!='YES' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; ////echo $query; // $stmt = $db->prepare($query); // $stmt->execute(); // $NumRows = $stmt->rowCount(); // return $NumRows; // } //fetch employee SUPPLIED QTY month status function getEmpSupplidQty($cat_id, $post_id, $edd_id, $am_id, $ez_id, $month_year, $org_id, $edd_name, $electry = '') { // echo $month_year; $prev_month = date('m', strtotime("$month_year-01")); $prev_year = date('Y', strtotime("$month_year-01")); $query = "SELECT * FROM employee_acc_wages WHERE exit_status!='yes' AND list_status NOT IN ('rejected') AND `wages_month`='$prev_month' AND `wages_year`='$prev_year'"; if ($am_id != '' && $am_id != NULL) { $query .= " AND `ag_id`='" . strip_tags($am_id) . "'"; } if ($electry != '' && $electry != NULL) { $query .= " AND electrycity_zone='" . strip_tags($electry) . "'"; } // $query .= " AND work_type='" . $post_id . "' AND skilled='" . $cat_id . "' AND ex_engineer='" . $edd_name . "' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; $query .= " AND skilled='" . $cat_id . "' AND ex_engineer='$edd_name' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; //echo $query; $result = $this->select_custom_query($query); $NumRows = count($result); return $NumRows; } function getEmpSupplidQty_wages($cat_id, $post_id, $edd_id, $am_id, $ez_id, $month_year, $org_id, $edd_name, $electry = '') { // echo $month_year; $prev_month = date('m', strtotime("$month_year-01")); $prev_year = date('Y', strtotime("$month_year-01")); $query = "SELECT e.*, p_id,post_name as work_type,cat_id,categoery_name as skilled,font_color,bg_color,short_post_name FROM `salary_table_combined` e LEFT JOIN posts ON posts.post_name=e.emp_work_type LEFT JOIN categoery ON categoery.categoery_name=e.emp_category WHERE salary_checked='yes' AND sal_month='$prev_month' AND sal_year='$prev_year'"; if ($am_id != '' && $am_id != NULL) { $query .= " AND `sal_ag_id`='" . strip_tags($am_id) . "'"; } if ($electry != '' && $electry != NULL) { $query .= " AND sal_substation='" . strip_tags($electry) . "'"; } // $query .= " AND p_id='" . $post_id . "' AND cat_id='" . $cat_id . "' AND sal_edd='" . $edd_name . "' ORDER BY `sal_substation` ASC,post_name ASC,categoery_no ASC"; $query .= " AND cat_id='" . $cat_id . "' AND sal_edd='$edd_name' GROUP BY emp_id ORDER BY `sal_substation` ASC,post_name ASC,categoery_no ASC"; // echo $query; $result = $this->select_custom_query($query); $NumRows = count($result); return $NumRows; } //fetch employee SUPPLIED QTY month status function getEmpSupplidQty_transfer($cat_id, $post_id, $edd_id, $am_id, $ez_id, $month_year, $org_id, $edd_name, $electry = '') { // echo $month_year; $prev_month = date('m', strtotime("$month_year-01")); $prev_year = date('Y', strtotime("$month_year-01")); $query = "SELECT * FROM employee_acc_wages WHERE exit_status!='yes' AND list_status NOT IN ('rejected') AND `wages_month`='$prev_month' AND `wages_year`='$prev_year'"; if ($am_id != '' && $am_id != NULL) { $query .= " AND `ag_id`='" . strip_tags($am_id) . "'"; } if ($electry != '' && $electry != NULL) { $query .= " AND electrycity_zone='" . strip_tags($electry) . "'"; } // $query .= " AND work_type='" . $post_id . "' AND skilled='" . $cat_id . "' AND ex_engineer='" . $edd_name . "' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; $query .= " AND skilled='" . $cat_id . "' AND ex_engineer='$edd_name' GROUP BY cid ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; //echo $query; $result = $this->select_custom_query($query); $NumRows = count($result); return $NumRows; } function getEmpSupplidQty_transfer_prev($cat_id, $post_id, $edd_id, $am_id, $ez_id, $month_year, $org_id, $edd_name, $electry = '') { // echo $month_year; $prev_month = date('m', strtotime("$month_year-01")); $prev_year = date('Y', strtotime("$month_year-01")); $query = "SELECT * FROM employee_acc_wages WHERE exit_status!='yes' AND application_status NOT IN ('transfer') AND list_status NOT IN ('rejected') AND `wages_month`='$prev_month' AND `wages_year`='$prev_year'"; if ($am_id != '' && $am_id != NULL) { $query .= " AND `ag_id`='" . strip_tags($am_id) . "'"; } if ($electry != '' && $electry != NULL) { $query .= " AND electrycity_zone='" . strip_tags($electry) . "'"; } // $query .= " AND work_type='" . $post_id . "' AND skilled='" . $cat_id . "' AND ex_engineer='" . $edd_name . "' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; $query .= " AND skilled='" . $cat_id . "' AND ex_engineer='$edd_name' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; //echo $query; $result = $this->select_custom_query($query); $NumRows = count($result); $query_trans = "SELECT * FROM employee_acc_wages WHERE exit_status!='yes' AND application_status IN ('transfer') AND list_status NOT IN ('rejected') AND `wages_month`='$prev_month' AND `wages_year`='$prev_year'"; if ($electry != '' && $electry != NULL) { $query_trans .= " AND electrycity_zone='" . strip_tags($electry) . "'"; } // $query_trans .= " AND work_type='" . $post_id . "' AND skilled='" . $cat_id . "' AND ex_engineer='" . $edd_name . "' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; $query_trans .= " AND skilled='" . $cat_id . "' AND ex_engineer='$edd_name' GROUP BY cid ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; //echo $query_trans; $result_trans = $this->select_custom_query($query_trans); $NumRows_trans = 0; foreach ($result_trans as $row_d) { $emp_id = $row_d["cid"]; $application_status = $row_d["application_status"]; $trans_edd_emp = "SELECT * FROM `terminated_employee` te INNER JOIN `employee_transferred` et ON et.t_id=te.t_id WHERE te.`emp_id`='$emp_id' AND et.`trans_month_year`='$month_year' AND `process_status` NOT IN ('rejected') AND `process_type`='$application_status' ORDER BY `terminated_date` DESC, `trans_id` DESC LIMIT 1"; $res_trans_edd_emp = $this->select_custom_query($trans_edd_emp); $trans_count_edd_emp = count($res_trans_edd_emp); if ($res_trans_edd_emp['edd_name'] == $res_trans_edd_emp['edd_name_prev']) { } else { $NumRows_trans++; } } $NumRows_total = ($NumRows + $NumRows_trans); return $NumRows_total; } //fetch employee AGREEMENT QTY month status function getAgmtQty($cat_id, $post_id, $edd_id, $am_id, $ez_id, $month_year, $org_id, $edd_name, $electry = '') { // $query = "SELECT SUM(emp_qty) AS emp_qty FROM tbl_agmt_empqty WHERE edd_id='" . $edd_id . "' AND am_id='" . $am_id . "' AND post_id='" . $post_id . "' AND cat_id='" . $cat_id . "' AND overtime_applicable='NO' AND month_year='" . $month_year . "'"; $query = "SELECT SUM(emp_qty) AS emp_qty FROM tbl_agmt_empqty WHERE edd_id='" . $edd_id . "' AND am_id='" . $am_id . "' AND cat_id='" . $cat_id . "' AND overtime_applicable='NO' AND month_year='" . $month_year . "'"; // echo $query; $empQtyData = $this->select_custom_query($query); if ($empQtyData[0]['emp_qty'] != NULL) { $total_emp_quantity = $empQtyData[0]['emp_qty']; } else { $total_emp_quantity = 0; } return $total_emp_quantity; } function getbillQty_saved($cat_id, $post_id, $edd_id, $am_id, $ez_id, $month_year, $org_id, $edd_name, $electry = '', $bill_id) { // $query = "SELECT SUM(emp_qty) AS emp_qty FROM tbl_agmt_empqty WHERE edd_id='" . $edd_id . "' AND am_id='" . $am_id . "' AND post_id='" . $post_id . "' AND cat_id='" . $cat_id . "' AND overtime_applicable='NO' AND month_year='" . $month_year . "'"; // $query = "SELECT SUM(emp_qty) AS emp_qty FROM tbl_agmt_empqty WHERE edd_id='" . $edd_id . "' AND am_id='" . $am_id . "' AND cat_id='" . $cat_id . "' AND overtime_applicable='NO' AND month_year='" . $month_year . "'"; // $query = "SELECT SUM(`emp_quantity`) as emp_qty FROM `tbl_invoice_billing_voucher_det` WHERE `voucher_id`='$bill_id' AND work_type='" . $post_id . "' AND skilled='" . $cat_id . "'"; $query = "SELECT SUM(`emp_quantity`) as emp_qty FROM `tbl_invoice_billing_voucher_det` WHERE `voucher_id`='$bill_id' AND skilled='" . $cat_id . "'"; // echo $query; $empQtyData = $this->select_custom_query($query); if ($empQtyData[0]['emp_qty'] != NULL) { $total_emp_quantity = $empQtyData[0]['emp_qty']; } else { $total_emp_quantity = 0; } return $total_emp_quantity; } function getTotalDemandQtyWorkPlaceWise($cat_id, $post_id, $edd_id, $ez_id, $am_id, $month_year, $org_id, $edd_name, $electry = '') { $query = "SELECT SUM(wages_qty) AS ttlqty FROM wagesqty WHERE 1"; if ($am_id != '' && $am_id != NULL) { $query .= " AND `am_id`='" . strip_tags($am_id) . "'"; } if ($electry != '' && $electry != NULL) { $query .= " AND ez_id='" . strip_tags($ez_id) . "'"; } // $query .= " AND `ex_id`='$edd_id' AND `month_year`='$month_year' AND `org_id`='$org_id' AND `cat_id`='$cat_id' AND `post_id`IN ('$work_type') AND `am_id`='$am_id'"; $query .= " AND `ex_id`='$edd_id' AND `month_year`='$month_year' AND `cat_id`='$cat_id'"; //echo $query; $result = mysqli_query($this->conn, $query); $row = mysqli_fetch_assoc($result); if ($row['ttlqty'] != NULL) { $ttlqty = $row['ttlqty']; } else { $ttlqty = 0; } return $ttlqty; } //fetch employee SUPPLIED QTY month status function getEmpSupplidQtyWorkPlaceWise($cat_id, $post_id, $edd_id, $ez_id, $am_id, $month_year, $org_id, $edd_name, $electry = '') { $prev_month = date('m', strtotime("$month_year-01")); $prev_year = date('Y', strtotime("$month_year-01")); $query = "SELECT * FROM employee_acc_wages WHERE exit_status!='yes' AND list_status NOT IN ('rejected') AND `wages_month`='$prev_month' AND `wages_year`='$prev_year'"; if ($am_id != '' && $am_id != NULL) { $query .= " AND `ag_id`='" . strip_tags($am_id) . "'"; } if ($electry != '' && $electry != NULL) { $query .= " AND electrycity_zone='" . strip_tags($electry) . "'"; } // $query .= " AND work_type='" . $post_id . "' AND skilled='" . $cat_id . "' AND ex_engineer='" . $edd_name . "' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; $query .= " AND skilled='" . $cat_id . "' AND ex_engineer='" . $edd_name . "' ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; //echo $query; $result = $this->select_custom_query($query); $NumRows = count($result); return $NumRows; } function get_employee_wages_amt($am_id, $sengg, $exngg, $month_year, $billing_date) { //fetch agreement details $query_ag = "SELECT under_category,under_worktype FROM tbl_agmt WHERE `am_id`='$am_id'"; $agrDet = $this->select_custom_query($query_ag); $CATArray = explode(",", $agrDet[0]['under_category']); $cat_id = implode("','", $CATArray); $WTArray = explode(",", $agrDet[0]['under_worktype']); $post_id = implode("','", $WTArray); $queryWorkType = "SELECT p_id,post_name,short_post_name FROM posts WHERE p_id IN ('$post_id') ORDER BY post_name ASC"; $WorkTypeArray = $this->select_custom_query($queryWorkType); $ttlSalaryAmt = 0; foreach ($WorkTypeArray as $retWT) { $wt_id = $retWT['p_id']; $queryCategory = "SELECT cat_id,categoery_name,font_color,bg_color FROM categoery WHERE cat_id IN ('$cat_id') ORDER BY categoery_no ASC"; $CategoryArray = $this->select_custom_query($queryCategory); foreach ($CategoryArray as $retCat) { $catID = $retCat['cat_id']; $sqlDA = "SELECT grand_total_monthly FROM `tbl_agmt_da` WHERE super_id='" . $sengg . "' AND am_id='" . $am_id . "' AND post_id='" . $wt_id . "' AND cat_id='" . $catID . "' AND da_effective_date<'$billing_date' ORDER BY da_effective_date DESC, created_at DESC"; //die; $DADet = $this->select_custom_query($sqlDA); //fetch employee qty basic da wise $empQtyBasicDaSql = "SELECT SUM(emp_qty) AS emp_qty FROM tbl_agmt_empqty WHERE super_id='" . $sengg . "' AND am_id='" . $am_id . "' AND post_id='" . $wt_id . "' AND cat_id='" . $catID . "' AND overtime_applicable='NO' AND month_year='" . $month_year . "'"; $empQtyData = $this->select_custom_query($empQtyBasicDaSql); if ($empQtyData[0]['emp_qty'] != NULL) { $total_emp_quantity = $empQtyData[0]['emp_qty']; } else { $total_emp_quantity = 0; } $grand_total_amt = ($DADet[0]['grand_total_monthly'] * $total_emp_quantity); $ttlSalaryAmt = ($ttlSalaryAmt + $grand_total_amt); } } return $ttlSalaryAmt; } ////manoj work start here public function msg_redirect($msg, $url, $seconds) { echo "<meta http-equiv=\"Refresh\" content=\"$seconds; URL=$url\">\n"; } //fetch leave category Name public function get_leave_cat_name($leave_cat_id) { $row = mysqli_fetch_array(mysqli_query($this->conn, "SELECT leave_cat_name FROM mstr_leave_cat WHERE leave_cat_id='" . intval($leave_cat_id) . "'")); return $row['leave_cat_name']; } //get_consumed_leave public function get_consumed_leave($emp_id, $lt_id, $fID) { // $sq = "SELECT SUM(c.ttl_consumed) AS ttl_consumed FROM tbl_leave_consumed c LEFT JOIN tbl_leave_apply a ON a.id=c.apply_id WHERE a.emp_id='" . $emp_id . "' AND c.lt_id='" . $lt_id . "' AND a.f_id='" . $fID . "' AND a.is_status!='Rejected'"; $sq = "SELECT SUM(a.leave_days) AS ttl_consumed FROM tbl_leave_apply a LEFT JOIN terminated_employee te ON te.t_id=a.t_id WHERE a.emp_id='" . $emp_id . "' AND a.leave_type_id='" . $lt_id . "' AND a.f_id='" . $fID . "' AND te.process_status!='rejected'"; //echo $sq; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); if ($row['ttl_consumed'] != NULL) { $consumedLeave = $row['ttl_consumed']; } else { $consumedLeave = 0; } return $consumedLeave; } //get all get_leave_type_name public function get_leave_type_name($lt_id) { $sq = "SELECT leave_type FROM `mstr_leave_type` WHERE lt_id='" . $lt_id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['leave_type']; } public function get_leave_type_name_language($lt_id, $hindi) { $sq = "SELECT leave_type$hindi as leave_type FROM `mstr_leave_type` WHERE lt_id='" . $lt_id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['leave_type']; } //get get_reject_reason_name public function get_reject_reason_name($mlrr_id) { $sq = "SELECT reject_reason FROM `mstr_leave_reject_reasons` WHERE mlrr_id='" . $mlrr_id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['reject_reason']; } //get get_user_name public function get_user_name($id) { $sq = "SELECT name FROM `sub_admin` WHERE id='" . $id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['name']; } function getTimeDiff($dtime, $atime) { $nextDay = $dtime > $atime ? 1 : 0; $dep = explode(':', $dtime); $arr = explode(':', $atime); $diff = abs(mktime($dep[0], $dep[1], 0, date('n'), date('j'), date('y')) - mktime($arr[0], $arr[1], 0, date('n'), date('j') + $nextDay, date('y'))); $hours = floor($diff / (60 * 60)); $mins = floor(($diff - ($hours * 60 * 60)) / (60)); $secs = floor(($diff - (($hours * 60 * 60) + ($mins * 60)))); if (strlen($hours) < 2) { $hours = "0" . $hours; } if (strlen($mins) < 2) { $mins = "0" . $mins; } if (strlen($secs) < 2) { $secs = "0" . $secs; } // return $hours . ':' . $mins . ':' . $secs; return $hours . ':' . $mins; } public function get_date_diff($sDate1, $sDate2, $sUnit = 'D') { //subtract $sDate2-$sDate1 and return the difference in $sUnit (Days,Hours,Minutes,Seconds) $nInterval = strtotime($sDate2) - strtotime($sDate1); if ($sUnit == 'D') { // days $nInterval = $nInterval / 60 / 60 / 24; } else if ($sUnit == 'H') { // hours $nInterval = $nInterval / 60 / 60; } else if ($sUnit == 'M') { // minutes $nInterval = $nInterval / 60; } else if ($sUnit == 'S') { // seconds } return $nInterval; } public function get_hour_from_time($sDate1, $sDate2, $sUnit = 'D') { $time1 = strtotime($sDate1); $time2 = strtotime($sDate2); $difference = round(abs($time2 - $time1) / 3600, 2); return $difference; } public function get_days_of_each_month_not_working($from_date, $to_date) { // echo$from_date; // echo$to_date; //$from_date = "2017-02-25"; //$to_date = "2017-04-03"; $start = $month = strtotime($from_date); $tmp = cal_days_in_month(CAL_GREGORIAN, date('m', strtotime($to_date)), date('Y', strtotime($to_date))); $end = strtotime(date('Y-m', strtotime($to_date)) . '-' . $tmp); $month_days = array(); while ($month < $end) { $days = cal_days_in_month(CAL_GREGORIAN, date('m', $month), date('Y', $month)); if (date('m', $start) == date('m', $month)) { $days = $days - date('d', $start) + 1; } else if (date('m', $end) == date('m', $month)) { $days = date('d', strtotime($to_date)); } // $days=sprintf('%02d', $days); $days = intval($days); $month_days[date('m-Y', $month)] = $days; echo "Days :" . $days . " Month :" . date('F', $month); // echo '<br>'; $month = strtotime("+1 month", $month); } print_r($month_days); return $month_days; } public function get_days_of_each_month($from_date, $to_date) { // echo $from_date; // echo $to_date; // $from_date = "2017-02-25"; // $to_date = "2017-04-03"; $start_date = new DateTime($from_date); // $start_date=$start_date->modify('+1 day'); $end_date = new DateTime($to_date); $end_date = $end_date->modify('+1 day'); $interval = new DateInterval('P1D'); $daterange = new DatePeriod($start_date, $interval, $end_date); $month_days = array(); foreach ($daterange as $date) { $date_month = $date->format('m'); $month_days[$date_month][] = $date->format('Y/m/d'); } // print_r($month_days); $result = array(); $month_days_arr = array(); foreach ($month_days as $days) { $begin = reset($days); $end = end($days); $result[$begin . '-' . $end] = count($days); $new_date = new DateTime($begin); $month_days_arr[$new_date->format('m-Y')] = count($days); } // print_r($result); // print_r($month_days_arr); return $month_days_arr; } public function dateRange($from, $to) { return array_map(function ($arg) { return date('Y-m-d', $arg); }, range(strtotime($from), strtotime($to), 86400)); } //No of DAY bw two dates or month public function no_countDays($startDate, $endDate, $day_nameNo) { // Convert string dates to DateTime objects $start = new DateTime($startDate); $end = new DateTime($endDate); // Make sure the end date is inclusive $end->modify('+1 day'); $count = 0; // Loop through each day in the date range while ($start < $end) { if ($start->format('N') == $day_nameNo) { // 'N' returns 1 for Monday $count++; } // Move to the next day $start->modify('+1 day'); } return $count; } //get first leave day Date from effective date public function get_first_leave_day_date($effective_date, $day_name) { // Convert the given date to a DateTime object $datetime = new DateTime($effective_date); // Modify the date to the first day name after the given date // $datetime->modify('next ' . $day_name); //after current first day name // $datetime->modify('this ' . $day_name); //including current first day name $datetime->modify('last ' . $day_name); //including previous first day name // Output the result $date = $datetime->format('Y-m-d'); return $date; } //get_employee_type public function get_employee_type($emp_id) { $sq = "SELECT outsource_emp FROM `parents_details` WHERE emp_id='" . $emp_id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); if ($row['outsource_emp'] != NULL && $row['outsource_emp'] != '') { $employee_type = $row['outsource_emp']; } else { $employee_type = 'NO'; } return $employee_type; } //get_employee_leave_allotment public function get_leave_allotment_ez($emp_id, $fID, $ez_id, $emp_cat_id) { $outsource_emp = user::get_employee_type($emp_id); // echo $sq = "SELECT la.lt_id, lt.leave_type, lt.leave_type_hindi, lt.applicable_for, lt.advance_restriction, lt.advance_day, lt.date_restriction, lt.day_from, lt.day_to, la.ttl_leave, la.f_id, la.emp_cat, la.apply_type, la.max_leave_allowed FROM employee emp INNER JOIN leave_allotment la ON la.emp_cat=emp.skilled LEFT JOIN mstr_leave_type lt ON lt.lt_id=la.lt_id WHERE emp.cid='" . $emp_id . "' AND la.f_id='" . $fID . "' AND FIND_IN_SET('" . $outsource_emp . "', lt.applicable_for) ORDER BY la.lt_id ASC"; $sq = "SELECT la.lt_id, lt.leave_type, lt.leave_type_hindi, lt.applicable_for, lt.advance_restriction, lt.advance_day, lt.date_restriction, lt.day_from, lt.day_to, la.ttl_leave, la.f_id, la.emp_cat, la.apply_type, la.max_leave_allowed FROM leave_allotment la LEFT JOIN mstr_leave_type lt ON lt.lt_id=la.lt_id WHERE la.f_id='" . $fID . "' AND FIND_IN_SET('" . $outsource_emp . "', lt.applicable_for) AND ez_id='$ez_id' AND emp_cat='$emp_cat_id' ORDER BY la.lt_id ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //get_employee_leave_allotment public function get_employee_leave_allotment($emp_id, $fID) { $outsource_emp = user::get_employee_type($emp_id); $sq = "SELECT la.lt_id, lt.leave_type, lt.leave_type_hindi, lt.applicable_for, lt.advance_restriction, lt.advance_day, lt.date_restriction, lt.day_from, lt.day_to, la.ttl_leave, la.f_id, la.emp_cat, la.apply_type, la.max_leave_allowed FROM employee emp INNER JOIN leave_allotment la ON la.emp_cat=emp.skilled LEFT JOIN mstr_leave_type lt ON lt.lt_id=la.lt_id WHERE emp.cid='" . $emp_id . "' AND la.f_id='" . $fID . "' AND FIND_IN_SET('" . $outsource_emp . "', lt.applicable_for) ORDER BY la.lt_id ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //get_employee_leave_allotment from profile public function get_employee_leave_allotment_profile($emp_id, $fID, $visible_for = '') { $outsource_emp = user::get_employee_type($emp_id); $visible_for_cnd = ""; if ($visible_for) { $visible_for_cnd = " AND FIND_IN_SET('$visible_for', lt.visible_for) "; } $sq = "SELECT la.lt_id, lt.leave_type, lt.leave_type_hindi, lt.applicable_for, lt.advance_restriction, lt.advance_day, lt.date_restriction, lt.day_from, lt.day_to, la.ttl_leave, la.f_id, la.emp_cat, la.apply_type, la.max_leave_allowed FROM employee emp INNER JOIN leave_allotment_emp la ON la.emp_id=emp.cid LEFT JOIN mstr_leave_type lt ON lt.lt_id=la.lt_id WHERE la.leave_applicable='YES' AND emp.cid='" . $emp_id . "' AND la.f_id='" . $fID . "' AND FIND_IN_SET('" . $outsource_emp . "', lt.applicable_for) $visible_for_cnd ORDER BY la.lt_id ASC"; $result = mysqli_query($this->conn, $sq); $count = mysqli_num_rows($result); if ($count > 0) { while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } } else { $emp_result = $this->employee_details($emp_id); $emp_details = mysqli_fetch_assoc($emp_result); $emp_cat_id = $emp_details['skilled']; $ez_id = $this->get_employee_working_place($emp_id, 'ez_id'); $row1 = $this->get_leave_allotment_ez($emp_id, $fID, $ez_id, $emp_cat_id); } return $row1; } //get_employee_leave_allotment from profile public function get_employee_leave_allotment_profile_status($emp_id, $visible_for = '') { $outsource_emp = user::get_employee_type($emp_id); $visible_for_cnd = ""; if ($visible_for) { $visible_for_cnd = " AND FIND_IN_SET('$visible_for', lt.visible_for) "; } $sq = "SELECT emp_id,la.lt_id, lt.leave_type, lt.leave_type_hindi, lt.applicable_for, lt.advance_restriction, lt.advance_day, lt.date_restriction, lt.day_from, lt.day_to, la.ttl_leave, la.f_id, la.emp_cat, la.apply_type, la.max_leave_allowed FROM employee emp INNER JOIN leave_allotment_emp la ON la.emp_id=emp.cid LEFT JOIN mstr_leave_type lt ON lt.lt_id=la.lt_id WHERE la.leave_applicable='YES' AND emp.cid='" . $emp_id . "' AND FIND_IN_SET('" . $outsource_emp . "', lt.applicable_for) $visible_for_cnd ORDER BY la.lt_id ASC"; $result = mysqli_query($this->conn, $sq); $count = mysqli_num_rows($result); if ($count > 0) { while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } } else { $emp_result = $this->employee_details($emp_id); $emp_details = mysqli_fetch_assoc($emp_result); $emp_cat_id = $emp_details['skilled']; $todayDate = date("Y-m-d"); $ez_id = $this->get_employee_working_place($emp_id, 'ez_id'); $get_current_financial_year = $this->get_current_financial_year($emp_details['company_id'], $todayDate); $fID = $get_current_financial_year; $row1 = $this->get_leave_allotment_ez($emp_id, $fID, $ez_id, $emp_cat_id); } return $row1; } // Get leave effective public function get_leave_effective_after($emp_id, $leave_type_id) { $outsource_emp = user::get_employee_type($emp_id); $sq = "SELECT * FROM `mstr_leave_effective_after` WHERE lea_status IN ('Active') AND leave_type_id='$leave_type_id' AND FIND_IN_SET('" . $outsource_emp . "', applicable_for) ORDER BY lea_id DESC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get letter types public function select_letter_types($status) { if ($status == 'ALL') { $sq = "SELECT * FROM `mstr_letter_type` WHERE 1 ORDER BY letter_type_name ASC"; } else { $sq = "SELECT * FROM `mstr_letter_type` WHERE letter_type_status='$status' ORDER BY letter_type_name ASC"; } // echo $sq; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get letter templates public function select_letter_templates($status) { if ($status == 'ALL') { $sq = "SELECT * FROM `tbl_letter_template` WHERE 1 ORDER BY letter_template_name ASC"; } else { $sq = "SELECT * FROM `tbl_letter_template` WHERE temp_status='$status' ORDER BY letter_template_name ASC"; } // echo $sq; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get letter templates public function select_letter_mode($status) { if ($status == 'ALL') { $sq = "SELECT * FROM `mstr_letter_mode` WHERE 1 ORDER BY display_no ASC"; } else { $sq = "SELECT * FROM `mstr_letter_mode` WHERE status='$status' ORDER BY display_no ASC"; } // echo $sq; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function list_employee_all() { $sq3 = "SELECT `employee`.*,p_id,post_name,short_post_name,post_name as work_type,cat_id,categoery_name,categoery_name as skilled,font_color,bg_color,post_name_hindi,categoery_name_hindi FROM `employee` LEFT JOIN posts ON posts.p_id=`employee`.work_type LEFT JOIN categoery ON categoery.cat_id=`employee`.skilled WHERE application_status NOT IN ('emergency','old_emergency','unaccepted') ORDER BY electrycity_zone asc,employee.skilled desc"; $result = mysqli_query($this->conn, $sq3); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function check_login() { if (!isset($_SESSION['login'])) { // mysqli_query($this->conn, "UPDATE login_details SET logout_at=now(),login_status='0' where login_detail_id='" . $_SESSION['ld_id'] . "'"); session_destroy(); $_SESSION['action'] = "Please login again!"; header("Location: ../index.php"); echo "<script>location.href='../login.php';</script>"; exit(); } } //Fetch Record For total function get_total_ravangee_records($table_name, $id_name, $id_val) { if ($id_val == 'all') { $query = "SELECT * FROM `$table_name` WHERE 1 GROUP BY t_id"; } else { $query = "SELECT * FROM `$table_name` WHERE $id_name='" . $id_val . "' GROUP BY t_id"; } // echo $query; $qu_res = mysqli_query($this->conn, $query); $countRows = mysqli_num_rows($qu_res); return $countRows; } //Fetch Record For total function get_total_records_by_process_type($table_name, $id_name, $id_val, $process_type) { if ($id_val == 'all') { $query = "SELECT * FROM `$table_name` WHERE process_type='$process_type'"; } else { $query = "SELECT * FROM `$table_name` WHERE process_type='$process_type' AND $id_name='" . $id_val . "'"; } // echo$query; $qu_res = mysqli_query($this->conn, $query); $countRows = mysqli_num_rows($qu_res); return $countRows; } //Fetch Record For total function get_total_pending_process($table_name, $days, $process_type) { if ($process_type == 'letter') { $process_status = "'rejected','dispatched'"; } else { $process_status = "'rejected','approved'"; } $query = "SELECT * FROM `$table_name` WHERE `process_type`='$process_type' AND `process_status` NOT IN ($process_status) AND `terminated_date` <= DATE_ADD(CURDATE(), INTERVAL $days DAY)"; $qu_res = mysqli_query($this->conn, $query); $countRows = mysqli_num_rows($qu_res); return $countRows; } //Fetch Record For total pending reminder function get_total_pending_reminder($table_name, $days, $process_type, $return_type) { if ($process_type == 'letter') { // $process_status = "'rejected','generate'"; $process_status = "'rejected'"; } else { $process_status = "'rejected'"; } $query = "SELECT * FROM `$table_name` a LEFT JOIN `terminated_employee` te ON te.t_id=a.t_id WHERE te.`process_type`='$process_type' AND te.`process_status` NOT IN ($process_status) AND `letter_reminder`='YES' AND `reminder_date` <= DATE_ADD(CURDATE(), INTERVAL $days DAY)"; $result = mysqli_query($this->conn, $query); $countRows = mysqli_num_rows($result); $countReminderRows = 0; if ($countRows > 0) { while ($row = mysqli_fetch_assoc($result)) { $t_id = $row['t_id']; $query_rem = "SELECT * FROM `terminated_employee` te WHERE te.`status_before_change`='reminder' AND te.`process_type`='$process_type' AND te.`process_status` NOT IN ('rejected') AND `injury_letter_no`='$t_id'"; $result_rem = mysqli_query($this->conn, $query_rem); $countRows_rem = mysqli_num_rows($result_rem); if ($countRows_rem > 0) { } else { $countReminderRows++; $row1[] = $row; $row_t_id[] = $t_id; } } } if ($return_type == 'row_array') { return $row1; } else if ($return_type == 'row_t_id') { return $row_t_id; } else { return $countReminderRows; } } //Fetch Record For total function get_total_employee_onleave($table_name, $date, $process_type) { $query = "SELECT * FROM $table_name a LEFT JOIN terminated_employee te ON te.t_id=a.t_id WHERE `process_type`='$process_type' AND `process_status` NOT IN ('rejected') AND '$date' BETWEEN leave_start_date AND leave_end_date ORDER BY leave_start_date ASC"; $qu_res = mysqli_query($this->conn, $query); $countRows = mysqli_num_rows($qu_res); return $countRows; } public function get_name_from_table($table_name, $search_column_name, $search_column_val, $get_column_name) { $sq = "SELECT $get_column_name as name FROM `$table_name` WHERE `$search_column_name`='" . $search_column_val . "' ORDER BY $get_column_name ASC"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['name']; } public function get_multi_name_from_table($table_name, $search_column_name, $search_column_val, $get_column_name) { $sq = "SELECT GROUP_CONCAT(`$get_column_name`) as name FROM `$table_name` WHERE `$search_column_name` IN ($search_column_val) ORDER BY $get_column_name ASC"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['name']; } public function get_data_by_table_id($table_name, $search_column_name, $search_column_val) { $sql = "SELECT * FROM `$table_name` WHERE `$search_column_name` IN ($search_column_val)"; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } //Fetch Record For total function get_total_records($table_name, $id_name, $id_val) { if ($id_val == 'all') { $query = "SELECT * FROM `$table_name` WHERE 1"; } else { $query = "SELECT * FROM `$table_name` WHERE $id_name='" . $id_val . "'"; } // echo $query; $qu_res = mysqli_query($this->conn, $query); $countRows = mysqli_num_rows($qu_res); return $countRows; } public function shift_name($shift_id, $type) { $sq = "SELECT * FROM `mstr_shift_detail` ms_d LEFT JOIN `mstr_shift_cat` ms_c ON ms_d.shift_cat=ms_c.s_cat_id WHERE shift_status='1' AND shift_id='$shift_id' ORDER BY `s_cat_name` ASC,`shift_name` ASC"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); if ($type == 'with_cat_time') { return $row['shift_name'] . ' [' . $row['s_cat_name'] . '] [' . $row['start_time'] . ' - ' . $row['end_time'] . ']'; } else if ($type == 'with_cat') { return $row['shift_name'] . ' [' . $row['s_cat_name'] . ']'; } else if ($type == 'with_time') { return $row['shift_name'] . ' [' . $row['start_time'] . ' - ' . $row['end_time'] . ']'; } else if ($type == 'only_time') { return ' [' . $row['start_time'] . ' - ' . $row['end_time'] . ']'; } else if ($type == 'start_time') { return $row['start_time']; } else if ($type == 'end_time') { return $row['end_time']; } else if ($type == 'lunch_both_time') { return ' [' . $row['lunch_start_time'] . ' - ' . $row['lunch_end_time'] . ']'; } else if ($type == 'lunch_start_time') { return $row['lunch_start_time']; } else if ($type == 'lunch_end_time') { return $row['lunch_end_time']; } else if ($type == 'lunch_duration') { return $row['lunch_duration']; } else { return $row['shift_name']; } } public function shift_rotation_name($shift_no, $shift_cat, $type) { $sq = "SELECT * FROM `mstr_shift_detail` ms_d LEFT JOIN `mstr_shift_cat` ms_c ON ms_d.shift_cat=ms_c.s_cat_id WHERE shift_status='1' AND shift_rotation_no='$shift_no' AND shift_cat='$shift_cat' ORDER BY `s_cat_name` ASC,`shift_name` ASC"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); if ($type == 'with_cat_time') { return $row['shift_name'] . ' [' . $row['s_cat_name'] . '] [' . $row['start_time'] . ' - ' . $row['end_time'] . ']'; } else if ($type == 'with_cat') { return $row['shift_name'] . ' [' . $row['s_cat_name'] . ']'; } else if ($type == 'with_time') { return $row['shift_name'] . ' [' . $row['start_time'] . ' - ' . $row['end_time'] . ']'; } else if ($type == 'only_time') { return ' [' . $row['start_time'] . ' - ' . $row['end_time'] . ']'; } else if ($type == 'start_time') { return $row['start_time']; } else if ($type == 'end_time') { return $row['end_time']; } else if ($type == 'lunch_both_time') { return ' [' . $row['lunch_start_time'] . ' - ' . $row['lunch_end_time'] . ']'; } else if ($type == 'lunch_start_time') { return $row['lunch_start_time']; } else if ($type == 'lunch_end_time') { return $row['lunch_end_time']; } else if ($type == 'lunch_duration') { return $row['lunch_duration']; } else if ($type == 'shift_id') { return $row['shift_id']; } else { return $row['shift_name']; } } public function get_not_login_dates($emp_id, $last_login_date, $date_to, $leave_day) { $begin = new DateTime($last_login_date); $end = new DateTime($date_to); $array = array(); for ($i = $begin; $i <= $end; $i->modify('+1 day')) { $entry_date = $i->format("Y-m-d"); $wages_month = date('n', strtotime($entry_date)); $wages_year = date('Y', strtotime($entry_date)); $attendence = 'P'; $day_name = strtoupper(date('l', strtotime($entry_date))); $sql_leave_apply = "SELECT * FROM tbl_leave_apply a LEFT JOIN terminated_employee te ON te.t_id=a.t_id WHERE a.`emp_id`='$emp_id' AND process_status NOT IN ('rejected') AND '$entry_date' BETWEEN `leave_start_date` AND `leave_end_date`"; $emp_leave_apply_result = $this->select_custom_query($sql_leave_apply); if (count($emp_leave_apply_result) > 0) { $leave_apply = 'yes'; } else { $leave_apply = ''; } $sql_att_manual_daily = "SELECT * FROM employee_attendence_manual a LEFT JOIN employee e ON e.cid=a.emp_id WHERE a.`emp_id`='$emp_id' AND a.attendence_status NOT IN ('rejected') AND DATE_FORMAT(a.`date`,'%Y-%m-%d') = '$entry_date' ORDER BY `added_date` DESC;"; $res_att_manual_daily_result = $this->select_custom_query($sql_att_manual_daily); if (count($res_att_manual_daily_result) > 0) { $manual_attendence = 'yes'; } else { $manual_attendence = ''; } $sql_ravangee_manual_daily = "SELECT * FROM employee_ravangee_manual a LEFT JOIN employee e ON e.cid=a.emp_id WHERE a.`emp_id`='$emp_id' AND a.attendence_status NOT IN ('rejected') AND DATE_FORMAT(a.`date`,'%Y-%m-%d') = '$entry_date' ORDER BY `added_date` DESC;"; $res_ravangee_manual_daily_result = $this->select_custom_query($sql_ravangee_manual_daily); if (count($res_ravangee_manual_daily_result) > 0) { $manual_ravangee = 'yes'; // $manual_ravangee = ''; } else { $manual_ravangee = ''; } if ($day_name == $leave_day) { } else if ($leave_apply == 'yes') { } else if ($manual_ravangee == 'yes') { } else { $array[] = $entry_date; } } return $array; } public function get_min_max_restrictions($ez_id, $leave_type, $leave_days, $effective_date) { $sql_rest = "SELECT * FROM `leave_type_multi_restriction` WHERE `ez_id`='$ez_id' AND `lt_id`='$leave_type' AND `effective_date` <='$effective_date' AND '$leave_days' BETWEEN `min_leave_day` AND `max_leave_day` ORDER BY `effective_date` DESC LIMIT 1"; $leave_apply_result = $this->select_custom_query($sql_rest); if (count($leave_apply_result) > 0) { $advance_day = $leave_apply_result[0]['advance_day']; $leave_res = 'yes'; } else { $advance_day = '0'; $leave_res = ''; } return $advance_day; } // Get letter types public function select_notification_status($status) { if ($status == 'ALL') { $sq = "SELECT * FROM `mstr_notification_status` WHERE 1 ORDER BY display_no ASC"; } else { $sq = "SELECT * FROM `mstr_notification_status` WHERE status='$status' ORDER BY display_no ASC"; } // echo $sq; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function get_employee_working_place($emp_id, $column_name) { $emp_result = $this->employee_details($emp_id); $emp_details = mysqli_fetch_assoc($emp_result); $substation_name = $emp_details['electrycity_zone']; $edd_name = $emp_details['ex_name']; $place_det = $this->get_substation_detail_by_edd_substation_name($substation_name, $edd_name); //print_r($place_det); $res = $place_det[$column_name]; return $res; } function get_employee_working_place_monthly($emp_id, $month, $year, $column_name) { $emp_result = employee_details_monthwise_all($emp_id, $month, $year); $emp_details = mysqli_fetch_assoc($emp_result); $substation_name = $emp_details['electrycity_zone']; $edd_name = $emp_details['ex_name']; $place_det = $this->get_substation_detail_by_edd_substation_name($substation_name, $edd_name); //print_r($place_det); $res = $place_det[$column_name]; return $res; } function get_letter_to_admin_by_letter_id($id, $val_type) { $sq = mysqli_query($this->conn, "SELECT te.*,tld.*,mlt.letter_type_name FROM tbl_letter_detail tld LEFT JOIN terminated_employee te ON te.t_id=tld.t_id LEFT JOIN mstr_letter_type mlt ON mlt.letter_type_id=tld.letter_type_id WHERE id='" . $id . "'"); $row = mysqli_fetch_array($sq); $t_id = $row['t_id']; $letter_type_name = $row['letter_type_name']; $payable_company_type = $row['payable_company_type']; $table_name = $row['table_name']; //$letter_to_admin = $row['letter_to_admin']; if ($payable_company_type == 'DEPARTMENT') { $discom_id = $row['discom_id']; $zone_id = $row['zone_id']; $super_id = $row['super_id']; $edd_id = $row['edd_id']; $edsd_id = $row['edsd_id']; $ez_id = $row['ez_id']; if ($discom_id > 0) { $letter_to_admin_details = $this->select_row_query("discom", "d_id=$discom_id"); $department_name = $letter_to_admin_details['discom_name']; $department_no = $letter_to_admin_details['contact_no_discom']; } if ($zone_id > 0) { $letter_to_admin_details = $this->select_row_query("zone", "zone_id=$zone_id"); $department_name = $letter_to_admin_details['zone_name']; $department_no = $letter_to_admin_details['contact_no_zone']; } if ($super_id > 0) { $letter_to_admin_details = $this->select_row_query("super_engineer", "super_id=$super_id"); $department_name = $letter_to_admin_details['super_name']; $department_no = $letter_to_admin_details['contact_no_super']; } if ($edd_id > 0) { $letter_to_admin_details = $this->select_row_query("executive_engineer", "ex_id=$edd_id"); $department_name = $letter_to_admin_details['ex_name']; $department_no = $letter_to_admin_details['contact_no_executive']; } if ($edsd_id > 0) { $letter_to_admin_details = $this->select_row_query("edsd_engineer", "edsd_id=$edsd_id"); $department_name = $letter_to_admin_details['edsd_name']; $department_no = $letter_to_admin_details['contact_no_edsd']; } if ($ez_id > 0) { $letter_to_admin_details = $this->select_row_query("electrycity_zone", "ez_id=$ez_id"); $department_name = $letter_to_admin_details['electrycity_zone_name']; $department_no = $letter_to_admin_details['contact_no_substation1']; } $letter_receipient = $department_name; $receipient_no = $department_no; } else if ($payable_company_type == 'PARTY') { $ep_id = $row['ep_id']; $letter_to_admin_details = $this->select_row_query("$table_name", "ep_id=$ep_id"); $letter_receipient = $letter_to_admin_details['ep_name']; $receipient_no = $letter_to_admin_details['ep_contact_no']; } else if ($payable_company_type == 'VENDOR') { $ep_id = $row['ep_id']; $letter_to_admin_details = $this->select_row_query("$table_name", "ep_id=$ep_id"); $letter_receipient = $letter_to_admin_details['ep_name']; $receipient_no = $letter_to_admin_details['ep_contact_no']; } else if ($payable_company_type == 'EMPLOYEE') { $emp_id = $row['emp_id']; $result = $this->view_specific_employee($emp_id); $letter_to_admin_details = mysqli_fetch_array($result); //print_r($letter_to_admin_details); $letter_receipient = $letter_to_admin_details['customer_name']; $receipient_no = $letter_to_admin_details['phone']; $zone_name = $letter_to_admin_details['zone_name']; $edc_name = $letter_to_admin_details['super_name']; $edd_name = $letter_to_admin_details['ex_name']; $edsd_name = $letter_to_admin_details['edsd_name']; $substation_name = $letter_to_admin_details['electrycity_zone']; $executive_district = $letter_to_admin_details['executive_district']; $gender = $letter_to_admin_details['gender']; $helpline_no = $letter_to_admin_details['helpline_no']; $emp_company_id = $letter_to_admin_details['company_id']; } else if ($payable_company_type == 'AUTHORITY') { $adm_id = $row['adm_id']; $letter_to_admin_details = $this->select_row_query("$table_name", "id=$adm_id"); $letter_receipient = $letter_to_admin_details['name']; $admin_result = $this->view_specific_employee($letter_to_admin_details['emp_id']); $admin_employee_detail = mysqli_fetch_array($admin_result); $receipient_no = $admin_employee_detail['phone']; } // $sql_ld_extra = "SELECT * FROM `letter_details_extra` WHERE `t_id`='$t_id' AND `l_id`='$id'"; // $result_ld_extra = $this->select_custom_query($sql_ld_extra); if (count($result_ld_extra) > 0) { $letter_type_name = $result_ld_extra[0]['letter_type_name']; $letter_to_designation = $result_ld_extra[0]['receiver_designation']; $letter_receipient = $result_ld_extra[0]['receiver_name']; $receipient_no = $letter_to_contact_no = $result_ld_extra[0]['receiver_contact_no']; $letter_to_email_id = $result_ld_extra[0]['receiver_email_id']; $discom_name = $result_ld_extra[0]['receiver_discom_name']; $zone_name = $result_ld_extra[0]['receiver_zone_name']; $edc_name = $result_ld_extra[0]['receiver_super_name']; $edd_name = $result_ld_extra[0]['receiver_edd_name']; $edsd_name = $result_ld_extra[0]['receiver_edsd_name']; $substation_name = $result_ld_extra[0]['receiver_substation_name']; $postal_address_1 = $result_ld_extra[0]['receiver_postal_address_1']; $postal_address_2 = $result_ld_extra[0]['receiver_postal_address_2']; $postal_address_3 = $result_ld_extra[0]['receiver_postal_address_3']; $postal_address_4 = $result_ld_extra[0]['receiver_postal_address_4']; $postal_address_5 = $result_ld_extra[0]['receiver_postal_address_5']; $postal_address_6 = $result_ld_extra[0]['receiver_postal_address_6']; $letter_by_name = $result_ld_extra[0]['sender_name']; $letter_by_no = $result_ld_extra[0]['sender_contact_no']; $letter_by_email_id = $result_ld_extra[0]['sender_email_id']; $letter_by_sign = $result_ld_extra[0]['sender_sign']; $letter_by_designation = $result_ld_extra[0]['sender_designation']; $letter_by_categoery = $result_ld_extra[0]['sender_categoery']; } if ($val_type == 'receipient_no') { return $receipient_no; } else { return $letter_receipient; } } function generate_letter_no($letter_date, $process_status) { // $qry_disp = "SELECT te.*,tld.*,mlt.letter_type_name FROM tbl_letter_detail tld LEFT JOIN terminated_employee te ON te.t_id=tld.t_id LEFT JOIN mstr_letter_type mlt ON mlt.letter_type_id=tld.letter_type_id WHERE tld.letter_date='" . $letter_date . "' AND te.process_status='$process_status'"; $qry_disp = "SELECT te.*,tld.*,mlt.letter_type_name FROM tbl_letter_detail tld LEFT JOIN terminated_employee te ON te.t_id=tld.t_id LEFT JOIN mstr_letter_type mlt ON mlt.letter_type_id=tld.letter_type_id WHERE tld.letter_date='" . $letter_date . "' AND tld.letter_no_int>0 ORDER BY letter_no_int DESC"; $sq_dispatched = mysqli_query($this->conn, $qry_disp); $res_disp = mysqli_fetch_array($sq_dispatched); $count_letter = mysqli_num_rows($sq_dispatched); $c_l_no_plus_one = $count_letter + 1; return $c_l_no_plus_one; } function generate_letter_no_format($letter_date, $letter_no_int) { $l_no_date = date('ymd', strtotime($letter_date)); // $letter_no = $l_no_date . sprintf('%03d', $letter_no_int); $letter_no = $l_no_date . $letter_no_int; return $letter_no; } function generate_voucher_no($payment_date, $f_id_from, $company_id, $unit_id, $voucher_type) { $inc_no = $this->generate_voucher_no_old($payment_date, $f_id_from, $company_id, $unit_id, $voucher_type); return $inc_no; } function generate_voucher_no_old($payment_date, $f_id_from, $company_id, $unit_id, $voucher_type) { $sel_query1 = "SELECT `voucher_no_digit` FROM `account_ledger_all` WHERE `f_y_id`='$f_id_from' AND `company_id`='$company_id' AND `unit_id`='$unit_id' AND `voucher_type`='$voucher_type' GROUP BY `txn_no` ORDER BY `voucher_no_digit` DESC"; $res_query1 = $this->select_custom_query($sel_query1); if ($res_query1[0]['voucher_no_digit'] != '') { $total_voucher = $res_query1[0]['voucher_no_digit']; } else { $total_voucher = 0; } $inc_no = $total_voucher + 1; return $inc_no; } function generate_voucher_no_new($payment_date, $f_id_from, $company_id, $unit_id, $voucher_type) { $sel_query1 = "SELECT `voucher_no_digit` FROM `account_ledger_all` WHERE `txn_date`='$payment_date' AND `company_id`='$company_id' AND `unit_id`='$unit_id' AND `voucher_type`='$voucher_type' GROUP BY `txn_no` ORDER BY `voucher_no_digit` DESC"; $res_query1 = $this->select_custom_query($sel_query1); if ($res_query1[0]['voucher_no_digit'] != '') { $total_voucher = $res_query1[0]['voucher_no_digit']; } else { $total_voucher = 0; } $inc_no = $total_voucher + 1; return $inc_no; } function generate_voucher_no_format($payment_date, $voucher_no_int, $unit_code, $voucher_type) { $voucher_no = $this->generate_voucher_no_format_old($payment_date, $voucher_no_int, $unit_code, $voucher_type); // $voucher_no = $this->generate_voucher_no_format_new($payment_date, $voucher_no_int, $unit_code, $voucher_type); return $voucher_no; } function generate_voucher_no_format_old($payment_date, $voucher_no_int, $unit_code, $voucher_type) { $voucher_code = substr($voucher_type, 0, 1); $inc_no_padd = str_pad($voucher_no_int, 5, 0, STR_PAD_LEFT); $voucher_no = $unit_code . $$voucher_code . '-' . $inc_no_padd; return $voucher_no; } function generate_voucher_no_format_new($payment_date, $voucher_no_int, $unit_code, $voucher_type) { $voucher_code = $this->get_name_from_table('voucher_types', 'voucher_type_name_backend', $voucher_type, 'voucher_code'); $v_no_date = date('ymd', strtotime($payment_date)); // $inc_no_padd = $v_no_date . sprintf('%03d', $voucher_no_int); $voucher_no = $unit_code . $voucher_code . '-' . $v_no_date . $voucher_no_int; return $voucher_no; } // Get logout reasons public function select_logout_reasons($status) { if ($status == 'ALL') { $sq = "SELECT * FROM `mstr_logout_reasons` WHERE 1 ORDER BY reason_name ASC"; } else { $sq = "SELECT * FROM `mstr_logout_reasons` WHERE mlrr_status='$status' ORDER BY reason_name ASC"; } // echo $sq; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_logout_reason_name($mlrr_id) { $sq = "SELECT reason_name FROM `mstr_logout_reasons` WHERE mlrr_id='" . $mlrr_id . "'"; $result = mysqli_query($this->conn, $sq); $row = mysqli_fetch_array($result); return $row['reason_name']; } // Get Last Logout id Details public function get_final_logout_id($company_id) { $c_cnd = ""; // if ($company_id) { // $c_cnd = " AND company_id='$company_id' "; // } $sql_rest = "SELECT * FROM `mstr_logout_reasons` WHERE is_final_logout='YES' $c_cnd ORDER BY `mlrr_updated_at` DESC"; $result = $this->select_custom_query($sql_rest); if (count($result) > 0) { $last_logout_id = $result[0]['mlrr_id']; } else { $last_logout_id = ''; } return $last_logout_id; } // Get Last Logout id Details public function get_lunch_logout_id($company_id) { $c_cnd = ""; if ($company_id) { $c_cnd = " AND company_id='$company_id' "; } $sql_rest = "SELECT * FROM `mstr_logout_reasons` WHERE is_lunch='YES' $c_cnd ORDER BY `mlrr_updated_at` DESC"; $result = $this->select_custom_query($sql_rest); if (count($result) > 0) { $last_logout_id = $result[0]['mlrr_id']; } else { $last_logout_id = ''; } return $last_logout_id; } function get_shift_detail_format_lunch_id($shift_id, $type) { //shift_name($shift_id, $type); $time_from = $this->shift_name($shift_id, 'start_time'); $time_to = $this->shift_name($shift_id, 'end_time'); $is_lunch = $this->shift_name($shift_id, 'is_lunch'); $lunch_time_from = $this->shift_name($shift_id, 'lunch_start_time'); $lunch_time_to = $this->shift_name($shift_id, 'lunch_end_time'); // // $lunch_duration=$this->getTimeDiff($lunch_time_from,$lunch_time_to); // $lunch_duration = $this->get_date_diff($lunch_time_from, $lunch_time_to, 'M'); $lunch_duration = $this->shift_name($shift_id, 'lunch_duration'); if ($type == 'with_lunch_detail') { if ($lunch_duration > 0) { $details = date('h:i A', strtotime($time_from)) . ' - ' . date('h:i A', strtotime($lunch_time_from)); $details .= '<br>Break : ' . $lunch_duration . ' Min'; $details .= '<br>' . date('h:i A', strtotime($lunch_time_to)) . ' - ' . date('h:i A', strtotime($time_to)); } else { $details = date('h:i A', strtotime($time_from)) . ' - ' . date('h:i A', strtotime($time_to)); } } else if ($type == 'without_lunch_detail') { $details = date('h:i A', strtotime($time_from)) . ' - ' . date('h:i A', strtotime($time_to)); } else { $details = date('h:i A', strtotime($time_from)) . '<br>' . date('h:i A', strtotime($time_to)); } return $details; } function get_shift_detail_format_lunch($shift_no, $shift_cat, $type) { //shift_name($shift_id, $type); $time_from = $this->shift_rotation_name($shift_no, $shift_cat, 'start_time'); $time_to = $this->shift_rotation_name($shift_no, $shift_cat, 'end_time'); $is_lunch = $this->shift_rotation_name($shift_no, $shift_cat, 'is_lunch'); $lunch_time_from = $this->shift_rotation_name($shift_no, $shift_cat, 'lunch_start_time'); $lunch_time_to = $this->shift_rotation_name($shift_no, $shift_cat, 'lunch_end_time'); // // $lunch_duration=$this->getTimeDiff($lunch_time_from,$lunch_time_to); // $lunch_duration = $this->get_date_diff($lunch_time_from, $lunch_time_to, 'M'); $lunch_duration = $this->shift_rotation_name($shift_no, $shift_cat, 'lunch_duration'); if ($type == 'with_lunch_detail') { if ($lunch_duration > 0) { $details = date('h:i A', strtotime($time_from)) . ' - ' . date('h:i A', strtotime($lunch_time_from)); $details .= '<br>Break : ' . $lunch_duration . ' Min'; $details .= '<br>' . date('h:i A', strtotime($lunch_time_to)) . ' - ' . date('h:i A', strtotime($time_to)); } else { $details = date('h:i A', strtotime($time_from)) . ' - ' . date('h:i A', strtotime($time_to)); } } else if ($type == 'without_lunch_detail') { $details = date('h:i A', strtotime($time_from)) . ' - ' . date('h:i A', strtotime($time_to)); } else { $details = date('h:i A', strtotime($time_from)) . '<br>' . date('h:i A', strtotime($time_to)); } return $details; } public function save_letter_details_extra($id, $t_id) { $date = date('Y-m-d'); $current_date = date('Y-m-d H:i:s'); $emp_id = $_SESSION['admin_emp_id']; $admin_cid = $_SESSION['admin_cid']; $admin_name = $_SESSION['name']; $sql = "SELECT te.*,tld.*,mlt.letter_type_name,mlt.letter_type_name_hindi FROM tbl_letter_detail tld LEFT JOIN terminated_employee te ON te.t_id=tld.t_id LEFT JOIN mstr_letter_type mlt ON mlt.letter_type_id=tld.letter_type_id WHERE tld.t_id='" . $t_id . "' AND id='" . $id . "'"; $sql_res = mysqli_query($this->conn, $sql); $row = mysqli_fetch_array($sql_res); $language = $row['language']; if ($language == 'HINDI') { $hindi = "_hindi"; $h = "h_"; } else { $hindi = ""; $h = ""; } $letter_type_name = $row['letter_type_name' . $hindi]; $payable_company_type = $row['payable_company_type']; $table_name = $row['table_name']; $letter_written_by = $row['letter_written_by']; //echo $letter_written_by; if ($letter_written_by == 'EMPLOYEE') { $letter_by = $row['added_by']; $result_admin = $this->view_specific_employee($letter_by); $letter_by_details = mysqli_fetch_array($result_admin); //print_r($letter_by_details); $letter_by_name = $letter_by_details['customer_name']; $letter_by_sign = $letter_by_details['emp_sign']; $letter_by_no = $letter_by_details['phone']; $letter_by_email_id = $letter_by_details['emailid']; // $letter_by_designation = $letter_by_details['post_name' . $hindi] . '-' . $letter_by_details['categoery_name' . $hindi]; $letter_by_designation = $letter_by_details['post_name' . $hindi]; $letter_by_categoery = $letter_by_details['categoery_name' . $hindi]; } else { $letter_by = $row['letter_by_authority_id']; $letter_by_role_id = $row['letter_by_authority_role_id']; $letter_by_designation = $this->get_role_designation($letter_by_role_id, 'letter_by_designation' . $hindi); $letter_by_details = $this->select_row_query("sub_admin", "id='$letter_by'"); $letter_by_name = $letter_by_details['name' . $hindi]; $letter_by_sign = $letter_by_details['sign']; $letter_by_admin_result = $this->view_specific_employee($letter_by_details['emp_id']); $letter_by_admin_employee_detail = mysqli_fetch_array($letter_by_admin_result); $letter_by_no = $letter_by_admin_employee_detail['phone']; $letter_by_categoery = $letter_by_admin_employee_detail['categoery_name' . $hindi]; $letter_by_email_id = $letter_by_admin_employee_detail['emailid']; $letter_by_2 = $row['letter_by_authority_id_2']; $letter_by_role_id_2 = $row['letter_by_authority_role_id_2']; $letter_by_designation_2 = $this->get_role_designation($letter_by_role_id_2, 'letter_by_designation' . $hindi); $letter_by_details_2 = $this->select_row_query("sub_admin", "id='$letter_by_2'"); $letter_by_name_2 = $letter_by_details_2['name' . $hindi]; $letter_by_sign_2 = $letter_by_details_2['sign']; $letter_by_admin_result_2 = $this->view_specific_employee($letter_by_details_2['emp_id']); $letter_by_admin_employee_detail_2 = mysqli_fetch_array($letter_by_admin_result_2); $letter_by_no_2 = $letter_by_admin_employee_detail_2['phone']; $letter_by_categoery_2 = $letter_by_admin_employee_detail_2['categoery_name' . $hindi]; $letter_by_email_id_2 = $letter_by_admin_employee_detail_2['emailid']; $letter_by_3 = $row['letter_by_authority_id_3']; $letter_by_role_id_3 = $row['letter_by_authority_role_id_3']; $letter_by_designation_3 = $this->get_role_designation($letter_by_role_id_3, 'letter_by_designation' . $hindi); $letter_by_details_3 = $this->select_row_query("sub_admin", "id='$letter_by_3'"); $letter_by_name_3 = $letter_by_details_3['name' . $hindi]; $letter_by_sign_3 = $letter_by_details_3['sign']; $letter_by_admin_result_3 = $this->view_specific_employee($letter_by_details_3['emp_id']); $letter_by_admin_employee_detail_3 = mysqli_fetch_array($letter_by_admin_result_3); $letter_by_no_3 = $letter_by_admin_employee_detail_3['phone']; $letter_by_categoery_3 = $letter_by_admin_employee_detail_3['categoery_name' . $hindi]; $letter_by_email_id_3 = $letter_by_admin_employee_detail_3['emailid']; } if ($payable_company_type == 'DEPARTMENT') { $discom_id = $row['discom_id']; $zone_id = $row['zone_id']; $super_id = $row['super_id']; $edd_id = $row['edd_id']; $edsd_id = $row['edsd_id']; $ez_id = $row['ez_id']; if ($discom_id > 0) { $area_id = $discom_id; $letter_to_admin_details = $this->select_row_query("discom", "d_id='$discom_id'"); $department_name = $letter_to_admin_details['discom_name' . $hindi]; $discom_name = $department_name; $department_no = $letter_to_admin_details['contact_no_discom']; $department_email = $letter_to_admin_details['contact_email_discom']; $department_contact_officer = $letter_to_admin_details['contact_officer_discom' . $hindi]; $department_contact_officer_designation = $letter_to_admin_details['contact_officer_designation' . $hindi . '_discom']; $postal_address_1 = $letter_to_admin_details['zone_postal_address_1']; $postal_address_2 = $letter_to_admin_details['zone_postal_address_2']; $postal_address_3 = $letter_to_admin_details['zone_postal_address_3']; } if ($zone_id > 0) { $area_id = $zone_id; $letter_to_admin_details = $this->select_row_query("zone", "zone_id='$zone_id'"); $department_name = $letter_to_admin_details['zone_name' . $hindi]; $zone_name = $department_name; $department_no = $letter_to_admin_details['contact_no_zone']; $department_email = $letter_to_admin_details['contact_email_zone']; $department_contact_officer = $letter_to_admin_details['contact_officer_zone' . $hindi]; $department_contact_officer_designation = $letter_to_admin_details['contact_officer_designation' . $hindi . '_zone']; $postal_address_1 = $letter_to_admin_details['zone_postal_address_1']; $postal_address_2 = $letter_to_admin_details['zone_postal_address_2']; $postal_address_3 = $letter_to_admin_details['zone_postal_address_3']; $pincode_receipient = $letter_to_admin_details['zone_pincode']; } if ($super_id > 0) { $area_id = $super_id; $letter_to_admin_details = $this->select_row_query("super_engineer", "super_id='$super_id'"); $department_name = $letter_to_admin_details['super_name' . $hindi]; $edc_name = $department_name; $department_no = $letter_to_admin_details['contact_no_super']; $department_email = $letter_to_admin_details['contact_email_super']; $department_contact_officer = $letter_to_admin_details['contact_officer_super' . $hindi]; $department_contact_officer_designation = $letter_to_admin_details['contact_officer_designation' . $hindi . '_super']; $postal_address_1 = $letter_to_admin_details['super_postal_address_1']; $postal_address_2 = $letter_to_admin_details['super_postal_address_2']; $postal_address_3 = $letter_to_admin_details['super_postal_address_3']; $pincode_receipient = $letter_to_admin_details['super_pincode']; } if ($edd_id > 0) { $area_id = $edd_id; $letter_to_admin_details = $this->select_row_query("executive_engineer", "ex_id='$edd_id'"); $department_name = $letter_to_admin_details['ex_name' . $hindi]; $edd_name = $department_name; $department_no = $letter_to_admin_details['contact_no_executive']; $department_email = $letter_to_admin_details['contact_email_executive']; $department_contact_officer = $letter_to_admin_details['contact_officer_executive' . $hindi]; $department_contact_officer_designation = $letter_to_admin_details['contact_officer_designation' . $hindi . '_executive']; $postal_address_1 = $letter_to_admin_details['ex_postal_address_1']; $postal_address_2 = $letter_to_admin_details['ex_postal_address_2']; $postal_address_3 = $letter_to_admin_details['ex_postal_address_3']; $pincode_receipient = $letter_to_admin_details['executive_pincode']; } if ($edsd_id > 0) { $area_id = $edsd_id; $letter_to_admin_details = $this->select_row_query("edsd_engineer", "edsd_id='$edsd_id'"); $department_name = $letter_to_admin_details['edsd_name' . $hindi]; $edsd_name = $department_name; $department_no = $letter_to_admin_details['contact_no_edsd']; $department_email = $letter_to_admin_details['contact_email_edsd']; $department_contact_officer = $letter_to_admin_details['contact_officer_edsd' . $hindi]; $department_contact_officer_designation = $letter_to_admin_details['contact_officer_designation' . $hindi . '_edsd']; $postal_address_1 = $letter_to_admin_details['edsd_postal_address_1']; $postal_address_2 = $letter_to_admin_details['edsd_postal_address_2']; $postal_address_3 = $letter_to_admin_details['edsd_postal_address_3']; $pincode_receipient = $letter_to_admin_details['edsd_pincode']; } if ($ez_id > 0) { $area_id = $ez_id; $letter_to_admin_details = $this->select_row_query("electrycity_zone", "ez_id='$ez_id'"); $department_name = $letter_to_admin_details[$h . 'electrycity_zone_name']; $substation_name = $department_name; $department_no = $letter_to_admin_details['contact_no_substation1']; $department_email = $letter_to_admin_details['contact_email_substation']; $department_contact_officer = $letter_to_admin_details['contact_officer_substation' . $hindi]; $department_contact_officer_designation = $letter_to_admin_details['contact_officer_designation' . $hindi]; $postal_address_1 = $letter_to_admin_details['substation_postal_address_1']; $postal_address_2 = $letter_to_admin_details['substation_postal_address_2']; $postal_address_3 = $letter_to_admin_details['substation_postal_address_3']; $pincode_receipient = $letter_to_admin_details['electry_pincode']; } $authority_id = $area_id; $letter_receipient = $department_name; $letter_to_contact_no = $department_no; $letter_to_email_id = $department_email; $letter_to_designation = $department_contact_officer_designation; } else if ($payable_company_type == 'PARTY') { $ep_id = $row['ep_id']; $authority_id = $ep_id; $letter_to_admin_details = $this->select_row_query("$table_name", "ep_id='$ep_id'"); $ep_name = $letter_to_admin_details['ep_name']; $department_contact_officer = $letter_to_admin_details['ep_contact_person']; $letter_to_contact_no = $letter_to_admin_details['ep_contact_no']; $letter_to_email_id = $letter_to_admin_details['ep_contact_emailid']; $pincode_receipient = $letter_to_admin_details['ep_pincode']; $ep_address = $letter_to_admin_details['ep_address']; $letter_receipient = $ep_name; $letter_to_designation = $department_contact_officer; $postal_address_1 = $ep_address; } else if ($payable_company_type == 'VENDOR') { $ep_id = $row['ep_id']; $authority_id = $ep_id; $letter_to_admin_details = $this->select_row_query("$table_name", "ep_id='$ep_id'"); $ep_name = $letter_to_admin_details['ep_name' . $hindi]; $department_contact_officer = $letter_to_admin_details['ep_contact_person_to_the' . $hindi]; $letter_to_contact_no = $letter_to_admin_details['ep_contact_no']; $letter_to_email_id = $letter_to_admin_details['ep_contact_emailid']; $pincode_receipient = $letter_to_admin_details['ep_pincode']; $ep_address = $letter_to_admin_details['ep_address_l1' . $hindi]; $letter_receipient = $ep_name; $letter_to_designation = $department_contact_officer; $postal_address_1 = $ep_address; $postal_address_2 = $letter_to_admin_details['ep_address_l2' . $hindi]; $postal_address_3 = $letter_to_admin_details['ep_address_l3' . $hindi]; $postal_address_4 = $letter_to_admin_details['ep_address_l4' . $hindi]; $postal_address_5 = $letter_to_admin_details['ep_address_l5' . $hindi]; $postal_address_6 = $letter_to_admin_details['ep_address_l6' . $hindi]; } else if ($payable_company_type == 'EMPLOYEE') { $emp_id = $row['emp_id']; $authority_id = $emp_id; $result = $this->view_specific_employee($emp_id); $letter_to_admin_details = mysqli_fetch_array($result); // print_r($letter_to_admin_details); $letter_receipient = $letter_to_admin_details['customer_name']; $letter_to_contact_no = $letter_to_admin_details['phone']; $letter_to_email_id = $letter_to_admin_details['emailid']; $zone_name = $letter_to_admin_details['zone']; $edc_name = $letter_to_admin_details['s_engineer']; // $edd_name = $letter_to_admin_details['ex_name']; $edd_name = $letter_to_admin_details['ex_name' . $hindi]; $edsd_name = $letter_to_admin_details['edsd_name']; // $substation_name = $letter_to_admin_details['electrycity_zone']; $substation_name = $letter_to_admin_details[$h . 'electrycity_zone_name']; $executive_district = $letter_to_admin_details['executive_district']; $gender = $letter_to_admin_details['gender']; $helpline_no = $letter_to_admin_details['helpline_no']; $emp_company_id = $letter_to_admin_details['company_id']; // $letter_to_designation = $letter_to_admin_details['post_name' . $hindi] . '-' . $letter_to_admin_details['categoery_name' . $hindi]; $letter_to_designation = $letter_to_admin_details['post_name' . $hindi]; $letter_to_categoery = $letter_to_admin_details['categoery_name' . $hindi]; $pincode_receipient = $letter_to_admin_details['pincode']; $letter_to_sign = $letter_to_admin_details['emp_sign']; if ($letter_to_admin_details['gender'] == 'Female') { $so_do = 'D/O'; } else { $so_do = 'S/O'; } $ad_line_1 = $letter_to_admin_details['customer_name']; $ad_line_2 = $so_do . ' ' . $letter_to_admin_details['father_name']; $ad_line_3 = $letter_to_admin_details['mohalla'] . ' ' . $letter_to_admin_details['village']; $ad_line_4 = $letter_to_admin_details['block'] . ' ' . $letter_to_admin_details['post']; $ad_line_5 = $letter_to_admin_details['district'] . ' ' . $letter_to_admin_details['state'] . ' - ' . $letter_to_admin_details['pincode']; if ($letter_to_admin_details['emailid']) { $ad_line_6 = $letter_to_admin_details['phone'] . ', ' . $letter_to_admin_details['emailid']; } else { $ad_line_6 = $letter_to_admin_details['phone']; } $cum_qry = "SELECT * FROM `employee_cummunication_details` WHERE `emp_id`='$emp_id'"; $cum_res_det = $this->select_custom_query($cum_qry); //print_r($cum_res_det); echo $language.count($cum_res_det); if ($language == 'HINDI') { if (count($cum_res_det) > 0) { $postal_address_1 = $cum_res_det[0]['address_line_1_hindi']; $postal_address_2 = $cum_res_det[0]['address_line_2_hindi']; $postal_address_3 = $cum_res_det[0]['address_line_3_hindi']; $postal_address_4 = $cum_res_det[0]['address_line_4_hindi']; $postal_address_5 = $cum_res_det[0]['address_line_5_hindi']; $postal_address_6 = $cum_res_det[0]['address_line_6_hindi']; } else { $postal_address_1 = $ad_line_1; $postal_address_2 = $ad_line_2; $postal_address_3 = $ad_line_3; $postal_address_4 = $ad_line_4; $postal_address_5 = $ad_line_5; $postal_address_6 = $ad_line_6; } } else { $postal_address_1 = $ad_line_1; $postal_address_2 = $ad_line_2; $postal_address_3 = $ad_line_3; $postal_address_4 = $ad_line_4; $postal_address_5 = $ad_line_5; $postal_address_6 = $ad_line_6; } } else if ($payable_company_type == 'AUTHORITY') { $adm_id = $row['adm_id']; $authority_id = $adm_id; $adm_role_id = $row['adm_role_id']; $letter_to_designation = $this->get_role_designation($adm_role_id, 'letter_to_designation' . $hindi); $letter_to_admin_details = $this->select_row_query("$table_name", "id='$adm_id'"); $letter_receipient = $letter_to_admin_details['name' . $hindi]; $letter_to_sign = $letter_to_admin_details['sign']; $admin_result = $this->view_specific_employee($letter_to_admin_details['emp_id']); $admin_employee_detail = mysqli_fetch_array($admin_result); $letter_to_contact_no = $admin_employee_detail['phone']; $letter_to_email_id = $admin_employee_detail['emailid']; $letter_to_categoery = $admin_employee_detail['categoery_name' . $hindi]; $pincode_receipient = $admin_employee_detail['pincode']; $zone_name = $admin_employee_detail['zone']; $edc_name = $admin_employee_detail['s_engineer']; // $edd_name = $admin_employee_detail['ex_name']; $edd_name = $admin_employee_detail['ex_name' . $hindi]; $edsd_name = $admin_employee_detail['edsd_name']; // $substation_name = $admin_employee_detail['electrycity_zone']; $substation_name = $admin_employee_detail[$h . 'electrycity_zone_name']; } $receiver_id = $authority_id; $sql_record_check = "SELECT * FROM `letter_details_extra` WHERE `l_id`='$id' AND `t_id`='$t_id'"; $res_exists = $this->select_custom_query($sql_record_check); if (count($res_exists) > 0) { $sqlog_1 = "UPDATE `letter_details_extra` SET `letter_type_name`='$letter_type_name',`receiver_id`='$receiver_id',`receiver_name`='$letter_receipient',`receiver_contact_person_name`='$letter_to_designation',`receiver_contact_no`='$letter_to_contact_no',`receiver_email_id`='$letter_to_email_id',`receiver_designation`='$letter_to_designation',`receiver_categoery`='$letter_to_categoery',`receiver_role_name`='$letter_to_designation',`receiver_sign`='$letter_to_sign',`receiver_postal_address_1`='$postal_address_1',`receiver_postal_address_2`='$postal_address_2',`receiver_postal_address_3`='$postal_address_3',`receiver_postal_address_4`='$postal_address_4',`receiver_postal_address_5`='$postal_address_5',`receiver_pincode`='$pincode_receipient',`receiver_discom_name`='$discom_name',`receiver_zone_name`='$zone_name',`receiver_super_name`='$edc_name',`receiver_edd_name`='$edd_name',`receiver_edsd_name`='$edsd_name',`receiver_substation_name`='$substation_name'" . ",`sender_id`='$letter_by',`sender_name`='$letter_by_name',`sender_contact_no`='$letter_by_no',`sender_email_id`='$letter_by_email_id',`sender_designation`='$letter_by_designation',`sender_categoery`='$letter_by_categoery',`sender_role_name`='$letter_by_designation',`sender_sign`='$letter_by_sign'" . ",`sender_id_2`='$letter_by_2',`sender_name_2`='$letter_by_name_2',`sender_contact_no_2`='$letter_by_no_2',`sender_email_id_2`='$letter_by_email_id_2',`sender_designation_2`='$letter_by_designation_2',`sender_categoery_2`='$letter_by_categoery_2',`sender_role_name_2`='$letter_by_designation_2',`sender_sign_2`='$letter_by_sign_2'" . ",`sender_id_3`='$letter_by_3',`sender_name_3`='$letter_by_name_3',`sender_contact_no_3`='$letter_by_no_3',`sender_email_id_3`='$letter_by_email_id_3',`sender_designation_3`='$letter_by_designation_3',`sender_categoery_3`='$letter_by_categoery_3',`sender_role_name_3`='$letter_by_designation_3',`sender_sign_3`='$letter_by_sign_3'" . " WHERE `l_id`='$id' AND `t_id`='$t_id'"; } else { $sqlog_1 = "INSERT INTO `letter_details_extra`(`l_id`, `t_id`, `letter_type_name`, `receiver_id`, `receiver_name`, `receiver_contact_person_name`, `receiver_contact_no`, `receiver_email_id`, `receiver_designation`, `receiver_categoery`, `receiver_role_name`, `receiver_sign`, `receiver_postal_address_1`, `receiver_postal_address_2`, `receiver_postal_address_3`, `receiver_postal_address_4`, `receiver_postal_address_5`, `receiver_pincode`, `receiver_discom_name`, `receiver_zone_name`, `receiver_super_name`, `receiver_edd_name`, `receiver_edsd_name`, `receiver_substation_name`" . ", `sender_id`, `sender_name`, `sender_contact_no`, `sender_email_id`, `sender_designation`, `sender_categoery`, `sender_role_name`, `sender_sign`" . ", `sender_id_2`, `sender_name_2`, `sender_contact_no_2`, `sender_email_id_2`, `sender_designation_2`, `sender_categoery_2`, `sender_role_name_2`, `sender_sign_2`" . ", `sender_id_3`, `sender_name_3`, `sender_contact_no_3`, `sender_email_id_3`, `sender_designation_3`, `sender_categoery_3`, `sender_role_name_3`, `sender_sign_3`)" . " VALUES ('$id','$t_id','$letter_type_name','$receiver_id','$letter_receipient','$letter_to_designation','$letter_to_contact_no','$letter_to_email_id','$letter_to_designation','$letter_to_categoery','$letter_to_designation','$letter_to_sign','$postal_address_1','$postal_address_2','$postal_address_3','$postal_address_4','$postal_address_5','$pincode_receipient','$discom_name','$zone_name','$edc_name','$edd_name','$edsd_name','$substation_name'" . ",'$letter_by','$letter_by_name','$letter_by_no','$letter_by_email_id','$letter_by_designation','$letter_by_categoery','$letter_by_designation','$letter_by_sign'" . ",'$letter_by_2','$letter_by_name_2','$letter_by_no_2','$letter_by_email_id_2','$letter_by_designation_2','$letter_by_categoery_2','$letter_by_designation_2','$letter_by_sign_2'" . ",'$letter_by_3','$letter_by_name_3','$letter_by_no_3','$letter_by_email_id_3','$letter_by_designation_3','$letter_by_categoery_3','$letter_by_designation_3','$letter_by_sign_3')"; } // echo $sqlog_1; $result = mysqli_query($this->conn, $sqlog_1); return $result; } public function get_vendor_type_detail($id) { $sq3 = "SELECT * FROM `mstr_vendor_type` WHERE `vt_id`='$id'"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function get_feeders() { $company_id = $_SESSION['company_id']; // $sq = "SELECT * FROM `mstr_feeder` mf LEFT JOIN `electrycity_zone` ez ON ez.ez_id=mf.ez_id INNER JOIN `executive_engineer` ex ON ex.`ex_id`=ez.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE zone.company_id='$company_id' ORDER BY feeder_name ASC"; $sq = "SELECT * FROM `mstr_feeder` mf LEFT JOIN `electrycity_zone` ez ON ez.ez_id=mf.ez_id INNER JOIN `edsd_engineer` edsd ON edsd.`edsd_id`=ez.`edsd_id` INNER JOIN `executive_engineer` ex ON ex.`ex_id`=edsd.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE zone.company_id='$company_id' ORDER BY feeder_name ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function feeder_details($id) { // $sq3 = "SELECT * FROM `mstr_feeder` mf LEFT JOIN `electrycity_zone` ez ON ez.ez_id=mf.ez_id INNER JOIN `executive_engineer` ex ON ex.`ex_id`=ez.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `feeder_id`='$id' ORDER BY feeder_name ASC"; $sq3 = "SELECT * FROM `mstr_feeder` mf LEFT JOIN `electrycity_zone` ez ON ez.ez_id=mf.ez_id INNER JOIN `edsd_engineer` edsd ON edsd.`edsd_id`=ez.`edsd_id` INNER JOIN `executive_engineer` ex ON ex.`ex_id`=edsd.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `feeder_id`='$id' ORDER BY feeder_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function feeder_details_with_edsd($id) { $sq3 = "SELECT * FROM `mstr_feeder` mf LEFT JOIN `electrycity_zone` ez ON ez.ez_id=mf.ez_id INNER JOIN `edsd_engineer` edsd ON edsd.`edsd_id`=ez.`edsd_id` INNER JOIN `executive_engineer` ex ON ex.`ex_id`=edsd.`ex_id` INNER JOIN `super_engineer` sup ON sup.`super_id`=ex.`super_id` INNER JOIN `zone` ON zone.zone_id=sup.zone_id INNER JOIN `discom` ON `discom`.`d_id`=`zone`.`discom_id` WHERE `feeder_id`='$id' ORDER BY feeder_name ASC"; $qu3 = mysqli_query($this->conn, $sq3); $row12 = mysqli_fetch_assoc($qu3); return $row12; } public function FeederName($id, $column_name) { $query = "SELECT * FROM `mstr_feeder` WHERE `feeder_id`='$id'"; $result = mysqli_query($this->conn, $query); $row = mysqli_fetch_assoc($result); return strip_tags($row[$column_name]); } public function add_feeder() { // $zone = $_POST['zone']; // $s_engineer = $_POST['s_engineer']; $ex_id = $_POST['ex_engineer']; $edsd_id = $_POST['edsd_engineer']; $ez_id = $_POST['electry_city']; $feeder_added_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $ttlaccused = $_POST['ttlaccused']; $ins_count = 0; for ($kk = 1; $kk <= $ttlaccused; $kk++) { $feeder_name = $_POST['feeder_name' . $kk]; $feeder_name_hindi = $_POST['feeder_name_hindi' . $kk]; $feeder_type = $_POST['feeder_type' . $kk]; $feeder_timing = $_POST['feeder_timing' . $kk]; $sq = "INSERT INTO `mstr_feeder`(`ex_id`, `edsd_id`, `ez_id`, `feeder_name`, `feeder_name_hindi` , `feeder_added_by`, `feeder_added_name`, `feeder_added_date`, `feeder_type`, `feeder_timing`) " . "VALUES ('$ex_id','$edsd_id','$ez_id','$feeder_name','$feeder_name_hindi','$admin_cid','$admin_name','$feeder_added_date', '$feeder_type', '$feeder_timing')"; $qu = mysqli_query($this->conn, $sq); if ($qu) { $ins_count++; } } if ($ins_count > 0) { $_SESSION['msg'] = 'Feeder detail added Successfully.'; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="0">'; } public function update_feeder($id) { $prev_sq = $this->feeder_details($id); $prev_feeder_name = $prev_sq['feeder_name']; $ex_id = $_POST['ex_engineer']; $edsd_id = $_POST['edsd_engineer']; $ez_id = $_POST['electry_city']; $feeder_name = $_POST['feeder_name']; $feeder_name_hindi = $_POST['feeder_name_hindi']; $feeder_type = $_POST['feeder_type']; $feeder_timing = $_POST['feeder_timing']; $feeder_status = $_POST['feeder_status']; $feeder_updated_date = date('Y-m-d H:i:s'); $admin_cid = $_POST['admin_cid']; $admin_name = $_POST['admin_name']; $company_id = $_POST['company_id']; $sq11 = "UPDATE `mstr_feeder` SET `ex_id`='$ex_id', `edsd_id`='$edsd_id', `ez_id`='$ez_id', `feeder_name`='$feeder_name',`feeder_name_hindi`='$feeder_name_hindi',`feeder_updated_by`='$admin_cid',`feeder_updated_name`='$admin_name',`feeder_updated_date`='$feeder_updated_date', `feeder_type`='$feeder_type', `feeder_timing`='$feeder_timing', `feeder_status`='$feeder_status' WHERE feeder_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); if ($qu11) { $_SESSION['msg'] = "Feeder Details Updated Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } echo '<meta http-equiv="refresh" content="5">'; } public function delete_feeder($id) { $sq11 = "DELETE FROM mstr_feeder WHERE feeder_id='$id'"; $qu11 = mysqli_query($this->conn, $sq11); // $_SESSION['msg_iteration'] = 0; if ($qu11) { $_SESSION['msg'] = "Feeder Details Deleted Successfully."; } else { $_SESSION['err_msg'] = 'Something Went Wrong!'; } // echo "<script> setTimeout(function () { // location.href='add_electrycity_house.php'; // }, 6000);</script>"; echo "<script> setTimeout(function () { window.history.back(); }, 6000);</script>"; // echo '<meta http-equiv="refresh" content="5">'; } public function agreement_details($ag_id, $column_name) { $query = "SELECT d.id,d.am_id,a.agreement_status,a.agreement_number as enter_agreement_number,a.org_id,d.work_start,d.work_end,d.super_id,d.under_edd FROM tbl_agmt a LEFT JOIN tbl_agmt_da d ON d.am_id=a.am_id WHERE 1"; $query .= " AND a.am_id='$ag_id' GROUP BY d.am_id"; // echo $query; $result = mysqli_query($this->conn, $query); $row = mysqli_fetch_assoc($result); return strip_tags($row[$column_name]); } public function get_bank_short_name($bank_name) { $words = explode(" ", $bank_name); $letters = ""; foreach ($words as $value) { $letters .= substr($value, 0, 1); } return $letters; } public function get_groups_by_gt($company_id, $tog_id) { $query = "SELECT * FROM `groups` WHERE company_id='$company_id' AND `group_status`='active' AND `t_id`='$tog_id' ORDER BY group_name ASC"; $result = mysqli_query($this->conn, $query); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_groups_not_in_fy_by_gt($company_id, $financial_year, $tog_id) { $result = $this->get_groups_by_gt($company_id, $tog_id); foreach ($result as $row) { $g_show_in_fy_String = $row['g_show_in_fy']; $g_show_in_fy_Arr = explode(",", $g_show_in_fy_String); if (!in_array($financial_year, $g_show_in_fy_Arr)) { $row1[] = $row; } } return $row1; } public function get_groups($company_id) { $query = "SELECT * FROM `groups` WHERE company_id='$company_id' AND `group_status`='active' ORDER BY group_name ASC"; $result = mysqli_query($this->conn, $query); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_groups_not_in_fy($company_id, $financial_year) { $result = $this->get_groups($company_id); foreach ($result as $row) { $g_show_in_fy_String = $row['g_show_in_fy']; $g_show_in_fy_Arr = explode(",", $g_show_in_fy_String); if (!in_array($financial_year, $g_show_in_fy_Arr)) { $row1[] = $row; } } return $row1; } public function get_sub_groups($group_id) { // SELECT * FROM `sub_groups` INNER JOIN `groups` ON `groups`.`group_id`=`sub_groups`.`g_id` INNER JOIN `company_details` ON `company_details`.`ep_id`=`groups`.`company_id` WHERE `group_id` IN (1) AND NOT FIND_IN_SET('4', sg_show_in_fy) AND CONCAT(',', sg_show_in_fy, ',') LIKE '%,6,%' ORDER BY sub_group_name ASC $query = "SELECT * FROM `sub_groups` INNER JOIN `groups` ON `groups`.`group_id`=`sub_groups`.`g_id` INNER JOIN `types_of_group` ON `types_of_group`.`tog_id`=`groups`.`t_id` INNER JOIN `company_details` ON `company_details`.`ep_id`=`groups`.`company_id` WHERE `group_id` IN ($group_id) ORDER BY sub_group_name ASC"; $result = mysqli_query($this->conn, $query); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_sub_groups_not_in_fy($group_id, $financial_year) { $result = $this->get_sub_groups($group_id); foreach ($result as $row) { $sg_show_in_fy_String = $row['sg_show_in_fy']; $sg_show_in_fy_Arr = explode(",", $sg_show_in_fy_String); if (!in_array($financial_year, $sg_show_in_fy_Arr)) { $row1[] = $row; } } return $row1; } public function get_sub_groups_by_id($sub_group_id) { $query = "SELECT * FROM `sub_groups` INNER JOIN `groups` ON `groups`.`group_id`=`sub_groups`.`g_id` INNER JOIN `types_of_group` ON `types_of_group`.`tog_id`=`groups`.`t_id` INNER JOIN `company_details` ON `company_details`.`ep_id`=`groups`.`company_id` WHERE `sub_group_id` IN ($sub_group_id) ORDER BY sub_group_name ASC"; $result = mysqli_query($this->conn, $query); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_subgroup_employee_providers($company_id, $group_id, $sub_group_id) { if ($company_id) { $c_cnd = " AND ep.company_id='$company_id' "; } if ($sub_group_id) { $sg_cnd = " AND `sub_group_id`='$sub_group_id'"; } $sql = "SELECT * FROM `employee_providers` as ep LEFT JOIN `sub_groups` ON `sub_groups`.`sub_group_id`=ep.`s_g_id` INNER JOIN `groups` ON `groups`.`group_id`=`sub_groups`.`g_id` INNER JOIN `types_of_group` ON `types_of_group`.`tog_id`=`groups`.`t_id` WHERE `group_id`='$group_id' $c_cnd $sg_cnd ORDER BY `ep_name` ASC"; // echo $sql; $result = mysqli_query($this->conn, $sql); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_subgroup_employees($company_id, $group_id, $sub_group_id) { $cnd = ''; if ($company_id) { $c_cnd = " AND ep.company_id='$company_id' "; } if ($sub_group_id) { $sg_cnd = " AND `sub_group_id`='$sub_group_id'"; } $sql_emp = "SELECT * FROM `employee` as ep LEFT JOIN `sub_groups` ON ep.`e_s_g_id`=`sub_groups`.`sub_group_id` INNER JOIN `groups` ON `groups`.`group_id`=`sub_groups`.`g_id` INNER JOIN `types_of_group` ON `types_of_group`.`tog_id`=`groups`.`t_id` WHERE `group_id`='$group_id' $c_cnd $sg_cnd AND form_status='complete' AND emergency_status!='generated' $cnd ORDER BY electrycity_zone ASC,work_type ASC,skilled DESC"; // echo $sql_emp; $result = mysqli_query($this->conn, $sql_emp); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Group types public function get_types_of_group() { $sq = "SELECT * FROM `types_of_group` ORDER BY type_for_sheet asc,type_name asc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get Group Sheet types public function get_sheet_types() { $sq = "SELECT * FROM `types_of_group_sheet` ORDER BY sheet_type_name asc"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_vehicle_types($status) { if ($status == 'ALL') { $sq = "SELECT * FROM `vehicle_type` WHERE 1 ORDER BY vehicle_type_name ASC"; } else { $sq = "SELECT * FROM `vehicle_type` WHERE vt_status='$status' ORDER BY vehicle_type_name ASC"; } $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_purchase_order($po_id) { $sq = "SELECT * FROM `purchase_orders` WHERE po_id='$po_id'"; $row = mysqli_query($this->conn, $sq); $result = mysqli_fetch_array($row); return $result; } // Get all get_purchase_orders status public function get_purchase_orders($po_status) { $company_id = $_SESSION['company_id']; if ($po_status == 'ALL') { $sq = "SELECT * FROM `purchase_orders` WHERE po_from_company='$company_id' ORDER BY po_id asc,po_created_date asc"; } else { $sq = "SELECT * FROM `purchase_orders` WHERE po_from_company='$company_id' AND po_status IN ('$po_status') ORDER BY po_id asc,po_created_date asc"; } $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } // Get all get_purchase_orders status public function get_purchase_order_items($po_id) { $sq = "SELECT * FROM `purchase_orders_items` WHERE po_id='$po_id'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_purchase_order_items_join($po_id) { $sq = "SELECT * FROM `purchase_orders_items` poi LEFT JOIN `purchase_orders` po ON po.po_id=poi.po_id WHERE po.po_id='$po_id'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_purchase_order_items_quality_by_po_id($po_id) { $sq = "SELECT * FROM `purchase_orders_items_quality` WHERE po_id='$po_id'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_purchase_order_items_quality_by_poi_id($poi_id) { $sq = "SELECT * FROM `purchase_orders_items_quality` WHERE poi_id='$poi_id'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_challan_items_quality_by_po_id($po_id) { $sq = "SELECT * FROM `challan_items_quality` WHERE po_id='$po_id'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_challan_items_quality_by_product_id($txn_no, $product_id) { $sq = "SELECT * FROM `challan_items_quality` WHERE q_c_txn_no='" . $txn_no . "' AND po_product_id='" . $product_id . "' ORDER BY q_c_date ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_quality_detail_by_name($txn_no, $product_id,$quality_name) { $sq = "SELECT * FROM `challan_items_quality` WHERE q_c_txn_no='" . $txn_no . "' AND po_product_id='" . $product_id . "' AND `po_quality_name` LIKE '$quality_name' ORDER BY q_c_date ASC"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_challan_items_quality_by_q_c_id($q_c_id) { $sq = "SELECT * FROM `challan_items_quality` WHERE q_c_id='$q_c_id'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } function generate_po_no($po_date, $po_type) { $qry_pon = "SELECT * FROM `purchase_orders` WHERE `po_date`='" . $po_date . "' AND `po_type`='$po_type' ORDER BY po_id DESC"; $sq_pon = mysqli_query($this->conn, $qry_pon); $res_pon = mysqli_fetch_array($sq_pon); $count_pon = mysqli_num_rows($sq_pon); $c_po_no_plus_one = $count_pon + 1; return $c_po_no_plus_one; } function generate_po_no_format($po_date, $po_type, $po_no_int) { $voucher_code = $this->get_name_from_table('voucher_types', 'voucher_type_name_backend', $po_type, 'voucher_code'); $po_no_date = date('ymd', strtotime($po_date)); // $po_no = $l_no_date . sprintf('%03d', $po_no_int); $po_no = $voucher_code . '-' . $po_no_date . $po_no_int; return $po_no; } public function get_po_items_quality_penality_bonus($po_id, $po_pb_of) { $sq = "SELECT * FROM `purchase_orders_items_quality` poiq LEFT JOIN `po_quality_penality_bonus` po_qpb ON po_qpb.qpoi_id=poiq.qpoi_id WHERE poiq.po_id='$po_id' AND `po_pb_of`='$po_pb_of'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } public function get_challans_for_invoicing($ci_txn_no) { $sq = "SELECT * FROM `challans_for_invoicing` WHERE `ci_txn_no`='$ci_txn_no'"; $result = mysqli_query($this->conn, $sq); while ($row = mysqli_fetch_assoc($result)) { $row1[] = $row; } return $row1; } }