EVOLUTION-NINJA
Edit File: MMG_rest.php
<?php defined('BASEPATH') or exit(ucwords('no direct script access allowed!')); // This can be removed if you use __autoload() in config.php OR use Modular Extensions require APPPATH . '/libraries/REST_Controller.php'; class MMG_rest extends REST_Controller{ /* @package CodeIgniter*/ function __construct() { // Construct the parent class parent::__construct(); $CI = &get_instance(); $this->db2 = $CI->load->database('db2', TRUE); } //login public function login_post() { $this->load->library('form_validation'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $this->form_validation->set_rules('phone','phone','trim|required|regex_match[/^[0-9]{10}$/]'); //$this->form_validation->set_rules('email', 'Email', 'required'); $this->form_validation->set_rules('password','password','trim|required|min_length[8]'); if ($this->form_validation->run() == FALSE) { $message=['status'=>'Fail','message'=>validation_errors()]; } else { $phone=$this->input->post('phone'); $password=$this->input->post('password'); $condition=array('phone'=>$phone,'password'=>$password,'delete_status'=>'ACTIVE'); $login_table='mmg_login'; //$condition=array('phone'=>$phone,'password'=>$password,'delete_status' =>'ACTIVE'); //$login_table='mmg_customer'; $check_user=$this->MMG_model->get_where_row_new_change($phone,$password); if(!empty($check_user)) { $message=['status'=>'Success','message'=>$check_user]; } else { $message=['status'=>'Fail','message'=>'please check your Username and Password']; } } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer login public function customer_login_post() { $this->load->library('form_validation'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $phone=$this->input->post('phone'); $password=$this->input->post('password'); $condition=array('phone'=>$phone,'password'=>$password,'delete_status' =>'ACTIVE'); $login_table='mmg_customer'; $check_user=$this->MMG_model->get_where_row($login_table,$condition); if(!empty($check_user)) { $message=['status'=>'Success','message'=>$check_user]; } else { $message=['status'=>'Fail','message'=>'please check your Username and Password']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //insert customers /* public function insert_customer_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $customer_name = $this->input->post('customer_name'); $customer_phone = $this->input->post('customer_phone'); $customer_email = $this->input->post('customer_email'); $customer_address = $this->input->post('customer_address'); $ref_type = $this->input->post('ref_type'); $ref_person = $this->input->post('ref_person'); $ref_layout_id = $this->input->post('ref_layout_id'); $ref_site_number = $this->input->post('ref_site_number'); //$ref_from = $this->input->post('ref_from'); $remarks = $this->input->post('remarks'); //$site_number = $this->input->post('site_number'); $password = $this->input->post('password'); $otp = mt_rand(100000, 999999); //$password = $this->input->post('password') $created_at = date('Y-m-d H:i:s'); $created_date = date('Y-m-d'); $data = array('name' =>$customer_name, 'phone' =>$customer_phone, 'email' =>$customer_email, 'address' =>$customer_address, 'ref_type' =>$ref_type, 'ref_person' =>$ref_person, 'ref_layout_id' =>$ref_layout_id, 'remarks' =>$remarks, //'ref_from' =>$ref_from, //'site_number' =>$site_number, 'ref_site_number' =>$ref_site_number, 'otp' =>$otp, 'password' =>$password, 'enquiry_status'=>'NEW', 'site_visiting_status'=>'NEW', 'created_by' =>$id, 'created_on' =>$created_at, 'created_at' =>$created_date); //print_r($data);die(); $table = 'mmg_customer'; $result=$this->MMG_model->insert($data,$table); if($result) { $where = array('id' =>$result); $details = $this->MMG_model->get_where_row($table,$where); $data_login = array('user_id' => $details->id, 'name' => $details->name, 'name' =>$details->name, 'email' =>$details->email, 'phone' =>$details->phone, 'password' =>'Admin123#', 'role_id' =>'2', 'created_at' =>$date, 'created_by' =>$details->id, ); $table_login = 'mmg_login'; $result = $this->MMG_model->insert($data_login,$table_login); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } */ public function insert_customer_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $customer_name = $this->input->post('customer_name'); $customer_phone = $this->input->post('customer_phone'); $alt_phone = $this->input->post('alt_phone'); if(!empty($alt_phone)) { $alt_phone = $this->input->post('alt_phone'); } else { $alt_phone = ""; } $customer_email = $this->input->post('customer_email'); $customer_address = $this->input->post('customer_address'); $customer_ids = $this->input->post('customer_ids'); $remarks = $this->input->post('remarks'); $password = $this->input->post('password'); $otp = mt_rand(100000, 999999); $department_id = $this->input->post('department_id'); $ref_type = $this->input->post('ref_type'); $table = "mmg_reference"; $where = array('id' =>$ref_type,'delete_status'=>'ACTIVE'); $details = $this->MMG_model->get_where_row($table,$where); if($details->reference_type == 'Old Customer') { $layout_id = $this->input->post('layout_id'); $site_id = $this->input->post('site_id'); } else { $layout_id = ""; $site_id = ""; } if($details->reference_type == 'Staff') { $customer_id = $this->input->post('employee_name'); } else if($details->reference_type == 'Channel Partner') { $customer_id = $this->input->post('refered_employee_id'); } else { $customer_id = $this->input->post('customer_id'); if(!empty($customer_id)) { $customer_id = $this->input->post('customer_id'); } else { $customer_id = ""; } } $enquiry_layout_id = $this->input->post('enquiry_layout_id'); $table = "mmg_customer"; $where = array('duplicate_cust!='=>'Duplicate','phone' =>$customer_phone,'id!= '=>$customer_ids,'delete_status'=>'ACTIVE'); $get_phone = $this->MMG_model->get_where_row($table,$where); if(empty($get_phone)) { $created_at = date('Y-m-d H:i:s'); $created_date = date('Y-m-d'); $data = array('name' =>$customer_name, 'phone' =>$customer_phone, 'alt_phone' =>$alt_phone, 'email' =>$customer_email, 'remarks' =>$remarks, 'otp' =>$otp, 'password' =>$password, 'enquiry_status' =>1, 'site_visiting_status' =>1, 'created_by' =>$id, 'created_on' =>$date, //'employee_id' =>$employee_name, 'department_id' =>$department_id, 'ref_layout_id' =>$layout_id, 'ref_site_number' =>$site_id, 'ref_person' =>$customer_id, 'nri_no' =>$customer_address, 'ref_type' =>$ref_type, 'enquiry_date' =>$created_date, 'enquiry_layout' =>$enquiry_layout_id); if(!empty($customer_email)) { $this->load->library('email'); /*require_once './email/PHPMailerAutoload.php'; $phpMailer = new PHPMailer(true); $phpMailer->isSMTP(); $phpMailer->Host = "smtp.gmail.com"; $phpMailer->SMTPAuth = true; $phpMailer->Username = "info.connectmmg@gmail.com"; $phpMailer->Password = "mmgP@ssw0rd"; $phpMailer->SMTPSecure = "tls"; $phpMailer->Port = 587; $phpMailer->isHTML(true); $phpMailer->CharSet = "UTF-8"; $phpMailer->setFrom("info.connectmmg@gmail.com", "MMG"); $phpMailer->addAddress($customer_email); $email_subject='Welcome to MMG Constructions LLP'; $email_message="Dear ".$customer_name."Thanks for reaching out! I'd be more than happy to help you.Welcoming you to serve you at our best! Warm Wishes Team MMG Constructions LLP"; $phpMailer->Subject = $email_subject; $phpMailer->Body = $email_message; $phpMailer->send();*/ require_once './email/PHPMailerAutoload.php'; $phpMailer = new PHPMailer(true); //$phpMailer->isSMTP(); $phpMailer->Host = "smtp.gmail.com"; $phpMailer->SMTPAuth = true; $phpMailer->Username = "Info.connectmmg@gmail.com"; $phpMailer->Password = "rqyckqjcjufpgbgh"; $phpMailer->SMTPSecure = "tls"; $phpMailer->Port = 587; $phpMailer->isHTML(true); $phpMailer->CharSet = "UTF-8"; $phpMailer->setFrom("Info.connectmmg@gmail.com", "MMG"); $email_subject='Welcome to MMG Constructions LLP'; $email_message="Dear ".$customer_name." Thanks for reaching out! I'd be more than happy to help you.Welcoming you to serve you at our best! Warm Wishes Team MMG Constructions LLP"; $phpMailer->addAddress($customer_email); $phpMailer->Subject = $email_subject; $phpMailer->Body = $email_message; $phpMailer->send(); } if(!empty($customer_phone)) { $msg = "Dear ".$customer_name." ,Thanks for reaching out! We'd be more than happy to help you. Welcoming you to serve you at our best! Warm Wishes Team MMG Constructions LLP"; $sms_message_new = $msg; $headers = ['Content-Type' => 'application/x-www-form-urlencoded', 'charset' => 'utf-8']; /* $url = "http://sms.jayblues.com/http-api.php?";*/ $url = "http://mysmsshop.in/http-api.php?"; $postData2 = array('username'=> 'mmgconstructions', 'password'=>'New$$888', 'senderid'=>'MMGCON', //'unicode'=>2, 'route'=>1, 'message' => $sms_message_new, 'number' => $customer_phone, ); $ch2 = curl_init(); curl_setopt_array($ch2, array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER =>$headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData2 )); $output1 = curl_exec($ch2); if(curl_errno($ch2)) { echo 'error:' . curl_error($ch2); } curl_close($ch2); } $table = 'mmg_customer'; if(empty($customer_ids)) { $data['created_at'] = $created_date; $result=$this->MMG_model->insert($data,$table); $where = array('id' =>$result); $details = $this->MMG_model->get_where_row($table,$where); $customerss=$details->id; } else { $condition=array('id'=>$customer_ids); $result=$this->MMG_model->update($condition,$table,$data); $customerss=$customer_ids; } if($result) { $where = array('id' =>$result); $details = $this->MMG_model->get_where_row($table,$where); $data_login = array('user_id' => $customerss, 'name' =>$customer_name, 'email' =>$customer_email, 'phone' =>$customer_phone, 'password' =>'Admin123#', 'role_id' =>'2', 'created_at' =>$date, 'created_by' =>$customerss, ); //print_r($data_login);die(); $table_login = 'mmg_login'; $result = $this->MMG_model->insert($data_login,$table_login); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=>'something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Phone Number Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer list public function customer_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); // print_r($id);die(); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_customer_list($id); // print_r($id);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //edit customer details public function edit_customer_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $result = $this->MMG_model->edit_customer_details($customer_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //update customer details public function update_customer_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->input_stream('login_id'); $edit_id = $this->input->input_stream('edit_id'); $name = $this->input->input_stream('customer_name'); $phone = $this->input->input_stream('customer_phone'); $alt_phone = $this->input->input_stream('alt_phone'); $email = $this->input->input_stream('customer_email'); $address = $this->input->input_stream('address'); $remarks = $this->input->input_stream('remarks'); $nri_no = $this->input->input_stream('nri_no'); $enquiry_layout_id = $this->input->input_stream('enquiry_layout_id'); $employee_name = $this->input->input_stream('employee_name'); $department_id = $this->input->input_stream('department_id'); $ref_type = $this->input->input_stream('ref_type'); $table = "mmg_reference"; $where = array('id' =>$ref_type,'delete_status'=>'ACTIVE'); $details = $this->MMG_model->get_where_row($table,$where); if($details->reference_type == 'Old Customer') { $layout_id = $this->input->input_stream('layout_id'); $site_id = $this->input->input_stream('site_id'); } else { $layout_id = ""; $site_id = ""; } if($details->reference_type == 'Staff') { $customer_id = $this->input->input_stream('employee_name'); } else if($details->reference_type == 'Channel Partner') { $customer_id = $this->input->input_stream('refered_employee_id'); } else { $customer_id = $this->input->input_stream('customer_id'); if(!empty($customer_id)) { $customer_id = $this->input->input_stream('customer_id'); } else { $customer_id = ""; } } $udpated_at = date('Y-m-d H:i:s'); $table='mmg_customer'; $condition=array('id !='=>$edit_id); $get_row_data=$this->MMG_model->get_where_row($table,$condition); /* if(empty($get_row_data)) {*/ $table='mmg_customer'; $condition=array('id'=>$edit_id); $data_update= array( 'name' =>$name, 'phone' =>$phone, 'alt_phone' =>$alt_phone, 'email' =>$email, 'address' =>$address, 'remarks' =>$remarks, 'updated_on' =>$udpated_at, 'updated_by' =>$login_id, //'employee_id' =>$employee_name, 'department_id' =>$department_id, 'ref_layout_id' =>$layout_id, 'ref_site_number' =>$site_id, 'ref_person' =>$customer_id, 'nri_no' =>$nri_no, 'ref_type' =>$ref_type, 'enquiry_layout' =>$enquiry_layout_id, ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','result'=>$result,'message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } /* }else { $message=['status'=>'Fail','message'=>'Phone number already exists']; }*/ } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //delete customer public function delete_customer_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_bookings'; $condition=array('customer_id'=>$id,'delete_status'=>'ACTIVE'); $get_row =$this->MMG_model->get_where_row($table,$condition); if(empty($get_row)) { $table='mmg_customer'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=>'You Cant Delete this Data,Its Already Booked']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //update customer followups public function update_customer_followups_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->input_stream('customer_id'); $description = $this->input->input_stream('description'); $progress = $this->input->input_stream('progress'); //print_r($progress);die(); $login_id = $this->input->input_stream('login_id'); $udpated_at = date('Y-m-d H:i:s'); $table='mmg_customer'; $condition=array('id'=>$customer_id); $data_update= array( 'description'=>$description, 'enquiry_status'=>$progress, 'updated_on'=>$udpated_at, 'enquiry_date'=>$udpated_at, 'updated_by'=>$login_id ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //update customer site visit public function update_customer_site_visiting_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->input_stream('customer_id'); $description = $this->input->input_stream('description'); $progress = $this->input->input_stream('progress'); //print_r($progress);die(); $login_id = $this->input->input_stream('login_id'); $udpated_at = date('Y-m-d H:i:s'); $table='mmg_customer'; $condition=array('id'=>$customer_id); $data_update= array( 'site_visiting_description'=>$description, 'site_visiting_status'=>$progress, 'site_visiting_date'=>$udpated_at, 'updated_on'=>$udpated_at, 'updated_by'=>$login_id ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //insert customers //edit customer details public function edit_customer_more_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $result=$this->MMG_model->get_customer_more_details($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer followup list public function get_customer_followups_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); /* $sidx=$this->input->get('sidx'); $limit=$this->input->get('limit'); $start=$this->input->get('start'); $sord=$this->input->get('sord'); $page=$this->input->get('page'); if(!$sidx) $sidx =1; $count=count($this->MMG_model->counting_list($id)); //print_r($count); die(); if( $count > 0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; // $query = $this->Model->getdatarate($start,$limit,$sidx,$sord,$where,$client_code); $query = $this->MMG_model->get_customer_followups_list($start,$limit,$sidx,$sord,$id); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { // print_r($row['id']); die(); $responce["rows"][$i]['id']=$row['id']; $responce["rows"][$i]['cell']=array($row['name'],$row['enquiry_layout'],,$row['reference_type'],$row['ref_from'],$row['ref_layout'],$row['ref_site_number'],$row['remarks'],$row['enquiry_status'],$row['created'],$row['created_by'],$row['created_time']); $i++; }*/ $result=$this->MMG_model->get_customer_followups_list($id); //print_r($result); die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer followup list public function get_customer_sitevisiting_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result=$this->MMG_model->get_customer_sitevisiting_list($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer list public function customer_today_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_customer'; //$current_date = date('Y-m-d'); $where = array('delete_status'=>'ACTIVE'); $id = $this->input->get('id'); $result=$this->MMG_model->get_customer_today_list($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer list public function approve_customer_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id=$this->input->get('customer_id'); $id=$this->input->get('id'); $table = 'mmg_approved_customers'; $order_by = 'id'; $details=$this->MMG_model->get_last_row_data($table,$order_by); if($details == '') { $approved_id = 1; $approved_with_id = 'IDNOMG-'.'01'; } else { $approved_id = $details->approved_id+1; if($approved_id >= 10) { $approved_ids = str_pad($approved_id, 2, '0', STR_PAD_LEFT); } else { $approved_ids = $approved_id; } $approved_with_id = 'IDNOMG-0'.$approved_ids; } $data = array( 'approval_status'=>'APPROVED', 'customer_id' => $customer_id, 'approved_id'=>$approved_id, 'approved_with_id'=>$approved_with_id, 'approved_date'=>$date, 'approved_by'=>$id, ); $result= $this->MMG_model->insert($data,$table); if($result) { $table = 'mmg_customer'; $where =array('id'=>$customer_id); $data = array( 'approval_status'=>'APPROVED'); $result= $this->MMG_model->update($where,$table,$data); if($result > 0) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function land_owner_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_land_owner'; $where = array('delete_status'=>'ACTIVE','layout_status'=>'ADDED'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customer_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //----------------------------------------------------shwetha ------------------------------------------------------// //Attendance List public function get_attendance_list_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { /*$table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE');*/ $result=$this->MMG_model->get_attendance_list(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_staffwise_attendance_list_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $employee_id = $this->input->get('employee_id'); $result = $this->MMG_model->get_staffwise_attendance_list($employee_id); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data Found']; } } else { $message = ['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_monthwise_attendance_list_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $month = $this->input->get('month'); $result = $this->MMG_model->get_monthwise_attendance_list($month); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data Found']; } } else { $message = ['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_yearwise_attendance_list_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $year = $this->input->get('year'); $result = $this->MMG_model->get_yearwise_attendance_list($year); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data Found']; } } else { $message = ['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_attendance_details_put() { $date = $this->input->input_stream('date'); $signature = $this->input->input_stream('signature'); $pubKey = $this->input->input_stream('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $id = $this->input->input_stream('id'); $table = 'mmg_employee_attendance'; $data = array('delete_status'=>'INACTIVE'); $where = array('id'=>$id); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Apply Leave public function apply_employee_leave_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $employee_id = $this->input->post('employee_id'); $leave_date = $this->input->post('leave_date'); $leave_date = date('Y-m-d',strtotime($leave_date)); $leave_type = $this->input->post('leave_type'); $reason = $this->input->post('reason'); $handover_emp_id = $this->input->post('handover_emp_id'); $note = $this->input->post('note'); $table = 'mmg_apply_leave'; $data = array( 'employee_id' => $employee_id, 'leave_date' => $leave_date, 'leave_type' => $leave_type, 'reason' => $reason, 'handover_emp_id' => $handover_emp_id, 'note' => $note, 'created_on' => $date ); $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Applied Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_leave_applications_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->leave_applications(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function leave_approval_post() { $leave_id = $this->input->post('leave_id'); $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = "mmg_apply_leave"; $where = array('id'=>$leave_id); $data = array('approval'=>'APPROVED'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Approved Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Could Not Approve..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_leave_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('leave_id'); $table = "mmg_apply_leave"; $data = array('id'=>$id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_employee_leave_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $leave_id = $this->input->post('leave_id'); $employee_id = $this->input->post('employee_id'); $leave_date = $this->input->post('leave_date'); $leave_date = date('Y-m-d',strtotime($leave_date)); $leave_type = $this->input->post('leave_type'); $reason = $this->input->post('reason'); $handover_emp_id = $this->input->post('handover_emp_id'); $note = $this->input->post('note'); $table = 'mmg_apply_leave'; $where = array('id'=>$leave_id); $data = array( 'employee_id' => $employee_id, 'leave_date' => $leave_date, 'leave_type' => $leave_type, 'reason' => $reason, 'handover_emp_id' => $handover_emp_id, 'note' => $note, 'updated_on' => $date ); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully..']; } else { $message=['status'=>'Fail','message'=>'Same data updated..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_leave_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $leave_id = $this->input->post('leave_id'); $table = "mmg_apply_leave"; $where = array('id'=>$leave_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function latest_payment_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result=$this->MMG_model->latest_payment_list(); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_attendance_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_employee_attendance($date); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Budget Approval public function budget_approval_post() { $budget_id = $this->input->post('id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_budget"; $where = array('id'=>$budget_id); $data = array('approval'=>'APPROVED'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Approved Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Could Not Approve..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } // Add employee salary public function add_employee_salary_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id = $this->input->post('emp_id'); $basic = $this->input->post('basic'); $basic = str_replace(',','',$basic); $hra = $this->input->post('hra'); $hra = str_replace(',','',$hra); $special_allowance = $this->input->post('special_allowance'); $special_allowance = str_replace(',','',$special_allowance); $pf = $this->input->post('pf'); $pf = str_replace(',','',$pf); $esi = $this->input->post('esi'); $esi = str_replace(',','',$esi); $prof_tax = $this->input->post('prof_tax'); $prof_tax = str_replace(',','',$prof_tax); $gross_earning = $this->input->post('gross_earning'); $gross_earning = str_replace(',','',$gross_earning); $gross_deduction = $this->input->post('gross_deduction'); $gross_deduction = str_replace(',','',$gross_deduction); $net_pay = $this->input->post('net_pay'); $net_pay = str_replace(',','',$net_pay); $table = 'mmg_salary'; $data = array( 'emp_id' => $emp_id, 'basic' => $basic, 'hra' => $hra, 'pf' => $pf, 'esi' => $esi, 'prof_tax' => $prof_tax, 'special_allowance' => $special_allowance, 'gross_earning' => $gross_earning, 'gross_deduction' => $gross_deduction, 'net_pay' => $net_pay, 'created_at' => $date ); $where = array('emp_id'=>$emp_id,'delete_status'=>'ACTIVE'); $sal_res = $this->MMG_model->get_where_count($table,$where); if($sal_res < 1) { $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=>'This employee salary details already exists..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function salary_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_emp_salary_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_salary_get() { $sal_id = $this->input->get('salary_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_salary"; $where = array('salary_id'=>$sal_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_salary_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id = $this->input->post('emp_id'); $basic = $this->input->post('basic'); $basic = str_replace(',','',$basic); $hra = $this->input->post('hra'); $hra = str_replace(',','',$hra); $special_allowance = $this->input->post('special_allowance'); $special_allowance = str_replace(',','',$special_allowance); $pf = $this->input->post('pf'); $pf = str_replace(',','',$pf); $esi = $this->input->post('esi'); $esi = str_replace(',','',$esi); $prof_tax = $this->input->post('prof_tax'); $prof_tax = str_replace(',','',$prof_tax); $gross_earning = $this->input->post('gross_earning'); $gross_earning = str_replace(',','',$gross_earning); $gross_deduction = $this->input->post('gross_deduction'); $gross_deduction = str_replace(',','',$gross_deduction); $net_pay = $this->input->post('net_pay'); $net_pay = str_replace(',','',$net_pay); $table = 'mmg_salary'; $where = array('emp_id'=>$emp_id); $data = array( 'basic' => $basic, 'hra' => $hra, 'pf' => $pf, 'esi' => $esi, 'prof_tax' => $prof_tax, 'special_allowance' => $special_allowance, 'gross_earning' => $gross_earning, 'gross_deduction' => $gross_deduction, 'net_pay' => $net_pay, 'updated_at' => $date ); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully..']; } else { $message=['status'=>'Fail','message'=>'Same data updated..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_salary_post() { $sal_id = $this->input->post('salary_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_salary"; $where = array('salary_id'=>$sal_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_id_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_emp_id(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } /*public function add_new_employee_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee_id = $this->input->post('employee_id'); $e_id = $this->input->post('e_id'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $full_name = $first_name." ".$last_name; $gender = $this->input->post('gender'); $department_id = $this->input->post('department_id'); $country = $this->input->post('country'); $state = $this->input->post('state'); $district = $this->input->post('district'); $project = $this->input->post('project'); $email_id = $this->input->post('email_id'); $reporting_to = $this->input->post('reporting_to'); $date_of_joining = $this->input->post('date_of_joining'); $phone = $this->input->post('phone'); $password = $this->input->post('password'); $otp = mt_rand(100000, 999999); $employee_status = $this->input->post('employee_status'); $employee_type = $this->input->post('employee_type'); $cl = $this->input->post('cl'); $ml = $this->input->post('ml'); $role_id = $this->input->post('role_id'); $bank_name = $this->input->post('bank_name'); $account_no = $this->input->post('account_no'); $ifsc_code = $this->input->post('ifsc_code'); $pan_no = $this->input->post('pan_no'); $aadhar_no = $this->input->post('aadhar_no'); $date_of_birth = $this->input->post('date_of_birth'); $address = $this->input->post('address'); $residential_address = $this->input->post('residential_address'); $personal_email_id = $this->input->post('personal_email_id'); $marital_status = $this->input->post('marital_status'); $father_name = $this->input->post('father_name'); $husband_name = $this->input->post('husband_name'); $job_description = $this->input->post('job_description'); $about_me = $this->input->post('about_me'); $date_of_exit = $this->input->post('date_of_exit'); $bank_detail = $this->input->post('bank_detail'); $pan_upload = $this->input->post('pan_upload'); $aadhar_upload = $this->input->post('aadhar_upload'); $profile = $this->input->post('profile'); $table = 'mmg_employees'; $data = array( 'employee_id' => $employee_id, 'e_id' => $e_id, 'first_name' => $first_name, 'last_name' => $last_name, 'full_name' => $full_name, 'gender' => $gender, 'department_id' => $department_id, 'country' => $country, 'state' => $state, 'district' => $district, 'project' => $project, 'email_id' => $email_id, 'reporting_to' => $reporting_to, 'date_of_joining' => $date_of_joining, 'phone' => $phone, 'password' => $password, 'otp' => $otp, 'employee_status' => $employee_status, 'employee_type' => $employee_type, 'cl' => $cl, 'ml' => $ml, 'role_id' => $role_id, 'bank_name' => $bank_name, 'account_no' => $account_no, 'ifsc_code' => $ifsc_code, 'pan_no' => $pan_no, 'aadhar_no' => $aadhar_no, 'date_of_birth' => $date_of_birth, 'address' => $address, 'residential_address' => $residential_address, 'personal_email_id' => $personal_email_id, 'marital_status' => $marital_status, 'father_name' => $father_name, 'husband_name' => $husband_name, 'job_description' => $job_description, 'about_me' => $about_me, 'date_of_exit' => $date_of_exit, 'bank_detail' => $bank_detail, 'pan_upload' => $pan_upload, 'aadhar_upload' => $aadhar_upload, 'profile' => $profile, 'delete_status' => 'ACTIVE', 'created_at' => $date ); $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); }*/ public function add_new_employee_post() { $logout_ampm = $this->input->post('logout_ampm'); $logout_time = $this->input->post('logout_time'); $login_ampm = $this->input->post('login_ampm'); $login_time = $this->input->post('login_time'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee_id = $this->input->post('employee_id'); $e_id = $this->input->post('e_id'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $full_name = $first_name." ".$last_name; $gender = $this->input->post('gender'); $department_id = $this->input->post('department_id'); $country = $this->input->post('country'); $state = $this->input->post('state'); $district = $this->input->post('district'); $project = $this->input->post('project'); $email_id = $this->input->post('email_id'); $reporting_to = $this->input->post('reporting_to'); $date_of_joining = $this->input->post('date_of_joining'); $phone = $this->input->post('phone'); $password = $this->input->post('password'); $otp = mt_rand(100000, 999999); $employee_status = $this->input->post('employee_status'); $employee_type = $this->input->post('employee_type'); $cl = $this->input->post('cl'); $ml = $this->input->post('ml'); $role_id = $this->input->post('role_id'); $bank_name = $this->input->post('bank_name'); $account_no = $this->input->post('account_no'); $ifsc_code = $this->input->post('ifsc_code'); $pan_no = $this->input->post('pan_no'); $aadhar_no = $this->input->post('aadhar_no'); $date_of_birth = $this->input->post('date_of_birth'); $address = $this->input->post('address'); $residential_address = $this->input->post('residential_address'); $personal_email_id = $this->input->post('personal_email_id'); $marital_status = $this->input->post('marital_status'); $father_name = $this->input->post('father_name'); $husband_name = $this->input->post('husband_name'); $job_description = $this->input->post('job_description'); $about_me = $this->input->post('about_me'); $date_of_exit = $this->input->post('date_of_exit'); $bank_detail = $this->input->post('bank_detail'); $pan_upload = $this->input->post('pan_upload'); $aadhar_upload = $this->input->post('aadhar_upload'); $profile = $this->input->post('profile'); $esi_number = $this->input->post('esi_number'); $esi_date_of_joining= $this->input->post('esi_date_of_joining'); $pf_number = $this->input->post('pf_number'); $pf_date_of_joining = $this->input->post('pf_date_of_joining'); $uan_number = $this->input->post('uan_number'); $uan_date_of_joining= $this->input->post('uan_date_of_joining'); $table = 'mmg_employees'; $data = array( 'employee_id' => $employee_id, 'e_id' => $e_id, 'first_name' => $first_name, 'last_name' => $last_name, 'full_name' => $full_name, 'gender' => $gender, 'department_id' => $department_id, 'country' => $country, 'state' => $state, 'district' => $district, 'project' => $project, 'email_id' => $email_id, 'reporting_to' => $reporting_to, 'date_of_joining' => $date_of_joining, 'phone' => $phone, 'password' => $password, 'otp' => $otp, 'employee_status' => $employee_status, 'employee_type' => $employee_type, 'cl' => $cl, 'ml' => $ml, 'role_id' => $role_id, 'bank_name' => $bank_name, 'account_no' => $account_no, 'ifsc_code' => $ifsc_code, 'pan_no' => $pan_no, 'aadhar_no' => $aadhar_no, 'date_of_birth' => $date_of_birth, 'address' => $address, 'residential_address' => $residential_address, 'personal_email_id' => $personal_email_id, 'marital_status' => $marital_status, 'father_name' => $father_name, 'husband_name' => $husband_name, 'job_description' => $job_description, 'about_me' => $about_me, 'date_of_exit' => $date_of_exit, 'bank_detail' => $bank_detail, 'pan_upload' => $pan_upload, 'aadhar_upload' => $aadhar_upload, 'profile' => $profile, 'esi_number' => $esi_number, 'esi_date_of_joining'=> $esi_date_of_joining, 'pf_number' => $pf_number, 'pf_date_of_joining'=> $pf_date_of_joining, 'uan_number' => $uan_number, 'uan_date_of_joining'=> $uan_date_of_joining, 'delete_status' => 'ACTIVE', 'created_at' => $date, 'login_time'=>$login_time, 'login_ampm'=>$login_ampm, 'logout_time'=>$logout_time, 'logout_ampm'=>$logout_ampm ); $result = $this->MMG_model->insert($data,$table); if($result) { $where = array('emp_id'=>$result); $details = $this->MMG_model->get_where_row($table,$where); $data_login = array( 'user_id' =>$details->emp_id, 'name' =>$details->full_name, 'department' =>$details->department_id, 'phone' =>$details->phone, 'password' =>$details->password, 'profile_image'=>$result->profile_image, 'role_id' =>'2', 'created_at' =>$date, 'created_by' =>$details->emp_id, ); $table_login = 'mmg_login'; $result = $this->MMG_model->insert($data_login,$table_login); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $department_id=$this->input->get('department_id'); $result = $this->MMG_model->employee_list($department_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_employee_post() { $emp_id = $this->input->post('emp_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_employees"; $where = array('emp_id'=>$emp_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); $resultdata = $this->MMG_model->get_emp_data($emp_id); if($resultdata) { $where_emp = array('user_id'=>$resultdata->employee_id); $data_login = array( 'delete_status'=>'INACTIVE' ); $table_login = "mmg_login"; $resulted = $this->MMG_model->update($where_emp,$table_login,$data_login); // print_r($resulted);die(); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_employee_get() { $emp_id = $this->input->get('emp_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_employees"; $where = array('emp_id'=>$emp_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_employee_post() { $logout_ampm = $this->input->post('logout_ampm'); $logout_time = $this->input->post('logout_time'); $login_ampm = $this->input->post('login_ampm'); $login_time = $this->input->post('login_time'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id = $this->input->post('emp_id'); $employee_id = $this->input->post('employee_id'); $password = $this->input->post('password'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $full_name = $first_name." ".$last_name; $gender = $this->input->post('gender'); $department_id = $this->input->post('department_id'); $country = $this->input->post('country'); $state = $this->input->post('state'); $district = $this->input->post('district'); $project = $this->input->post('project'); $email_id = $this->input->post('email_id'); $reporting_to = $this->input->post('reporting_to'); $date_of_joining = $this->input->post('date_of_joining'); $phone = $this->input->post('phone'); $employee_status = $this->input->post('employee_status'); $employee_type = $this->input->post('employee_type'); $cl = $this->input->post('cl'); $ml = $this->input->post('ml'); $role_id = $this->input->post('role_id'); $bank_name = $this->input->post('bank_name'); $account_no = $this->input->post('account_no'); $ifsc_code = $this->input->post('ifsc_code'); $pan_no = $this->input->post('pan_no'); $aadhar_no = $this->input->post('aadhar_no'); $date_of_birth = $this->input->post('date_of_birth'); $address = $this->input->post('address'); $residential_address= $this->input->post('residential_address'); $personal_email_id = $this->input->post('personal_email_id'); $marital_status = $this->input->post('marital_status'); $father_name = $this->input->post('father_name'); $husband_name = $this->input->post('husband_name'); $job_description = $this->input->post('job_description'); $about_me = $this->input->post('about_me'); $date_of_exit = $this->input->post('date_of_exit'); $bank_detail = $this->input->post('bank_detail'); $pan_upload = $this->input->post('pan_upload'); $aadhar_upload = $this->input->post('aadhar_upload'); $profile = $this->input->post('profile'); $esi_number = $this->input->post('esi_number'); $esi_date_of_joining= $this->input->post('esi_date_of_joining'); $pf_number = $this->input->post('pf_number'); $pf_date_of_joining = $this->input->post('pf_date_of_joining'); $uan_number = $this->input->post('uan_number'); $uan_date_of_joining= $this->input->post('uan_date_of_joining'); if(!empty($bank_detail)) { $bank_detail = $this->input->post('bank_detail'); } else { $where = array('emp_id'=>$emp_id); $table = 'mmg_employees'; $get_details = $this->MMG_model->get_where_row($table,$where); $bank_detail = $get_details->bank_detail; } if(!empty($pan_upload)) { $pan_upload = $this->input->post('pan_upload'); } else { $where = array('emp_id'=>$emp_id); $table = 'mmg_employees'; $get_details = $this->MMG_model->get_where_row($table,$where); $pan_upload = $get_details->pan_upload; } if(!empty($aadhar_upload)) { $aadhar_upload = $this->input->post('aadhar_upload'); } else { $where = array('emp_id'=>$emp_id); $table = 'mmg_employees'; $get_details = $this->MMG_model->get_where_row($table,$where); $aadhar_upload = $get_details->aadhar_upload; } if(!empty($profile)) { $profile = $this->input->post('profile'); } else { $where = array('emp_id'=>$emp_id); $table = 'mmg_employees'; $get_details = $this->MMG_model->get_where_row($table,$where); $profile = $get_details->profile; } $table = "mmg_employees"; $where = array('emp_id'=>$emp_id); $data = array( 'employee_id' => $employee_id, 'password' => $password, 'first_name' => $first_name, 'last_name' => $last_name, 'full_name' => $full_name, 'gender' => $gender, 'department_id' => $department_id, 'country' => $country, 'state' => $state, 'district' => $district, 'project' => $project, 'email_id' => $email_id, 'reporting_to' => $reporting_to, 'date_of_joining' => $date_of_joining, 'phone' => $phone, 'employee_status' => $employee_status, 'employee_type' => $employee_type, 'cl' => $cl, 'ml' => $ml, 'role_id' => $role_id, 'bank_name' => $bank_name, 'account_no' => $account_no, 'ifsc_code' => $ifsc_code, 'pan_no' => $pan_no, 'aadhar_no' => $aadhar_no, 'date_of_birth' => $date_of_birth, 'address' => $address, 'residential_address' => $residential_address, 'personal_email_id' => $personal_email_id, 'marital_status' => $marital_status, 'father_name' => $father_name, 'husband_name' => $husband_name, 'job_description' => $job_description, 'about_me' => $about_me, 'date_of_exit' => $date_of_exit, 'esi_number' => $esi_number, 'esi_date_of_joining'=> $esi_date_of_joining, 'pf_number' => $pf_number, 'pf_date_of_joining'=> $pf_date_of_joining, 'uan_number' => $uan_number, 'uan_date_of_joining'=> $uan_date_of_joining, 'bank_detail' => $bank_detail, 'pan_upload' => $pan_upload, 'aadhar_upload' => $aadhar_upload, 'profile' => $profile, 'delete_status' => 'ACTIVE', 'updated_at' => $date, 'login_time'=>$login_time, 'login_ampm'=>$login_ampm, 'logout_time'=>$logout_time, 'logout_ampm'=>$logout_ampm ); $result = $this->MMG_model->update($where,$table,$data); $resultdata = $this->MMG_model->edit_emp_details($emp_id); // print_r($resultdata);die(); if($resultdata) { $where_emp = array('user_id'=>$resultdata->user_id); $data_login = array( 'department' => $department_id, 'phone' => $phone, 'name' => $full_name, ); $table_login = 'mmg_login'; $resulted = $this->MMG_model->update($where_emp,$table_login,$data_login); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully..']; } else { $message=['status'=>'Fail','message'=>'Same data updated..']; } } else { $message=['status'=>'Fail','message'=>'No data found in user login']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Annexure Master public function add_annexure_details_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->post('login_id'); $type_of_work = $this->input->post('type_of_work'); $foundation_level = $this->input->post('foundation_level'); $unit_quantity = $this->input->post('unit_quantity'); // $gst = $this->input->post('gst'); $created_at = date('Y-m-d H:i:s'); $data = array( 'type_of_work' => $type_of_work, 'foundation_level' => $foundation_level, 'unit_quantity' => $unit_quantity, // 'gst' => $gst, 'created_by' => $login_id, 'created_on' => $created_at); $table = 'mmg_annexure'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully..']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_annexure_master_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = "mmg_annexure"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_annexure_details_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('edit_id'); $table = "mmg_annexure"; $data = array('id'=>$id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_annexure_details_put() { $date = $this->input->input_stream('date'); $signature = $this->input->input_stream('signature'); $pubKey = $this->input->input_stream('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $login_id = $this->input->input_stream('login_id'); $up_id = $this->input->input_stream('up_id'); $type_of_work = $this->input->input_stream('type_of_work'); $foundation_level = $this->input->input_stream('foundation_level'); $unit_quantity = $this->input->input_stream('unit_quantity'); // $gst = $this->input->input_stream('gst'); $updated_at = date('Y-m-d H:i:s'); $where = array('id'=>$up_id); $table = 'mmg_annexure'; $data = array( 'type_of_work' =>$type_of_work, 'foundation_level' =>$foundation_level, 'unit_quantity' =>$unit_quantity, //'gst' =>$gst, 'updated_by' =>$login_id, 'updated_on' =>$updated_at ); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully..']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_annexure_details_put() { $date = $this->input->input_stream('date'); $signature = $this->input->input_stream('signature'); $pubKey = $this->input->input_stream('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $del_id = $this->input->input_stream('del_id'); $where = array('id'=>$del_id); $table = 'mmg_annexure'; $data = array('delete_status'=>'INACTIVE'); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted successfully..']; } else { $message=['status'=>'Fail','message'=>'Could Not Delete']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edited_budget_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result=$this->MMG_model->get_edited_budget_results(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //------------------------------------------------------------------------------------------------------------// //customer details list public function customer_details_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result=$this->MMG_model->get_customer_details(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $where=array('delete_status'=>'Active'); $result = $this->MMG_model->get_emp_list($where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function state_id_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_states"; $result = $this->MMG_model->get_all_result($table); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function state_district_details_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $state_id = $this->input->post("state_id"); $table = "mmg_districts"; $where = array("state_id"=>$state_id); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer datewise list public function get_datewise_customer_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $from_date=$this->input->get('from_date'); $id=$this->input->get('id'); $to_date=$this->input->get('to_date'); $table = 'mmg_customer'; $result=$this->MMG_model->get_datewise_customer_list($from_date,$to_date,$id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer monthwise list public function get_monthwise_customer_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $month=$this->input->get('month'); $id = $this->input->get('id'); $table = 'mmg_customer'; $result=$this->MMG_model->get_monthwise_customer_list($month,$id); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //customer yearwise list public function get_yearwise_customer_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $year=$this->input->get('year'); $id=$this->input->get('id'); $table = 'mmg_customer'; $result=$this->MMG_model->get_yearwise_customer_list($year,$id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //todays followups count public function get_todays_followups_count_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result=$this->MMG_model->get_todays_followups_count($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //expired followups count public function get_expired_followups_count_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result=$this->MMG_model->get_expired_followups_count($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //total callback count public function get_total_callback_count_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result=$this->MMG_model->get_total_callback_count($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //expired callback count public function get_expired_callback_count_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result=$this->MMG_model->get_expired_callback_count($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function department_id_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_department"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //layout module public function layout_name_new_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_layout_names_adding(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function layout_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_layout_names(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fetch_owner_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_name = $this->input->post("layout_name"); $table = "mmg_land_owner"; $where = array("layout_name"=>$layout_name,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function agent_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_agent_name(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_layout_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $stamp_duty_per = $this->input->post('stamp_duty_per'); $per_sq_ft = $this->input->post('per_sq_ft'); $login_id = $this->input->post('login_id'); $layout_name = $this->input->post('layout_name'); $agent_name = $this->input->post('agent_name'); $layout_address = $this->input->post('layout_address'); $sub_register_address = $this->input->post('sub_register_address'); $land_owners = $this->input->post('land_owners'); $bank_name = $this->input->post('bank_name'); $discount = $this->input->post('discount'); $discount = str_replace(',','',$discount); $register_value = $this->input->post('register_value'); $register_value = str_replace(',','',$register_value); $stamp_duty_percent = $this->input->post('stamp_duty_percent'); $stamp_duty = $this->input->post('stamp_duty'); $fees_percent = $this->input->post('fees_percent'); $fees = $this->input->post('fees'); $stamp_cess_percent = $this->input->post('stamp_cess_percent'); $stamp_cess = $this->input->post('stamp_cess'); $total_value = $this->input->post('total_value'); $total_area = $this->input->post('total_area'); $total_area = str_replace(',','',$total_area); $landlord_share = $this->input->post('landlord_share'); $landlord_share = str_replace(',','',$landlord_share); $balance_area = $this->input->post('balance_area'); $total_company_area = $this->input->post('total_company_area'); $total_company_area = str_replace(',','',$total_company_area); $land_purchased_amount = $this->input->post('land_purchased_amount'); $land_purchased_amount = str_replace(',','',$land_purchased_amount); $muda_fees = $this->input->post('muda_fees'); $muda_fees = str_replace(',','',$muda_fees); $cd_patti = $this->input->post('cd_patti'); $cd_patti = str_replace(',','',$cd_patti); $plan_expenditure = $this->input->post('plan_expenditure'); $plan_expenditure = str_replace(',','',$plan_expenditure); $individual_site_khata = $this->input->post('individual_site_khata'); $individual_site_khata = str_replace(',','',$individual_site_khata); $relinguish_expenditure = $this->input->post('relinguish_expenditure'); $relinguish_expenditure = str_replace(',','',$relinguish_expenditure); $layout_development = $this->input->post('layout_development'); $layout_development = str_replace(',','',$layout_development); $work_order = $this->input->post('work_order'); $work_order = str_replace(',','',$work_order); $work_order_expenditure = $this->input->post('work_order_expenditure'); $work_order_expenditure = str_replace(',','',$work_order_expenditure); $register_expenses = $this->input->post('register_expenses'); $register_expenses = str_replace(',','',$register_expenses); $keb_fees = $this->input->post('keb_fees'); $keb_fees = str_replace(',','',$keb_fees); $water_board = $this->input->post('water_board'); $water_board = str_replace(',','',$water_board); $water_board_expenditure = $this->input->post('water_board_expenditure'); $water_board_expenditure = str_replace(',','',$water_board_expenditure); $stp = $this->input->post('stp'); $stp = str_replace(',','',$stp); $pollution_control_board = $this->input->post('pollution_control_board'); $pollution_control_board = str_replace(',','',$pollution_control_board); $others = $this->input->post('others'); $others = str_replace(',','',$others); $modt_charges = $this->input->post('modt_charges'); $modt_charges = str_replace(',','',$modt_charges); $bank_total_amount1 = $this->input->post('bank_total_amount1'); $bank_total_amount1 = str_replace(',','',$bank_total_amount1); $bank_int_percent1 = $this->input->post('bank_int_percent1'); $bank_interest1 = $this->input->post('bank_interest1'); $bank_interest_month1 = $this->input->post('bank_interest_month1'); $bank_interest_amt1 = $this->input->post('bank_interest_amt1'); $bank_total_amount2 = $this->input->post('bank_total_amount2'); $bank_total_amount2 = str_replace(',','',$bank_total_amount2); $bank_int_percent2 = $this->input->post('bank_int_percent2'); $bank_interest2 = $this->input->post('bank_interest2'); $bank_interest_month2 = $this->input->post('bank_interest_month2'); $bank_interest_amt2 = $this->input->post('bank_interest_amt2'); $total_expenditure_charges = $this->input->post('total_expenditure_charges'); $per_sqft_amount = $this->input->post('per_sqft_amount'); $residential_company_area = $this->input->post('residential_company_area'); $upload_layout = $this->input->post('upload_layout'); $brochure = $this->input->post('brochure'); $location_map = $this->input->post('location_map'); $residential = $this->input->post('residential'); $land_type = $this->input->post('land_type'); $upload_image = $this->input->post('upload_image'); $upload_vedio = $this->input->post('upload_vedio'); $message_text = $this->input->post('message_text'); $layout_status = $this->input->post('layout_status'); $res_sqft = $this->input->post('res_sqft'); $land_per_cost = $this->input->post('land_per_cost'); $reg_val = $this->input->post('reg_val'); $rem_pay = $this->input->post('rem_pay'); $reg_charge = $this->input->post('reg_charge'); $total = $this->input->post('total'); $created_at = date('Y-m-d H:i:s'); $data= array('layout_name' => $layout_name, 'agent_name' => $agent_name, 'layout_address' => $layout_address, 'sub_register_address' => $sub_register_address, 'land_owners' => $land_owners, //'bank_name' => $bank_name, 'discount' => $discount, 'register_value' => $register_value, 'stamp_duty_percent' => $stamp_duty_percent, 'stamp_duty' => $stamp_duty, //'fees_percent' => $fees_percent, //'fees' => $fees, //'stamp_cess_percent' => $stamp_cess_percent, //'stamp_cess' => $stamp_cess, 'total_value' => $total_value, 'total_area' => $total_area, 'landlord_share' => $landlord_share, 'balance_area' => $balance_area, 'total_company_area' => $total_company_area, 'land_purchased_amount' => $land_purchased_amount, 'muda_fees' => $muda_fees, 'cd_patti' => $cd_patti, 'plan_expenditure' => $plan_expenditure, 'individual_site_khata' => $individual_site_khata, 'relinguish_expenditure' => $relinguish_expenditure, 'work_order' => $work_order, 'work_order_expenditure' => $work_order_expenditure, 'layout_development' => $layout_development, 'register_expenses' => $register_expenses, 'keb_fees' => $keb_fees, 'water_board' => $water_board, 'water_board_expenditure' => $water_board_expenditure, 'stp' => $stp, 'pollution_control_board' => $pollution_control_board, 'others' => $others, 'modt_charges' => $modt_charges, 'bank_total_amount1' => $bank_total_amount1, 'bank_int_percent1' => $bank_int_percent1, 'bank_interest1' => $bank_interest1, 'bank_interest_month1' => $bank_interest_month1, 'bank_interest_amt1' => $bank_interest_amt1, 'bank_total_amount2' => $bank_total_amount2, 'bank_int_percent2' => $bank_int_percent2, 'bank_interest2' => $bank_interest2, 'bank_interest_month2' => $bank_interest_month2, 'bank_interest_amt2' => $bank_interest_amt2, 'total_expenditure_charges' => $total_expenditure_charges, 'per_sqft_amount' => $per_sqft_amount, 'residential_company_area' => $residential_company_area, 'upload_layout' => $upload_layout, 'brochure' => $brochure, 'location_map' => $location_map, 'created_by' => $login_id, 'created_on' => $created_at, 'residential' => $residential, 'land_type' => $land_type, 'message_text' =>$message_text, 'upload_image' =>$upload_image, 'upload_vedio' =>$upload_vedio, 'layouts_stamp_duty ' => $stamp_duty_per, 'per_sq_ft' => $per_sq_ft, 'res_sqft'=>$res_sqft, 'land_per_cost'=>$land_per_cost, 'reg_val'=>$reg_val, 'rem_pay'=>$rem_pay, 'reg_charge'=>$reg_charge, 'total'=>$total, 'layout_status' =>$layout_status ); $table = 'mmg_layouts'; $result=$this->MMG_model->insert($data,$table); if($result) { $result1 = $this->MMG_model->layout_status($result); if($result1) { $data=array('layout_status'=>'ADDED'); $table = 'mmg_land_owner'; $where=array('id'=>$result1->land_owners,'delete_status'=>'ACTIVE'); $resulted = $this->MMG_model->update($where,$table,$data); if($resulted > 0) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_layout_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_layout_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_layout_post() { $layout_id = $this->input->post('layout_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_layouts"; $where = array('id'=>$layout_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); $result1= $this->MMG_model->get_where_row($table,$where); $data=array('layout_status'=>'PENDING'); $table = 'mmg_land_owner'; $where=array('id'=>$result1->land_owners,'delete_status'=>'ACTIVE'); $resulted = $this->MMG_model->update($where,$table,$data); if($resulted) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_layout_get() { $layout_id = $this->input->get('layout_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_layouts"; $where = array('id'=>$layout_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function layout_details_post() { $layout_id = $this->input->post('layout_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_layouts"; $where = array('id'=>$layout_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_layout_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->post('layout_id'); $login_id = $this->input->post('login_id'); $layout_name = $this->input->post('layout_name'); $agent_name = $this->input->post('agent_name'); $layout_address = $this->input->post('layout_address'); $sub_register_address = $this->input->post('sub_register_address'); $land_owners = $this->input->post('land_owners'); $bank_name = $this->input->post('bank_name'); $discount = $this->input->post('discount'); $discount = str_replace(',','',$discount); $register_value = $this->input->post('register_value'); $register_value = str_replace(',','',$register_value); $stamp_duty_percent = $this->input->post('stamp_duty_percent'); $stamp_duty = $this->input->post('stamp_duty'); $fees_percent = $this->input->post('fees_percent'); $fees = $this->input->post('fees'); $stamp_cess_percent = $this->input->post('stamp_cess_percent'); $stamp_cess = $this->input->post('stamp_cess'); $total_value = $this->input->post('total_value'); $total_area = $this->input->post('total_area'); $total_area = str_replace(',','',$total_area); $landlord_share = $this->input->post('landlord_share'); $landlord_share = str_replace(',','',$landlord_share); $balance_area = $this->input->post('balance_area'); $total_company_area = $this->input->post('total_company_area'); $total_company_area = str_replace(',','',$total_company_area); $land_purchased_amount = $this->input->post('land_purchased_amount'); $land_purchased_amount = str_replace(',','',$land_purchased_amount); $muda_fees = $this->input->post('muda_fees'); $muda_fees = str_replace(',','',$muda_fees); $cd_patti = $this->input->post('cd_patti'); $cd_patti = str_replace(',','',$cd_patti); $plan_expenditure = $this->input->post('plan_expenditure'); $plan_expenditure = str_replace(',','',$plan_expenditure); $individual_site_khata = $this->input->post('individual_site_khata'); $individual_site_khata = str_replace(',','',$individual_site_khata); $relinguish_expenditure = $this->input->post('relinguish_expenditure'); $relinguish_expenditure = str_replace(',','',$relinguish_expenditure); $layout_development = $this->input->post('layout_development'); $layout_development = str_replace(',','',$layout_development); $work_order = $this->input->post('work_order'); $work_order = str_replace(',','',$work_order); $work_order_expenditure = $this->input->post('work_order_expenditure'); $work_order_expenditure = str_replace(',','',$work_order_expenditure); $register_expenses = $this->input->post('register_expenses'); $register_expenses = str_replace(',','',$register_expenses); $keb_fees = $this->input->post('keb_fees'); $keb_fees = str_replace(',','',$keb_fees); $water_board = $this->input->post('water_board'); $water_board = str_replace(',','',$water_board); $water_board_expenditure = $this->input->post('water_board_expenditure'); $water_board_expenditure = str_replace(',','',$water_board_expenditure); $stp = $this->input->post('stp'); $stp = str_replace(',','',$stp); $pollution_control_board = $this->input->post('pollution_control_board'); $pollution_control_board = str_replace(',','',$pollution_control_board); $others = $this->input->post('others'); $others = str_replace(',','',$others); $modt_charges = $this->input->post('modt_charges'); $modt_charges = str_replace(',','',$modt_charges); $bank_total_amount1 = $this->input->post('bank_total_amount1'); $bank_total_amount1 = str_replace(',','',$bank_total_amount1); $bank_int_percent1 = $this->input->post('bank_int_percent1'); $bank_interest1 = $this->input->post('bank_interest1'); $bank_interest_month1 = $this->input->post('bank_interest_month1'); $bank_interest_amt1 = $this->input->post('bank_interest_amt1'); $bank_total_amount2 = $this->input->post('bank_total_amount2'); $bank_total_amount2 = str_replace(',','',$bank_total_amount2); $bank_int_percent2 = $this->input->post('bank_int_percent2'); $bank_interest2 = $this->input->post('bank_interest2'); $bank_interest_month2 = $this->input->post('bank_interest_month2'); $bank_interest_amt2 = $this->input->post('bank_interest_amt2'); $total_expenditure_charges = $this->input->post('total_expenditure_charges'); $per_sqft_amount = $this->input->post('per_sqft_amount'); $residential_company_area = $this->input->post('residential_company_area'); $upload_layout = $this->input->post('upload_layout'); $brochure = $this->input->post('brochure'); $location_map = $this->input->post('location_map'); $land_type = $this->input->post('land_type'); $residential = $this->input->post('residential'); $upload_vedio = $this->input->post('upload_vedio'); $upload_image = $this->input->post('upload_image'); $message_text = $this->input->post('message_text'); $per_sq_ft = $this->input->post('per_sq_ft'); $stamp_duty_per = $this->input->post('stamp_duty_per'); $save_and_approve =$this->input->post('save_and_approve'); $layout_status = $this->input->post('layout_status'); $res_sqft = $this->input->post('res_sqft'); $land_per_cost = $this->input->post('land_per_cost'); $reg_val = $this->input->post('reg_val'); $rem_pay = $this->input->post('rem_pay'); $reg_charge = $this->input->post('reg_charge'); $total = $this->input->post('total'); $table = 'mmg_layouts'; $where = array('id'=>$layout_id); $result_img = $this->MMG_model->get_where_row($table,$where); if(empty($upload_vedio)) { $upload_vedio1 = $result_img->upload_vedio; } else { $upload_vedio1 = $upload_vedio; } if(empty($upload_image)) { $upload_image1 = $result_img->upload_image; } else { $upload_image1 = $upload_image; } $table = 'mmg_layouts'; $where = array('id'=>$layout_id); if($save_and_approve == 'save') { $data= array('layout_name' => $layout_name, 'agent_name' => $agent_name, 'layout_address' => $layout_address, 'sub_register_address' => $sub_register_address, 'land_owners' => $land_owners, 'bank_name' => $bank_name, 'discount' => $discount, 'register_value' => $register_value, 'stamp_duty_percent' => $stamp_duty_percent, 'stamp_duty' => $stamp_duty, 'fees_percent' => $fees_percent, 'fees' => $fees, 'stamp_cess_percent' => $stamp_cess_percent, 'stamp_cess' => $stamp_cess, 'total_value' => $total_value, 'total_area' => $total_area, 'landlord_share' => $landlord_share, 'balance_area' => $balance_area, 'total_company_area' => $total_company_area, 'land_purchased_amount' => $land_purchased_amount, 'muda_fees' => $muda_fees, 'cd_patti' => $cd_patti, 'plan_expenditure' => $plan_expenditure, 'individual_site_khata' => $individual_site_khata, 'relinguish_expenditure' => $relinguish_expenditure, 'work_order' => $work_order, 'work_order_expenditure' => $work_order_expenditure, 'layout_development' => $layout_development, 'register_expenses' => $register_expenses, 'keb_fees' => $keb_fees, 'water_board' => $water_board, 'water_board_expenditure' => $water_board_expenditure, 'stp' => $stp, 'pollution_control_board' => $pollution_control_board, 'others' => $others, 'modt_charges' => $modt_charges, 'bank_total_amount1' => $bank_total_amount1, 'bank_int_percent1' => $bank_int_percent1, 'bank_interest1' => $bank_interest1, 'bank_interest_month1' => $bank_interest_month1, 'bank_interest_amt1' => $bank_interest_amt1, 'bank_total_amount2' => $bank_total_amount2, 'bank_int_percent2' => $bank_int_percent2, 'bank_interest2' => $bank_interest2, 'bank_interest_month2' => $bank_interest_month2, 'bank_interest_amt2' => $bank_interest_amt2, 'total_expenditure_charges' => $total_expenditure_charges, 'upload_layout' => $upload_layout, 'brochure' => $brochure, 'location_map' => $location_map, 'per_sqft_amount' => $per_sqft_amount, 'residential_company_area' => $residential_company_area, 'created_by' => $login_id, 'residential' =>$residential, 'land_type' =>$land_type, 'message_text' =>$message_text, 'upload_image' =>$upload_image1, 'status' =>'NOT_APPROVED', 'upload_vedio' =>$upload_vedio1, 'layouts_stamp_duty' => $stamp_duty_per, 'per_sq_ft' => $per_sq_ft, 'res_sqft'=>$res_sqft, 'land_per_cost'=>$land_per_cost, 'reg_val'=>$reg_val, 'rem_pay'=>$rem_pay, 'reg_charge'=>$reg_charge, 'total'=>$total, 'layout_status' => $layout_status ); } else { $data= array('layout_name' => $layout_name, 'agent_name' => $agent_name, 'layout_address' => $layout_address, 'sub_register_address' => $sub_register_address, 'land_owners' => $land_owners, 'bank_name' => $bank_name, 'discount' => $discount, 'register_value' => $register_value, 'stamp_duty_percent' => $stamp_duty_percent, 'stamp_duty' => $stamp_duty, 'fees_percent' => $fees_percent, 'fees' => $fees, 'stamp_cess_percent' => $stamp_cess_percent, 'stamp_cess' => $stamp_cess, 'total_value' => $total_value, 'total_area' => $total_area, 'landlord_share' => $landlord_share, 'balance_area' => $balance_area, 'total_company_area' => $total_company_area, 'land_purchased_amount' => $land_purchased_amount, 'muda_fees' => $muda_fees, 'cd_patti' => $cd_patti, 'plan_expenditure' => $plan_expenditure, 'individual_site_khata' => $individual_site_khata, 'relinguish_expenditure' => $relinguish_expenditure, 'work_order' => $work_order, 'work_order_expenditure' => $work_order_expenditure, 'layout_development' => $layout_development, 'register_expenses' => $register_expenses, 'keb_fees' => $keb_fees, 'water_board' => $water_board, 'water_board_expenditure' => $water_board_expenditure, 'stp' => $stp, 'pollution_control_board' => $pollution_control_board, 'others' => $others, 'modt_charges' => $modt_charges, 'bank_total_amount1' => $bank_total_amount1, 'bank_int_percent1' => $bank_int_percent1, 'bank_interest1' => $bank_interest1, 'bank_interest_month1' => $bank_interest_month1, 'bank_interest_amt1' => $bank_interest_amt1, 'bank_total_amount2' => $bank_total_amount2, 'bank_int_percent2' => $bank_int_percent2, 'bank_interest2' => $bank_interest2, 'bank_interest_month2' => $bank_interest_month2, 'bank_interest_amt2' => $bank_interest_amt2, 'total_expenditure_charges' => $total_expenditure_charges, 'upload_layout' => $upload_layout, 'brochure' => $brochure, 'location_map' => $location_map, 'per_sqft_amount' => $per_sqft_amount, 'residential_company_area' => $residential_company_area, 'created_by' => $login_id, 'residential' =>$residential, 'land_type' =>$land_type, 'message_text' =>$message_text, 'upload_image' =>$upload_image1, 'status' =>'APPROVED', 'upload_vedio' =>$upload_vedio1, 'layouts_stamp_duty' => $stamp_duty_per, 'per_sq_ft' => $per_sq_ft, 'res_sqft'=>$res_sqft, 'land_per_cost'=>$land_per_cost, 'reg_val'=>$reg_val, 'rem_pay'=>$rem_pay, 'reg_charge'=>$reg_charge, 'total'=>$total, 'layout_status' => $layout_status); } $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully..']; } else { $message=['status'=>'Fail','message'=>'Same data updated..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Employee pay slip public function employee_pay_slip_get() { $emp_id = $this->input->get('emp_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_pay_slip($emp_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Site availability public function check_availability_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_land_owner"; //$where = array('delete_status'=>'ACTIVE','layout_status'=>'PENDING'); $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Fetch site based on layout public function fetch_site_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_name = $this->input->post("layout_name"); $result = $this->MMG_model->get_layout_sites($layout_name); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Employee id for assets public function fetch_emp_id_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_employees"; $where = array("delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Employee assets public function assets_category_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_assets_category"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function assets_subcategory_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_assets_subcategory"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function single_employee_assets_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id = $this->input->post("emp_id"); $table = "mmg_employee_assets"; $where = array("employee_id"=>$emp_id,"delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $assets = unserialize($result->assets); $subassets = unserialize($result->sub_assets); if($assets) { $message = ['status'=>'Success','message'=>$assets,'details'=>$result,'sub_assets'=>$subassets]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_employee_assets_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id = $this->input->post('employee_id'); $category_id = $this->input->post('category_id'); $subcategory_id = $this->input->post('subcategory_id'); $description = $this->input->post('description'); $category_array = array(); $subcategory_array = array(); if(!empty($category_id)) { foreach($category_id as $value) { $category_array[] = $value; } if(!empty($subcategory_id)) { foreach($subcategory_id as $val) { $subcategory_array[] = $val; } $category_assets = serialize($category_array); $subcategory_assets = serialize($subcategory_array); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $table = 'mmg_employee_assets'; $data = array( 'assets' => $category_assets, 'sub_assets' => $subcategory_assets, 'employee_id' => $emp_id, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_on' => $created_at ); $where = array('delete_status'=>'ACTIVE'); $employees = $this->MMG_model->get_where_result($table,$where); $emp_array = array(); foreach($employees as $value) { array_push($emp_array, $value->employee_id); } if(in_array($emp_id,$emp_array)) { $where_emp = array('employee_id' => $emp_id); $update_data = array( 'assets' => $category_assets, 'sub_assets' => $subcategory_assets, 'employee_id' => $emp_id, 'description' => $description, 'delete_status' => 'ACTIVE', 'updated_on' => $created_at ); $result = $this->MMG_model->update($where_emp,$table,$update_data); if($result) { $message = ['status'=>'Success','message'=>'Assets added successfully']; } else { $message = ['status'=>'Fail','message'=>'Same data updated..']; } } else { $result = $this->MMG_model->insert($data,$table); //print_r($result); if($result) { $message = ['status'=>'Success','message'=>"Assets added successfully"]; } else { $message = ['status'=>'Fail','message'=>'Something went wrong.. try again']; } } } } else { $message = ['status'=>'Fail','message'=>'Select Atleast One Menu']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_employee_payslip_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $month_year = $this->input->post('month_year'); $emp_id = $this->input->post('emp_id'); $employee_id = $this->input->post('employee_id'); $location = $this->input->post('location'); $employee_name = $this->input->post('employee_name'); $bank_name = $this->input->post('bank_name'); $dept_name = $this->input->post('dept_name'); $account_no = $this->input->post('account_no'); $designation = $this->input->post('designation'); $pan_no = $this->input->post('pan_no'); $dob = $this->input->post('dob'); $pf_uan_no = $this->input->post('pf_uan_no'); $date_of_joining = $this->input->post('date_of_joining'); $cl = $this->input->post('cl'); $payable_days = $this->input->post('payable_days'); $remaining_el = $this->input->post('remaining_el'); $paid_days = $this->input->post('paid_days'); $lop = $this->input->post('lop'); $lop = str_replace(',','',$lop); $basic = $this->input->post('basic'); $basic = str_replace(',','',$basic); $pf = $this->input->post('pf'); $pf = str_replace(',','',$pf); $hra = $this->input->post('hra'); $hra = str_replace(',','',$hra); $esi = $this->input->post('esi'); $esi = str_replace(',','',$esi); $special_allowance = $this->input->post('special_allowance'); $special_allowance = str_replace(',','',$special_allowance); $prof_tax = $this->input->post('prof_tax'); $prof_tax = str_replace(',','',$prof_tax); $gross_earning = $this->input->post('gross_earning'); $gross_earning = str_replace(',','',$gross_earning); $gross_deduction = $this->input->post('gross_deduction'); $gross_deduction = str_replace(',','',$gross_deduction); $net_pay = $this->input->post('net_pay'); $net_pay = str_replace(',','',$net_pay); $amt_in_words = $this->input->post('amt_in_words'); $created_on = date('Y-m-d H:i:s'); $data = array( 'month_year' => $month_year, 'emp_id' => $emp_id, 'employee_id' => $employee_id, 'location' => $location, 'employee_name' => $employee_name, 'bank_name' => $bank_name, 'dept_name' => $dept_name, 'account_no' => $account_no, 'designation' => $designation, 'pan_no' => $pan_no, 'dob' => $dob, 'pf_uan_no' => $pf_uan_no, 'date_of_joining' => $date_of_joining, 'cl' => $cl, 'payable_days' => $payable_days, 'remaining_el' => $remaining_el, 'paid_days' => $paid_days, 'lop' => $lop, 'basic' => $basic, 'pf' => $pf, 'hra' => $hra, 'esi' => $esi, 'special_allowance' => $special_allowance, 'prof_tax' => $prof_tax, 'gross_earning' => $gross_earning, 'gross_deduction' => $gross_deduction, 'net_pay' => $net_pay, 'amt_in_words' => $amt_in_words, 'created_on' => $created_on); $table = 'mmg_employee_payslip'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //------------------------------------------------------------------ lakshmi----------------------------------------------// public function Add_owner_list_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->post('id'); $name =$this->input->post('name'); $contact_no =$this->input->post('contact_no'); $layout_name =$this->input->post('layout_name'); $pan_no =$this->input->post('pan_no'); $email =$this->input->post('email'); $address =$this->input->post('address'); $created_at = date('Y-m-d H:i:s'); $data =array('name' =>$name, 'contact_no' =>$contact_no, 'layout_name' =>$layout_name, 'pan_adhar' =>$pan_no, 'email' =>$email, 'address' =>$address, 'created_by' =>$id, 'created_on' =>$created_at); $table = 'mmg_land_owner'; $result=$this->MMG_model->insert($data,$table); $table_trend='mmg_layout_master'; $data_trend= array('layout_name'=> $layout_name,'land_owner_id'=>$result); $result2=$this->MMG_model->insert2($data_trend,$table_trend); if($result) { $message=['status'=>'Success','message'=>' added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_owner_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_land_owner'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_owner_result(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_owner_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $result1 =$this->MMG_model->get_landowner_data($id); if(!empty($result1)) { $message=['status'=>'Fail','message'=>"Layout Already in Use You Can't delete"]; } else { $table ='mmg_land_owner'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); $table1 ='mmg_layout_master'; $where1 =array('land_owner_id'=>$id); $data1 =array('delete_status'=>'INACTIVE'); $result1 = $this->MMG_model->update2($where1,$table1,$data1); if($result1) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_owner_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_land_owner'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_owner_list_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $name =$this->input->input_stream('name'); $contact_no =$this->input->input_stream('contact_no'); $layout_name =$this->input->input_stream('layout_name'); $pan_adhar =$this->input->input_stream('pan_adhar'); $email =$this->input->input_stream('email'); $address =$this->input->input_stream('address'); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_land_owner'; $data =array('name'=>$name, 'contact_no'=>$contact_no, 'layout_name'=>$layout_name, 'pan_adhar'=>$pan_adhar, 'email'=>$email, 'address'=>$address, 'updated_by'=>$id, 'updated_on'=>$created_at,); $result=$this->MMG_model->update($where,$table,$data); $table_trend='mmg_layout_master'; $where_trends= array('land_owner_id'=> $update_id); $data_trend= array('layout_name'=> $layout_name); $result2=$this->MMG_model->update2($where_trends,$table_trend,$data_trend); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //add sites public function Add_site_list_post() { $date =$this->input->post('date'); $pubKey =$this->input->post('pubKey'); $signature =$this->input->post('signature'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $layout = $this->input->post('layout'); //$select_type = $this->input->post('select_type'); $site_no = $this->input->post('site_no'); $facing = $this->input->post('facing'); //$purch_for = $this->input->post('purch_for'); $site_type = $this->input->post('site_type'); $remarks = $this->input->post('remarks'); $north = $this->input->post('north'); $north_mtrs = $this->input->post('north_mtrs'); $south = $this->input->post('south'); $south_mtrs = $this->input->post('south_mtrs'); $east = $this->input->post('east'); $east_mtrs = $this->input->post('east_mtrs'); $west = $this->input->post('west'); $west_mtrs = $this->input->post('west_mtrs'); $north_south = $this->input->post('north_south'); $east_west = $this->input->post('east_west'); $sq_mt = $this->input->post('sq_mt'); $sq_ft = $this->input->post('sq_ft'); $created_at = date('Y-m-d H:i:s'); if(!empty($site_no)) { $condition=array('layout' => $layout,'site_no'=> $site_no,'delete_status'=>'ACTIVE'); $table_sites='mmg_sites'; $get_row_data=$this->MMG_model->get_where_row($table_sites,$condition); } else { $get_row_data = ""; } if(empty($get_row_data)) { $data = array('layout' => $layout, 'select_type' => 'Site', //'godown_name' => $godown_name, 'site_no' => $site_no, 'facing' => $facing, //'purch_for' => $purch_for, 'site_type' => $site_type, 'remarks' => $remarks, 'north' => $north, 'north_mtrs' => $north_mtrs, 'south' => $south, 'south_mtrs' => $south_mtrs, 'east' => $east, 'east_mtrs' => $east_mtrs, 'west' => $west, 'west_mtrs' => $west_mtrs, 'north_south' => $north_south, 'east_west' => $east_west, 'sq_mt' => $sq_mt, 'sq_ft' => $sq_ft, 'created_by' => $id, 'created_on' => $created_at); $table = 'mmg_sites'; $result=$this->MMG_model->insert($data,$table); if($result) { $table = 'mmg_land_owner'; $data = array('delete_status'=>'ACTIVE','id'=>$layout); $result1 = $this->MMG_model->get_where_row($table,$data); $table = 'mmg_layout_master'; $data = array('delete_status'=>'ACTIVE','layout_name'=>$result1->layout_name); $result3 = $this->MMG_model->get_where_row2($table,$data); $table_trends = "mmg_site_master"; $data2 = array('mmg_site_id' => $result, 'layout_id' => $result3->id, 'select_type' => 'Site', //'godown_name' => $godown_name, 'site_home' => $site_no, 'owner' => 'MMG', 'created_at' => $created_at); $result2=$this->MMG_model->insert2($data2,$table_trends); if($result2) { $message=['status'=>'Success','message'=>' added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Site number already exists for this layout']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //get site lists public function get_site_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_sites'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_site_list(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //delete site details public function delete_site_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table = 'mmg_customer_site_visiting_followup'; $data = array('delete_status'=>'ACTIVE','site_id'=>$id); $result1 = $this->MMG_model->get_where_row($table,$data); if(empty($result1)) { $table ='mmg_sites'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $table_trends = "mmg_site_master"; $where2 = array('mmg_site_id'=>$id); $data2 = array('delete_status'=>'INACTIVE'); $result2 = $this->MMG_model->update2($where2,$table_trends,$data2); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Could not Delete']; } } else { $message=['status'=>'Fail','message'=>'Could not Delete']; } } else { $message=['status'=>'Fail','message'=>'Site Already Booked,You Cant Dlete this Data']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //edit site details public function edit_site_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $layout_name =$this->input->get('layout_name'); $result=$this->MMG_model->get_site_detils_for_edit($id,$layout_name); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //update site details public function update_site_list_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('id'); $update_id = $this->input->input_stream('update_id'); $layout = $this->input->input_stream('layout'); $select_type= $this->input->input_stream('select_type'); $site_no = $this->input->input_stream('site_no'); $facing = $this->input->input_stream('facing'); $purch_for = $this->input->input_stream('purch_for'); $site_type = $this->input->input_stream('site_type'); $remarks = $this->input->input_stream('remarks'); $north = $this->input->input_stream('north'); $north_mtrs = $this->input->input_stream('north_mtrs'); $south = $this->input->input_stream('south'); $south_mtrs = $this->input->input_stream('south_mtrs'); $east = $this->input->input_stream('east'); $east_mtrs = $this->input->input_stream('east_mtrs'); $west = $this->input->input_stream('west'); $west_mtrs = $this->input->input_stream('west_mtrs'); $north_south= $this->input->input_stream('north_south'); $east_west = $this->input->input_stream('east_west'); $sq_mt = $this->input->input_stream('sq_mt'); $sq_ft = $this->input->input_stream('sq_ft'); $created_at = date('Y-m-d H:i:s'); $where = array('id'=>$update_id); $table = 'mmg_sites'; $condition = array('id !='=>$update_id,'layout'=> $layout,'site_no'=> $site_no,'delete_status'=>'ACTIVE'); $table_sites='mmg_sites'; $get_row_data=$this->MMG_model->get_where_row($table_sites,$condition); if(empty($get_row_data)) { $data = array( 'layout' => $layout, 'select_type' => 'Site', //'godown_name' => $godown_name, 'site_no' => $site_no, 'facing' => $facing, 'purch_for' => $purch_for, 'site_type' => $site_type, 'remarks' => $remarks, 'north' => $north, 'north_mtrs' => $north_mtrs, 'south' => $south, 'south_mtrs' => $south_mtrs, 'east' => $east, 'east_mtrs' => $east_mtrs, 'west' => $west, 'west_mtrs' => $west_mtrs, 'north_south' => $north_south, 'east_west' => $east_west, 'sq_mt' => $sq_mt, 'sq_ft' => $sq_ft, 'updated_by' => $id, 'updated_on' => $created_at, 'status' =>'Approved'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=>'Site number already exists for this layout']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //add assets public function Add_assets_list_post() { $date =$this->input->post('date'); $pubKey =$this->input->post('pubKey'); $signature =$this->input->post('signature'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->post('id'); $category =$this->input->post('category'); $created_at = date('Y-m-d H:i:s'); $data =array('category' =>$category, 'created_by' =>$id, 'created_at' =>$created_at); $where =array('category' =>$category, 'delete_status' =>'ACTIVE' ); $table = 'mmg_assets_category'; $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>' added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Assets Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //get assets public function get_assets_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_assets_category'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //delete assets public function delete_assets_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_assets_category'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //edit assets public function edit_assets_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_assets_category'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //update assets public function update_assets_list_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $category =$this->input->input_stream('category'); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_assets_category'; $data =array('category' =>$category,); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //add subcategory public function add_subcategory_post() { $date =$this->input->post('date'); $pubKey =$this->input->post('pubKey'); $signature =$this->input->post('signature'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->post('id'); $category_id =$this->input->post('category_id'); $sub_category =$this->input->post('sub_category'); $created_at = date('Y-m-d H:i:s'); $data =array( 'category_id' =>$category_id, 'sub_category' =>$sub_category, 'created_by' =>$id, 'created_at' =>$created_at); $where =array( 'category_id' =>$category_id, 'sub_category' =>$sub_category, 'delete_status' =>'ACTIVE'); $table = 'mmg_assets_subcategory'; $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>' added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Sub Category Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //get subcategory public function get_subcategory_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $category_id=$this->input->get('category_id'); $table='mmg_assets_subcategory'; $data=array('category_id'=>$category_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //delete delete subcategory public function delete_subcategory_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_assets_subcategory'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //edit subcategory public function edit_subcategory_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_assets_subcategory'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //update subcategory public function update_subcategory_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $sub_category =$this->input->input_stream('sub_category'); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_assets_subcategory'; $data =array('sub_category' =>$sub_category,); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function all_site_no_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_sites'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function site_no_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_sites'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function site_number_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_sites'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_contract_order_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id= $this->input->get('employee_id'); $result=$this->MMG_model->get_contract_order($emp_id); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_contract_date_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee_id =$this->input->input_stream('employee_ids'); $contract_from_date =$this->input->input_stream('contract_from'); $contract_to_date =$this->input->input_stream('contract_to'); $table = 'mmg_employees'; $where = array('emp_id'=>$employee_id); $data = array('contract_from'=>$contract_from_date, 'contract_to'=>$contract_to_date); $result=$this->MMG_model->update($where,$table,$data); if($result > 0) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function editlayout_name_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_land_owner'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_booking_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->post('login_id'); $customer_id = $this->input->post('customer_id'); $layout_id = $this->input->post('layout_id'); $site_number = $this->input->post('site_number'); $north_south = $this->input->post('north_south'); $east_west = $this->input->post('east_west'); $phone_number =$this->input->post('phone_number'); /*$site_dimension_south = $this->input->post('site_dimension_south'); $site_dimension_west = $this->input->post('site_dimension_west');*/ $id_name = $this->input->post('id_name'); $id_no = $this->input->post('id_no'); $nominee = $this->input->post('nominee'); $nominee_contact_no = $this->input->post('nominee_contact_no'); $nri_no = $this->input->post('nri_no'); $email = $this->input->post('email'); $address = $this->input->post('address'); $id_scan = $this->input->post('id_scan'); $book_date = $this->input->post('booking_date'); $booking_date = date('Y-m-d',strtotime($book_date)); $booking_amount = $this->input->post('booking_amount'); $booking_amount = str_replace(',','',$booking_amount); $payment_type = $this->input->post('payment_type'); if($payment_type == 'Cash' || $payment_type == 'Swipe') { $pay_no = ''; $pay_date = ''; $bank_name = ''; } else if($payment_type == 'Cheque') { $pay_no = $this->input->post('cheque_no'); $cheque_date = $this->input->post('cheque_date'); $pay_date = date('Y-m-d',strtotime($cheque_date)); $bank_name = $this->input->post('cheque_bank_name'); } else if( $payment_type == 'Online Payment' ) { $pay_no = $this->input->post('utr_no'); $payment_date = $this->input->post('pay_date'); $pay_date = date('Y-m-d',strtotime($payment_date)); $bank_name = ''; } else if( $payment_type == 'DD' ) { $pay_no = $this->input->post('dd_no'); $pay_dates = $this->input->post('dd_date'); $pay_date = date('Y-m-d',strtotime($pay_dates)); $bank_name = $this->input->post('dd_bank_name'); } $site_type = $this->input->post('site_type'); /* if($site_type == "Site/Custruction") { $tsv = $this->input->post('tsv'); $tsv = str_replace(',','',$tsv); $tcc = $this->input->post('tcc'); $tcc = str_replace(',','',$tcc); $total_value = $this->input->post('total_value'); $total_value = str_replace(',','',$total_value); } else { $tsv = $this->input->post('tsv'); $tsv = str_replace(',','',$tsv); $total_value = $this->input->post('tsv'); $total_value = str_replace(',','',$total_value); $tcc = ""; }*/ $sq_mtr = $this->input->post('sq_mtr'); /* $sale_date = $this->input->post('sale_agree_date'); $sale_agree_date = date('Y-m-d',strtotime($sale_date)); $sale_agreement_amount =$this->input->post('sale_agreement_amount'); $sale_agreement_amount = str_replace(',','',$sale_agreement_amount); $instal_date =$this->input->post('instal_due_date'); $instal_due_date = date('Y-m-d',strtotime($instal_date)); $instal_due_amount =$this->input->post('instal_due_amount'); $instal_due_amount = str_replace(',','',$instal_due_amount); $reg_date =$this->input->post('reg_due_date'); $reg_due_date = date('Y-m-d',strtotime($reg_date)); $reg_due_amount =$this->input->post('reg_due_amount'); $reg_due_amount = str_replace(',','',$reg_due_amount); */ $sq_ft = $this->input->post('sq_ft'); $created_date = date('Y-m-d H:i:s'); $registered_name = $this->input->post('registered_name'); $customer_name = $this->input->post('customer_name'); if(!empty($registered_name)) { $table1 = 'mmg_customer'; $condition1 = array('delete_status'=>'ACTIVE','id'=>$customer_id); $data1 = array('old_cust_name'=>$customer_name,'registered_name'=>$registered_name,'name'=>$registered_name); $result2 = $this->MMG_model->update($condition1,$table1,$data1); } $table = 'mmg_bookings'; $where = array('delete_status'=>'ACTIVE','site_number'=>$site_number,'layout_id'=>$layout_id,'customer_id'=>$customer_id); $get_customer =$this->MMG_model->get_where_row($table,$where); if(empty($get_customer)) { $data = array('customer_id'=>$customer_id, 'layout_id'=>$layout_id, 'site_number'=>$site_number, 'north_south'=>$north_south, 'east_west'=>$east_west, /*'site_dimension_south'=>$site_dimension_south, 'site_dimension_west'=>$site_dimension_west,*/ 'phone_number' =>$phone_number, 'id_name'=>$id_name, 'id_no'=>$id_no, 'id_scan'=>$id_scan, 'nominee'=>$nominee, 'nominee_con_no'=>$nominee_contact_no, /* 'tsv'=>$tsv, 'tcc'=>$tcc, 'total_value'=>$total_value,*/ 'booking_date'=>$booking_date, 'booking_amount'=>$booking_amount, 'sq_ft' =>$sq_ft, /*'payment_type'=>$payment_type, 'pay_no'=>$pay_no, 'pay_date'=>$pay_date, 'bank_name'=>$bank_name,*/ /*'sale_agree_date'=>$sale_agree_date, 'sale_agree_amount'=>$sale_agreement_amount, 'instal_due_date'=>$instal_due_date, 'instal_due_amount'=>$instal_due_amount, 'reg_due_date'=>$reg_due_date, 'reg_due_amount'=>$reg_due_amount,*/ 'email'=>$email, 'address'=>$address, 'nri_no'=>$nri_no, 'created_by' =>$login_id, 'created_at' =>$created_date, 'site_type' =>$site_type, 'sq_mt' =>$sq_mtr); $table = 'mmg_bookings'; $result=$this->MMG_model->insert($data,$table); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$customer_id); $get_customers =$this->MMG_model->get_where_row($table,$where); if(!empty($get_customers)) { $msg = "Thank you for booking a property with MMG Constructions LLP. If there is anything we can do please call us on {".$get_customers->phone."}"; $sms_message_new = $msg; $headers = ['Content-Type' => 'application/x-www-form-urlencoded', 'charset' => 'utf-8']; /* $url = "http://sms.jayblues.com/http-api.php?";*/ $url = "http://mysmsshop.in/http-api.php?"; $postData2 = array('username'=> 'mmgconstructions', 'password'=>'New$$888', 'senderid'=>'MMGCON', //'unicode'=>2, 'route'=>1, 'message' => $sms_message_new, 'number' => $get_customers->phone, ); $ch2 = curl_init(); curl_setopt_array($ch2, array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER =>$headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData2 )); $output1 = curl_exec($ch2); if(curl_errno($ch2)) { echo 'error:' . curl_error($ch2); } curl_close($ch2); } } else { $data_update = array('customer_id'=>$customer_id, 'layout_id'=>$layout_id, 'site_number'=>$site_number, 'north_south'=>$north_south, 'east_west'=>$east_west, 'phone_number' =>$phone_number, 'id_name'=>$id_name, 'id_no'=>$id_no, 'id_scan'=>$id_scan, 'nominee'=>$nominee, 'nominee_con_no'=>$nominee_contact_no, /* 'tsv'=>$tsv, 'tcc'=>$tcc, 'total_value'=>$total_value,*/ 'booking_date'=>$booking_date, 'booking_amount'=>$booking_amount, /*'payment_type'=>$payment_type, 'pay_no'=>$pay_no, 'pay_date'=>$pay_date, 'bank_name'=>$bank_name,*/ /*'sale_agree_date'=>$sale_agree_date, 'sale_agree_amount'=>$sale_agreement_amount, 'instal_due_date'=>$instal_due_date, 'instal_due_amount'=>$instal_due_amount, 'reg_due_date'=>$reg_due_date, 'reg_due_amount'=>$reg_due_amount,*/ 'email'=>$email, 'address'=>$address, 'nri_no'=>$nri_no, 'created_by' =>$login_id, 'created_at' =>$created_date, 'site_type' =>$site_type, 'sq_ft' =>$sq_ft, 'sq_mt' =>$sq_mtr); $table = 'mmg_bookings'; $condition = array('delete_status'=>'ACTIVE','site_number'=>$site_number,'layout_id'=>$layout_id,'customer_id'=>$customer_id); $result =$this->MMG_model->update($condition,$table,$data_update); } if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customers_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //------------------------------------------------------------------------------------------------------// //-------------------------------------------- shubha --------------------------------------------------// public function insert_annexure_package_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $package_name = $this->input->post('package_id'); $annexure_id = $this->input->post('annexure_Category'); $annexure_ids = json_encode($this->input->post('annexure_Category')); $created_on = date('Y-m-d H:i:s'); $data = array( 'package_id' =>$package_name, 'annexure_Category' =>$annexure_ids, 'created_on' =>$created_on, ); $table = 'mmg_annexure_package'; $result=$this->MMG_model->insert_annexure($package_name,$annexure_id,$data,$table); // print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>'Added successfully']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_package_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result=$this->MMG_model->get_package_name(); // print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_package_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $result =$this->MMG_model->get_sub_package_name($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function annexure_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $annexure_id = $this->input->get('id'); $table = 'mmg_annexure_package'; $where = array('id'=>$annexure_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); $after_decode = json_decode($result->annexure_Category); $annexure_result = $this->MMG_model->get_annexure_category($after_decode); $salesman_array = array(); foreach ($annexure_result as $key => $value) { $anne_id = $value->id; $indent_id = $value->foundation_level; array_push($salesman_array,$anne_id,$indent_id); } print_r($salesman_array);die(); $after_encode = json_encode($salesman_array); if($salesman_array) { $message=['status'=>'Success','message'=>$salesman_array]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_annexure_names_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = "mmg_annexure"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_package_list_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $package =$this->input->input_stream('package'); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_annexure_package'; $data =array('package_id' =>$package,); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_package_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_annexure_package'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function sub_annexure_category_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $annexure_id = $this->input->get('annex_id'); $table = 'mmg_annexure_package'; $where = array('id'=>$annexure_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); $after_decode = json_decode($result->annexure_Category); $annexure_result = $this->MMG_model->get_annexure_category($after_decode); //print_r($annexure_result);die(); if($annexure_result) { $message=['status'=>'Success','message'=>$annexure_result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_package_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $package_name = $this->input->post('package_name'); $created_at = date('Y-m-d H:i:s'); $data = array( 'package_name' =>$package_name, 'created_by' =>$id, 'created_at' =>$created_at, ); $table = 'mmg_package'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function package_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_package'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_package_details_get() { $package_id = $this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_package'; $where = array('id'=>$package_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$where); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_package_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('id'); $package_name = $this->input->input_stream('package_name'); $updated_at = date('Y-m-d H:i:s'); $table='mmg_package'; $condition=array('id'=>$id); $data_update= array( 'package_name'=>$package_name, 'updated_by' =>$id, 'updated_on' =>$updated_at ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>'Updated successfully..']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_package_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_package'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function annexure_list() { $id =$this->session->userdata('id'); if($id) { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $data= array('date'=>$date, 'signature'=>$signature, 'pubKey'=>$public_key); // $result_data = $this->rest->get('Get-annexure-master',$data); // $data['annexure'] = $result_data->message; $this->load->view('admin/annexure_list',$data); } } public function get_annexure_list() { $id =$this->session->userdata('id'); if($id) { // sender key details $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $data= array('date'=>$date, 'signature'=>$signature, 'pubKey'=>$public_key); $result_data = $this->rest->get('Get-annexure-master',$data); //print_r($result_data);die(); $result=$result_data->message; if($result_data->status=='Success') { echo json_encode($result_data->message); } else { echo json_encode(array('result'=>0,'message'=>$result_data->message)); } } else { redirect('/'); } } public function annexure_approval() { $id = $this->session->userdata('id'); $annexure_id = $this->input->post('annexure_id'); if($id) { // sender key details $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $data = array('a_id'=>$annexure_id,'date'=>$date, 'signature'=>$signature, 'pubKey'=>$public_key); $result_data = $this->rest->post('Annexure-approval',$data); if($result_data->status=='Success') { echo json_encode(array('result'=>1,'message'=>$result_data->message)); } else { echo json_encode(array('result'=>0,'message'=>$result_data->message)); } } else { redirect('/'); } } public function annexure_approval_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $annexure_id = $this->input->post('a_id'); $annexure_ids = json_encode($this->input->post('a_id')); $table = 'mmg_annexure'; $data = array('checked_status'=>$annexure_ids); $result=$this->MMG_model->annexure_approval_update($annexure_id,$data,$table); if($result) { $message=['status'=>'Success','message'=>'Checked Successfully']; } else { $message=['status'=>'Fail','message'=>'Not checked']; } } else { $message=['status'=>'Fail','message'=> 'Something went wrong']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_followup_progress_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('progress_id'); $progress_name = $this->input->post('progress_name'); $created_at = date('Y-m-d H:i:s'); $data = array('progress_name' =>$progress_name, 'created_by' =>$id, 'created_at' =>$created_at); $where = array('progress_name' =>$progress_name, 'delete_status' =>'ACTIVE'); $table = 'mmg_followup_progress'; $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Follow Up Progress Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function followup_progress_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_followup_progress'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_followupprogress_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $progress_id = $this->input->get('progress_id'); $table='mmg_followup_progress'; $data=array('id'=>$progress_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_followupprogress_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { // $login_id = $this->input->input_stream('login_id'); $progress_id = $this->input->input_stream('id'); $progress_name = $this->input->input_stream('progress_name'); // $udpated_at = date('Y-m-d H:i:s'); $table='mmg_followup_progress'; $where=array('id'=>$progress_id); $data_update= array( 'progress_name' =>$progress_name, // 'updated_on'=>$udpated_at, // 'updated_by'=>$login_id ); $condition =array('progress_name' =>$progress_name, 'delete_status' =>'ACTIVE'); $res=$this->MMG_model->get_where_row($table,$condition); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->update($where,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Follow Up Progress Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_followupprogress_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_followup_progress'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_site_visiting_progress_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $progress_name = $this->input->post('progress_name'); $created_at = date('Y-m-d H:i:s'); $data = array('progress_name' =>$progress_name, 'created_by' =>$id, 'created_at' =>$created_at); $where = array('progress_name' =>$progress_name, 'delete_status' =>'ACTIVE'); $table = 'mmg_site_visiting_progress'; $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Site Visiting Progress Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function site_visiting_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_site_visiting_progress'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_site_visiting_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $site_id = $this->input->get('site_id'); $table='mmg_site_visiting_progress'; $data=array('id'=>$site_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_site_visiting_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { // $login_id = $this->input->input_stream('login_id'); $site_id = $this->input->input_stream('id'); $progress_name = $this->input->input_stream('progress_name'); // $udpated_at = date('Y-m-d H:i:s'); $table='mmg_site_visiting_progress'; $condition=array('id'=>$site_id); $data_update= array( 'progress_name'=>$progress_name, // 'updated_on'=>$udpated_at, // 'updated_by'=>$login_id ); $where =array( 'progress_name' =>$progress_name, 'delete_status' =>'ACTIVE'); $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Site Visiting Progress Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_site_visiting_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_site_visiting_progress'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //rest controller public function all_reference_type_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_reference'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function all_progress_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_followup_progress'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //get all customer site visiting progress name public function all_sitevisiting_progress_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_site_visiting_progress'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function layout_name_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_land_owner'; $where = array('delete_status'=>'ACTIVE'); // $result = $this->MMG_model->get_layouts_name(); $result = $this->MMG_model->get_layouts_name_po(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function experience_letter_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee_id =$this->input->get('employee_id'); $table = 'mmg_employees'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_employee_with_department($employee_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function change_experience_status_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee_id =$this->input->get('employee_id'); $table = 'mmg_employees'; $where = array('emp_id'=>$employee_id); $data = array('experience_status'=>'GENERATED'); $result=$this->MMG_model->update($where,$table,$data); if($result > 0) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } // public function get_layout_details() // { // $id = $this->session->userdata('id'); // $layout_name = $this->input->post('layout_name'); // if($id) // { // $data['role_id']=$this->session->userdata('role_id'); // $privatekey =$this->config->item('private_key'); // $public_key = uniqid(rand(),true); // $private_key=$privatekey.$public_key; // date_default_timezone_set('Asia/Kolkata'); // $date = date('Y-m-d H:i:s', time()); // // Generate content verification signature // $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); // $data= array('id'=>$id,'role_id'=>$data['role_id'],'layout_name'=>$layout_name,'date'=>$date, 'signature'=>$signature, 'pubKey'=>$public_key); // $result_data = $this->rest->get('Get-layout-details',$data); // if($result_data->status == 'Success') // { // echo json_encode(array('result'=>1,'message'=>$result_data->message)); // } // else // { // echo json_encode(array('result'=>0,'message'=>$result_data->message)); // } // } // else // { // redirect('/'); // } // } // public function get_layout_list_get() // { // $date=$this->input->get('date'); // $signature=$this->input->get('signature'); // $pubKey=$this->input->get('pubKey'); // $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); // if($hmacsecurity=='success') // { // $result = $this->MMG_model->get_layout_details(); // if($result) // { // $message = ['status'=>'Success','message'=>$result]; // } // else // { // $message = ['status'=>'Fail','message'=>'No data found']; // } // } // else // { // $message=['status'=>'Fail','message'=>'Unauthorised url']; // } // $this->set_response($message, REST_Controller::HTTP_OK); // } public function get_layout_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_name = $this->input->get("layout_name"); $table = "mmg_layouts"; $where = array("id"=>$layout_name,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_booking_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_bookings'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_booking_list(); // print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_booking_detail_get() { $booking_id = $this->input->get('booking_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_bookings'; $where = array('booking_id'=>$booking_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$where); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_booking_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); //print_r($pubKey.'----------'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { // $login_id = $this->input->input_stream('login_id'); $booking_id = $this->input->post('booking_id'); $site_number = $this->input->post('site_number'); //$site_dimension = $this->input->post('site_dimension'); $id_name = $this->input->post('id_name'); $id_scan = $this->input->post('id_scan'); /* $tcc = $this->input->post('tcc'); $total_value = $this->input->post('total_value');*/ $booking_amount = $this->input->post('booking_amount'); $booking_status = $this->input->post('booking_status'); // $udpated_at = date('Y-m-d H:i:s'); $table='mmg_bookings'; $condition=array('booking_id'=>$booking_id); $data_update= array( 'site_number' =>$site_number, //'site_dimension' =>$site_dimension, 'id_name' =>$id_name, 'id_scan' =>$id_scan, /* 'tcc' =>$tcc, 'total_value' =>$total_value,*/ 'booking_amount' =>$booking_amount, 'booking_status' =>$booking_status, // 'updated_on'=>$udpated_at, // 'updated_by'=>$login_id ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_booking_list_post() { $booking_id = $this->input->post('booking_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_bookings"; $where = array('booking_id'=>$booking_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_budget_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $type_of_work = $this->input->post('type_of_work'); $material = $this->input->post('material'); $length = $this->input->post('length'); $breadth = $this->input->post('breadth'); $dimension = $this->input->post('dimension'); $no = $this->input->post('no'); $total = $this->input->post('total'); $unit_total = $this->input->post('unit_total'); $radio_unit = $this->input->post('radio_unit'); $rf = $this->input->post('rf'); $quantity = $this->input->post('quantity'); $unit_quantity = $this->input->post('unit_quantity'); $rate_unit = $this->input->post('rate_unit'); $total_amount = $this->input->post('total_amount'); $final_amount = $this->input->post('final_amount'); $gst = $this->input->post('gst'); $gst_amount = $this->input->post('gst_amount'); $labour_without_gst = $this->input->post('labour_without_gst'); $labour_without_gst1 = $this->input->post('labour_without_gst1'); $created_at = date('Y-m-d H:i:s'); $data = array( 'type_of_work' =>$type_of_work, 'material' =>$material, 'length' =>$length, 'breadth' =>$breadth, 'dimention' =>$dimension, 'number' =>$no, 'total' =>$total, 'unit_total' =>$unit_total, 'radio_unit' =>$radio_unit, 'rf' =>$rf, 'quantity' =>$quantity, 'unit_quantity' =>$unit_quantity, 'rate_unit' =>$rate_unit, 'total_amount' =>$total_amount, 'final_amount' =>$final_amount, 'gst' =>$gst, 'gst_amount' =>$gst_amount, 'labour_charges_without_gst' =>$labour_without_gst, 'labour_charges_fourty_without_gst' =>$labour_without_gst1, 'parent_id' =>'0', 'created_by' =>$id, 'created_on' =>$created_at, ); $table = 'mmg_budget'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function budget_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_budget'; $where = array('parent_id'=>'0','delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_budget_details_get() { $budget_id = $this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_budget'; $where = array('id'=>$budget_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$where); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_budget_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $budget_id = $this->input->post('budget_id'); $type_of_work = $this->input->post('type_of_work'); $material = $this->input->post('material'); $length = $this->input->post('length'); $breadth = $this->input->post('breadth'); $dimension = $this->input->post('dimension'); $no = $this->input->post('no'); $total = $this->input->post('total'); $unit_total = $this->input->post('unit_total'); $radio_unit = $this->input->post('radio_unit'); $rf = $this->input->post('rf'); $quantity = $this->input->post('quantity'); $unit_quantity = $this->input->post('unit_quantity'); $rate_unit = $this->input->post('rate_unit'); $total_amount = $this->input->post('total_amount'); $final_amount = $this->input->post('final_amount'); $gst = $this->input->post('gst'); $gst_amount = $this->input->post('gst_amount'); $labour_without_gst = $this->input->post('labour_without_gst'); $labour_without_gst1 = $this->input->post('labour_without_gst1'); $login_id = $this->input->post('login_id'); $created_on = date('Y-m-d'); $created_at = date('Y-m-d H:i:s'); $table='mmg_budget'; $data = array( 'parent_id' =>$budget_id, 'type_of_work' =>$type_of_work, 'material' =>$material, 'length' =>$length, 'breadth' =>$breadth, 'dimention' =>$dimension, 'number' =>$no, 'total' =>$total, 'unit_total' =>$unit_total, 'radio_unit' =>$radio_unit, 'rf' =>$rf, 'quantity' =>$quantity, 'unit_quantity' =>$unit_quantity, 'rate_unit' =>$rate_unit, 'total_amount' =>$total_amount, 'final_amount' =>$final_amount, 'gst' =>$gst, 'gst_amount' =>$gst_amount, 'labour_charges_without_gst' =>$labour_without_gst, 'labour_charges_fourty_without_gst' =>$labour_without_gst1, 'created_by' =>$login_id, 'created_on' =>$created_on, 'created_at' =>$created_at ); $where= array('id'=>$budget_id); $data_update = array('edited_status'=>'YES'); $update_result=$this->MMG_model->update($where,$table,$data_update); if($update_result > 0) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_budget_post() { $budget_id = $this->input->post('id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_budget"; $where = array('id'=>$budget_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //------------------------------------------------------- keerthana ---------------------------------------------------// public function Add_leave_deatils_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $yearly_cl = $this->input->post('yearly_cl'); $yearly_ml = $this->input->post('yearly_ml'); $week_off = $this->input->post('week_off'); $created_at = date('Y-m-d H:i:s'); $data = array('yearly_cl' =>$yearly_cl, 'yearly_ml' =>$yearly_ml, 'week_off' =>$week_off, 'delete_status' =>'ACTIVE', 'created_by' =>$id, 'created_at' =>$created_at); $table = 'mmg_leave_detail'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function leave_deatils_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_leave_detail'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_leave_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $table='mmg_leave_detail'; $data=array('id'=>$id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_leave_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('id'); $yearly_cl = $this->input->input_stream('yearly_cl'); $yearly_ml = $this->input->input_stream('yearly_ml'); $week_off = $this->input->input_stream('week_off'); $table='mmg_leave_detail'; $condition=array('id'=>$id); $data_update= array( 'yearly_cl' =>$yearly_cl, 'yearly_ml' =>$yearly_ml, 'week_off' =>$week_off ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_leave_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_leave_detail'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function material_details_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $material_id = $this->input->post("material_id"); $table = "mmg_material"; $where = array("id"=>$material_id); $result = $this->MMG_model->get_where_row($table,$where); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function unit_details_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $units = $this->input->post("units"); $table = "mmg_unit"; $where = array("id"=>$units); $result = $this->MMG_model->get_where_row($table,$where); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //////Add Type of Work///////////// public function Add_type_of_work_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $type_of_work = $this->input->post('type_of_work'); $created_at = date('Y-m-d H:i:s'); $data = array('type_of_work' =>$type_of_work, 'created_by' =>$id, 'created_at' =>$created_at); $where = array('type_of_work' =>$type_of_work, 'delete_status' =>'ACTIVE' ); $table = 'mmg_type_of_work'; $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Type of Work Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function type_of_work_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_type_of_work'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_type_of_work_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $table='mmg_type_of_work'; $data=array('id'=>$id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_type_of_work_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('id'); $type_of_work = $this->input->input_stream('type_of_work'); $table='mmg_type_of_work'; $where=array('id'=>$id); $data_update= array( 'type_of_work'=>$type_of_work ); $condition =array('type_of_work' =>$type_of_work, 'delete_status' =>'ACTIVE'); $res=$this->MMG_model->get_where_row($table,$condition); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->update($where,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>'Updated successfully..']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Type Of Work Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_type_of_work_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_type_of_work'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function Add_unit_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $unit_name = $this->input->post('unit_name'); $created_at = date('Y-m-d H:i:s'); $data = array('unit_name' =>$unit_name, 'created_by' =>$id, 'created_at' =>$created_at); $where = array('unit_name' =>$unit_name, 'delete_status' =>'ACTIVE'); $table = 'mmg_unit'; $res=$this->MMG_model->get_where_row($table,$where); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Unit Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function unit_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_unit'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_unit_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $table='mmg_unit'; $data=array('id'=>$id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_unit_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('id'); $unit_name = $this->input->input_stream('unit_name'); $table='mmg_unit'; $condition=array('id' =>$id); $data_update= array( 'unit_name'=>$unit_name ); $where =array( 'unit_name' =>$unit_name, 'delete_status' =>'ACTIVE'); $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unit Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_unit_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_unit'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function Add_department_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->post('id'); $dept_name =ucfirst($this->input->post('dept_name')); $created_at = date('Y-m-d H:i:s'); $data =array('dept_name' =>$dept_name, 'created_at' =>$created_at, 'created_by' =>$id ); $where =array('dept_name' =>$dept_name, 'delete_status' =>'ACTIVE' ); $table = 'mmg_department'; $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>' added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Department Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_department_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_department'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_department_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_department'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_department_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_department'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_department_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $dept_name =ucfirst($this->input->input_stream('dept_name')); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_department'; $data =array('dept_name' =>$dept_name,); $condition =array( 'dept_name' =>$dept_name, 'delete_status' =>'ACTIVE'); $res=$this->MMG_model->get_where_row($table,$condition); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Department Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_reference_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->post('id'); $reference_type =$this->input->post('reference_type'); $created_at = date('Y-m-d H:i:s'); $data =array('reference_type' =>$reference_type, 'created_at' =>$created_at, 'created_by' =>$id ); $where =array('reference_type' =>$reference_type, 'delete_status' =>'ACTIVE'); $table = 'mmg_reference'; $res=$this->MMG_model->get_where_row($table,$where); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>' added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Reference Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_reference_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_reference'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_reference_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_reference'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_reference_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $reference_type =$this->input->input_stream('reference_type'); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_reference'; $data =array('reference_type' =>$reference_type,); $condition =array('reference_type' =>$reference_type, 'delete_status' =>'ACTIVE'); $res=$this->MMG_model->get_where_row($table,$condition); //print_r($res);die(); if(empty($res)) { $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Reference Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_reference_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_reference'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //payment form add public function add_payment_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $employee_type = $this->input->post('employee_type'); //$pf_type = $this->input->post('pf_type'); $pf = $this->input->post('pf'); $pf = str_replace(',','',$pf); //$esi_type = $this->input->post('esi_type'); $esi_above = $this->input->post('esi_above'); $esi_above = str_replace(',','',$esi_above); $esi = $this->input->post('esi'); $esi = str_replace(',','',$esi); //$prof_tax_type = $this->input->post('prof_tax_type'); $prof_tax_above = $this->input->post('prof_tax_above'); $prof_tax_above = str_replace(',','',$prof_tax_above); $prof_tax = $this->input->post('prof_tax'); $prof_tax = str_replace(',','',$prof_tax); //$hra_type = $this->input->post('hra_type'); $hra = $this->input->post('hra'); $hra = str_replace(',','',$hra); //$allowance_type = $this->input->post('allowance_type'); //$travel_allowance = $this->input->post('travel_allowance'); //$travel_allowance = str_replace(',','',$travel_allowance); //$other_allowance = $this->input->post('other_allowance'); $effect_from = $this->input->post('effect_from'); $effect_from = date('Y-m-d',strtotime($effect_from)); $created_on = date('Y-m-d H:i:s'); $data = array( 'employee_type' => $employee_type, //'pf_type' => $pf_type, 'pf' => $pf, //'esi_type' => $esi_type, 'esi_above' => $esi_above, 'esi' => $esi, //'prof_tax_type' => $prof_tax_type, 'prof_tax_above' => $prof_tax_above, 'prof_tax' => $prof_tax, //'hra_type' => $hra_type, 'hra' => $hra, //'allowance_type' => $allowance_type, //'travel_allowance' => $travel_allowance, //'other_allowance' => $other_allowance, 'effect_from' => $effect_from, 'created_by' => $id, 'created_on' => $created_on ); $table = 'mmg_payment'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>' added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_payment_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_payment'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_payment_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_payment'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_payment_details_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { //$id = $this->input->input_stream('id'); $update_id = $this->input->input_stream('update_id'); $m_employee_type = $this->input->input_stream('m_employee_type'); //$m_pf_type = $this->input->input_stream('m_pf_type'); $m_pf = $this->input->input_stream('m_pf'); $m_pf = str_replace(',','',$m_pf); //$m_esi_type = $this->input->input_stream('m_esi_type'); $m_esi_above = $this->input->input_stream('m_esi_above'); $m_esi_above = str_replace(',','',$m_esi_above); $m_esi = $this->input->input_stream('m_esi'); $m_esi = str_replace(',','',$m_esi); //$m_prof_tax_type = $this->input->input_stream('m_prof_tax_type'); $m_prof_tax_above = $this->input->input_stream('m_prof_tax_above'); $m_prof_tax_above = str_replace(',','',$m_prof_tax_above); $m_prof_tax = $this->input->input_stream('m_prof_tax'); $m_prof_tax = str_replace(',','',$m_prof_tax); //$m_hra_type = $this->input->input_stream('m_hra_type'); $m_hra = $this->input->input_stream('m_hra'); $m_hra = str_replace(',','',$m_hra); //$m_allowance_type = $this->input->input_stream('m_allowance_type'); //$m_travel_allowance = $this->input->input_stream('m_travel_allowance'); //$m_travel_allowance = str_replace(',','',$m_travel_allowance); //$m_other_allowance = $this->input->input_stream('m_other_allowance'); $updated_on = date('Y-m-d H:i:s'); $where = array('id'=>$update_id); $table = 'mmg_payment'; $data = array( 'employee_type' => $m_employee_type, //'pf_type' => $m_pf_type, 'pf' => $m_pf, //'esi_type' => $m_esi_type, 'esi_above' => $m_esi_above, 'esi' => $m_esi, //'prof_tax_type' => $m_prof_tax_type, 'prof_tax_above' => $m_prof_tax_above, 'prof_tax' => $m_prof_tax, //'hra_type' => $m_hra_type, 'hra' => $m_hra, //'allowance_type' => $m_allowance_type, //'travel_allowance' => $m_travel_allowance, //'other_allowance' => $m_other_allowance, 'updated_by' => $update_id, 'updated_on' => $updated_on ); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_payment_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_payment'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function all_permanent_offerletter_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id= $this->input->get('employee_id'); $result=$this->MMG_model->get_gross_in_payment($emp_id); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function change_appointment_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee_id =$this->input->get('employee_id'); $table = 'mmg_employees'; $where = array('emp_id'=>$employee_id); $data = array('offer_letter_status'=>'GENERATED'); $result=$this->MMG_model->update($where,$table,$data); if($result > 0) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_user_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $admin_id = $this->input->get('admin_id'); $table='mmg_login'; $data=array('id'=>$admin_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_user_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $admin_id = $this->input->post('admin_id'); $admin_email = $this->input->post('admin_email'); $admin_password = $this->input->post('admin_password'); $profile_image = $this->input->post('profile_image'); if(!empty($profile_image)) { $profile_image = $this->input->post('profile_image'); } else { $where = array('id'=>$admin_id); $table = 'mmg_login'; $get_details = $this->MMG_model->get_where_row($table,$where); $profile_image = $get_details->profile_image; } $table = 'mmg_login'; $where = array('id'=>$admin_id); $data= array( 'email' => $admin_email, 'password' => $admin_password, 'profile_image' => $profile_image, 'created_by' => $admin_id); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully..']; } else { $message=['status'=>'Fail','message'=>'Same data updated..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function latest_payment_details_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id = $this->input->post('emp_id'); $table = 'mmg_employees'; $where = $where=array('emp_id'=>$emp_id); $e_res = $this->MMG_model->get_where_row($table,$where); $type = $e_res->employee_type; //print_r($type);die(); $result = $this->MMG_model->latest_payment_details($type); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //---------------------------------------------- API --------------------------------------------------------// public function employee_apply_leave_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity == 'success') { $employee_id = $this->input->post('employee_id'); $leave_date = $this->input->post('leave_date'); $leave_date = date('Y-m-d',strtotime($leave_date)); $leave_type = $this->input->post('leave_type'); $reason = $this->input->post('reason'); $handover_emp_id = $this->input->post('handover_emp_id'); $note = $this->input->post('note'); $employee_table = 'mmg_employees'; $employee_where = array('delete_status'=>'ACTIVE'); $employee_result = $this->MMG_model->get_where_result($employee_table,$employee_where); $array = []; foreach ($employee_result as $value) { array_push($array, $value->emp_id); } if(in_array($employee_id, $array)) { $data = array( 'employee_id' => $employee_id, 'leave_date' => $leave_date, 'leave_type' => $leave_type, 'reason' => $reason, 'handover_emp_id' => $handover_emp_id, 'note' => $note, 'created_on' => $date ); $table = 'mmg_apply_leave'; $result = $this->MMG_model->insert($data,$table); if($result) { $leave_table = 'mmg_apply_leave'; $where = array('id'=>$result); $leave_result = $this->MMG_model->get_where_row($leave_table,$where); $message=['status'=>'Success','message'=>'Added successfully','employee_id'=>$leave_result->employee_id,'leave_date'=>$leave_result->leave_date,'leave_type'=>$leave_result->leave_type,'reason'=>$leave_result->reason,'handover_emp_id'=>$leave_result->handover_emp_id,'note'=>$leave_result->note]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=>'Employee not Exit...']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function leave_details_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $employee_id = $this->input->post('employee_id'); $table = 'mmg_apply_leave'; $where = array("delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); $array = []; foreach ($result as $value) { array_push($array,$value->employee_id); } if(in_array($employee_id,$array)) { $leave_table = 'mmg_apply_leave'; $condition = array('employee_id'=>$employee_id); $leave_result = $this->MMG_model->get_where_result($leave_table,$condition); $message=['status'=>'Success','message'=>$leave_result]; } else { $message = ['status'=>'Fail','message'=>'Employee not exit']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_employee_details_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $table = 'mmg_employees'; $where = array('delete_status'=>'ACTIVE'); $order_by= 'emp_id'; $details=$this->MMG_model->get_limit_data($table,$where,$order_by); /* if($details->e_id != '') { $e_id = $details->e_id+1; } else { $e_id = 1; } $emp_id = $e_id; if($emp_id >= '1' && $emp_id <= '9') { $employee_id = 'MMG-0'.$emp_id; } else { $employee_id = 'MMG-'.$emp_id; }*/ $email_id = $this->input->post('email_id'); $user_name = $this->input->post('user_name'); $phone_number = $this->input->post('phone_number'); $password = $this->input->post('password'); $otp = mt_rand(100000, 999999); $created_at = date('Y-m-d H:i:s'); $created_date = date('Y-m-d'); $table = 'mmg_employees'; $where = array('delete_status'=>'ACTIVE'); $result =$this->MMG_model->get_where_result($table,$where); $array=[]; foreach($result as $value) { array_push($array, $value->phone); } if(in_array($phone_number,$array)) { $data = array( 'full_name' =>$user_name, 'password' =>$password, 'email_id' =>$email_id, 'otp' =>$otp, 'updated_at' =>$date); $table = 'mmg_employees'; $where = array('phone'=>$phone_number); $result1=$this->MMG_model->update($where,$table,$data); $href = base_url(''); $time= '12:10:00'; $activation=md5($time); $cur_time = time(); $this->load->library('email'); if ($cur_time>$time) { $email_content = 'Hello '.$user_name.', Your OTP is : '.$otp; } else { $email_content=""; } require_once './email/PHPMailerAutoload.php'; $phpMailer = new PHPMailer(true); //$phpMailer->isSMTP(); $phpMailer->Host = "smtp.zoho.com"; $phpMailer->SMTPAuth = true; $phpMailer->Username = "support@nparrots.com"; $phpMailer->Password = "Nparrots@1236"; $phpMailer->SMTPSecure = "tls"; $phpMailer->Port = 587; $phpMailer->isHTML(true); $phpMailer->CharSet = "UTF-8"; $phpMailer->setFrom("support@nparrots.com", "MMG"); $phpMailer->addAddress($email_id); $phpMailer->Subject = "Sending OTP"; $phpMailer->Body = $email_content; $phpMailer->send(); //$results=$this->Email_model->sendEmail($from='shubharajappahk@gmail.com',$to=$email_id,$name=$user_name,$subject='Sending OTP',$message='You have successfully send OTP. Thank you'); if($result1>0) { $login_table = 'mmg_login'; $data1 = array( 'name' =>$user_name, 'phone' =>$phone_number, 'password' =>$password, 'email' =>$email_id, //'user_id' =>$employee_id, 'otp' =>$otp, 'role_id' =>'2', 'created_at' =>$created_at); // $result2=$this->MMG_model->insert($data1,$login_table); $where = array('phone'=>$phone_number); $result2=$this->MMG_model->update($where,$login_table,$data1); if($result1) { $where_id = array('phone'=>$phone_number); $check = $this->MMG_model->get_where_row($table,$where_id); $message=['status'=>'Success','message'=>'Updated successfully','details'=>$check]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Enter register phone Number']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_customer_details_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $user_name = $this->input->post('user_name'); $email_id = $this->input->post('email_id'); $password = $this->input->post('password'); $phone_number = $this->input->post('phone_number'); $layout_name = $this->input->post('layout_name'); $site_no = $this->input->post('site_no'); $otp = mt_rand(100000, 999999); $created_at = date('Y-m-d H:i:s'); $created_date = date('Y-m-d'); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); $array=[]; foreach ($result as $value) { array_push($array, $value->phone); } if(in_array($phone_number,$array)) { $data = array( 'name' =>$user_name, 'email' =>$email_id, 'password' =>$password, 'phone' =>$phone_number, 'layout_name' =>$layout_name, 'site_number' =>$site_no, 'otp' =>$otp, 'updated_on' =>$date ); $table ='mmg_customer'; $where = array('phone'=>$phone_number); $result1=$this->MMG_model->update($where,$table,$data); $href = base_url(''); $time= '12:10:00'; $activation=md5($time); $cur_time = time(); $this->load->library('email'); require_once './email/PHPMailerAutoload.php'; if ($cur_time>$time) { $email_content= 'Hello '.$user_name.', Your OTP is : '.$otp; } else { $email_content= ""; } $phpMailer = new PHPMailer(true); //$phpMailer->isSMTP(); $phpMailer->Host = "smtp.zoho.com"; $phpMailer->SMTPAuth = true; $phpMailer->Username = "support@nparrots.com"; $phpMailer->Password = "Nparrots@1236"; $phpMailer->SMTPSecure = "tls"; $phpMailer->Port = 587; $phpMailer->isHTML(true); $phpMailer->CharSet = "UTF-8"; $phpMailer->setFrom("support@nparrots.com", "MMG"); $phpMailer->addAddress($email_id); $phpMailer->Subject = "Sending OTP"; $phpMailer->Body = $email_content; $phpMailer->send(); if(!empty($result1)) { $login_table = 'mmg_login'; $data1 = array( 'name' =>$user_name, 'phone' =>$phone_number, 'password' =>$password, 'user_id' =>$result1, 'email' =>$email_id, 'otp' =>$otp, 'role_id' =>'3', 'created_at' =>$created_at); //$result2=$this->MMG_model->insert($data1,$login_table); $where = array('phone'=>$phone_number); $check_customer=$this->MMG_model->get_where_row($login_table,$where); if(!empty($check_customer)) { $result2=$this->MMG_model->update($where,$login_table,$data1); } else { $result2=$this->MMG_model->insert($data1,$login_table); } $where_id = array('phone'=>$phone_number); $check = $this->MMG_model->get_where_row($table,$where_id); $message=['status'=>'Success','message'=>'Updated successfully','details'=>$check]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Enter register phone Number']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function longitude_and_latitude_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $emp_id =$this->input->post('emp_id'); $longitude = $this->input->post('longitude'); $latitude = $this->input->post('latitude'); $table = 'mmg_employees'; $where = array('emp_id'=>$emp_id); $data = array('longitude' =>$longitude, 'latitude' =>$latitude, ); $result=$this->MMG_model->update($where,$table,$data); if($result) { $where = array('emp_id'=>$result); $result = $this->MMG_model->get_where_row($table,$where); $message=['status'=>'Success','message'=>'Added successfully','emp_id'=>$emp_id,'longitude'=>$result->longitude,'latitude'=>$result->latitude]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_verify_OTP_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $emp_id = $this->input->post('emp_id'); $otp = $this->input->post('otp'); $table = 'mmg_employees'; $where = array('emp_id'=>$emp_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($otp == $result->otp) { $message = ['status'=>'Valid otp','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Invalid otp']; } $where1 = array('emp_id'=>$emp_id,'delete_status'=>'INACTIVE'); $result1 = $this->MMG_model->get_where_row($table,$where1); if($result1['delete_status']=='INACTIVE') { $message = ['status'=>'Fail','message'=>'Employee not exit']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customer_verify_OTP_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $customer_id = $this->input->post('customer_id'); $otp = $this->input->post('otp'); $table = 'mmg_customer'; $where = array('id'=>$customer_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($otp == $result->otp) { $message = ['status'=>'Valid otp','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Invalid otp']; } $where1 = array('id'=>$customer_id,'delete_status'=>'INACTIVE'); $result1 = $this->MMG_model->get_where_row($table,$where1); if($result1['delete_status']=='INACTIVE') { $message = ['status'=>'Fail','message'=>'Customer not exit']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_login_track_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $login_date = $this->input->post('login_date'); $login_time = $this->input->post('login_time'); $login_longitude = $this->input->post('login_longitude'); $login_latitude = $this->input->post('login_latitude'); $login_image = $this->input->post('login_image'); $login_datetime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $login_datetime = $login_datetime->format('Y-m-d H:i:s'); $otp = mt_rand(100000, 999999); $created_at = date('Y-m-d H:i:s'); if($_FILES) { if(empty($_FILES['login_image']['name'])) { $profile = ""; } else { $target='employee_track/'; $target.=time().$_FILES['login_image']['name']; $profile=time().$_FILES['login_image']['name']; $image=$target; move_uploaded_file($_FILES['login_image']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; $config['width']=200; $config['height']=150; $this->image_lib->initialize($config); $this->image_lib->resize(); } } $data = array( 'login_date' =>$login_date, 'login_time' =>$login_time, 'login_longitude' =>$login_longitude, 'login_latitude' =>$login_latitude, 'login_image' =>$login_image, 'login_datetime' =>$login_datetime, 'otp' =>$otp, 'delete_status' => 'ACTIVE', 'created_at' =>$created_at ); $table = 'mmg_employee_track'; $result=$this->MMG_model->insert($data,$table); if($result) { $where = array('id'=>$result); $result = $this->MMG_model->get_where_row($table,$where); $message=['status'=>'Success','message'=>'Added successfully','emp_id'=>$result->id,'login_date'=>$result->login_date,'login_time'=>$result->login_time,'login_longitude'=>$result->login_longitude,'login_latitude'=>$result->login_latitude,'login_image'=>$result->login_image,'otp'=>$result->otp]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_logout_track_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $emp_id = $this->input->post('emp_id'); $logout_date = $this->input->post('logout_date'); $logout_time = $this->input->post('logout_time'); $logout_longitude = $this->input->post('logout_longitude'); $logout_latitude = $this->input->post('logout_latitude'); $logout_image = $this->input->post('logout_image'); $logout_datetime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $logout_datetime = $logout_datetime->format('Y-m-d H:i:s'); $created_at = date('Y-m-d H:i:s'); if($_FILES) { if(empty($_FILES['login_image']['name'])) { $profile = ""; } else { $target='employee_track/'; $target.=time().$_FILES['login_image']['name']; $profile=time().$_FILES['login_image']['name']; $image=$target; move_uploaded_file($_FILES['login_image']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; $config['width']=200; $config['height']=150; $this->image_lib->initialize($config); $this->image_lib->resize(); } } $table = 'mmg_employee_track'; $where=array('id'=> $emp_id); $result1 = $this->MMG_model->get_where_row($table,$where); $data = array( 'logout_date' =>$logout_date, 'logout_time' =>$logout_time, 'logout_longitude' =>$logout_longitude, 'logout_latitude' =>$logout_latitude, 'logout_image' =>$logout_image, 'logout_datetime' =>$logout_datetime, 'login_status' => 'Logged_OUT', 'created_at' =>$created_at ); $result = $this->MMG_model->update($where,$table,$data); if($result>0) { $where = array('id'=>$emp_id); $result = $this->MMG_model->get_where_row($table,$where); $message=['status'=>'Success','message'=>'Added successfully','customer_id'=>$result->id,'logout_date'=>$result->logout_date,'logout_time'=>$result->logout_time,'logout_longitude'=>$result->logout_longitude,'logout_latitude'=>$result->logout_latitude,'logout_image'=>$result->logout_image,'otp'=>$result->otp]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customer_login_track_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $login_date = $this->input->post('login_date'); $login_time = $this->input->post('login_time'); $login_longitude = $this->input->post('login_longitude'); $login_latitude = $this->input->post('login_latitude'); $login_image = $this->input->post('login_image'); $login_datetime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $login_datetime = $login_datetime->format('Y-m-d H:i:s'); $otp = mt_rand(100000, 999999); $created_at = date('Y-m-d H:i:s'); if($_FILES) { if(empty($_FILES['login_image']['name'])) { $profile = ""; } else { $target='customer_track/'; $target.=time().$_FILES['login_image']['name']; $profile=time().$_FILES['login_image']['name']; $image=$target; move_uploaded_file($_FILES['login_image']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; $config['width']=200; $config['height']=150; $this->image_lib->initialize($config); $this->image_lib->resize(); } } $data = array( 'login_date' =>$login_date, 'login_time' =>$login_time, 'login_longitude' =>$login_longitude, 'login_latitude' =>$login_latitude, 'login_image' =>$login_image, 'login_datetime' =>$login_datetime, 'otp' =>$otp, 'delete_status' => 'ACTIVE', 'created_at' =>$created_at ); $table = 'mmg_customer_track'; $result=$this->MMG_model->insert($data,$table); if($result) { $where = array('id'=>$result); $result = $this->MMG_model->get_where_row($table,$where); $message=['status'=>'Success','message'=>'Added successfully','customer_id'=>$result->id,'login_date'=>$result->login_date,'login_time'=>$result->login_time,'login_longitude'=>$result->login_longitude,'login_latitude'=>$result->login_latitude,'login_image'=>$result->login_image,'otp'=>$result->otp]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customer_logout_track_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $customer_id = $this->input->post('customer_id'); $logout_date = $this->input->post('logout_date'); $logout_time = $this->input->post('logout_time'); $logout_longitude = $this->input->post('logout_longitude'); $logout_latitude = $this->input->post('logout_latitude'); $logout_image = $this->input->post('logout_image'); $logout_datetime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $logout_datetime = $logout_datetime->format('Y-m-d H:i:s'); $created_at = date('Y-m-d H:i:s'); if($_FILES) { if(empty($_FILES['login_image']['name'])) { $profile = ""; } else { $target='customer_track/'; $target.=time().$_FILES['login_image']['name']; $profile=time().$_FILES['login_image']['name']; $image=$target; move_uploaded_file($_FILES['login_image']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; $config['width']=200; $config['height']=150; $this->image_lib->initialize($config); $this->image_lib->resize(); } } $table = 'mmg_customer_track'; $where=array('id'=> $customer_id); $data = array( 'logout_date' =>$logout_date, 'logout_time' =>$logout_time, 'logout_longitude' =>$logout_longitude, 'logout_latitude' =>$logout_latitude, 'logout_image' =>$logout_image, 'logout_datetime' =>$logout_datetime, 'login_status' => 'Logged_OUT', 'created_at' =>$created_at ); $result = $this->MMG_model->update($where,$table,$data); if($result) { $where = array('id'=>$customer_id); $result = $this->MMG_model->get_where_row($table,$where); $message=['status'=>'Success','message'=>'Added successfully','customer_id'=>$result->id,'logout_date'=>$result->logout_date,'logout_time'=>$result->logout_time,'logout_longitude'=>$result->logout_longitude,'logout_latitude'=>$result->logout_latitude,'logout_image'=>$result->logout_image,'otp'=>$result->otp]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_attendance_Logintrack_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $emp_id = $this->input->post('emp_id'); $entry_date = $this->input->post('entry_date'); $entry_time = $this->input->post('entry_time'); $entry_longitude = $this->input->post('entry_longitude'); $entry_latitude = $this->input->post('entry_latitude'); $entry_datetime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $entry_datetime = $entry_datetime->format('Y-m-d H:i:s'); $created_at = date('Y-m-d H:i:s'); $entry_image = $this->input->post('entry_image'); $folderPath = ".././client/uploads/"; $image_parts = explode(";base64,", $entry_image); $image_type_aux = explode("image/", $image_parts[0]); $image_type = $image_type_aux[0]; $image_base64 = base64_decode($image_parts[0]); $file = $folderPath . uniqid() . '.png'; file_put_contents($file, $image_base64); $time = date_create()->format('Y-m-d H:i:s'); $employee_table = 'mmg_employees'; $employee_where = array('emp_id'=>$emp_id); $result5 = $this->MMG_model->get_where_row($employee_table,$employee_where); if(!empty($result5)) { $employee_table = 'mmg_employee_attendance'; $employee_where = array('emp_id'=>$emp_id); $order_by = 'id'; $result4 = $this->MMG_model->get_where_row_orderby($employee_table,$employee_where,$order_by); if(!empty($result4)) { if($result4->emp_id == $emp_id && $result4->entry_status !='Logged_IN') { $table2 = 'mmg_employees'; $where2 = array('delete_status'=>'ACTIVE'); $result2 = $this->MMG_model->get_where_result($table2,$where2); $array=[]; foreach ($result2 as $value) { array_push($array, $value->emp_id); } if(in_array($emp_id,$array)) { $data = array( 'emp_id' =>$emp_id, 'entry_date' =>$entry_date, 'entry_time' =>$entry_time, 'entry_longitude' =>$entry_longitude, 'entry_latitude' =>$entry_latitude, 'entry_image' =>$file, 'entry_datetime' =>$entry_datetime, 'delete_status' => 'ACTIVE', 'created_at' =>$created_at ); $table = 'mmg_employee_attendance'; $result=$this->MMG_model->insert($data,$table); if($result) { $where4 = array('id'=>$result); $result4 = $this->MMG_model->get_where_row($table,$where4); $message=['status'=>'Success','message'=>'Added successfully','emp_id'=>$result4->emp_id,'entry_date'=>$result4->entry_date,'entry_time'=>$result4->entry_time,'entry_longitude'=>$result4->entry_longitude,'entry_latitude'=>$result4->entry_latitude]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Employee not exit']; } } else { $message=['status'=>'Fail','message'=> 'Employee already Logged_IN,please Logged_OUT']; } } else { $table2 = 'mmg_employees'; $where2 = array('delete_status'=>'ACTIVE'); $result2 = $this->MMG_model->get_where_result($table2,$where2); $array=[]; foreach ($result2 as $value) { array_push($array, $value->emp_id); } if(in_array($emp_id,$array)) { $data = array( 'emp_id' =>$emp_id, 'entry_date' =>$entry_date, 'entry_time' =>$entry_time, 'entry_longitude' =>$entry_longitude, 'entry_latitude' =>$entry_latitude, 'entry_image' =>$file, 'entry_datetime' =>$entry_datetime, 'delete_status' => 'ACTIVE', 'created_at' =>$created_at ); $table = 'mmg_employee_attendance'; $result=$this->MMG_model->insert($data,$table); if($result) { $where4 = array('id'=>$result); $result4 = $this->MMG_model->get_where_row($table,$where4); $message=['status'=>'Success','message'=>'Added successfully','emp_id'=>$result4->emp_id,'entry_date'=>$result4->entry_date,'entry_time'=>$result4->entry_time,'entry_longitude'=>$result4->entry_longitude,'entry_latitude'=>$result4->entry_latitude]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Employee not exit']; } } } else { $message=['status'=>'Fail','message'=> 'Employee not exit']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_attendance_Logouttrack_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $emp_id = $this->input->post('emp_id'); $exit_date = $this->input->post('exit_date'); $exit_time = $this->input->post('exit_time'); $exit_longitude = $this->input->post('exit_longitude'); $exit_latitude = $this->input->post('exit_latitude'); $exit_datetime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $exit_datetime = $exit_datetime->format('Y-m-d H:i:s'); $created_at = date('Y-m-d H:i:s'); $exit_image = $this->input->post('exit_image'); $folderPath = ".././client/uploads/"; $image_parts = explode(";base64,", $exit_image); $image_type_aux = explode("image/", $image_parts[0]); $image_type = $image_type_aux[0]; $image_base64 = base64_decode($image_parts[0]); $file = $folderPath . uniqid() . '.png'; file_put_contents($file, $image_base64); $time = date_create()->format('Y-m-d H:i:s'); $employee_table = 'mmg_employees'; $employee_where = array('emp_id'=>$emp_id); $result5 = $this->MMG_model->get_where_row($employee_table,$employee_where); if(!empty($result5)) { $table2 = 'mmg_employee_attendance'; $where2=array('emp_id'=>$emp_id); $order_by = 'id'; $result2 = $this->MMG_model->get_where_row_orderby($table2,$where2,$order_by); if(!empty($result2)) { if($result2->emp_id == $emp_id && $result2->entry_status=='Logged_OUT') { $message=['status'=>'Fail','message'=>'Employee already Logged_OUT']; } else { $table = 'mmg_employee_attendance'; $where=array('id'=> $result2->id); $data = array( 'exit_date' =>$exit_date, 'exit_time' =>$exit_time, 'exit_longitude' =>$exit_longitude, 'exit_latitude' =>$exit_latitude, 'exit_image' =>$file, 'exit_datetime' =>$exit_datetime, 'entry_status' => 'Logged_OUT', 'created_at' =>$created_at ); $result = $this->MMG_model->update($where,$table,$data); if(!empty($result)) { $table1 = 'mmg_employee_attendance'; $where1 = array('id'=> $result2->id); $result1 = $this->MMG_model->get_where_row($table1,$where1); $message=['status'=>'Success','message'=>'Added successfully','emp_id'=>$result1->emp_id,'exit_date'=>$result1->exit_date,'exit_time'=>$result1->exit_time,'exit_longitude'=>$result1->exit_longitude,'exit_latitude'=>$result1->exit_latitude]; } else { $message=['status'=>'Fail','message'=>'Employee Not Exist']; } } } else { $message=['status'=>'Fail','message'=> 'Employee Not Yet Logged IN']; } } else { $message=['status'=>'Fail','message'=>'Employee Not Exist']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fetch_layout_details_get() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $table = "mmg_layouts"; $where = array("delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); $details = []; foreach ($result as $res) { $details[]=array( 'id' => $res->id, 'layout_name' => $res->layout_name, 'layout_address' => $res->layout_address, 'layout_development' => $res->layout_development, ); } if($details) { $message = ['status'=>'Success','message'=>$details]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fetch_site_details_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $layout_id = $this->input->post('layout_id'); $table = 'mmg_sites'; $where = array("delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); $array=[]; foreach ($result as $value) { array_push($array, $value->layout); } if(in_array($layout_id,$array)) { $table1 = 'mmg_sites'; $where1 = array('layout'=>$layout_id); $result1 = $this->MMG_model->get_where_result($table1,$where1); } if(!empty($result1)) { $message=['status'=>'Success','message'=>$result1]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function all_login_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $phone =$this->input->post('phone'); $password = $this->input->post('password'); $table = 'mmg_login'; $where = array('phone' =>$phone, 'password' =>$password, ); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $where = array('id'=>$result->id); $result_data = $this->MMG_model->get_where_row($table,$where); $message=['status'=>'Success','id'=>$result->user_id,'phone'=>$result->phone,'password'=>$result->password,'role_id'=>$result->role_id]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //------------------------------------------------------------------------------------------------------------// public function get_site_dimension_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->post("layout_id"); $site_id = $this->input->post("site_id"); $table = "mmg_sites"; $where = array("id"=>$site_id,"layout"=>$layout_id,"delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_name_dimension_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id= $this->input->post('layout_id'); $site_num=$this->input->post('site_num'); $result=$this->MMG_model->get_customer_booking_details($layout_id,$site_num); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_plot_payment_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { //table1 $id = $this->input->post('id'); $booking_id = $this->input->post('booking_id'); $customer_id = $this->input->post('customer_id'); $layout_id = $this->input->post('layout_id'); $site_number = $this->input->post('site_number'); $site_dimension_north = $this->input->post('site_dimension_north'); $site_dimension_east = $this->input->post('site_dimension_east'); $site_dimension_south = $this->input->post('site_dimension_south'); $site_dimension_west = $this->input->post('site_dimension_west'); $maintenance = $this->input->post('maintenance'); $num_of_years = $this->input->post('num_of_years'); $club_house = $this->input->post('club_house'); $created_at = date('Y-m-d H:i:s'); //table2 $agreement_amount = $this->input->post('agreement_amount'); $agreement_date = $this->input->post('agreement_date'); $agreement_date = date('Y-m-d',strtotime($agreement_date)); $agreement_payment_type = $this->input->post('agreement_payment_type'); if($agreement_payment_type == 'Cash' || $agreement_payment_type == 'Swipe') { $agr_pay_no = ''; $agr_pay_date = ''; $agr_bank_name = ''; } else if($agreement_payment_type == 'Cheque') { $agr_pay_no = $this->input->post('agr_cheque_no'); $agr_cheque_date = $this->input->post('agr_cheque_date'); $agr_pay_date = date('Y-m-d',strtotime($agr_cheque_date)); $agr_bank_name = $this->input->post('agr_cheque_bank_name'); } else if( $agreement_payment_type == 'Online Payment' ) { $agr_pay_no = $this->input->post('agr_utr_no'); $agr_pay_date = $this->input->post('agr_pay_date'); $agr_pay_date = date('Y-m-d',strtotime($agr_pay_date)); $agr_bank_name = ''; } else if( $agreement_payment_type == 'DD' ) { $agr_pay_no = $this->input->post('agr_dd_no'); $agr_dd_date = $this->input->post('agr_dd_date'); $agr_pay_date = date('Y-m-d',strtotime($agr_dd_date)); $agr_bank_name = $this->input->post('agr_dd_bank_name'); } //table3 $installment_amount = $this->input->post('installment_amount'); $installment_date = $this->input->post('installment_date'); $installment_date = date('Y-m-d',strtotime($installment_date)); $installment_payment_type = $this->input->post('installment_payment_type'); if($installment_payment_type == 'Cash' || $installment_payment_type == 'Swipe') { $ins_pay_no = ''; $ins_pay_date = ''; $ins_bank_name = ''; } else if($installment_payment_type == 'Cheque') { $ins_pay_no = $this->input->post('ins_cheque_no'); $ins_cheque_date = $this->input->post('ins_cheque_date'); $ins_pay_date = date('Y-m-d',strtotime($ins_cheque_date)); $ins_bank_name = $this->input->post('ins_cheque_bank_name'); } else if( $installment_payment_type == 'Online Payment' ) { $ins_pay_no = $this->input->post('ins_utr_no'); $ins_pay_date = $this->input->post('ins_pay_date'); $ins_pay_date = date('Y-m-d',strtotime($ins_pay_date)); $ins_bank_name = ''; } else if( $installment_payment_type == 'DD' ) { $ins_pay_no = $this->input->post('ins_dd_no'); $ins_dd_date = $this->input->post('ins_dd_date'); $ins_pay_date = date('Y-m-d',strtotime($ins_dd_date)); $ins_bank_name = $this->input->post('ins_dd_bank_name'); } //table4 $registration_amount = $this->input->post('registration_amount'); $registration_value = $this->input->post('registration_value'); $registration_date = $this->input->post('registration_date'); $registration_date = date('Y-m-d',strtotime($registration_date)); $registration_payment_type = $this->input->post('registration_payment_type'); if($registration_payment_type == 'Cash' || $registration_payment_type == 'Swipe') { $pay_no = ''; $pay_date = ''; $bank_name = ''; } else if($registration_payment_type == 'Cheque') { $pay_no = $this->input->post('reg_cheque_no'); $reg_cheque_date = $this->input->post('reg_cheque_date'); $pay_date = date('Y-m-d',strtotime($reg_cheque_date)); $bank_name = $this->input->post('reg_cheque_bank_name'); } else if( $registration_payment_type == 'Online Payment' ) { $pay_no = $this->input->post('reg_utr_no'); $reg_pay_date = $this->input->post('reg_pay_date'); $pay_date = date('Y-m-d',strtotime($reg_pay_date)); $bank_name = ''; } else if( $registration_payment_type == 'DD' ) { $pay_no = $this->input->post('reg_dd_no'); $reg_dd_date = $this->input->post('reg_dd_date'); $pay_date = date('Y-m-d',strtotime($reg_dd_date)); $bank_name = $this->input->post('reg_dd_bank_name'); } $data1 = array('booking_id' => $booking_id, 'customer_id' => $customer_id, 'layout_id' => $layout_id, 'site_id' => $site_number, 'site_dimension_north' => $site_dimension_north, 'site_dimension_east' => $site_dimension_east, 'site_dimension_south' => $site_dimension_south, 'site_dimension_west' => $site_dimension_west, 'maintenance' => $maintenance, 'num_of_years' => $num_of_years, 'club_house' => $club_house, 'delete_status' => 'ACTIVE', 'created_by' => $id, 'created_at' => $created_at); $table1 = 'mmg_plot_payment'; $result=$this->MMG_model->insert($data1,$table1); if($result) { if($agreement_amount != '' || $agreement_amount != 0) { $data2 = array('p_id' => $result, 'booking_id' => $booking_id, 'agreement_amount' => $agreement_amount, 'agreement_date' => $agreement_date, 'agreement_payment_type'=> $agreement_payment_type, 'agr_pay_no' => $agr_pay_no, 'agr_pay_date' => $agr_pay_date, 'agr_bank_name' => $agr_bank_name, 'delete_status' => 'ACTIVE', 'created_by' => $id, 'created_at' => $created_at); $table2 = 'mmg_payment_agreement'; $result2 = $this->MMG_model->insert($data2,$table2); } if($installment_amount != '' || $installment_amount != 0) { $data3 = array('p_id' => $result, 'booking_id' => $booking_id, 'installment_amount' => $installment_amount, 'installment_date' => $installment_date, 'installment_payment_type' => $installment_payment_type, 'ins_pay_no' => $ins_pay_no, 'ins_pay_date' => $ins_pay_date, 'ins_bank_name' => $ins_bank_name, 'delete_status' => 'ACTIVE', 'created_by' => $id, 'created_at' => $created_at); $table3 = 'mmg_payment_installment'; $result3 = $this->MMG_model->insert($data3,$table3); } if($registration_amount != '' || $registration_amount != 0) { $data4 = array('p_id' => $result, 'booking_id' => $booking_id, 'registration_amount' => $registration_amount, 'registration_value' => $registration_value, 'registration_date' => $registration_date, 'registration_payment_type' => $registration_payment_type, 'pay_no' => $pay_no, 'pay_date' => $pay_date, 'bank_name' => $bank_name, 'delete_status' => 'ACTIVE', 'created_by' => $id, 'created_at' => $created_at); $table4 = 'mmg_payment_registration'; $result4 = $this->MMG_model->insert($data4,$table4); } /*print_r($result."---");print_r($result2."---");print_r($result3."---"); print_r($result4."---");die();*/ $message=['status'=>'Success','message'=>'Added successfully']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_plot_payment_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result=$this->MMG_model->get_plot_paymentlist_details(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //------------------------------------------------------------ account master--------------------------------------------// public function add_item_creation_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $item_name = $this->input->post('item_name'); $Alias = $this->input->post('Alias'); $print_name = $this->input->post('print_name'); $item_group = $this->input->post('item_group'); $unit = $this->input->post('unit'); $op_stock_qty = $this->input->post('op_stock_qty'); $op_stock_value = $this->input->post('op_stock_value'); $tax_category = $this->input->post('tax_category'); $hsn_sac_code = $this->input->post('hsn_sac_code'); $created_at = date('Y-m-d H:i:s'); $data = array( 'item_name' => $item_name, 'Alias' => $Alias, 'print_name' => $print_name, 'item_group' => $item_group, 'unit' => $unit, 'op_stock_qty' => $op_stock_qty, 'op_stock_value' => $op_stock_value, 'tax_category' => $tax_category, 'hsn_sac_code' => $hsn_sac_code, 'delete_status' => 'ACTIVE', 'created_by' => $id, 'created_at' => $created_at ); //print_r($data);die(); $table = 'mmg_item_creation'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_item_creation_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_item_creation'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_item_creation_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_item_creation'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_item_creation_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('id'); $update_id = $this->input->input_stream('update_id'); $item_name = $this->input->input_stream('item_name'); $Alias = $this->input->input_stream('Alias'); $print_name = $this->input->input_stream('print_name'); $item_group = $this->input->input_stream('item_group'); $unit = $this->input->input_stream('unit'); $op_stock_qty = $this->input->input_stream('op_stock_qty'); $op_stock_value = $this->input->input_stream('op_stock_value'); $tax_category = $this->input->input_stream('tax_category'); $hsn_sac_code = $this->input->input_stream('hsn_sac_code'); //print_r($under_group);die(); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_item_creation'; $data =array('item_name' => $item_name, 'Alias' => $Alias, 'print_name' => $print_name, 'item_group' => $item_group, 'unit' => $unit, 'op_stock_qty' => $op_stock_qty, 'op_stock_value' => $op_stock_value, 'tax_category' => $tax_category, 'hsn_sac_code' => $hsn_sac_code ); //print_r($data);die(); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_item_creation_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_item_creation'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_tax_category_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $tax_name = $this->input->post('tax_name'); $tax_type = $this->input->post('tax_type'); $tax_rate_igst = $this->input->post('tax_rate_igst'); $tax_rate_cgst = $this->input->post('tax_rate_cgst'); $tax_rate_sgst = $this->input->post('tax_rate_sgst'); $tax_mrp = $this->input->post('tax_mrp'); $created_at = date('Y-m-d H:i:s'); $data = array( 'tax_name' => $tax_name, 'tax_type' => $tax_type, 'tax_rate_igst' => $tax_rate_igst, 'tax_rate_cgst' => $tax_rate_cgst, 'tax_rate_sgst' => $tax_rate_sgst, 'tax_mrp' => $tax_mrp, 'delete_status' => 'ACTIVE', 'created_by' => $id, 'created_at' => $created_at ); //print_r($data);die(); $table = 'mmg_tax_category'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_tax_category_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_tax_category'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_tax_category_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_tax_category'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_tax_category_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('id'); $update_id = $this->input->input_stream('update_id'); $tax_name = $this->input->input_stream('tax_name'); $tax_type = $this->input->input_stream('tax_type'); $tax_rate_igst = $this->input->input_stream('tax_rate_igst'); $tax_rate_cgst = $this->input->input_stream('tax_rate_cgst'); $tax_rate_sgst = $this->input->input_stream('tax_rate_sgst'); $tax_mrp = $this->input->input_stream('tax_mrp'); //print_r($under_group);die(); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_tax_category'; $data =array('tax_name' => $tax_name, 'tax_type' => $tax_type, 'tax_rate_igst' => $tax_rate_igst, 'tax_rate_cgst' => $tax_rate_cgst, 'tax_rate_sgst' => $tax_rate_sgst, 'tax_mrp' => $tax_mrp ); //print_r($data);die(); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_tax_category_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_tax_category'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_item_group_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $item_group = $this->input->post('item_group'); $Alias = $this->input->post('Alias'); $primary_group = $this->input->post('primary_group'); $under_group = $this->input->post('under_group'); $created_at = date('Y-m-d H:i:s'); $data = array( 'item_group' => $item_group, 'Alias' => $Alias, 'primary_group' => $primary_group, 'under_group' => $under_group, 'delete_status' => 'ACTIVE', 'created_by' => $id, 'created_at' => $created_at ); //print_r($data);die(); $table = 'mmg_item_group'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_item_group_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_item_group'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_item_group_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_item_group'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_item_group_details_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $item_group = $this->input->input_stream('item_group'); $Alias = $this->input->input_stream('Alias'); $primary_group = $this->input->input_stream('primary_group'); $under_group = $this->input->input_stream('under_group'); //print_r($under_group);die(); $created_at =date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_item_group'; $data =array('item_group' => $item_group, 'Alias' => $Alias, 'primary_group' => $primary_group, 'under_group' => $under_group ); //print_r($data);die(); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_item_group_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_item_group'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customer_info_import_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $created_by = $this->input->post('login_id'); date_default_timezone_set('Asia/Kolkata'); $created_on = date('Y-m-d H:i:s', time()); $details = $this->input->post('details'); $decoded = json_decode($details); //print_r($decoded);die(); $data = []; foreach ($decoded as $key => $value) { $customer_name = $value->customer_name; if($value->customer_name != "NULL" || $value->customer_name != "") { $customer_name = $value->customer_name; } else { $customer_name = ''; } $phone = $value->phone; if($value->phone != "NULL" || $value->phone != "") { $phone = $value->phone; } else { $phone = ''; } $nri_no = $value->nri_no; if($value->nri_no != "NULL" || $value->nri_no != "") { $nri_no = $value->nri_no; } else { $nri_no = ''; } $ref_type = $value->ref_type; if($ref_type !='' && $ref_type !='NULL') { $table = "mmg_reference"; $where = array('reference_type'=>$ref_type,'delete_status'=>'ACTIVE'); $ref_result = $this->MMG_model->get_where_row($table,$where); $ref_type_id = $ref_result->id; } else { $ref_type_id = ''; } if($ref_type != '') { if($ref_type == "Old Customer") { $ref_from = $value->ref_from; if($ref_from != '' && $ref_from != 'NULL') { $table = "mmg_customer"; $where = array('name'=>$ref_from,'delete_status'=>'ACTIVE'); $cust_result = $this->MMG_model->get_where_row($table,$where); if(!empty($cust_result)) { $ref_from = $cust_result->id; } else { $ref_from = ""; } } else { $ref_from = ''; } } else if($ref_type == 'Staff'|| $ref_type == 'Channel Partner') { $table = "mmg_employees"; $where = array('first_name'=>$value->ref_from,'delete_status'=>'ACTIVE'); $cust_result = $this->MMG_model->get_where_row($table,$where); if(!empty($cust_result)) { $ref_from = $cust_result->emp_id; } else { $ref_from = ""; } } else { $ref_from = ''; } } else { $ref_from = ''; } $layout_name = $value->layout_name; if($layout_name != '' && $ref_from != 'NULL') { $table = "mmg_land_owner"; $where = array('layout_name'=>$layout_name,'delete_status'=>'ACTIVE'); $layout_result = $this->MMG_model->get_where_row($table,$where); if(!empty($layout_result)) { $layout_id = $layout_result->id; } else { $layout_id = ""; } } else { $layout_id = ''; } $site_number = $value->site_no; if($site_number != '' && $ref_from != 'NULL') { $table = "mmg_sites"; $where = array('site_no'=>$site_number,'delete_status'=>'ACTIVE'); $site_result = $this->MMG_model->get_where_row($table,$where); if(!empty($site_result)) { $site_id = $site_result->id; } else { $site_id = ""; } } else { $site_id = ''; } /*$employee_name = $value->employee_name; if($employee_name != '' && $ref_from != 'NULL') { $table = "mmg_employees"; $where = array('first_name'=>$employee_name,'delete_status'=>'ACTIVE'); $emp_res = $this->MMG_model->get_where_row($table,$where); $emp_id = $emp_res->emp_id; } else { $emp_id = ''; }*/ $department = $value->department; if($department != '' && $ref_from != 'NULL') { $table = "mmg_department"; $where = array('dept_name'=>$department,'delete_status'=>'ACTIVE'); $dept_res = $this->MMG_model->get_where_row($table,$where); if(!empty($dept_res)) { $dept_id = $dept_res->id; } else { $dept_id = ""; } } else { $dept_id = ''; } $enquiry_status = $value->enquiry_status; if($enquiry_status != '' && $ref_from != 'NULL') { $table = "mmg_followup_progress"; $where = array('progress_name'=>$enquiry_status,'delete_status'=>'ACTIVE'); $pro_res = $this->MMG_model->get_where_row($table,$where); if(!empty($pro_res)) { $pro_id = $pro_res->id; } else { $pro_id = ""; } } else { $pro_id = ''; } if($value->email != "NULL" || $value->email != "") { $email = $value->email; } else { $email = ''; } if($value->remarks != "NULL" || $value->remarks != "") { $remarks = $value->remarks; } else { $remarks = ''; } $enquiry_layout = $value->enquiry_layout; if($enquiry_layout != '' || $enquiry_layout != 'NULL') { $table = "mmg_land_owner"; $where = array('layout_name'=>$enquiry_layout,'delete_status'=>'ACTIVE'); $enquiry = $this->MMG_model->get_where_row($table,$where); if(!empty($enquiry)) { $enquiry_layout = $enquiry->id; } else { $enquiry_layout = ""; } } else { $enquiry_layout = ''; } $table ='mmg_customer'; $data =array('delete_status'=>'ACTIVE','phone'=>$value->phone); $result=$this->MMG_model->get_where_row($table,$data); if(empty($result)) { $otp = mt_rand(100000, 999999); $data = array('name' => $customer_name, 'phone' => $phone, 'email' => $email, 'nri_no' => $nri_no, 'ref_type' => $ref_type_id, 'ref_person' => $ref_from, 'ref_layout_id' => $layout_id, 'ref_site_number' => $site_id, //'employee_id' =>$emp_id, 'department_id' =>$dept_id, 'enquiry_status' =>$pro_id, 'remarks' => $remarks, 'created_by' => $created_by, 'created_on' => $created_on, 'created_at' => $created_on, 'otp' =>$otp, 'enquiry_layout' =>$enquiry_layout, ); $table = "mmg_customer"; $result = $this->MMG_model->insert($data,$table); } else { $otp = mt_rand(100000, 999999); $data = array('name' => $customer_name, 'phone' => $phone, 'email' => $email, 'nri_no' => $nri_no, 'ref_type' => $ref_type_id, 'ref_person' => $ref_from, 'ref_layout_id' => $layout_id, 'ref_site_number' => $site_id, //'employee_id' =>$emp_id, 'department_id' =>$dept_id, 'enquiry_status' =>$pro_id, 'remarks' => $remarks, 'created_by' => $created_by, 'created_on' => $created_on, 'created_at' => $created_on, 'otp' =>$otp, 'enquiry_layout' =>$enquiry_layout, 'duplicate_cust' =>'Duplicate', ); $table = "mmg_customer"; $result = $this->MMG_model->insert($data,$table); } } if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_info_import_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $created_by = $this->input->post('login_id'); date_default_timezone_set('Asia/Kolkata'); $created_on = date('Y-m-d H:i:s', time()); $details = $this->input->post('details'); $decoded = json_decode($details); //print_r($decoded);die(); $data = []; foreach ($decoded as $key => $value) { $employee_id = $value->employee_id; $employee = explode("-",$employee_id); $e_id = $employee[1]; $first_name = $value->first_name; $last_name = $value->last_name; $full_name = $value->full_name; if($full_name != '') { $full_name = $full_name; } else { $full_name = $first_name.' '.$last_name; } $gender = $value->gender; if($gender == 'F' || $gender == 'f' || $gender == 'Female' || $gender == 'female') { $gender = 'Female'; } else if($gender == 'M' || $gender == 'm' || $gender == 'Male' || $gender == 'male') { $gender = 'Male'; } $email_id = $value->email_id; $phone = $value->phone; $district = ucwords($value->district); $table = "mmg_districts"; $where = array('name'=>$district); $res_district = $this->MMG_model->get_where_row($table,$where); $district_id = $res_district->id; $state = ucwords($value->state); $table = "mmg_states"; $where = array('name'=>$state); $res_state = $this->MMG_model->get_where_row($table,$where); $state_id = $res_state->id; $country = $value->country; $department = ucwords($value->department); $table = "mmg_department"; $where = array('dept_name'=>$department,'delete_status'=>'ACTIVE'); $res_department = $this->MMG_model->get_where_row($table,$where); $department_id = $res_department->id; $layout = $value->layout; $table = "mmg_layouts"; $where = array('layout_name'=>$layout,'delete_status'=>'ACTIVE'); $res_layout = $this->MMG_model->get_where_row($table,$where); $layout_id = $res_layout->id; $reporting_to = $value->reporting_to; $date_of_joining= $value->date_of_joining; if($date_of_joining != '') { $doj = explode("/",$date_of_joining); $date_of_joining = $doj[0].'-'.$doj[1].'-'.$doj[2]; } else { $date_of_joining = ''; } $employee_status= $value->employee_status; $employee_type = $value->employee_type; $cl = $value->cl; if($cl != '') { $cl = $cl; } else { $cl = ''; } $ml = $value->ml; if($ml != '') { $ml = $ml; } else { $ml = ''; } $designation = $value->designation; $bank_name = $value->bank_name; $ifsc_code = $value->ifsc_code; $account_no = $value->account_no; $pan_no = $value->pan_no; $aadhar_no = $value->aadhar_no; $per_address = $value->per_address; $residential_address = $value->residential_address; $personal_email_id = $value->personal_email_id; $date_of_birth = $value->date_of_birth; if($date_of_birth != '') { $dob = explode("/",$date_of_birth); $date_of_birth = $dob[0].'-'.$dob[1].'-'.$dob[2]; } else { $date_of_birth = ''; } $marital_status = ucfirst($value->marital_status); $father_name = $value->father_name; if($father_name != '') { $father_name = $father_name; } else { $father_name = ''; } $husband_name = $value->husband_name; if($husband_name != '') { $husband_name = $husband_name; } else { $husband_name = ''; } $job_description = $value->job_description; $about_me = $value->about_me; $date_of_exit = $value->date_of_exit; if($date_of_exit != '') { $doe = explode("/",$date_of_exit); $date_of_exit= $doe[0].'-'.$doe[1].'-'.$doe[2]; } else { $date_of_exit= ''; } $data[] = array('employee_id' => $employee_id, 'e_id' => $e_id, 'first_name' => $first_name, 'last_name' => $last_name, 'full_name' => $full_name, 'gender' => $gender, 'email_id' => $email_id, 'phone' => $phone, 'district' => $district_id, 'state' => $state_id, 'country' => $country, 'department_id' => $department_id, 'project' => $layout_id, 'reporting_to' => $reporting_to, 'date_of_joining' => $date_of_joining, 'employee_status' => $employee_status, 'employee_type' => $employee_type, 'cl' => $cl, 'ml' => $ml, 'role_id' => $designation, 'bank_name' => $bank_name, 'ifsc_code' => $ifsc_code, 'account_no' => $account_no, 'pan_no' => $pan_no, 'aadhar_no' => $aadhar_no, 'address' => $per_address, 'residential_address' => $residential_address, 'personal_email_id' => $personal_email_id, 'date_of_birth' => $date_of_birth, 'marital_status' => $marital_status, 'father_name' => $father_name, 'husband_name' => $husband_name, 'job_description' => $job_description, 'about_me' => $about_me, 'date_of_exit' => $date_of_exit, 'created_at' => $created_on ); } //print_r($data);die(); $table = "mmg_employees"; $result = $this->MMG_model->insert_batch($table,$data); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function site_info_import_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $created_by = $this->input->post('login_id'); date_default_timezone_set('Asia/Kolkata'); $created_on = date('Y-m-d H:i:s', time()); $details = $this->input->post('details'); $decoded = json_decode($details); //print_r($decoded);die(); $data = []; foreach ($decoded as $key => $value) { $layout_name = $value->layout_name; $table = "mmg_layouts"; $where = array('layout_name'=>$layout_name,'delete_status'=>'ACTIVE'); $res_layout = $this->MMG_model->get_where_row($table,$where); $layout_id = $res_layout->id; $table_trend = "mmg_layout_master"; $where = array('layout_name'=>$layout_name,'delete_status'=>'ACTIVE'); $res_layout2 = $this->MMG_model->get_where_row2($table_trend,$where); if(!empty($res_layout2)) { $layout_id_trend = $res_layout2->id; } else { $table_trend = "mmg_layout_master"; $data =array('layout_name'=>$layout_name); $res= $this->MMG_model->insert2($data,$table); $where = array('layout_name'=>$layout_name,'delete_status'=>'ACTIVE'); $res_layout2 = $this->MMG_model->get_where_row2($table_trend,$where); $layout_id_trend = $res_layout2->id; } $site_no = $value->site_no; $facing = ucfirst($value->facing); $purchase_for = ucfirst($value->purchase_for); $site_type = ucfirst($value->site_type); $remarks = $value->remarks; $north = $value->north; $north_mtrs = $value->north_mtrs; $south = $value->south; $south_mtrs = $value->south_mtrs; $east = $value->east; $east_mtrs = $value->east_mtrs; $west = $value->west; $west_mtrs = $value->west_mtrs; $north_south = ($north_mtrs + $south_mtrs)/2; $east_west = ($east_mtrs + $west_mtrs)/2; $sq_mt = ($north_south * $east_west); $sq_ft = ($sq_mt * 10.76); $data[] = array('layout' => $layout_id, 'site_no' => $site_no, 'facing' => $facing, 'purch_for' => $purchase_for, 'site_type' => $site_type, 'remarks' => $remarks, 'north' => $north, 'north_mtrs' => $north_mtrs, 'south' => $south, 'south_mtrs' => $south_mtrs, 'east' => $east, 'east_mtrs' => $east_mtrs, 'west' => $west, 'west_mtrs' => $west_mtrs, 'north_south' => $north_south, 'east_west' => $east_west, 'sq_mt' => $sq_mt, 'sq_ft' => $sq_ft, 'created_by' => $created_by, 'created_on' => $created_on ); $data2[] = array('layout_id' => $layout_id_trend, 'site_home' => $site_no, 'owner' => 'MMG', 'created_at' => $created_on); } $table = "mmg_sites"; $table_trends = "mmg_site_master"; $result = $this->MMG_model->insert_batch($table,$data); $result2 = $this->MMG_model->insert_batch2($table_trends,$data2); //print_r($result);die(); if($result2) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function layout_info_import_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $created_by = $this->input->post('login_id'); date_default_timezone_set('Asia/Kolkata'); $created_on = date('Y-m-d H:i:s', time()); $details = $this->input->post('details'); $decoded = json_decode($details); //print_r($decoded);die(); $owner_error = array(); $owner_found = array(); foreach ($decoded as $key => $value) { $layout_name = $value->layout_name; $table = "mmg_layouts"; $where = array('layout_name'=>$layout_name,'delete_status'=>'ACTIVE'); $res_layout = $this->MMG_model->get_where_row($table,$where); if(empty($res_layout)) { $land_owners = $value->land_owners; $table = "mmg_land_owner"; $where = array('name'=>$land_owners,'layout_name'=>$layout_name,'delete_status'=>'ACTIVE'); $res_land_owner = $this->MMG_model->get_where_row($table,$where); if($res_land_owner != '') { $land_owners_id = $res_land_owner->id; $layout_address = $value->layout_address; $sub_register_address = $value->sub_register_address; $agent_name = $value->agent_name; $res_agent_name = $this->MMG_model->layout_agent_name($agent_name); if($res_agent_name != '') { $agent_id = $res_agent_name->emp_id; } else { $agent_id = ''; } $bank_name = $value->bank_name; $dis = $value->discount; $discount = str_replace(',','',$dis); $reg_value = $value->register_value; $register_value = str_replace(',','',$reg_value); $stamp_duty_percent = $value->stamp_duty_percent; $stamp_duty = round(($register_value*$stamp_duty_percent/100),2); $fees_percent = $value->fees_percent; $fees = round(($register_value*$fees_percent/100),2); $stamp_cess_percent = $value->stamp_cess_percent; $stamp_cess = round(($register_value*$stamp_cess_percent/100),2); $total_value = $stamp_duty+$fees+$stamp_cess; $tot_area = $value->total_area; $total_area = str_replace(',','',$tot_area); $landlord = $value->landlord_share; $landlord_share = str_replace(',','',$landlord); $balance_area = $total_area-$landlord_share; $total_company_area = $value->total_company_area; $land_purchased_amt = $value->land_purchased_amount; $land_purchased_amount = str_replace(',','',$land_purchased_amt); $muda_fee = $value->muda_fees; $muda_fees = str_replace(',','',$muda_fee); $patti = $value->cd_patti; $cd_patti = str_replace(',','',$patti); $plan_expenditure = $value->plan_expenditure; $plan_expenditure = str_replace(',','',$plan_expenditure); $individual_site_khata = $value->individual_site_khata; $individual_site_khata = str_replace(',','',$individual_site_khata); $relinguish_expenditure = $value->relinguish_expenditure; $relinguish_expenditure = str_replace(',','',$relinguish_expenditure); $work_order = $value->work_order; $work_order = str_replace(',','',$work_order); $work_order_expenditure = $value->work_order_expenditure; $work_order_expenditure = str_replace(',','',$work_order_expenditure); $layout_development = $value->layout_development; $layout_development = str_replace(',','',$layout_development); $register_expenses = $value->register_expenses; $register_expenses = str_replace(',','',$register_expenses); $keb_fees = $value->keb_fees; $keb_fees = str_replace(',','',$keb_fees); $water_board = $value->water_board; $water_board = str_replace(',','',$water_board); $water_board_expenditure = $value->water_board_expenditure; $water_board_expenditure = str_replace(',','',$water_board_expenditure); $stp = $value->stp; $stp = str_replace(',','',$stp); $pollution_control_board = $value->pollution_control_board; $pollution_control_board = str_replace(',','',$pollution_control_board); $others = $value->others; $others = str_replace(',','',$others); $total_expenditure_charges = ($land_purchased_amount+$muda_fees+$cd_patti+$plan_expenditure+$individual_site_khata+$relinguish_expenditure+$work_order+$work_order_expenditure+$layout_development+$register_expenses+$keb_fees+$water_board+$water_board_expenditure+$stp+$pollution_control_board+$others); $per_sqft_amount = round(($total_expenditure_charges/$total_company_area),2); $bank_total_amount1 = $value->bank_total_amount1; $bank_total_amount1 = str_replace(',','',$bank_total_amount1); $bank_int_percent1 = $value->bank_int_percent1; $bank_interest1 = round(($bank_total_amount1*$bank_int_percent1/100),2); $bank_interest_month1 = $value->bank_interest_month1; $bank_interest_amt1 = round(($bank_interest1*$bank_interest_month1),2); $bank_total_amount2 = $value->bank_total_amount2; $bank_total_amount2 = str_replace(',','',$bank_total_amount2); $bank_int_percent2 = $value->bank_int_percent2; $bank_interest2 = round(($bank_total_amount2*$bank_int_percent2/100),2); $bank_interest_month2 = $value->bank_interest_month2; $bank_interest_amt2 = round(($bank_interest2*$bank_interest_month2),2); $modt_charges = $value->modt_charges; $modt_charges = str_replace(',','',$modt_charges); $data = array( 'layout_name' => $layout_name, 'layout_address' => $layout_address, 'sub_register_address'=> $sub_register_address, 'land_owners' => $land_owners_id, 'agent_name' => $agent_id, 'bank_name' => $bank_name, 'discount' => $discount, 'register_value' => $register_value, 'stamp_duty_percent'=> $stamp_duty_percent, 'stamp_duty' => $stamp_duty, 'fees_percent' => $fees_percent, 'fees' => $fees, 'stamp_cess_percent'=> $stamp_cess_percent, 'stamp_cess' => $stamp_cess, 'total_value' => $total_value, 'total_area' => $total_area, 'landlord_share' => $landlord_share, 'balance_area' => $balance_area, 'total_company_area'=> $total_company_area, 'land_purchased_amount' => $land_purchased_amount, 'muda_fees' => $muda_fees, 'cd_patti' => $cd_patti, 'plan_expenditure' => $plan_expenditure, 'individual_site_khata' => $individual_site_khata, 'relinguish_expenditure'=> $relinguish_expenditure, 'work_order' => $work_order, 'work_order_expenditure'=> $work_order_expenditure, 'layout_development' => $layout_development, 'register_expenses' => $register_expenses, 'keb_fees' => $keb_fees, 'water_board' => $water_board, 'water_board_expenditure' => $water_board_expenditure, 'stp' => $stp, 'pollution_control_board' => $pollution_control_board, 'others' => $others, 'bank_total_amount1'=> $bank_total_amount1, 'bank_int_percent1' =>$bank_int_percent1, 'bank_interest1' =>$bank_interest1, 'bank_interest_month1' =>$bank_interest_month1, 'bank_interest_amt1'=>$bank_interest_amt1, 'bank_total_amount2'=>$bank_total_amount2, 'bank_int_percent2' =>$bank_int_percent2, 'bank_interest2' =>$bank_interest2, 'bank_interest_month2' =>$bank_interest_month2, 'bank_interest_amt2'=>$bank_interest_amt2, 'modt_charges' =>$modt_charges, 'total_expenditure_charges' =>$total_expenditure_charges, 'per_sqft_amount' => $per_sqft_amount, 'residential_company_area' =>$total_company_area, 'created_by' =>$created_by, 'created_on' => $created_on ); $table = "mmg_layouts"; $result = $this->MMG_model->insert($data,$table); } else { $msg = 'Land_owners: '.$value->land_owners.' is Not the owner of '.$value->layout_name.'<br>'; if(!in_array($value->land_owners, $owner_found)) { array_push($owner_found, $value->land_owners); array_push($owner_error, $msg); } } } else { $msg = $value->layout_name.' already exists..<br>'; if(!in_array($value->layout_name, $owner_found)) { array_push($owner_found, $value->layout_name); array_push($owner_error, $msg); } } } //print_r($owner_error); //print_r($result);die(); if(!empty($owner_error)) { $message=['status'=>'Success','message'=>$owner_error]; } else if(empty($owner_error) && !empty($result)) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_layout_name_site_number_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id=$this->input->get('id'); //$where = array('customer_id'=>$customer_id); $result = $this->MMG_model->get_layoutname_sitenumber($customer_id); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //Material Master public function add_material_details_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->post('login_id'); $material = $this->input->post('material'); $material_type = $this->input->post('material_type'); $unit = $this->input->post('unit'); $amount = $this->input->post('amount'); $created_at = date('Y-m-d H:i:s'); $data = array( 'material' => $material, 'material_type' => $material_type, 'unit' => $unit, 'amount' => $amount, 'created_by' => $login_id, 'created_on' => $created_at); $table = 'mmg_material'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully..']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_material_master_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = "mmg_material"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_material_details_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('edit_id'); $table = "mmg_material"; $data = array('id'=>$id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_material_details_put() { $date = $this->input->input_stream('date'); $signature = $this->input->input_stream('signature'); $pubKey = $this->input->input_stream('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $login_id = $this->input->input_stream('login_id'); $up_id = $this->input->input_stream('up_id'); $material = $this->input->input_stream('material'); $material_type = $this->input->input_stream('material_type'); $unit = $this->input->input_stream('unit'); $amount = $this->input->input_stream('amount'); $updated_at = date('Y-m-d H:i:s'); $where = array('id'=>$up_id); $table = 'mmg_material'; $data = array( 'material'=>$material, 'material_type'=>$material_type, 'unit'=>$unit, 'amount'=>$amount, 'updated_by'=>$login_id, 'updated_on'=>$updated_at ); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully..']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_material_details_put() { $date = $this->input->input_stream('date'); $signature = $this->input->input_stream('signature'); $pubKey = $this->input->input_stream('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $del_id = $this->input->input_stream('del_id'); $where = array('id'=>$del_id); $table = 'mmg_material'; $data = array('delete_status'=>'INACTIVE'); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted successfully..']; } else { $message=['status'=>'Fail','message'=>'Could Not Delete']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function user_roles_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_user_roles"; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_menu_list_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_menu_list(); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data Found']; } } else { $message = ['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_access_controls_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $department_id = $this->input->post('department_id'); $menu_id = $this->input->post('menu_id'); $array = array(); $created_at = date('Y-m-d H:i:s'); $table = 'mmg_access_controls'; $where = array('delete_status'=>'ACTIVE','department_id'=>$department_id); $departments = $this->MMG_model->get_where_row($table,$where); if($departments) { $data = array( 'department_id' => $department_id, 'menu_ids' => $menu_id, 'updated_by' => $id, 'updated_at' => $created_at ); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Added Successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $data = array('department_id' => $department_id, 'menu_ids' => $menu_id, 'created_at' => $created_at, 'created_by' => $id); $result=$this->MMG_model->insert($data,$table); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>'Added Successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_access_controls_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $department_id = $this->input->get('department_id'); $table = 'mmg_access_controls'; $where = array('delete_status'=>'ACTIVE','department_id'=>$department_id); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_access_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $table = 'mmg_login'; $where = array('id'=>$id); $d=$this->MMG_model->get_where_row($table,$where); $data['id']=$d->department; $table='mmg_access_controls'; $where=array('department_id'=>$data['id']); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_menu_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $table = 'mmg_constructions_menu'; $where = array('delete_status' =>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function annexure_info_import_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $created_by = $this->input->post('login_id'); date_default_timezone_set('Asia/Kolkata'); $created_on = date('Y-m-d H:i:s', time()); $details = $this->input->post('details'); $decoded = json_decode($details); $data = []; foreach ($decoded as $key => $value) { $package_name = $value->package_name; $annexure_Category = $value->annexure_Category; $unit_quantity = $value->unit_quantity; $data[] = array('type_of_work' => $package_name, 'foundation_level' => $annexure_Category, 'unit_quantity' => $unit_quantity, 'created_by' => $created_by, 'created_on' => $created_on ); } $table = "mmg_annexure"; $result = $this->MMG_model->insert_batch($table,$data); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_enquiry_details_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $name = $this->input->post('name'); $phone_number = $this->input->post('phone_number'); $email = $this->input->post('email'); $layout = $this->input->post('layout'); $description = $this->input->post('description'); $created_at = date('Y-m-d H:i:s'); $data = array( 'name' =>$name, 'phone_number' =>$phone_number, 'email' =>$email, 'layout' =>$layout, 'description' =>$description, 'delete_status' => 'ACTIVE', 'created_on' =>$created_at ); $table = 'mmg_enquiry'; $result=$this->MMG_model->insert($data,$table); if($result) { $enquiry_table = 'mmg_enquiry'; $condition = array('id'=>$result); $result = $this->MMG_model->get_where_row($enquiry_table,$condition); $message = ['status'=>'Success','message'=>'Added successfully','id'=>$result->id,'name'=>$result->name,'phone_number'=>$result->phone_number,'email'=>$result->email,'layout'=>$result->layout,'description'=>$result->description]; } else { $message=['status'=>'Fail','message'=>'Insertion failed']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function department_details_get() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $table = 'mmg_department'; $where = array("delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fetch_employee_names_get() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $table = 'mmg_employees'; $where = array("delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); $array = []; foreach ($result as $value) { $details[] = array( 'id' => $value->emp_id, 'employee_name' => $value->full_name, ); } if($details) { $message=['status'=>'Success','message'=>$details]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_ticket_details_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $ticket_no = $this->input->post('ticket_no'); $layout = $this->input->post('layout'); $site_no = $this->input->post('site_no'); $comment = $this->input->post('comment'); $department = $this->input->post('department'); $employee_name = $this->input->post('employee_name'); $created_at = date('Y-m-d H:i:s'); $data = array( 'ticket_no' =>$ticket_no, 'layout' =>$layout, 'site_no' =>$site_no, 'comment' =>$comment, 'department' =>$department, 'employee_name' =>$employee_name, 'delete_status' => 'ACTIVE', 'created_at' =>$created_at ); $table = 'mmg_ticket'; $result=$this->MMG_model->insert($data,$table); if($result) { $result_table = 'mmg_ticket'; $result_where = array('id'=>$result); $res = $this->MMG_model->get_where_row($result_table,$result_where); $message = ['status'=>'Success','message'=>'Added successfully','id'=>$res->id,'ticket_no'=>$res->ticket_no,'layout'=>$res->layout,'site_no'=>$res->site_no,'comment'=>$res->comment,'department'=>$res->department,'employee_name'=>$res->employee_name]; } else { $message=['status'=>'Fail','message'=>'Insertion failed']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_message_details_post() { $privatekey =$this->config->item('private_key'); $public_key = uniqid(rand(),true); $private_key=$privatekey.$public_key; date_default_timezone_set('Asia/Kolkata'); $date = date('Y-m-d H:i:s', time()); // Generate content verification signature $signature = base64_encode(hash_hmac('sha1', $date, $private_key, TRUE)); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$public_key); if($hmacsecurity=='success') { $user_ids = $this->input->post('user_ids'); $message_type = $this->input->post('message_type'); $user_type = $this->input->post('user_type'); $layout_id = $this->input->post('layout_id'); // $subject = $this->input->post('subject'); $message = $this->input->post('message'); $message_image = $this->input->post('message_image'); $created_at = date('Y-m-d H:i:s'); $data = array('user_ids' => $user_ids, 'message_type' => $message_type, 'user_type' => $user_type, 'layout_id' => $layout_id, //'subject' => $subject, 'message' => $message, 'message_image' => $message_image, 'delete_status' => 'ACTIVE', 'created_at' => $date, ); $table = 'mmg_send_message'; $result=$this->MMG_model->insert($data,$table); if($result) { $where = array('id'=>$result); $details = $this->MMG_model->get_where_row($table,$where); $user_id = json_decode($details->user_ids); $user_types = $details->user_type; $email_subject = $details->subject; $email_message = $details->message; $file_name = $details->message_image; if($user_types == 'layout_customer' || $user_types == 'new_customer' || $user_types == 'booking_layout') { $value = $this->MMG_model->get_where_in_customer($user_id); } else { $value = $this->MMG_model->get_where_in_employee($user_id); } $email_array = array(); $phone_array = array(); foreach ($value as $keys => $values) { if(!empty($values->email)) { array_push($email_array,$values->email); } if(!empty($values->phone)) { array_push($phone_array,$values->phone); } } if($message_type == 'email') { foreach ($email_array as $email_key => $email_ids) { $href = base_url(''); $this->load->library('email'); require_once './email/PHPMailerAutoload.php'; $phpMailer = new PHPMailer(true); // $phpMailer->isSMTP(); $phpMailer->Host = "smtp.gmail.com"; $phpMailer->SMTPAuth = true; $phpMailer->Username = "Info.connectmmg@gmail.com"; $phpMailer->Password = "rqyckqjcjufpgbgh"; $phpMailer->SMTPSecure = "tls"; $phpMailer->Port = 587; $phpMailer->isHTML(true); $phpMailer->CharSet = "UTF-8"; $phpMailer->setFrom("Info.connectmmg@gmail.com", "MMG"); $phpMailer->addAddress("Info.connectmmg@gmail.com"); if(!empty($file_name)) { $phpMailer->addAttachment($_SERVER["DOCUMENT_ROOT"].'/MMG/client/messages/'.$file_name); } $phpMailer->Subject = $email_subject; $phpMailer->Body = $email_message; $phpMailer->AddBCC($email_ids); $phpMailer->send(); } } else { //$phone_array = array('9980611283','8553586833'); if(!empty($phone_array)) { foreach ($phone_array as $phone_key => $phones) { $msg = $email_subject.' '.$email_message; $sms_message_new = $msg; $headers = ['Content-Type' => 'application/x-www-form-urlencoded', 'charset' => 'utf-8']; /* $url = "http://sms.jayblues.com/http-api.php?";*/ $url = "http://mysmsshop.in/http-api.php?"; $postData2 = array('username'=> 'mmgconstructions', 'password'=>'New$$888', 'senderid'=>'MMGCON', //'unicode'=>2, 'route'=>1, 'message' => $sms_message_new, 'number' => $phones ); $ch2 = curl_init(); curl_setopt_array($ch2, array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER =>$headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData2 )); $output1 = curl_exec($ch2); if(curl_errno($ch2)) { echo 'error:' . curl_error($ch2); } curl_close($ch2); } } } $message = ['status'=>'Success','message'=>'Added successfully']; } else { $message=['status'=>'Fail','message'=>'Insertion failed']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_customer_followups_post() { $description = $this->input->post('description'); $followuser_id = $this->input->post('followuser_id'); $follow_date = $this->input->post('follow_date'); $progress = $this->input->post('progress'); $employee = $this->input->post('employee'); $department = $this->input->post('department'); $newfollow_date = date("Y-m-d", strtotime($follow_date)); $created_by = $this->input->post('created_by'); $date=$this->input->post('date'); $website=$this->input->post('website'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { if($website != '') { if($website == 'website') { $table = "mmg_website_customer"; $where = array('id'=>$followuser_id); $result1 = $this->MMG_model->get_where_row($table,$where); $created_at = date('Y-m-d'); $cust_table = 'mmg_customer'; $data1 = array( 'name' =>$result1->name, 'phone' =>$result1->phone, 'email' =>$result1->email, 'created_at' =>$created_at, 'status' =>$website); $result2=$this->MMG_model->insert($data1,$cust_table); $table = "mmg_website_customer"; $where = array('id'=>$followuser_id); $data = array('status'=>'website'); $result5 = $this->MMG_model->update($where,$table,$data); $datetime = new DateTime($date); $time = $datetime->format('H:i'); $site_id=$this->input->post('site_id'); $layout_id=$this->input->post('layout_id'); $data=array('site_id'=>$site_id,'layout_id'=>$layout_id,'created_by'=>$created_by,'customer_id'=>$result2,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'employee_assigned'=>$employee,'depart_assigned'=>$department,'created_at'=>date('Y-m-d'),'created_by'=>$created_by,'created_time'=>$time,'delete_status'=>'ACTIVE'); $table='mmg_customer_followup'; $result = $this->MMG_model->insert($data,$table); } else if($website == 'facebook') { $table = "mmg_facebook_leads"; $where = array('id'=>$followuser_id); $result1 = $this->MMG_model->get_where_row($table,$where); $created_at = date('Y-m-d'); $cust_table = 'mmg_customer'; $data1 = array( 'name' =>$result1->name, 'phone' =>$result1->phone, 'email' =>$result1->email, 'created_at' =>$created_at, 'status' =>$website); $result2=$this->MMG_model->insert($data1,$cust_table); $table = "mmg_facebook_leads"; $where = array('id'=>$followuser_id); $data = array('status'=>'website'); $result5 = $this->MMG_model->update($where,$table,$data); $datetime = new DateTime($date); $time = $datetime->format('H:i'); $site_id=$this->input->post('site_id'); $layout_id=$this->input->post('layout_id'); $data=array('site_id'=>$site_id,'layout_id'=>$layout_id,'created_by'=>$created_by,'customer_id'=>$result2,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'employee_assigned'=>$employee,'depart_assigned'=>$department,'created_at'=>date('Y-m-d'),'created_by'=>$created_by,'created_time'=>$time,'delete_status'=>'ACTIVE'); $table='mmg_customer_followup'; $result = $this->MMG_model->insert($data,$table); } } else { $datetime = new DateTime($date); $time = $datetime->format('H:i'); $site_id=$this->input->post('site_id'); $layout_id=$this->input->post('layout_id'); $data=array('site_id'=>$site_id,'layout_id'=>$layout_id,'created_by'=>$created_by,'customer_id'=>$followuser_id,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'employee_assigned'=>$employee,'depart_assigned'=>$department,'created_at'=>date('Y-m-d'),'created_by'=>$created_by,'created_time'=>$time,'delete_status'=>'ACTIVE'); $table='mmg_customer_followup'; $result = $this->MMG_model->insert($data,$table); } $table1='mmg_callback_followup'; $table2='mmg_reject_followup'; $table3='mmg_sitevisit_followup'; if($progress == "Call Back") { $table = "mmg_sitevisit_followup"; $where = array('customer_id'=>$followuser_id); $result = $this->MMG_model->delete_data($table,$where); $result = $this->MMG_model->insert($data,$table1); } else if($progress == "Reject") { $table = "mmg_sitevisit_followup"; $where = array('customer_id'=>$followuser_id); $result = $this->MMG_model->delete_data($table,$where); $table = "mmg_callback_followup"; $where = array('customer_id'=>$followuser_id); $result = $this->MMG_model->delete_data($table,$where); $result = $this->MMG_model->insert($data,$table2); } else if($progress == "Site Visit") { $table = "mmg_callback_followup"; $where = array('customer_id'=>$followuser_id); $result = $this->MMG_model->delete_data($table,$where); $result = $this->MMG_model->insert($data,$table3); } $file_name=$this->input->post('file'); $file_attachment_name=$this->input->post('file_name'); $data2=array('document' =>$file_name, 'file_attachment_name' =>$file_attachment_name, 'layout_id' =>$layout_id, 'site_id' =>$site_id, 'created_by' =>$created_by, 'created_at' =>$date, 'customer_id' =>$followuser_id, 'follow_up' =>'Enquiry'); $table2='mmg_customer_documents'; $result2 = $this->MMG_model->insert($data2,$table2); if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customers_followup_list_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $data=array('delete_status'=>'ACTIVE'); if($user_id!=0) { $data['customer_id']=$user_id; } $table='mmg_customer_followup'; $result = $this->MMG_model->get_where_result_customerfollowups($user_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function site_visiting_followup_list_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $data=array('delete_status'=>'ACTIVE'); if($user_id!=0) { $data['customer_id']=$user_id; } $table='mmg_customer_site_visiting_followup'; $result = $this->MMG_model->get_where_result_siteviste($user_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } /*------------------------------------From Trends---------------------------------*/ public function indent_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $result = $this->MMG_model->indent_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function subgrid_indent_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $indent_id = $this->input->get('indent_id'); $data = $this->MMG_model->subgrid_indent_data($indent_id); $sl_indent_no = $data->sl_indent_no; $result = $this->MMG_model->subgrid_indent_details($sl_indent_no); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_indent_get() { $indent_id = $this->input->get('indent_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_indent"; $where = array('id'=>$indent_id); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function product_department_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_product_group"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function location_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_location"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_product_group_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); //print_r($hmacsecurity);die(); if($hmacsecurity == 'success') { $order_by = 'product_group_name'; $table = "mmg_product_group"; $where = array('delete_status'=>'ACTIVE',); $result = $this->MMG_model->get_where_result_orderby_asc($table,$where,$order_by); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function layout_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_land_owner"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_layouts_name(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_units_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = "mmg_unit"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_level_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = "mmg_level_master"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_indent_post() { $indent_id = $this->input->post('indent_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_indent"; $where = array('id'=>$indent_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function indent_approval_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $indent_sub_ids = $this->input->post('indent_sub_ids'); $explode_indent_sub_ids = explode (",", $indent_sub_ids); $approved_by = $this->input->post('approved_by'); $approved_date = date('Y-m-d H:i:s'); foreach($explode_indent_sub_ids as $indent) { $table = "mmg_indent"; $where = array('id'=>$indent); $data = array( 'approval'=>'APPROVED', 'approved_by'=>$approved_by, 'approved_date'=>$approved_date); $result = $this->MMG_model->update($where,$table,$data); } if($result) { $message = ['status'=>'Success','message'=>'Approved Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Could Not Approve..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function indent_approvalall_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $indent_id = $this->input->post('indent_id'); $approved_by = $this->input->post('approved_by'); $approved_date = date('Y-m-d H:i:s'); foreach ($indent_id as $indent) { $table = "mmg_indent"; $where = array('id'=>$indent); $data = array( 'approval'=>'APPROVED', 'approved_by'=>$approved_by, 'approved_date'=>$approved_date); $result = $this->MMG_model->update($where,$table,$data); } if($result) { $message = ['status'=>'Success','message'=>'Approved Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Could Not Approve..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function approved_indent_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $result = $this->MMG_model->approved_indent_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function indent_approved_subgrid_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $indent_id = $this->input->get('indent_id'); $data = $this->MMG_model->subgrid_indent_data($indent_id); $sl_indent_no = $data->sl_indent_no; $result = $this->MMG_model->indent_approved_subgrid($sl_indent_no); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function tax_free_indent_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $result = $this->MMG_model->tax_free_indent_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function subgrid_tax_free_indent_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $indent_id = $this->input->get('indent_id'); $data = $this->MMG_model->subgrid_indent_data($indent_id); $sl_indent_no = $data->sl_indent_no; $result = $this->MMG_model->subgrid_tax_free_indent_details($sl_indent_no); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function approved_tax_free_indent_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $result = $this->MMG_model->approved_tax_free_indent_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function indent_approved_tax_free_subgrid_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $indent_id = $this->input->get('indent_id'); $data = $this->MMG_model->subgrid_indent_data($indent_id); $sl_indent_no = $data->sl_indent_no; $result = $this->MMG_model->indent_approved_tax_free_subgrid($sl_indent_no); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function indent_no_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); //print_r($hmacsecurity);die(); if($hmacsecurity=='success') { $result = $this->MMG_model->get_indent_no(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function sl_indent_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $sl_indent_no = $this->input->get('sl_indent_no'); //print_r($sl_indent_no);die(); $result=$this->MMG_model->sl_indent_list($sl_indent_no); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fetch_sites_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_name = $this->input->post("layout_name"); $table = "mmg_sites"; $where = array("layout_id"=>$layout_name,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_product_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result=$this->MMG_model->product_list(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_product_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $product_ids =$this->input->post('product_id'); $array = array(); foreach($product_ids as $key=>$product_id) { $details = $this->MMG_model->get_where_products($product_id); if($details) { $data['product_id'] = $details->product_id; $data['product_name'] = $details->product_name; $data['product_group_id'] = $details->product_group_id; $data['product_group_name'] = $details->product_group_name; $data['product_quantity'] = 0; $data['u_id'] = $details->u_id; $data['unit_name'] = $details->unit_name; array_push($array, $data); } } if($array) { $message=['status'=>'Success','message'=>$array]; } else { $message=['status'=>'Fail','message'=>'Not found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_indent_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $created_by = $this->input->post('login_id'); date_default_timezone_set('Asia/Kolkata'); $created_on = date('Y-m-d H:i:s', time()); $table_trends = 'mmg_indent'; $where_trends = array('master'=>1,'delete_status'=>'ACTIVE'); $order_by = 'id'; $last_trends_row = $this->MMG_model->last_trends_row($table_trends,$where_trends,$order_by); $trends_sl_indent = $last_trends_row->sl_indent_no; $trends_sl_indent_no = $trends_sl_indent+1; $cur_date = date('Y-m-d'); $current_date = date('d.m.Y',strtotime($cur_date)); $trends_indent_no = $trends_sl_indent_no." MC.".$current_date; $details = $this->input->post('details'); $decoded = json_decode($details); $data1 = []; foreach ($decoded as $key => $value) { $indent_no = $value->indent_no; $sl_indent_no = $value->sl_indent_no; $layout = $value->layout; $site_number = $value->site_number; $send_to = $value->send_to; $tax = $value->tax; $consumed_at = $value->consumed_at; $required_before = $value->required_before; if($required_before != '') { $r_before = explode("-",$required_before); $required_before = $r_before[2].'-'.$r_before[1].'-'.$r_before[0]; } else { $required_before = ''; } $level = $value->level; $selection_indent = $value->selection_indent; $product_type = $value->product_type; $add_products = $value->add_products; $quantity = $value->quantity; $unit_id = $value->unit_id; $prod_reason = $value->prod_reason; $data = array( 'indent_no' => $indent_no, 'sl_indent_no' => $sl_indent_no, 'layout_name' => $layout, 'site_no' => $site_number, 'send_to' => $send_to, 'tax' => $tax, 'consumed_at' => $consumed_at, 'required_on_or_before' => $required_before, 'product_types' => $product_type, 'add_products' => $add_products, 'quantity' => $quantity, 'unit_id' => $unit_id, 'prod_reason' => $prod_reason, 'created_at' => $created_on, 'level' => $level, 'selected_type' => $selection_indent, 'master' => 1, 'created_by' => $created_by); $table = 'mmg_indent'; $result = $this->MMG_model->insert($data,$table); $table_trends = 'mmg_indent'; $data_trends = array( 'mmg_indent_id' => $result, 'indent_no' => $indent_no, 'sl_indent_no' => $sl_indent_no, 'layout_name' => $layout, 'site_no' => $site_number, 'send_to' => $send_to, 'tax' => $tax, 'consumed_at' => $consumed_at, 'required_on_or_before' => $required_before, 'product_types' => $product_type, 'add_products' => $add_products, 'quantity' => $quantity, 'unit_id' => $unit_id, 'prod_reason' => $prod_reason, 'created_at' => $created_on, 'level' => $level, 'selected_type' => $selection_indent, 'master' => 1, 'created_by' => $created_by); $result2 = $this->MMG_model->insert2($data_trends,$table_trends); } /*$table = 'mmg_indent'; $result = $this->MMG_model->insert_batch($table,$data);*/ if($result) { $message=['status'=>'Success','message'=>'Added Successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fetch_product_group_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $product_type = $this->input->post("product_type"); $table = "mmg_products"; $where = array("product_type"=>$product_type,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_indent_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $id = $this->input->post('login_id'); $update_id = $this->input->post('update_id'); $indent_no = $this->input->post('indent_no'); $sl_indent_no = $this->input->post('sl_indent_no'); //$department = $this->input->post('department'); $consumed_at = $this->input->post('consumed_at'); $product_type = $this->input->post('product_type'); $quantity = $this->input->post('quantity'); $unit_id = $this->input->post('unit_id'); $add_products = $this->input->post('add_products'); $prod_reason = $this->input->post('prod_reason'); $required_before = $this->input->post('required_before'); $required_before = date('Y-m-d',strtotime($required_before)); $layout = $this->input->post('layout'); $site_number = $this->input->post('site_number'); $level = $this->input->post('level'); $cus_layout = $this->input->post('cus_layout'); $updated_at = date('Y-m-d H:i:s'); $table = 'mmg_indent'; $where = array('id'=>$update_id); $data =array( 'indent_no' => $indent_no, 'sl_indent_no' => $sl_indent_no, //'department' => $department, 'consumed_at' => $consumed_at, 'product_types' => $product_type, 'quantity' => $quantity, 'unit_id' => $unit_id, 'add_products' => $add_products, 'prod_reason' => $prod_reason, 'required_on_or_before' => $required_before, 'layout_name' => $layout, 'site_no' => $site_number, 'level' => $level, 'selected_type' => $cus_layout, 'updated_at' => $updated_at, 'updated_by' => $id); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully..']; } else { $message=['status'=>'Fail','message'=>'Same data updated..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function indent_preview_get() { $indent_id = $this->input->get('indent_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $indent = $this->MMG_model->indent_dept_not_approved($indent_id); $sl_indent_no = $indent['sl_indent_no']; $result = $this->MMG_model->indent_not_approved_preview($sl_indent_no); if($result) { $message = ['status'=>'Success','message'=>$result,'indent_data'=>$indent]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function indent_preview_aprove_get() { $indent_id = $this->input->get('indent_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $indent = $this->MMG_model->indent_dept($indent_id); $sl_indent_no = $indent['sl_indent_no']; $result = $this->MMG_model->indent_preview($sl_indent_no); if($result) { $message = ['status'=>'Success','message'=>$result,'indent_data'=>$indent]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function product_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $p_type_id = $this->input->get('p_type_id'); $result = $this->MMG_model->po_product_list($p_type_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function purchase_order_generate_po_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $ids = $this->input->get('ids'); $explode_id = explode(",",$ids); $array_ids = array(); foreach($explode_id as $eids) { array_push($array_ids,$eids); } $result = $this->MMG_model->order_generate_po($array_ids); if(!empty($result)) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_po_sl_no_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $financial_year = $this->input->get('financial_year'); $table = "indent_po"; $where = array('financial_year'=>$financial_year); $result = $this->MMG_model->max_select_years_purchase_no($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_product_po_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $created_by = $this->input->post('login_id'); date_default_timezone_set('Asia/Kolkata'); $created_on = date('Y-m-d H:i:s', time()); $details = $this->input->post('details'); $decoded = json_decode($details); //print_r($decoded);die(); $data = []; foreach ($decoded as $key => $value) { $po_no = $value->po_no; $po_id = $value->po_id; $financial_year = $value->financial_year; $p_date = $value->po_date; $pod = explode("-",$p_date); $po_date = $pod[2].'-'.$pod[1].'-'.$pod[0]; $currency = $value->currency; $po_for = $value->po_for; $layout = $value->layout; $site_number = $value->site_number; $level = $value->level; $customer = $value->customer; $customer_address = $value->customer_address; $vendor = $value->vendor; $vendor_address = $value->vendor_address; $godown_id = $value->godown_id; $product_name = $value->product_name; $product_id = $value->product_id; $product_type = $value->product_type; $product_type_id = $value->product_type_id; $quantity = $value->quantity; $quantity_no = $value->quantity_no; $unit_id = $value->unit_id; $unit_price = $value->unit_price; $inr_value = $value->inr_value; $sgst = $value->sgst; $cgst = $value->cgst; $igst = $value->igst; $total_value = $value->total_value; $ot_charges = $value->ot_charges; $ot_charges_quantity = $value->ot_charges_quantity; $ot_charges_unit_price = $value->ot_charges_unit_price; $ot_charges_inr_value = $value->ot_charges_inr_value; $ot_charges_sgst = $value->ot_charges_sgst; $ot_charges_cgst = $value->ot_charges_cgst; $ot_charges_igst = $value->ot_charges_igst; $ot_charges_tot_val = $value->ot_charges_tot_val; $note = $value->note; $total_amt = $value->total_amt; $tax_amount = $value->tax_amount; $total = $value->total; $round_off = $value->round_off; $g_total = $value->g_total; $comment = $value->comment; $gst_no = $value->gst_no; $terms_payment = $value->terms_payment; $bank_details = $value->bank_details; $data[] = array('ot_charges_tot_val'=>$ot_charges_tot_val, 'po_no' => $po_no, 'po_id' => $po_id, 'financial_year' => $financial_year, 'po_date' => $po_date, 'currency' => $currency, 'godown_site' => $po_for, 'layout_id' => $layout, 'site_id' => $site_number, 'level_id' => $level, 'customer' => $customer, 'customer_address' => $customer_address, 'vendor_name' => $vendor, 'address' => $vendor_address, 'godown' => $godown_id, 'product_name' => $product_name, 'product_id' => $product_id, 'product_type' => $product_type, 'product_type_id' => $product_type_id, 'quantity' => $quantity, 'quantity_no' => $quantity_no, 'unit_id' => $unit_id, 'unit_price' => $unit_price, 'inr_value' => $inr_value, 'sgst' => $sgst, 'cgst' => $cgst, 'igst' => $igst, 'total_value' => $total_value, 'ot_charges' => $ot_charges, 'ot_charges_quantity' => $ot_charges_quantity, 'ot_charges_unit_price' => $ot_charges_unit_price, 'ot_charges_inr_value' => $ot_charges_inr_value, 'ot_charges_sgst' => $ot_charges_sgst, 'ot_charges_cgst' => $ot_charges_cgst, 'ot_charges_igst' => $ot_charges_igst, 'note' => $note, 'total_amt' => $total_amt, 'total' => $total, 'round_off' => $round_off, 'tax_amount' => $tax_amount, 'g_total' => $g_total, 'comment' => $comment, 'gst_no' => $gst_no, 'terms_payment' => $terms_payment, 'bank_details' => $bank_details, 'created_on' => $created_on, 'created_by' => $created_by ); } $table = "indent_po"; $result = $this->MMG_model->insert_batch($table,$data); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function product_po_list_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $result = $this->MMG_model->product_po_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function subgrid_product_po_details_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $p_id = $this->input->get('p_id'); $data = $this->MMG_model->subgrid_po_data($p_id); $po_id = $data->po_id; $result = $this->MMG_model->subgrid_product_po_details($po_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function po_preview_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "indent_po"; $where = array('id'=>$p_id,'delete_status'=>'ACTIVE'); $po = $this->MMG_model->get_where_row($table,$where); $po_id = $po->po_id; $table = "indent_po"; $where_po = array('po_id'=>$po_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where_po); if($result) { $message = ['status'=>'Success','message'=>$result,'po_row'=>$po]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_created_po_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $updated_by = $this->input->post('login_id'); date_default_timezone_set('Asia/Kolkata'); $updated_on = date('Y-m-d H:i:s', time()); $details = $this->input->post('details'); $decoded = json_decode($details); //print_r($decoded);die(); //$data = []; $array = []; foreach ($decoded as $key => $value) { $edit_id = $value->edit_id; $po_no = $value->po_no; $po_id = $value->po_id; $financial_year = $value->financial_year; $p_date = $value->po_date; $pod = explode("-",$p_date); $po_date = $pod[2].'-'.$pod[1].'-'.$pod[0]; $currency = $value->currency; $layout = $value->layout; $site_number = $value->site_number; $level = $value->level; $customer = $value->customer; $customer_address = $value->customer_address; $vendor = $value->vendor; $vendor_address = $value->vendor_address; $product_name = $value->product_name; $product_type = $value->product_type; $indent_no = $value->indent_no; $quantity = $value->quantity_no; $unit_price = $value->unit_price; $inr_value = $value->inr_value; $sgst = $value->sgst; $cgst = $value->cgst; $igst = $value->igst; $total_value = $value->total_value; $ot_charges = $value->ot_charges; $ot_charges_quantity = $value->ot_charges_quantity; $ot_charges_unit_price = $value->ot_charges_unit_price; $ot_charges_inr_value = $value->ot_charges_inr_value; $ot_charges_sgst = $value->ot_charges_sgst; $ot_charges_cgst = $value->ot_charges_cgst; $ot_charges_igst = $value->ot_charges_igst; $ot_charges_tot_val = $value->ot_charges_tot_val; $note = $value->note; $total_amt = $value->total_amt; $tax_amount = $value->tax_amount; // $discount = $value->discount; // $discount_amount = $value->discount_amount; $total = $value->total; $round_off = $value->round_off; $g_total = $value->g_total; $comment = $value->comment; $gst_no = $value->gst_no; $terms_payment = $value->terms_payment; $bank_details = $value->bank_details; $data = array('ot_charges_tot_val'=>$ot_charges_tot_val, 'po_no' => $po_no, 'po_id' => $po_id, 'financial_year' => $financial_year, 'po_date' => $po_date, 'currency' => $currency, 'layout_id' => $layout, 'site_id' => $site_number, 'level_id' => $level, 'customer' => $customer, 'customer_address' => $customer_address, 'vendor_name' => $vendor, 'address' => $vendor_address, 'product_name' => $product_name, 'product_type' => $product_type, 'indent_no' => $indent_no, 'quantity' => $quantity, 'unit_price' => $unit_price, 'inr_value' => $inr_value, 'sgst' => $sgst, 'cgst' => $cgst, 'igst' => $igst, 'total_value' => $total_value, 'ot_charges' => $ot_charges, 'ot_charges_quantity' => $ot_charges_quantity, 'ot_charges_unit_price' => $ot_charges_unit_price, 'ot_charges_inr_value' => $ot_charges_inr_value, 'ot_charges_sgst' => $ot_charges_sgst, 'ot_charges_cgst' => $ot_charges_cgst, 'ot_charges_igst' => $ot_charges_igst, 'note' => $note, 'total_amt' => $total_amt, 'tax_amount' =>$tax_amount, // 'discount' => $discount, // 'discount_amount' => $discount_amount, 'total' => $total, 'round_off' => $round_off, 'g_total' => $g_total, 'comment' => $comment, 'gst_no' => $gst_no, 'terms_payment' => $terms_payment, 'bank_details' => $bank_details, 'updated_on' => $updated_on, 'updated_by' => $updated_by ); $table = "indent_po"; $where = array('id'=>$edit_id); $res = $this->MMG_model->update($where,$table,$data); array_push($array, $res); } //print_r($array); if($array) { $message=['status'=>'Success','message'=>'Updated Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_created_po_post() { $p_id = $this->input->post('p_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table_name = "indent_po"; $where_result = array('id'=>$p_id); $result_data = $this->MMG_model->get_where_row($table_name,$where_result); if($result_data->id == $p_id && $result_data->approval=='APPROVED') { $message = ['status'=>'Fail','message'=>'Already Approved you cannot be deleted..']; } else { $table = "indent_po"; $where = array('id'=>$p_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function po_approval_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $po_id = $this->input->post('po_id'); $approved_by = $this->input->post('approved_by'); $approved_date = date('Y-m-d H:i:s'); $table = "indent_po"; $where = array('id'=>$po_id); $res = $this->MMG_model->get_where_row($table,$where); $p_id = $res->po_id; $where_approve = array('po_id'=>$p_id); $data = array( 'approval'=>'APPROVED', 'status'=>'NOT_YET', 'approved_by'=>$approved_by, 'approved_on'=>$approved_date); $result = $this->MMG_model->update($where_approve,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Approved Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Could Not Approve..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function product_inward_purchase_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $result = $this->MMG_model->product_inward_purchase(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function product_inward_purchase_subgrid_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $p_id = $this->input->get('p_id'); $data = $this->MMG_model->subgrid_po_data($p_id); $po_id = $data->po_id; $result = $this->MMG_model->product_inward_purchase_subgrid($po_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_vendor_goods_details_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $po = $this->MMG_model->po_row($p_id); $po_id = $po->po_id; $result = $this->MMG_model->inward_purchase_details($po_id); if($result) { $message = ['status'=>'Success','message'=>$result,'po_row'=>$po]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function Update_vendor_goods_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $created_by = $this->input->post('login'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $details = $this->input->post('details'); $decoded = json_decode($details); $array = []; foreach ($decoded as $key => $value) { $edit_id = $value->edit_id; $product_id = $value->product_id; $table = "indent_po"; $where_id = array('id'=>$edit_id); $res = $this->MMG_model->get_where_row($table,$where_id); if($res->received_goods == '') { $received_goods = $value->received_goods; } else { $received_goods = $res->received_goods+$value->received_goods; } $invoice_no = $value->invoice_no; $location = $value->location; $received_date = $value->received_date; $data = array( 'received_goods' => $received_goods, 'invoice_no' => $invoice_no, 'location' => $location, 'received_date' => $received_date, 'subgrid_status' => 'PARTIAL' ); $table = "indent_po"; $where = array('id'=>$edit_id); $res = $this->MMG_model->update($where,$table,$data); array_push($array, $res); $table_stock = "mmg_stock"; $where_stock = array('po_id' => $value->edit_id); $stock = $this->MMG_model->get_where_row($table_stock,$where_stock); if(empty($stock)) { $received_goods = $value->received_goods; $insert_stock = array('po_id' => $edit_id, 'product_id' => $product_id, 'received_goods' => $received_goods, 'balance_goods' => $received_goods, 'created_by' => $created_by, 'created_at' => $created_at); $result = $this->MMG_model->insert($insert_stock,$table_stock); } else { $received_goods = $stock->received_goods+$value->received_goods; $balance_goods = $stock->balance_goods+$value->received_goods; $update_stock = array('received_goods' => $received_goods, 'balance_goods' => $balance_goods, 'updated_by' => $created_by, 'updated_at' => $created_at); $result = $this->MMG_model->update($where_stock,$table_stock,$update_stock); } } if($array) { $message=['status'=>'Success','message'=>'Added Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function inward_preview_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $po = $this->MMG_model->get_po_row($p_id); /* $po_vendor = $po['vendor_name']; $table = "mmg_vendor"; $where_vendor = array('vendor'=>$po_vendor); $vendor_data = $this->MMG_model->get_where_row($table,$where_vendor);*/ $po_id = $po['po_id']; $table = "indent_po"; $where_po = array('po_id'=>$po_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result_inward($po_id); if($result) { $message = ['status'=>'Success','message'=>$result,'po_row'=>$po]; } else { $message = ['status'=>'Fail','message'=>'No data found','po_row'=>$po]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_po_no_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); //print_r($hmacsecurity);die(); if($hmacsecurity=='success') { $p_id = $this->input->get('p_id'); $table = "indent_po"; $where = array('id'=>$p_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_creditdebit_details_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $product_id = $this->input->post('product'); $po_no = $this->input->post('po_no'); $po_id = $this->input->post('po_id'); $note_type = $this->input->post('note_type'); $location = $this->input->post('location'); $received_quantity = $this->input->post('received_quantity'); $inr_value = $this->input->post('inr_value'); $unit_price = $this->input->post('unit_price'); $return_stock = $this->input->post('return_stock'); $return_amount = $this->input->post('return_amount'); $id = $this->input->post('id'); $total_amount = $this->input->post('total_amount'); $created_at = date('Y-m-d H:i:s'); $table = 'mmg_credit_debit_notes'; foreach ($product_id as $key => $value) { if($note_type == 'Debit') { $return_amounts = 0; } else { $return_amounts = $return_amount[$key]; } $data= array( 'product' => $value, 'po_no' => $po_no, 'po_id' => $po_id, 'note_type' => $note_type, 'location' => $location, 'received_quantity' => $received_quantity[$key], 'unit_price' => $unit_price[$key], 'inr_value' => $inr_value[$key], 'return_stock' => $return_stock[$key], 'return_amount' => $return_amounts, 'total_amount' => $total_amount, 'created_by' =>$id, 'created_at' => $created_at ); $result = $this->MMG_model->insert($data,$table); } if($result) { $message=['status'=>'Success','message'=>'Added successfully..']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_credit_note_list_get() { $product_id = $this->input->get('product_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_credit_note_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_debit_note_list_get() { $product_id = $this->input->get('product_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_debit_note_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function inward_credit_note_preview_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $po = $this->MMG_model->get_po_row($p_id); /*$po_vendor = $po['vendor_name']; $table = "mmg_vendor"; $where_vendor = array('vendor'=>$po_vendor); $vendor_data = $this->MMG_model->get_where_row($table,$where_vendor);*/ $po_id = $po['po_id']; $result = $this->MMG_model->inward_credit_note_preview($p_id); if($result) { $message = ['status'=>'Success','message'=>$result,'po_row'=>$po]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function inward_debit_note_preview_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $po = $this->MMG_model->get_po_details($p_id); /*$po_vendor = $po['vendor_name']; $table = "mmg_vendor"; $where_vendor = array('vendor'=>$po_vendor); $vendor_data = $this->MMG_model->get_where_row($table,$where_vendor);*/ $po_id = $po['po_id']; $result = $this->MMG_model->inward_debit_note_preview($p_id); if($result) { $message = ['status'=>'Success','message'=>$result,'po_row'=>$po]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } /*public function datewise_attendance_report_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $report_date=$this->input->get('report_date'); $to_date=$this->input->get('to_date'); $employee=$this->input->get('employee'); $result=$this->MMG_model->datewise_attendance_report($report_date,$to_date,$employee,$date); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); }*/ public function datewise_attendance_report_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $report_date=$this->input->get('report_date'); $to_date=$this->input->get('to_date'); $employee=$this->input->get('employee'); $result=$this->MMG_model->datewise_attendance_report($report_date,$to_date,$employee,$date); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } /////////////////////////////////////////////////////////////////////////////////////// public function add_level_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $level_name = $this->input->post('level_name'); $created_at = date('Y-m-d H:i:s'); $data = array( 'level_name' => $level_name, 'master' => 1, 'created_at' => $created_at ); $where = array( 'level_name' =>$level_name, 'delete_status' =>'ACTIVE' ); $table = 'mmg_level_master'; $res = $this->MMG_model->get_where_row($table,$where); if(empty($res)) { $result = $this->MMG_model->insert($data,$table); if($result) { $table_trends = 'mmg_level_master'; $data_trends = array( 'mmg_level_id' => $result, 'level_name' => $level_name, 'master' => 1, 'created_at' => $created_at ); $result2 = $this->MMG_model->insert2($data_trends,$table_trends); $message=['status'=>'Success','message'=>'Added Successfully']; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Level Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_level_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_level_master'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_level_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_level_master'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_level_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_level_master'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $table_trends = 'mmg_level_master'; $where_trends = array('mmg_level_id'=>$id); $result = $this->MMG_model->update2($where_trends,$table_trends,$data); $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_level_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $level_name =$this->input->input_stream('level_name'); $created_at = date('Y-m-d H:i:s'); $where =array('id'=>$update_id); $table ='mmg_level_master'; $data =array('level_name' => $level_name, 'updated_at' => $created_at); $condition =array( 'level_name' =>$level_name, 'delete_status' =>'ACTIVE'); $res=$this->MMG_model->get_where_row($table,$condition); if(empty($res)) { $result=$this->MMG_model->update($where,$table,$data); if($result) { $where_trends = array('mmg_level_id'=>$update_id); $table_trends = 'mmg_level_master'; $result2 = $this->MMG_model->update2($where_trends,$table_trends,$data); $message=['status'=>'Success','message'=>'Updated successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Level Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_product_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $updated_by = $this->input->post('login_id'); $product_id = $this->input->post('product_id'); $unit_price = $this->input->post('unit_price'); $from_date = $this->input->post('from_date'); $to_date = $this->input->post('to_date'); $updated_at = date('Y-m-d H:i:s'); $table = 'mmg_products'; $where = array('product_id'=>$product_id); $data = array('unit_price' => $unit_price, 'product_updated_by'=> $updated_by, 'product_updated_at'=> $updated_at, 'from_date' => $from_date, 'to_date' => $to_date); $result = $this->MMG_model->update($where,$table,$data); $data1 = array('product_id' => $product_id, 'unit_price' => $unit_price, 'created_by' => $updated_by, 'created_at' => $updated_at, 'from_date' => $from_date, 'to_date' => $to_date); $table1 = 'mmg_product_validity'; $result=$this->MMG_model->insert($data1,$table1); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function ven_id_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_vendor_id(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_vendor_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $vendor = $this->input->post('vendor'); $v_id = $this->input->post('v_id'); $vendor_id = $this->input->post('vendor_id'); $address = $this->input->post('address'); $city = $this->input->post('city'); $country = $this->input->post('country'); $pincode = $this->input->post('pincode'); $gst_no = $this->input->post('gst_no'); $phone = $this->input->post('phone'); $email = $this->input->post('email'); $cont_person = $this->input->post('cont_person'); $bank_name = $this->input->post('bank_name'); $bank_address = $this->input->post('bank_address'); $ac_no = $this->input->post('ac_no'); $pan_no = $this->input->post('pan_no'); $swift_code = $this->input->post('swift_code'); $currency = $this->input->post('currency'); $ifsc_code = $this->input->post('ifsc_code'); // $vendor_type1 =$this->input->post('vendor_type'); $created_at = date('Y-m-d H:i:s'); $table_name = "mmg_vendor"; $where = array('delete_status'=>'ACTIVE'); $result_data = $this->MMG_model->get_where_result($table_name,$where); $phone_array = []; foreach ($result_data as $value) { array_push($phone_array, $value->phone); } if(in_array($phone,$phone_array)) { $message=['status'=>'Fail','message'=>'phone_number already exit please check onces']; } else { $data = array('vendor' => $vendor, 'vendor_id' => $vendor_id, 'v_id' => $v_id, 'address' => $address, 'city' => $city, 'country' => $country, 'pincode' => $pincode, 'gst_no' => $gst_no, 'phone' => $phone, 'email' => $email, 'cont_person' => $cont_person, 'bank_name' => $bank_name, 'bank_address' => $bank_address, 'ac_no' => $ac_no, 'pan_no' => $pan_no, 'swift_code' => $swift_code, 'currency' => $currency, 'ifsc_code' => $ifsc_code, 'created_on' =>$created_at, 'created_by' =>$id); $table = 'mmg_vendor'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added Successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function vendor_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_vendor"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_vendor_details_get() { $vendor_id = $this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_vendor'; $where = array('id'=>$vendor_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_vendor_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $vendors_id = $this->input->post('vendors_id'); $vendor = $this->input->post('vendor'); $v_id = $this->input->post('v_id'); $vendor_id = $this->input->post('vendor_id'); $address = $this->input->post('address'); $city = $this->input->post('city'); $country = $this->input->post('country'); $pincode = $this->input->post('pincode'); $gst_no = $this->input->post('gst_no'); $phone = $this->input->post('phone'); $email = $this->input->post('email'); $cont_person = $this->input->post('cont_person'); $bank_name = $this->input->post('bank_name'); $bank_address = $this->input->post('bank_address'); $ac_no = $this->input->post('ac_no'); $pan_no = $this->input->post('pan_no'); $swift_code = $this->input->post('swift_code'); $currency = $this->input->post('currency'); $ifsc_code = $this->input->post('ifsc_code'); $login_id = $this->input->post('login_id'); $created_on = date('Y-m-d'); $created_at = date('Y-m-d H:i:s'); $table = 'mmg_vendor'; $condition = array('id'=>$vendors_id); $data = array( 'vendor' => $vendor, 'vendor_id' => $vendor_id, 'address' => $address, 'city' => $city, 'country' => $country, 'pincode' => $pincode, 'gst_no' => $gst_no, 'phone' => $phone, 'email' => $email, 'cont_person' => $cont_person, 'bank_name' => $bank_name, 'bank_address' => $bank_address, 'ac_no' => $ac_no, 'pan_no' => $pan_no, 'swift_code' => $swift_code, 'currency' => $currency, 'ifsc_code' => $ifsc_code, 'created_by' =>$login_id, 'created_on' =>$created_on); $update_result=$this->MMG_model->update($condition,$table,$data); if($update_result > 0) { $message=['status'=>'Success','message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function vendor_data_get() { $vendor_id = $this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_vendor'; $where = array('id'=>$vendor_id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_vendor_master_put() { $date = $this->input->input_stream('date'); $signature = $this->input->input_stream('signature'); $pubKey = $this->input->input_stream('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('id'); $table = 'mmg_vendor'; $data = array('delete_status'=>'INACTIVE'); $where = array('id'=>$id); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function vendor_data_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $vendor_id = $this->input->post('vendor_id'); $table = 'mmg_vendor'; $where = array('id'=>$vendor_id,'delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No Details found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fetch_sales_customer_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $layout_id = $this->input->post('layout_id'); $site_id = $this->input->post('site_id'); $table = 'mmg_sales'; $where = array('layout_name_id'=>$layout_id,'site_no_id'=>$site_id,'delete_status'=>'ACTIVE'); $sales = $this->MMG_model->get_where_row($table,$where); $customer_id = $sales->customer_name_id; $cust_table = "mmg_customer"; $cust_where = array('id'=>$customer_id); $result = $this->MMG_model->get_where_row($cust_table,$cust_where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No Details found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_payment_type_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $created_by = $this->input->post('id'); $payment_type = $this->input->post('payment_type'); $created_at = date('Y-m-d H:i:s'); $data = array( 'payment_type' =>$payment_type, 'created_on' =>$created_at, 'created_by' =>$created_by ); $where = array( 'payment_type' =>$payment_type, 'delete_status' =>'ACTIVE' ); $table = 'mmg_payment_type_master'; $res=$this->MMG_model->get_where_row($table,$where); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>' added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Payment Type Name Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function payment_type_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_payment_type_master'; $data=array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_payment_type_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $table ='mmg_payment_type_master'; $data =array('delete_status'=>'ACTIVE','id'=>$id); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_payment_type_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $update_id =$this->input->input_stream('update_id'); $payment_type =$this->input->input_stream('payment_type'); $where =array('id'=>$update_id); $table ='mmg_payment_type_master'; $data =array('payment_type' =>$payment_type,); $condition =array( 'payment_type' =>$payment_type, 'delete_status' =>'ACTIVE'); $res=$this->MMG_model->get_where_row($table,$condition); if(empty($res)) { $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Payment Type Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_payment_type_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_payment_type_master'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } /*public function add_sales_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->post('login_id'); $cust_name =$this->input->post('cust_name'); $layout =$this->input->post('layout'); $site_number =$this->input->post('site_number'); $gf_built_up =$this->input->post('gf_builtup'); $gf_balcony =$this->input->post('gf_semi_builtup'); $gf_days =$this->input->post('gf_days'); $gf_mf_built_up =$this->input->post('mf_builtup'); $gf_mf_balcony =$this->input->post('mf_semi_buildup'); $gf_mf_days =$this->input->post('mf_days'); $total_sq_ft =$this->input->post('total_sq_ft'); $per_sq_ft =$this->input->post('per_sq_ft'); $total_construction_cost =$this->input->post('total_construction_cost'); $sq_ft =$this->input->post('sq_ft'); $site_sq_ft =$this->input->post('site_sq_ft'); $total_site_cost =$this->input->post('total_site_cost'); $main_grand_total =$this->input->post('main_grand_total'); $difference =$this->input->post('difference'); $const_site_total =$this->input->post('const_site_total'); $doc_charge =$this->input->post('doc_charge'); $katha_charge =$this->input->post('katha_charge'); $mooda_plan_section =$this->input->post('mooda_plan_section'); $cr_charges =$this->input->post('cr_charges'); $valuation_legal_charge =$this->input->post('valuation_legal_charge'); $reg_exp_charge =$this->input->post('reg_exp_charge'); $commission_percentage =$this->input->post('commission_percentage'); $commission_amount =$this->input->post('commission_amount'); $maintainace_charge =$this->input->post('maintainace_charge'); $interior_charge =$this->input->post('interior_charge'); $architect_charge =$this->input->post('architect_charge'); $total_amount =$this->input->post('total_amount'); $saledeed_charge =$this->input->post('saledeed_charge'); $stamp_duty_percentage =$this->input->post('stamp_duty_percentage'); $stamp_duty_amount =$this->input->post('stamp_duty_amount'); $reg_cost =$this->input->post('reg_cost'); $saledeed_value =$this->input->post('saledeed_value'); $doc_charge_amount =$this->input->post('doc_charge_amount'); $stamp_duty_charge =$this->input->post('stamp_duty_charge'); $remaining_payment =$this->input->post('remaining_payment'); $grand_total =$this->input->post('grand_total'); $level_id =$this->input->post('level_id'); $percentage =$this->input->post('percentage'); $total_value =$this->input->post('total_value'); $total_percentage =$this->input->post('total_percentage'); $total_payment_cost =$this->input->post('total_payment_cost'); $edit_id =$this->input->post('edit_id'); $note =$this->input->post('note'); $created_at = $date; $table_name = "mmg_sales"; $where = array('customer_name_id'=>$cust_name); $res = $this->MMG_model->get_where_row($table_name,$where); if(empty($res)) { $data =array( 'layout_name_id' =>$layout, 'site_no_id' =>$site_number, 'customer_name_id' =>$cust_name, 'gf_built_up' =>$gf_built_up, 'gf_balcony' =>$gf_balcony, 'gf_days' =>$gf_days, 'gf_mf_built_up' =>$gf_mf_built_up, 'gf_mf_balcony' =>$gf_mf_balcony, 'gf_mf_days' =>$gf_mf_days, 'total_sq_ft' =>$total_sq_ft, 'per_sq_ft' =>$per_sq_ft, 'total_construction_cost' =>$total_construction_cost, 'sq_ft' =>$sq_ft, 'site_sq_ft' =>$site_sq_ft, 'total_site_cost' =>$total_site_cost, // 'total_value' =>$main_grand_total, 'difference' =>$difference, 'const_site_total' =>$const_site_total, 'doc_charge' =>$doc_charge , 'katha_charge' =>$katha_charge, 'mooda_plan_section ' =>$mooda_plan_section, 'cr_charges ' =>$cr_charges, 'valuation_legal_charge' =>$valuation_legal_charge, 'reg_exp_charge' =>$reg_exp_charge, 'commission_percentage' =>$commission_percentage, 'commission_amount' =>$commission_amount, 'maintainace_charge' =>$maintainace_charge, 'interior_charge' =>$interior_charge, 'architect_charge' =>$architect_charge, 'total_amount' =>$total_amount, 'saledeed_charge' =>$saledeed_charge, 'stamp_duty_percentage' =>$stamp_duty_percentage, 'stamp_duty_amount' =>$stamp_duty_amount, 'reg_cost' =>$reg_cost, 'saledeed_value' =>$saledeed_value , 'doc_charge_amount' =>$doc_charge_amount, 'stamp_duty_charge' =>$stamp_duty_charge, 'remaining_payment' =>$remaining_payment, 'grand_total' =>$grand_total, 'created_on' =>$created_at, 'created_by' =>$id, 'note' =>$note); $table = 'mmg_sales'; $result=$this->MMG_model->insert($data,$table); } else { if($id == 1) { $status = "APPROVED"; } else { $status = ""; } $data =array( 'layout_name_id' =>$layout, 'site_no_id' =>$site_number, 'customer_name_id' =>$cust_name, 'gf_built_up' =>$gf_built_up, 'gf_balcony' =>$gf_balcony, 'gf_days' =>$gf_days, 'gf_mf_built_up' =>$gf_mf_built_up, 'gf_mf_balcony' =>$gf_mf_balcony, 'gf_mf_days' =>$gf_mf_days, 'total_sq_ft' =>$total_sq_ft, 'per_sq_ft' =>$per_sq_ft, 'total_construction_cost' =>$total_construction_cost, 'sq_ft' =>$sq_ft, 'site_sq_ft' =>$site_sq_ft, 'total_site_cost' =>$total_site_cost, // 'total_value' =>$main_grand_total, 'difference' =>$difference, 'const_site_total' =>$const_site_total, 'doc_charge' =>$doc_charge , 'katha_charge' =>$katha_charge, 'mooda_plan_section ' =>$mooda_plan_section, 'cr_charges ' =>$cr_charges, 'valuation_legal_charge' =>$valuation_legal_charge, 'reg_exp_charge' =>$reg_exp_charge, 'commission_percentage' =>$commission_percentage, 'commission_amount' =>$commission_amount, 'maintainace_charge' =>$maintainace_charge, 'interior_charge' =>$interior_charge, 'architect_charge' =>$architect_charge, 'total_amount' =>$total_amount, 'saledeed_charge' =>$saledeed_charge, 'stamp_duty_percentage' =>$stamp_duty_percentage, 'stamp_duty_amount' =>$stamp_duty_amount, 'reg_cost' =>$reg_cost, 'saledeed_value' =>$saledeed_value , 'doc_charge_amount' =>$doc_charge_amount, 'stamp_duty_charge' =>$stamp_duty_charge, 'remaining_payment' =>$remaining_payment, 'grand_total' =>$grand_total, 'created_on' =>$created_at, 'created_by' =>$id, 'status' =>$status, 'note' =>$note); $table = 'mmg_sales'; $where =array('customer_name_id'=>$cust_name,'delete_status'=>'ACTIVE'); $result =$this->MMG_model->update($where,$table,$data); } $table_name = "mmg_payment_details"; $res2 = $this->MMG_model->get_payment_validation($cust_name); if(!empty($percentage)) { foreach ($percentage as $key => $value) { if(!empty($value)) { $data2 =array( 'layout_id' =>$layout, 'site_id' =>$site_number, 'customer_id' =>$cust_name, 'total_site_cost' =>$total_site_cost, 'total_construction_cost' =>$total_construction_cost, 'final_cost' =>$grand_total, 'level_id' =>$level_id[$key], 'percentage' =>$value, 'total_payment_amount' =>$total_value[$key], 'created_at' =>$created_at, 'created_by' =>$id, 'total_payment_cost' =>$total_payment_cost, 'total_percentage' =>$total_percentage); $table2 = 'mmg_payment_details'; $result=$this->MMG_model->insert($data2,$table2); } } } if($result) { $message=['status'=>'Success','message'=>'Added Successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); }*/ //<!----------------------------------------> /* public function add_multilevel_budget_post() { $row_input=json_decode($this->input->post('row_input')); $select_type=json_decode($this->input->post('select_type')); $meterial=json_decode($this->input->post('meterial')); $l_name=json_decode($this->input->post('l_name')); $b_name=json_decode($this->input->post('b_name')); $d_name=json_decode($this->input->post('d_name')); $no_name=json_decode($this->input->post('no_name')); $total_name=json_decode($this->input->post('total_name')); $unit_name=json_decode($this->input->post('unit_name')); $ratio_name=json_decode($this->input->post('ratio_name')); $rf_name=json_decode($this->input->post('rf_name')); $qty_name=json_decode($this->input->post('qty_name')); $unit_qty_name=json_decode($this->input->post('unit_qty_name')); $tamt_name=json_decode($this->input->post('tamt_name')); $gst_name=json_decode($this->input->post('gst_name')); $gst_amt_name=json_decode($this->input->post('gst_amt_name')); $final_amount_name=json_decode($this->input->post('final_amount_name')); $l_c_without_gst_name=json_decode($this->input->post('l_c_without_gst_name')); $l_c_fourty_without_gst_name=json_decode($this->input->post('l_c_fourty_without_gst_name')); $rate_unit_name=json_decode($this->input->post('rate_unit_name')); $type_of_work_name=json_decode($this->input->post('type_of_work_name')); $heading_table=$this->input->post('heading_table'); $user_id = $this->input->post('user_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_multilevel_budget'; $condition=array('delete_status'=>'ACTIVE'); $order_by='id'; $get_row=$this->MMG_model->get_where_row_orderby($table,$condition,$order_by); if(!empty($get_row)) { $insertion_id=$get_row->insertion_count+1; } else { $insertion_id=1; } foreach($select_type as $key=>$value) { $data[]= array('created_by'=>$user_id,'type_of_work'=>$value, 'material'=>$meterial[$key], 'l_data'=>$l_name[$key], 'b_data'=>$b_name[$key], 'd_data'=>$d_name[$key], 'number'=>$no_name[$key], 'total'=>$total_name[$key], 'unit_total'=>$unit_name[$key], 'ratio_unit'=>$ratio_name[$key], 'rf_data'=>$rf_name[$key], 'quantity'=>$qty_name[$key], 'unit_quantity'=>$unit_qty_name[$key], 'total_amount'=>$tamt_name[$key], 'gst'=>$gst_name[$key], 'gst_amount'=>$gst_amt_name[$key], 'final_amount'=>$final_amount_name[$key], 'labour_charge_without_gst'=>$l_c_without_gst_name[$key], 'labour_charge_fourty_without_gst'=>$l_c_fourty_without_gst_name[$key], 'rate_unit'=>$rate_unit_name[$key], 'insertion_count'=>$insertion_id, 'row_number'=>$row_input[$key], 'type_of_work_name'=>$type_of_work_name[$key], 'table_heading'=>$heading_table, 'created_at'=>date('Y-m-d H:i:s'),'created_by'=>$user_id,'delete_status'=>'ACTIVE'); } $table='mmg_multilevel_budget'; $result = $this->MMG_model->insert_batch($table,$data); if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); }*/ public function add_multilevel_budget_post() { $row_input=json_decode($this->input->post('row_input')); $select_type=json_decode($this->input->post('select_type')); $meterial=json_decode($this->input->post('meterial')); $l_name=json_decode($this->input->post('l_name')); $b_name=json_decode($this->input->post('b_name')); $d_name=json_decode($this->input->post('d_name')); $no_name=json_decode($this->input->post('no_name')); $total_name=json_decode($this->input->post('total_name')); //$unit_name=json_decode($this->input->post('unit_name')); $ratio_name=json_decode($this->input->post('ratio_name')); $rf_name=json_decode($this->input->post('rf_name')); $qty_name=json_decode($this->input->post('qty_name')); $unit_qty_name=json_decode($this->input->post('unit_qty_name')); $tamt_name=json_decode($this->input->post('tamt_name')); $gst_name=json_decode($this->input->post('gst_name')); $gst_amt_name=json_decode($this->input->post('gst_amt_name')); $final_amount_name=json_decode($this->input->post('final_amount_name')); $rate_unit_name=json_decode($this->input->post('rate_unit_name')); $type_of_work_name=json_decode($this->input->post('type_of_work_name')); $heading_table=$this->input->post('heading_table'); $level_id =json_decode($this->input->post('level_id')); if(!empty($level_id)) { $level_id =json_decode($this->input->post('level_id')); } else { $level_id =""; } $product_group_id =json_decode($this->input->post('product_group_id')); if(!empty($product_group_id)) { $product_group_id =json_decode($this->input->post('product_group_id')); } else { $product_group_id =""; } $product_id =json_decode($this->input->post('product_id')); if(!empty($product_id)) { $product_id =json_decode($this->input->post('product_id')); } else { $product_id =""; } $unit_id =json_decode($this->input->post('unit_id')); if(!empty($product_id)) { $unit_id =json_decode($this->input->post('unit_id')); } else { $unit_id =""; } $gf_built_up =$this->input->post('gf_built_up'); $gf_balcony =$this->input->post('gf_balcony'); $gf_days =$this->input->post('gf_days'); $gf_mf_built_up =$this->input->post('gf_mf_built_up'); $gf_mf_balcony =$this->input->post('gf_mf_balcony'); $gf_mf_days =$this->input->post('gf_mf_days'); $user_id = $this->input->post('user_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_multilevel_budget'; $condition=array('delete_status'=>'ACTIVE'); $order_by='id'; $get_row=$this->MMG_model->get_where_row_orderby($table,$condition,$order_by); if(!empty($get_row)) { $insertion_id=$get_row->insertion_count+1; } else { $insertion_id=1; } $table='mmg_multilevel_budget'; $condition=array('delete_status'=>'ACTIVE','table_heading'=>$heading_table); $order_by='id'; $get_row=$this->MMG_model->get_where_row_orderby($table,$condition,$order_by); if(empty($get_row)) { foreach($select_type as $key=>$value) { if(!empty($meterial[$key])) { $meterial[$key]=$meterial[$key]; } else { $meterial[$key]=''; } if(!empty($product_id[$key])) { $product_id[$key]=$product_id[$key]; } else { $product_id[$key]=''; } if(!empty($level_id[$key])) { $level_id[$key]=$level_id[$key]; } else { $level_id[$key]=''; } if(!empty($product_group_id[$key])) { $product_group_id[$key]=$product_group_id[$key]; } else { $product_group_id[$key]=''; } if(!empty($unit_id[$key])) { $unit_id[$key]=$unit_id[$key]; } else { $unit_id[$key]=''; } $stri = (string)$l_name[$key]; if(!empty($stri[0])) { if($stri[0] == ".") { $l_name[$key] = '0'.$l_name[$key]; } else { } } else { $l_name[$key] = $l_name[$key]; } $b = (string)$b_name[$key]; if(!empty($b[0])) { if($b[0] == ".") { $b_name[$key] = '0'.$b_name[$key]; } else { $b_name[$key] = $b_name[$key]; } } else { $b_name[$key] = $b_name[$key]; } $d = (string)$d_name[$key]; if(!empty($d[0])) { if($d[0] == ".") { $d_name[$key] = '0'.$d_name[$key]; } else { $d_name[$key] = $d_name[$key]; } } else { $d_name[$key] = $d_name[$key]; } $no = (string)$no_name[$key]; if(!empty($no[0])) { if($no[0] == ".") { $no_name[$key] = '0'.$no_name[$key]; } else { $no_name[$key] = $no_name[$key]; } } else { $no_name[$key] = $no_name[$key]; } $ratio = (string)$ratio_name[$key]; if(!empty($ratio[0])) { if($ratio[0] == ".") { $ratio_name[$key] = '0'.$ratio_name[$key]; } else { $ratio_name[$key] = $ratio_name[$key]; } } else { $ratio_name[$key] = $ratio_name[$key]; } $rf = (string)$rf_name[$key]; if(!empty($rf[0])) { if($rf[0] == ".") { $rf_name[$key] = '0'.$rf_name[$key]; } else { $rf_name[$key] = $rf_name[$key]; } } else { $rf_name[$key] = $rf_name[$key]; } $rate = (string)$rate_unit_name[$key]; if(!empty($rate[0])) { if($rate[0] == ".") { $rate_unit_name[$key] = '0'.$rate_unit_name[$key]; } else { $rate_unit_name[$key] = $rate_unit_name[$key]; } } else { $rate_unit_name[$key] = $rate_unit_name[$key]; } $data= array('created_by'=>$user_id,'type_of_work'=>$value, 'material'=>$meterial[$key], 'l_data'=>$l_name[$key], 'b_data'=>$b_name[$key], 'd_data'=>$d_name[$key], 'number'=>$no_name[$key], 'total'=>$total_name[$key], 'ratio_unit'=>$ratio_name[$key], 'rf_data'=>$rf_name[$key], 'quantity'=>$qty_name[$key], 'unit_quantity'=>$unit_qty_name[$key], 'total_amount'=>$tamt_name[$key], 'gst'=>$gst_name[$key], 'gst_amount'=>$gst_amt_name[$key], 'final_amount'=>$final_amount_name[$key], 'rate_unit'=>$rate_unit_name[$key], 'insertion_count'=>$insertion_id, 'row_number'=>$row_input[$key], 'type_of_work_name'=>$type_of_work_name[$key], 'table_heading'=>$heading_table, 'gf_builtup' =>$gf_built_up, 'gf_balcony' =>$gf_balcony, 'gf_days' =>$gf_days, 'mf_builtup' =>$gf_mf_built_up, 'mf_balcony' =>$gf_mf_balcony, 'mf_days' =>$gf_mf_days, 'product_id' =>$product_id[$key], 'level_id' =>$level_id[$key], 'product_type_id' =>$product_group_id[$key], 'unit_total' =>$unit_id[$key], 'created_at'=>date('Y-m-d H:i:s'),'created_by'=>$user_id,'delete_status'=>'ACTIVE'); $table='mmg_multilevel_budget'; $result = $this->MMG_model->insert($data,$table); } if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message = ['status'=>'Fail','message'=>'Design Name Already Exists','result'=>0]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_budget_list_data_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_where_result_multilevel_budget(); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to fetch data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function multilevel_subgrid_data_get() { $user_id=$this->input->get('user_id'); $row_id=$this->input->get('row_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->multilevel_subgrid_data($row_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to fetch data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_edit_data_post() { $user_id=$this->input->post('user_id'); $row_id=$this->input->post('row_id'); $insertion_count=$this->input->post('insertion_count'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_edit_data($insertion_count); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_multilevel_budget_post() { $row_id=json_decode($this->input->post('row_id')); $row_input=json_decode($this->input->post('row_input')); $select_type=json_decode($this->input->post('select_type')); $meterial=json_decode($this->input->post('meterial')); $l_name=json_decode($this->input->post('l_name')); $b_name=json_decode($this->input->post('b_name')); $d_name=json_decode($this->input->post('d_name')); $no_name=json_decode($this->input->post('no_name')); $total_name=json_decode($this->input->post('total_name')); $unit_name=json_decode($this->input->post('unit_name')); $ratio_name=json_decode($this->input->post('ratio_name')); $rf_name=json_decode($this->input->post('rf_name')); $qty_name=json_decode($this->input->post('qty_name')); $unit_qty_name=json_decode($this->input->post('unit_qty_name')); $tamt_name=json_decode($this->input->post('tamt_name')); $gst_name=json_decode($this->input->post('gst_name')); $gst_amt_name=json_decode($this->input->post('gst_amt_name')); $final_amount_name=json_decode($this->input->post('final_amount_name')); $l_c_without_gst_name=json_decode($this->input->post('l_c_without_gst_name')); $l_c_fourty_without_gst_name=json_decode($this->input->post('l_c_fourty_without_gst_name')); $rate_unit_name=json_decode($this->input->post('rate_unit_name')); $insertion_count=json_decode($this->input->post('insertion_count')); $type_of_work_name=json_decode($this->input->post('type_of_work_name')); $heading_table=$this->input->post('heading_table'); $level_id =json_decode($this->input->post('level_id')); $product_group_id =json_decode($this->input->post('product_group_id')); $product_id =json_decode($this->input->post('product_id')); $unit_id =json_decode($this->input->post('unit_id')); $gf_built_up =$this->input->post('gf_built_up'); $gf_balcony =$this->input->post('gf_balcony'); $gf_days =$this->input->post('gf_days'); $gf_mf_built_up =$this->input->post('gf_mf_built_up'); $gf_mf_balcony =$this->input->post('gf_mf_balcony'); $gf_mf_days =$this->input->post('gf_mf_days'); $edit_id =$this->input->post('edit_id'); $user_id = $this->input->post('user_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_multilevel_budget'; $condition=array('delete_status'=>'ACTIVE'); $order_by='id'; $get_row=$this->MMG_model->get_where_row_orderby($table,$condition,$order_by); if(!empty($get_row)) { $insertion_id=$get_row->insertion_count+1; } else { $insertion_id=1; } $get_row2=$this->MMG_model->get_multilevel_validation($insertion_count); $table='mmg_multilevel_budget'; $condition=array('delete_status'=>'ACTIVE','table_heading'=>$heading_table,'insertion_count!='=>$insertion_count); $order_by='id'; $get_row=$this->MMG_model->get_where_row_orderby($table,$condition,$order_by); if(empty($get_row)) { foreach($select_type as $key=>$value) { if(!empty($meterial[$key])) { $meterial[$key]=$meterial[$key]; } else { $meterial[$key]=''; } if(!empty($product_id[$key])) { $product_id[$key]=$product_id[$key]; } else { $product_id[$key]=''; } if(!empty($level_id[$key])) { $level_id[$key]=$level_id[$key]; } else { $level_id[$key]=''; } if(!empty($product_group_id[$key])) { $product_group_id[$key]=$product_group_id[$key]; } else { $product_group_id[$key]=''; } if(!empty($unit_id[$key])) { $unit_id[$key]=$unit_id[$key]; } else { $unit_id[$key]=''; } $stri = (string)$l_name[$key]; if(!empty($stri[0])) { if($stri[0] == ".") { $l_name[$key] = '0'.$l_name[$key]; } else { } } else { $l_name[$key] = $l_name[$key]; } $b = (string)$b_name[$key]; if(!empty($b[0])) { if($b[0] == ".") { $b_name[$key] = '0'.$b_name[$key]; } else { $b_name[$key] = $b_name[$key]; } } else { $b_name[$key] = $b_name[$key]; } $d = (string)$d_name[$key]; if(!empty($d[0])) { if($d[0] == ".") { $d_name[$key] = '0'.$d_name[$key]; } else { $d_name[$key] = $d_name[$key]; } } else { $d_name[$key] = $d_name[$key]; } $no = (string)$no_name[$key]; if(!empty($no[0])) { if($no[0] == ".") { $no_name[$key] = '0'.$no_name[$key]; } else { $no_name[$key] = $no_name[$key]; } } else { $no_name[$key] = $no_name[$key]; } $ratio = (string)$ratio_name[$key]; if(!empty($ratio[0])) { if($ratio[0] == ".") { $ratio_name[$key] = '0'.$ratio_name[$key]; } else { $ratio_name[$key] = $ratio_name[$key]; } } else { $ratio_name[$key] = $ratio_name[$key]; } $rf = (string)$rf_name[$key]; if(!empty($rf[0])) { if($rf[0] == ".") { $rf_name[$key] = '0'.$rf_name[$key]; } else { $rf_name[$key] = $rf_name[$key]; } } else { $rf_name[$key] = $rf_name[$key]; } $rate = (string)$rate_unit_name[$key]; if(!empty($rate[0])) { if($rate[0] == ".") { $rate_unit_name[$key] = '0'.$rate_unit_name[$key]; } else { $rate_unit_name[$key] = $rate_unit_name[$key]; } } else { $rate_unit_name[$key] = $rate_unit_name[$key]; } $data= array( 'table_heading'=>$heading_table, 'type_of_work'=>$select_type[$key], 'type_of_work_name'=>$type_of_work_name[$key], 'l_data'=>$l_name[$key], 'b_data'=>$b_name[$key], 'd_data'=>$d_name[$key], 'number'=>$no_name[$key], 'total'=>$total_name[$key], 'ratio_unit'=>$ratio_name[$key], 'rf_data'=>$rf_name[$key], 'quantity'=>$qty_name[$key], 'unit_quantity'=>$unit_qty_name[$key], 'total_amount'=>$tamt_name[$key], 'gst'=>$gst_name[$key], 'gst_amount'=>$gst_amt_name[$key], 'final_amount'=>$final_amount_name[$key], 'insertion_count'=>$insertion_id, 'created_at'=>date('Y-m-d H:i:s'),'created_by'=>$user_id,'delete_status'=>'ACTIVE', 'gf_builtup' =>$gf_built_up, 'gf_balcony' =>$gf_balcony, 'gf_days' =>$gf_days, 'mf_builtup' =>$gf_mf_built_up, 'mf_balcony' =>$gf_mf_balcony, 'mf_days' =>$gf_mf_days, 'product_id' =>$product_id[$key], 'level_id' =>$level_id[$key], 'product_type_id' =>$product_group_id[$key], 'unit_total' =>$unit_id[$key], 'material' =>$meterial[$key], 'rate_unit' =>$rate_unit_name[$key]); $table='mmg_multilevel_budget'; $result = $this->MMG_model->insert($data,$table); } if($result) { $message = ['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to update data, Try again!','result'=>0]; } } else { $message = ['status'=>'Fail','message'=>'Table heading is already exits,Please rename heading.','result'=>0]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_edited_budget_list_data_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_where_result_multilevel_budget_edited_data(); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to fetch data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edited_multilevel_subgrid_data_get() { $user_id=$this->input->get('user_id'); $row_id=$this->input->get('row_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->edited_multilevel_subgrid_data($row_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to fetch data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function sales_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $result=$this->MMG_model->get_sales_customer_list($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_sales_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $sales_id = $this->input->get('sales_id'); $result=$this->MMG_model->get_sales_detail_row($sales_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_layout_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_layouts"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_customer"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_site_number_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_sites"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_sales_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $sales_id =$this->input->post('sales_id'); $layout =$this->input->post('layout'); $site_number =$this->input->post('site_number'); $site_num =$this->input->post('site_num'); $sqft =$this->input->post('sqft'); // $gf_built_up =$this->input->post('gf_built_up'); // $gf_balcony =$this->input->post('gf_balcony'); // $gf_days =$this->input->post('gf_days'); // $gf_mf_built_up =$this->input->post('gf_mf_built_up'); // $gf_mf_balcony =$this->input->post('gf_mf_balcony'); // $gf_mf_days =$this->input->post('gf_mf_days'); $sales_selection =$this->input->post('sales_selection'); $cust_name =$this->input->post('cust_name'); $payment_type =$this->input->post('payment_type'); $reg_date =$this->input->post('reg_date'); $completed_date =$this->input->post('completed_date'); $site_cost =$this->input->post('site_cost'); $site_reg_cost =$this->input->post('site_reg_cost'); $const_cost =$this->input->post('const_cost'); $tot_cost =$this->input->post('tot_cost'); $const_cost =$this->input->post('const_cost'); $plan_site =$this->input->post('plan_site'); $plan_const =$this->input->post('plan_const'); $final_plan =$this->input->post('final_plan'); $package_tot =$this->input->post('package_tot'); $muda_plan =$this->input->post('muda_plan'); $land_owner_khata =$this->input->post('land_owner_khata'); $comm =$this->input->post('comm'); $cr =$this->input->post('cr'); $login_id = $this->input->post('login_id'); $created_at = date('Y-m-d H:i:s'); $table='mmg_sales'; $data = array( 'layout_name_id' =>$layout, 'site_no_id' =>$site_number, 'site_number' =>$site_num, 'sqft' =>$sqft, // 'gf_built_up' =>$gf_built_up, // 'gf_balcony' =>$gf_balcony, // 'gf_days' =>$gf_days, // 'gf_mf_built_up' =>$gf_mf_built_up, // 'gf_mf_balcony' =>$gf_mf_balcony, // 'gf_mf_days' =>$gf_mf_days, 'selection_type' =>$sales_selection, 'customer_name_id' =>$cust_name, 'payment_type_id' =>$payment_type, 'register_date' =>$reg_date, 'completed_date' =>$completed_date, 'site_cost' =>$site_cost, 'site_reg_cost' =>$site_reg_cost, 'construction_cost' =>$const_cost, 'plan_of_site' =>$plan_site, 'plan_of_construction' =>$plan_const, 'final_plan' =>$final_plan, 'package_total' =>$package_tot, 'muda_approved_plan' =>$muda_plan, 'land_owner_khata' =>$land_owner_khata, 'comm' =>$comm, 'cr' =>$cr, 'updated_by' =>$login_id, 'updated_on' =>$created_at ); $where= array('id'=>$sales_id); $update_result=$this->MMG_model->update($where,$table,$data); if($update_result > 0) { $message=['status'=>'Success','message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function stock_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->stock_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_holiday_details_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $holiday_date = $this->input->post('holiday_date'); $holiday_date = date('Y-m-d',strtotime($holiday_date)); $description = $this->input->post('description'); $name = $this->input->post('name'); $created_at = date('Y-m-d H:i:s'); $table = 'mmg_holiday_details'; $data = array( 'holiday_date' => $holiday_date, 'description' => $description, 'name' => $name, 'created_at' => $created_at ); $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added Successfully..']; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_holiday_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_holiday_details"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function qc_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->qc_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } //new public function qc_approval_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $po_id = $this->input->post('po_id'); $qc_approved_by = $this->input->post('approved_by'); $qc_approved_date = date('Y-m-d H:i:s'); $table = "indent_po"; $where = array('id'=>$po_id); $res = $this->MMG_model->get_where_row($table,$where); $p_id = $res->po_id; $where_approve = array('po_id'=>$p_id); $data = array( 'qc_approval' =>'APPROVED', 'qc_approved_date' =>$qc_approved_date, 'qc_approved_by' =>$qc_approved_by ); $result = $this->MMG_model->update($where_approve,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Approved Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Could Not Approve..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function view_qc_details_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "indent_po"; $where = array('id'=>$p_id,'delete_status'=>'ACTIVE'); $po = $this->MMG_model->get_where_row($table,$where); $po_id = $po->po_id; $result = $this->MMG_model->view_qc_details($po_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function view_stock_details_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "indent_po"; $where = array('id'=>$p_id,'delete_status'=>'ACTIVE'); $po = $this->MMG_model->get_where_row($table,$where); $po_id = $po->po_id; $result = $this->MMG_model->view_stock_details($po_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fetch_site_godown_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $po_for = $this->input->post("po_for"); $layout_id = $this->input->post("layout_id"); $result = $this->MMG_model->fetch_site_godown($po_for,$layout_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function inventory_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->inventory_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function issue_inventory_products_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "indent_po"; $where = array('id'=>$p_id,'delete_status'=>'ACTIVE'); $po = $this->MMG_model->get_where_row($table,$where); $po_id = $po->po_id; $result = $this->MMG_model->issue_inventory_details($po_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_issue_inventory_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $issued_by = $this->input->post('login'); $site_id = $this->input->post('site_id'); $level_id = $this->input->post('level_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $issued_at = $date->format('Y-m-d H:i:s'); $details = $this->input->post('details'); $decoded = json_decode($details); $array = []; foreach ($decoded as $key => $value) { $edit_id = $value->edit_id; $issued = $value->issued_goods; $table = "mmg_stock"; $where = array('id' => $edit_id); $stock = $this->MMG_model->get_where_row($table,$where); $issued_goods = $stock->issued_goods+$value->issued_goods; $balance_goods = $stock->balance_goods-$value->issued_goods; if($issued == 0) { continue; } else { $update_stock = array('issued_goods' => $issued_goods, 'balance_goods' => $balance_goods, 'issued_by' => $issued_by, 'issued_at' => $issued_at); $result = $this->MMG_model->update($where,$table,$update_stock); $table_issue = "mmg_issue_stock"; $issue_data = array('stock_id' => $edit_id, 'issued_goods' => $issued, 'issued_to_site_id' => $site_id, 'level_id' => $level_id, 'issued_by' => $issued_by, 'issued_at' => $issued_at); $res = $this->MMG_model->insert($issue_data,$table_issue); } array_push($array, $result); } if($array) { $message=['status'=>'Success','message'=>'Issued Successfully']; } else { $message=['status'=>'Fail','message'=>'Could Not Issue!!']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function return_inventory_products_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "indent_po"; $where = array('id'=>$p_id,'delete_status'=>'ACTIVE'); $po = $this->MMG_model->get_where_row($table,$where); $po_id = $po->po_id; $result = $this->MMG_model->return_inventory_details($po_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_return_inventory_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $returned_by = $this->input->post('login'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $returned_at = $date->format('Y-m-d H:i:s'); $details = $this->input->post('details'); $decoded = json_decode($details); $array = []; foreach ($decoded as $key => $value) { $edit_id = $value->edit_id; $returned = $value->returned_goods; /*$table = "mmg_stock"; $where = array('id' => $value->edit_id); $stock = $this->MMG_model->get_where_row($table,$where); $returned_goods = $stock->returned_goods+$value->returned_goods; $balance_goods = $stock->balance_goods+$value->returned_goods;*/ if($returned == 0) { continue; } else { /*$update_stock = array('returned_goods' => $returned_goods, 'balance_goods' => $balance_goods, 'returned_by' => $returned_by, 'returned_at' => $returned_at); $result = $this->MMG_model->update($where,$table,$update_stock);*/ $table_return = "mmg_return_stock"; $return_data = array('stock_id' => $edit_id, 'returned_goods' => $returned, 'returned_by' => $returned_by, 'returned_at' => $returned_at); $res = $this->MMG_model->insert($return_data,$table_return); } array_push($array, $res); } if($array) { $message=['status'=>'Success','message'=>'Returned Successfully']; } else { $message=['status'=>'Fail','message'=>'Could Not Return!!']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function preview_inventory_products_get() { $p_id = $this->input->get('p_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $po = $this->MMG_model->po_godown_row($p_id); $po_id = $po->po_id; $res_issue = $this->MMG_model->preview_issue_details($po_id); $res_return = $this->MMG_model->preview_return_details($po_id); if($po) { $message = ['status'=>'Success','message_issue'=>$res_issue,'message_return'=>$res_return,'po_row'=>$po]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function auto_complete_product_name_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $keyword = $this->input->get('keyword'); $result = $this->MMG_model->Getsearch_productname_auto($keyword); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_product_based_on_product_group_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $product_group_id = $this->input->get('product_group_id'); $result=$this->MMG_model->get_product_based_on_product_group($product_group_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_product_based_unit_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $product_id = $this->input->get('product_id'); $result=$this->MMG_model->get_product_based_unit_for_design($product_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function layout_customers_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $layout_id = $this->input->post('layout_id'); $customer_type = $this->input->post('customer_type'); $id = $this->input->post('id'); $result = $this->MMG_model->layout_customers($layout_id,$id,$customer_type); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_phone_number_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->post("customer_id"); //$site_id = $this->input->post("site_id"); $table = "mmg_customer"; $where = array("id"=>$customer_id,"delete_status"=>'ACTIVE'); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_all_employee_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_employees"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_employee_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_all_department_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_department"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_customer_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->post('login_id'); $customer_id = $this->input->post('customer_id'); $customer_alias_name = $this->input->post('customer_alias_name'); $relation = $this->input->post('relation'); $relation_name = $this->input->post('relation_name'); $alt_phone = $this->input->post('alt_phone'); $alt_email = $this->input->post('alt_email'); $dob = $this->input->post('dob'); $doe = $this->input->post('doe'); $common_address = $this->input->post('common_address'); $auth_person = $this->input->post('auth_person'); $auth_email = $this->input->post('auth_email'); $working = $this->input->post('working'); $state = $this->input->post('state'); $created_at = date('Y-m-d H:i:s'); $data = array('customer_id' =>$customer_id, 'alias_name' =>$customer_alias_name, 'relation' =>$relation, 'relation_name' =>$relation_name, 'alt_phone' =>$alt_phone, 'alt_email' =>$alt_email, 'dob' =>$dob, 'doe' =>$doe, 'common_address'=>$common_address, 'state' =>$state, 'auth_person' =>$auth_person, 'auth_email' =>$auth_email, 'working' =>$working, 'created_by' =>$login_id, 'created_on' =>$created_at); $table = 'mmg_customer_details'; $where = array('customer_id'=>$customer_id); $details = $this->MMG_model->get_where_row($table,$where); if(!empty($details)) { $data1 = array( 'alias_name' =>$customer_alias_name, 'relation' =>$relation, 'relation_name' =>$relation_name, 'alt_phone' =>$alt_phone, 'alt_email' =>$alt_email, 'dob' =>$dob, 'doe' =>$doe, 'common_address'=>$common_address, 'state' =>$state, 'auth_person' =>$auth_person, 'auth_email' =>$auth_email, 'working' =>$working, 'created_by' =>$login_id, 'created_on' =>$created_at); $result=$this->MMG_model->update($where,$table,$data1); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } else { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'omething went wrong.. try again']; } } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_name_followup_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $site_id = $this->input->get('site_id'); $layout_id = $this->input->get('layout_id'); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$customer_id); $result=$this->MMG_model->get_where_row($table,$where); $result_enquiry=$this->MMG_model->get_customer_details_for_enquiry($customer_id); $result_finalized=$this->MMG_model->get_customer_details_for_finalized($customer_id); $result_booking=$this->MMG_model->get_customer_details_for_booking_list($customer_id,$site_id,$layout_id); $result_sales=$this->MMG_model->get_customer_details_for_sales_list($customer_id,$site_id,$layout_id); $result_revised=$this->MMG_model->get_customer_details_for_revised_list($customer_id,$site_id,$layout_id); $result_architecture=$this->MMG_model->get_customer_details_for_architecture_list($customer_id,$site_id,$layout_id); if($result) { $message = ['status'=>'Success','message'=>$result,'enquiry'=>$result_enquiry,'booking'=>$result_booking,'finalized'=>$result_finalized,'sales'=>$result_sales,'result_revised'=>$result_revised,'result_architecture'=>$result_architecture]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_based_on_layout_site_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $site_id = $this->input->get('site_id'); $result = $this->MMG_model->get_customer_based_on_layout__site_get($layout_id,$site_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_department_based_on_employee_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee_name = $this->input->get('employee_name'); $result = $this->MMG_model->get_department_based_on_employee($employee_name); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_employees"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_site_visiting_followups_post() { $description = $this->input->post('description'); $followuser_id = $this->input->post('followuser_id'); $follow_date = $this->input->post('follow_date'); $newfollow_date = date("Y-m-d", strtotime($follow_date)); $progress = $this->input->post('progress'); $employee = $this->input->post('employee'); $department = $this->input->post('department'); $layout_id = $this->input->post('layout_id'); $site_id = $this->input->post('site_id'); $created_by = $this->input->post('created_by'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $date = date('H:i:s', time()); $data=array('layout_id'=>$layout_id,'site_id'=>$site_id,'created_time'=>$date,'created_by'=>$created_by,'customer_id'=>$followuser_id,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'emp_assigned'=>$employee,'emp_department'=>$department,'created_at'=>date('Y-m-d'),'created_by'=>$created_by,'delete_status'=>'ACTIVE'); $table='mmg_customer_site_visiting_followup'; $where = array('layout_id'=>$layout_id,'site_id'=>$site_id,'delete_status'=>'ACTIVE','progress'=>'Booking finalization'); $result = $this->MMG_model->get_site_visiting_sites($layout_id,$site_id,$followuser_id); if(empty($result)) { $result = $this->MMG_model->insert($data,$table); $file_name=$this->input->post('file'); $file_attachment_name=$this->input->post('file_name'); $data2=array('document' =>$file_name, 'file_attachment_name' =>$file_attachment_name, 'layout_id' =>$layout_id, 'site_id' =>$site_id, 'created_by' =>$created_by, 'created_at' =>$date, 'customer_id' =>$followuser_id, 'follow_up' =>'Finalized'); $table2='mmg_customer_documents'; $result2 = $this->MMG_model->insert($data2,$table2); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$followuser_id); $get_customers =$this->MMG_model->get_where_row($table,$where); if(!empty($get_customers)) { $msg = "Dear ".$get_customers->name." Thank you for visiting our property if you have further query call us at ".$get_customers->phone." MMGCON"; $sms_message_new = $msg; $headers = ['Content-Type' => 'application/x-www-form-urlencoded', 'charset' => 'utf-8']; $url = "http://mysmsshop.in/http-api.php?"; $postData2 = array('username'=> 'mmgconstructions', 'password'=>'New$$888', 'senderid'=>'MMGCON', 'route'=>1, 'message' => $sms_message_new, 'number' => $get_customers->phone, ); $ch2 = curl_init(); curl_setopt_array($ch2, array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER =>$headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData2 )); $output1 = curl_exec($ch2); if(curl_errno($ch2)) { echo 'error:' . curl_error($ch2); } curl_close($ch2); } if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message = ['status'=>'Fail','message'=>'Site Already Booked']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_site_based_on_layout_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $result = $this->MMG_model->get_site_based_on_layout($layout_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_details_layout_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $result = $this->MMG_model->get_details_layout($layout_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_site_visiting_customer_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $result = $this->MMG_model->get_site_visiting_customer_name($customer_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_booking_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $phone = $this->input->get('phone'); $id = $this->input->get('id'); $result = $this->MMG_model->get_booking_customer_list($phone,$id); //print_r($result);die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_details_for_booking_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $site_id = $this->input->get('site_id'); $booking_id = $this->input->get('booking_id'); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$customer_id); $result=$this->MMG_model->get_customer_details_for_booking($customer_id,$site_id,$booking_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function auto_complete_phone_based_customer_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $keyword = $this->input->get('keyword'); $result=$this->MMG_model->auto_complete_phone_based_customer($keyword); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_details_based_phoneno_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $phone_no_search = $this->input->get('phone_no_search'); $result=$this->MMG_model->get_customer_details_based_phoneno($phone_no_search); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_followup_callback_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result=$this->MMG_model->get_customer_followup_callback_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_followup_reject_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result=$this->MMG_model->get_customer_followup_reject_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_expired_callback_followup_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result=$this->MMG_model->get_customer_expired_callback_followup($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_channel_partners_employee_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $channel_partner = $this->input->get('channel_partner'); $result=$this->MMG_model->get_employee_based_channel_partners($channel_partner); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_expired_customer_sitevisiting_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $result=$this->MMG_model->get_expired_customer_sitevisiting_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_site_visit_followup_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result=$this->MMG_model->get_customer_site_visit_followup($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_refered_staff_employee_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_employees'; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_followup_list_based_phone_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $phone = $this->input->get('phone'); $id = $this->input->get('id'); /* $sidx=$this->input->get('sidx'); $limit=$this->input->get('limit'); $start=$this->input->get('start'); $sord=$this->input->get('sord'); $page=$this->input->get('page'); if(!$sidx) $sidx =1; $count=count($this->MMG_model->get_customer_followup_list_based_phone_count($phone,$id)); //print_r($count); die(); if( $count > 0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; // $query = $this->Model->getdatarate($start,$limit,$sidx,$sord,$where,$client_code); $query = $this->MMG_model->get_customer_followup_list_based_phone($start,$limit,$sidx,$sord,$id,$phone); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { // print_r($row['id']); die(); $responce["rows"][$i]['id']=$row['id']; $responce["rows"][$i]['cell']=array($row['name'],$row['enquiry_layout '],$row['reference_type'],$row['ref_from'],$row['ref_layout'],$row['ref_site_number'],$row['remarks'],$row['follow_date'],$row['enquiry_status'],$row['description'],$row['follow_created_at'],$row['created_by'],$row['created_time']); $i++; } */ $result=$this->MMG_model->get_customer_followup_list_based_phone($phone,$id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_sitevisiting_list_based_phone_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $phone = $this->input->get('phone'); $id = $this->input->get('id'); $result=$this->MMG_model->get_customer_sitevisiting_list_based_phone($phone,$id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_booking_followups_post() { $description = $this->input->post('description'); $followuser_id = $this->input->post('followuser_id'); $follow_date = $this->input->post('follow_date'); $newfollow_date = date("Y-m-d", strtotime($follow_date)); $progress = $this->input->post('progress'); $employee = $this->input->post('employee'); $department = $this->input->post('department'); $layout_id = $this->input->post('layout_id'); $site_id = $this->input->post('site_id'); $created_by = $this->input->post('created_by'); $file_name = $this->input->post('file_name'); $file = $this->input->post('file'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { if($progress == "Finalized Reject") { $data2 = array('customer_name_id'=>$followuser_id,'layout_name_id'=>$layout_id,'site_no_id'=>$site_id,'delete_status'=>'ACTIVE'); $table2= 'mmg_sales'; $result2 = $this->MMG_model->get_where_row($table2,$data2); if($result2) { $message = ['status'=>'Fail','message'=>'This site already Registered.','result'=>0]; } else { $table1='mmg_bookings'; $data1=array('delete_status'=>'INACTIVE'); $condition1 = array('customer_id'=>$followuser_id,'layout_id'=>$layout_id,'site_number'=>$site_id,'delete_status'=>'ACTIVE'); $this->MMG_model->update($condition1,$table1,$data1); $table2='mmg_customer_site_visiting_followup'; $data2=array('delete_status'=>'INACTIVE'); $condition2 = array('customer_id'=>$followuser_id,'layout_id'=>$layout_id,'site_id'=>$site_id,'delete_status'=>'ACTIVE'); $this->MMG_model->update($condition2,$table2,$data2); $datetime = new DateTime($date); $time = $datetime->format('H:i'); $data=array('layout_id'=>$layout_id,'site_id'=>$site_id,'created_time'=>$time,'created_by'=>$created_by,'customer_id'=>$followuser_id,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'emp_assigned'=>$employee,'emp_department'=>$department,'created_at'=>date('Y-m-d'),'created_by'=>$created_by,'delete_status'=>'ACTIVE','file_name' =>$file_name, 'file' =>$file); $table='mmg_booking_followup'; $where2 = array('delete_status'=>'ACTIVE','progress'=>$progress,'site_id'=>$site_id); $get_row=$this->MMG_model->get_where_row($table,$where2); if(empty($get_row)) { $result = $this->MMG_model->insert($data,$table); $file_name=$this->input->post('file'); $file_attachment_name=$this->input->post('file_name'); $data2=array('document' =>$file_name, 'file_attachment_name' =>$file_attachment_name, 'layout_id' =>$layout_id, 'site_id' =>$site_id, 'created_by' =>$created_by, 'created_at' =>$date, 'customer_id' =>$followuser_id, 'follow_up' =>'Booking'); $table2='mmg_customer_documents'; $result2 = $this->MMG_model->insert($data2,$table2); if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message = ['status'=>'Fail','message'=>'Progress Already Exists','result'=>0]; } } } else { $datetime = new DateTime($date); $time = $datetime->format('H:i'); $data=array('layout_id'=>$layout_id,'site_id'=>$site_id,'created_time'=>$time,'created_by'=>$created_by,'customer_id'=>$followuser_id,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'emp_assigned'=>$employee,'emp_department'=>$department,'created_at'=>date('Y-m-d'),'created_by'=>$created_by,'delete_status'=>'ACTIVE'); $table='mmg_booking_followup'; $result = $this->MMG_model->insert($data,$table); $file_name=$this->input->post('file'); $file_attachment_name=$this->input->post('file_name'); $data2=array('document' =>$file_name, 'file_attachment_name' =>$file_attachment_name, 'layout_id' =>$layout_id, 'site_id' =>$site_id, 'created_by' =>$created_by, 'created_at' =>$date, 'customer_id' =>$followuser_id, 'follow_up' =>'Booking'); $table2='mmg_customer_documents'; $result2 = $this->MMG_model->insert($data2,$table2); if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function booking_followup_list_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $data=array('delete_status'=>'ACTIVE'); if($user_id!=0) { $data['customer_id']=$user_id; } $site_id=$this->input->get('site_id'); $layout_id=$this->input->get('layout_id'); $result = $this->MMG_model->get_booking_followup_list($user_id,$site_id,$layout_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_all_progress_customer_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee_name=$this->input->get('employee_name'); $result = $this->MMG_model->get_all_progress_customer_list($employee_name); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No Data Found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_all_status_based_progress_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $employee_id = $this->input->get('employee_id'); $result = $this->MMG_model->get_all_status_based_progress($customer_id,$employee_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No Data Found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_details_for_sales_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $site_id = $this->input->get('site_id'); $layout_id = $this->input->get('layout_id'); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$customer_id); $cust_id=$this->MMG_model->get_where_row($table,$where); if($cust_id->ref_person != "") { if($cust_id->ref_type==10) { $table = 'mmg_customer'; $where2 = array('delete_status'=>'ACTIVE','id'=>$cust_id->ref_person); $refer_person1=$this->MMG_model->get_where_row($table,$where2); $refer_person['name']=$refer_person1->name; } else if($cust_id->ref_type==23) { $table = 'mmg_employees'; $where2 = array('delete_status'=>'ACTIVE','emp_id'=>$cust_id->ref_person); $refer_person2=$this->MMG_model->get_where_row($table,$where2); if(!empty($refer_person2)) { $refer_person['name']=$refer_person2->first_name; } else { $refer_person['name']=""; } } else if($cust_id->ref_type==24) { $table = 'mmg_employees'; $where2 = array('delete_status'=>'ACTIVE','emp_id'=>$cust_id->ref_person); $refer_person1=$this->MMG_model->get_where_row($table,$where2); if(!empty($refer_person1)) { $refer_person['name']=$refer_person1->first_name; } else { $refer_person['name']=""; } } } else { $refer_person['name'] = ""; } $result=$this->MMG_model->get_customer_details_for_sales($customer_id,$site_id,$layout_id); if($result) { $message = ['status'=>'Success','message'=>$result,'reference_person'=>$refer_person]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_sales_followups_post() { $description = $this->input->post('description'); $followuser_id = $this->input->post('followuser_id'); $follow_date = $this->input->post('follow_date'); $newfollow_date = date("Y-m-d", strtotime($follow_date)); $progress = $this->input->post('progress'); $employee = $this->input->post('employee'); $department = $this->input->post('department'); $layout_id = $this->input->post('layout_id'); $site_id = $this->input->post('site_id'); $created_by = $this->input->post('created_by'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $file_name = $this->input->post('file_name'); $file = $this->input->post('file'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { if($progress == "Booking" || $progress == "Finalized Reject") { $table1='mmg_sales'; $data1=array('delete_status'=>'INACTIVE'); $condition1=array('customer_name_id'=>$followuser_id); $this->MMG_model->update($condition1,$table1,$data1); } else { } $data=array('layout_id'=>$layout_id,'site_id'=>$site_id,'created_time'=>$date,'created_by'=>$created_by,'customer_id'=>$followuser_id,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'emp_assigned'=>$employee,'emp_department'=>$department,'created_at'=>date('Y-m-d'),'created_by'=>$created_by,'delete_status'=>'ACTIVE','file_name' =>$file_name, 'file' =>$file); $table='mmg_sales_followup'; $where2 = array('delete_status'=>'ACTIVE','progress'=>$progress,'site_id'=>$site_id); $get_row=$this->MMG_model->get_where_row($table,$where2); if(empty($get_row)) { $result = $this->MMG_model->insert($data,$table); $file_name=$this->input->post('file'); $file_attachment_name=$this->input->post('file_name'); $data2=array('document' =>$file_name, 'file_attachment_name' =>$file_attachment_name, 'layout_id' =>$layout_id, 'site_id' =>$site_id, 'created_by' =>$created_by, 'created_at' =>$date, 'customer_id' =>$followuser_id, 'follow_up' =>'Sales'); $table2='mmg_customer_documents'; $result2 = $this->MMG_model->insert($data2,$table2); if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message = ['status'=>'Fail','message'=>'Progress Already Exists']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function sales_followup_list_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $data=array('delete_status'=>'ACTIVE'); if($user_id!=0) { $data['customer_id']=$user_id; } $site_id=$this->input->get('site_id'); $layout_id=$this->input->get('layout_id'); $result = $this->MMG_model->get_sales_followup_list($user_id,$site_id,$layout_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_details_payment_details_get() { $customer_id=$this->input->get('customer_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_customer_details_payment_details($customer_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_expired_entry_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $result=$this->MMG_model->get_customer_expired_entry_list($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_unbooked_customer_bookings_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $id = $this->input->get('id'); $result = $this->MMG_model->get_unbooked_customer_bookings_list($customer_id,$id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_payment_details_row_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_payment_details'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_new_sales_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->get('id'); $result = $this->MMG_model->get_new_sales_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_layout_list_with_filter_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $result = $this->MMG_model->get_layout_list_with_filter($layout_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_sub_group_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $group_name = $this->input->post('group_name'); $sub_group = $this->input->post('sub_group'); $primary_group_name = $this->input->post('primary_group_name'); if($primary_group_name == "Y") { $data = array('group_name'=>$sub_group,'delete_status'=>'ACTIVE'); $table= 'mmg_group_master'; $result = $this->MMG_model->get_where_row($table,$data); if(empty($result)) { $created_at = date('Y-m-d H:i:s'); $data = array( 'group_name' =>$sub_group, //'primary_group'=>$primary_group_name, 'created_at' =>$created_at, 'created_by' =>$id, ); $table= 'mmg_group_master'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=>'Group Already Exists']; } } else { $data = array('sub_group'=>$sub_group,'delete_status'=>'ACTIVE'); $table= 'mmg_sub_group'; $result = $this->MMG_model->get_where_row($table,$data); if(empty($result)) { $created_at = date('Y-m-d H:i:s'); $data = array('group_id' => $group_name, 'sub_group' =>$sub_group, 'created_at' =>$created_at, 'created_by' =>$id, 'primary_group_name'=>$primary_group_name, ); $table = 'mmg_sub_group'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=>'Sub Group Already Exists']; } } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_group_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_sub_group'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_sub_group_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_group_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_group_master'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_sub_group_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_sub_group'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_sub_group_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $edit_id = $this->input->get('edit_id'); $data = array('id'=>$edit_id,'delete_status'=>'ACTIVE'); $table= 'mmg_sub_group'; $result = $this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_sub_group_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->input_stream('login_id'); $edit_id = $this->input->input_stream('edit_id'); $group_name = $this->input->input_stream('group_name'); $sub_group = $this->input->input_stream('sub_group'); $udpated_at = date('Y-m-d H:i:s'); $table='mmg_sub_group'; $condition = array('id'=>$edit_id); $data_update= array( 'group_id' =>$group_name, 'sub_group' =>$sub_group, 'updated_at' =>$udpated_at, 'updated_by' =>$login_id, ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','result'=>$result,'message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_godown_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $layout_id = $this->input->post('layout_id'); $godown_name = $this->input->post('godown_name'); $created_at = $date; $data = array('layout' =>$layout_id, 'godown_name' =>$godown_name, 'select_type' =>'Godown', 'created_on' =>$created_at, 'created_by' =>$id, ); $table = 'mmg_sites'; $result = $this->MMG_model->insert($data,$table); if($result) { $table = 'mmg_land_owner'; $data = array('delete_status'=>'ACTIVE','id'=>$layout_id); $result1 = $this->MMG_model->get_where_row($table,$data); $table = 'mmg_layout_master'; $data = array('delete_status'=>'ACTIVE','layout_name'=>$result1->layout_name); $result3 = $this->MMG_model->get_where_row2($table,$data); $table_trends = "mmg_site_master"; $data2 = array('mmg_site_id' => $result, 'layout_id' => $result3->id, 'select_type' =>'Godown', 'godown_name' => $godown_name, 'owner' => 'MMG', 'created_at' => $created_at); $result2=$this->MMG_model->insert2($data2,$table_trends); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_godown_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_sub_group'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_godown_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_godown_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $edit_id = $this->input->get('edit_id'); $data = array('id'=>$edit_id,'delete_status'=>'ACTIVE'); $table= 'mmg_sites'; $result = $this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_godown_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->input_stream('login_id'); $edit_id = $this->input->input_stream('edit_id'); $layout_id = $this->input->input_stream('layout_id'); $godown_name = $this->input->input_stream('godown_name'); $table='mmg_sites'; $condition = array('id'=>$edit_id); $data_update= array( 'layout' =>$layout_id, 'godown_name' =>$godown_name, 'updated_on' =>$date, 'updated_by' =>$login_id, ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $table = 'mmg_land_owner'; $data = array('delete_status'=>'ACTIVE','id'=>$layout_id); $result1 = $this->MMG_model->get_where_row($table,$data); $table = 'mmg_layout_master'; $data = array('delete_status'=>'ACTIVE','layout_name'=>$result1->layout_name); $result3 = $this->MMG_model->get_where_row2($table,$data); $table_trends = "mmg_site_master"; $condition1 = array('mmg_site_id'=>$edit_id); $data2 = array( 'layout_id' => $result3->id, 'select_type' =>'Godown', 'godown_name' => $godown_name, 'owner' => 'MMG' ); $result2=$this->MMG_model->update2($condition1,$table_trends,$data2); if($result) { $message=['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_godown_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_sites'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); $id=$this->input->input_stream('id'); $table_trends='mmg_site_master'; $data2=array('delete_status'=>'INACTIVE'); $condition2=array('mmg_site_id'=>$id); $result=$this->MMG_model->update2($condition2,$table_trends,$data2); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_department_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $department_id = $this->input->get('department_id'); $data = array('id'=>$department_id,'delete_status'=>'ACTIVE'); $table= 'mmg_department'; $result = $this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_layout_land_type_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $data = array('land_owners'=>$layout_id,'delete_status'=>'ACTIVE'); $table= 'mmg_layouts'; $result = $this->MMG_model->get_where_row($table,$data); if(!empty($result->land_type)) { if($result->land_type == "Site Purchase") { $site_purchse = $result->land_type; $site_purchse1 = $this->MMG_model->get_site_purchase_site_count($site_purchse,$layout_id); $land_development1 = ""; } else if($result->land_type == "Land Developer") { $land_development = $result->land_type; $land_development1 = $this->MMG_model->get_land_development_count($land_development,$layout_id); $site_purchse1 = ""; } else { $site_purchse1 = ""; $land_development1 = ""; } } else { $site_purchse1 = ""; $land_development1 = ""; } if($result) { $message=['status'=>'Success','message'=>$result,'land_development'=>$land_development1,'site_purchse'=>$site_purchse1]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_under_customers_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee = $this->input->post('employee'); $from_date = $this->input->post('from_date'); $to_date = $this->input->post('to_date'); $result = $this->MMG_model->get_employee_under_customers($employee,$from_date,$to_date); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_under_followup_customers_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee = $this->input->get('employee'); $from_date = $this->input->get('from_date'); $to_date = $this->input->get('to_date'); $result = $this->MMG_model->get_employee_under_followup_customers($employee,$from_date,$to_date); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_under_sitevisit_customers_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee = $this->input->get('employee'); $from_date = $this->input->get('from_date'); $to_date = $this->input->get('to_date'); $result = $this->MMG_model->get_employee_under_sitevisit_customers($employee,$from_date,$to_date); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_under_booking_customers_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee = $this->input->get('employee'); $from_date = $this->input->get('from_date'); $to_date = $this->input->get('to_date'); $result = $this->MMG_model->get_employee_under_booking_customers($employee,$from_date,$to_date); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_under_sales_customers_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee = $this->input->get('employee'); $from_date = $this->input->get('from_date'); $to_date = $this->input->get('to_date'); $result = $this->MMG_model->get_employee_under_sales_customers($employee,$from_date,$to_date); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_employee_under_expiry_customers_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $employee = $this->input->get('employee'); $from_date = $this->input->get('from_date'); $to_date = $this->input->get('to_date'); $result = $this->MMG_model->get_employee_under_expiry_customers($employee,$from_date,$to_date); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_attendance_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $employee_name = $this->input->post('employee_name'); $entry_status = $this->input->post('entry_status'); $entry_time = $this->input->post('entry_time'); $entry_date = $this->input->post('entry_date'); $entry_datetime = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $entry_datetime = $entry_datetime->format('Y-m-d H:i:s'); $created_at = date('Y-m-d H:i:s'); $employe_date = date('d/m/Y'); $employee_table = 'mmg_employees'; $employee_where = array('emp_id'=>$employee_name); $result5 = $this->MMG_model->get_where_row($employee_table,$employee_where); if(!empty($result5)) { $employee_table = 'mmg_employee_attendance'; $employee_where = array('emp_id'=>$employee_name,'entry_date'=>$entry_date); $order_by = 'id'; $result4 = $this->MMG_model->get_where_row_orderby($employee_table,$employee_where,$order_by); if(!empty($result4)) { if($result4->emp_id == $employee_name && $result4->entry_status !='Logged_IN' && $entry_status == 'Logged_IN') { $data = array( 'emp_id' =>$employee_name, 'entry_date' =>$entry_date, 'entry_time' =>$entry_time, 'entry_datetime' =>$entry_datetime, 'entry_status' =>$entry_status, 'delete_status' => 'ACTIVE', 'created_at' =>$created_at ); $table = 'mmg_employee_attendance'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else if($result4->emp_id == $employee_name && $result4->entry_status =='Logged_IN' && $entry_status == 'Logged_OUT') { $table = 'mmg_employee_attendance'; $where=array('id'=> $result4->id); $data = array( 'exit_date' =>$entry_date, 'exit_time' =>$entry_time, 'exit_datetime' =>$entry_datetime, 'entry_status' => $entry_status, 'created_at' =>$created_at ); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else if($result4->emp_id == $employee_name && $result4->entry_status =='Logged_OUT' && $entry_status == 'Logged_OUT') { $message=['status'=>'Fail','message'=>'Employee already Logged_OUT,please Logged_IN']; } else { $message=['status'=>'Fail','message'=>'Employee already Logged_IN,please Logged_OUT']; } } else { $data = array( 'emp_id' =>$employee_name, 'entry_date' =>$entry_date, 'entry_time' =>$entry_time, 'entry_datetime' =>$entry_datetime, 'entry_status' =>$entry_status, 'delete_status' => 'ACTIVE', 'created_at' =>$created_at ); $table = 'mmg_employee_attendance'; $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } } else { $message=['status'=>'Fail','message'=> 'Employee not exit']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fun_approve_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_sales'; $data=array('status'=>'APPROVED'); $condition=array('customer_name_id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Approved Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function fun_disapprove_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_sales'; $data=array('status'=>''); $condition=array('customer_name_id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Disapproved Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_approved_layout_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_approved_layout_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_approved_site_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_approved_site_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_approved_sales_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_approved_sales_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_dob_calender_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $calender = $this->input->post('calender'); $event = $this->input->post('event'); $description = $this->input->post('description'); $created_at = $date; $data = array('dob_date' =>$calender, 'event' =>$event, 'description' =>$description, 'created_on' =>$created_at, 'created_by' =>$id, ); $table = 'mmg_holiday_list'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_dob_dates_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_holiday_list'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_payment_amount_based_layout_site_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout= $this->input->get('layout'); $site= $this->input->get('site'); $tax_type= $this->input->get('tax_type'); $result = $this->MMG_model->get_payment_amount_based_layout_site($layout,$site,$tax_type); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } /*public function add_payment_entry_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $layout_id = $this->input->post('layout_id'); $site_id = $this->input->post('site_id'); $remaining_payment = $this->input->post('remaining_payment'); $stamp_duty_charge = $this->input->post('stamp_duty_charge'); $doc_charge_amount = $this->input->post('doc_charge_amount'); $payment_mode = $this->input->post('payment_mode'); $payment_given0 = $this->input->post('payment_given0'); $payment_given1 = $this->input->post('payment_given1'); $payment_given2 = $this->input->post('payment_given2'); $total_amt0 = $this->input->post('total_amt0'); $total_amt1 = $this->input->post('total_amt1'); $total_amt2 = $this->input->post('total_amt2'); $loop_id = json_encode($this->input->post('loop_id')); $tax_type = $this->input->post('tax_type'); $saledeed_value = $this->input->post('saledeed_value'); $payment_mode_sale = $this->input->post('payment_mode_sale'); $payment_given_sale = $this->input->post('payment_given_sale'); $total_amt_sale = $this->input->post('total_amt_sale'); $pay_mode_date = $this->input->post('pay_mode_date'); $pay_mode_no = $this->input->post('pay_mode_no'); $pay_mode_amt = $this->input->post('pay_mode_amt'); $bank_name = $this->input->post('bank_name'); $payment_mode = $this->input->post('payment_mode'); $total_amount = [$remaining_payment,$stamp_duty_charge,$doc_charge_amount]; if($tax_type == "without_tax") { $payment_type = ['Remaining Payment','Stamp Duty Charge','Doc Charge Amount']; } else { $payment_type_sale = "Saledeed Value"; $payment_type = ['Saledeed Value']; } $paid_amount = [$payment_given0,$payment_given1,$payment_given2]; $balance = [$total_amt0,$total_amt1,$total_amt2]; $details = json_decode($this->input->post('details')); $created_at = $date; $loop_id0 = 1; $loop_id1 = 1; $loop_id2= 1; $balance_goods = [$loop_id0,$loop_id1,$loop_id2]; $insert_function = $this->input->post('insert_function'); if($insert_function == "insert") { if($tax_type == "without_tax") { foreach ($balance_goods as $key => $value) { $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'payment_type' =>$payment_type[$key], 'total_amount' =>$total_amount[$key], 'paid_amount' =>$paid_amount[$key], 'balance' =>$balance[$key], 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, ); $table = 'mmg_payment_entry'; $result = $this->MMG_model->insert($data,$table); $table2 = 'mmg_sales_payment'; $result = $this->MMG_model->insert($data,$table2); } } else { $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'payment_type' =>$payment_type_sale, 'total_amount' =>$saledeed_value, 'paid_amount' =>$payment_given_sale, 'balance' =>$total_amt_sale, 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, ); $table = 'mmg_payment_entry'; $result = $this->MMG_model->insert($data,$table); $table2 = 'mmg_sales_payment'; $result = $this->MMG_model->insert($data,$table2); } } else if($insert_function == "edit") { foreach ($details as $key => $value) { $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'payment_type' =>$payment_type[$key], 'total_amount' =>$value->total_payment[$key], 'paid_amount' =>$value->payment_given[$key], 'balance' =>$value->total_balance[$key], 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, ); $table = 'mmg_sales_payment'; $result = $this->MMG_model->insert($data,$table); } foreach ($details as $key => $value) { $paid_amount = $value->paid_amount[$key]+$value->payment_given[$key]; $total_payment = $value->paid_amount[$key]+$value->balance[$key]; $balance = $value->total_payment[$key]-$paid_amount; $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'payment_type' =>$payment_type[$key], 'total_amount' =>$value->total_payment[$key], 'paid_amount' =>$paid_amount, 'balance' =>$balance, 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, ); $table = 'mmg_payment_entry'; $where = array('id'=>$value->edit_id[$key]); $result2 = $this->MMG_model->update($where,$table,$data); } } else if($insert_function == "template") { $level_id = $this->input->post("level_id"); $total_amount = $this->input->post("total_amount"); $paid_amount = $this->input->post("paid_amount"); $prev_balance = $this->input->post("prev_balance"); $template_id = $this->input->post('template_id'); $payment_given = $this->input->post('payment_given'); $total_balance = $this->input->post('total_balance'); foreach ($level_id as $key => $value) { $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'level_id' =>$level_id[$key], 'total_payment_amount' =>$total_amount[$key], 'balance' =>$total_balance[$key], 'paid_amount' =>$payment_given[$key], 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, ); $table = 'mmg_template_payment_report'; $result = $this->MMG_model->insert($data,$table); } $table = 'mmg_template_payment_entry'; $where = array('layout_id'=>$layout_id,'site_id'=>$site_id,'tax_type'=>$tax_type,'delete_status'=>'ACTIVE'); $result2=$this->MMG_model->get_where_row($table,$where); if(empty($result2)) { foreach ($level_id as $key => $value) { $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'level_id' =>$level_id[$key], 'total_payment_amount' =>$total_amount[$key], 'balance' =>$total_balance[$key], 'paid_amount' =>$payment_given[$key], 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, ); $table = 'mmg_template_payment_entry'; $result = $this->MMG_model->insert($data,$table); } } else { foreach ($level_id as $key => $value) { $final_paid_amount = $paid_amount[$key]+$payment_given[$key]; //$balance = $total_amount[$key]-$paid_amount; $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'level_id' =>$level_id[$key], 'total_payment_amount' =>$total_amount[$key], 'balance' =>$total_balance[$key], 'paid_amount' =>$final_paid_amount, 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, ); $table = 'mmg_template_payment_entry'; $where = array('id'=>$template_id[$key]); $result2 = $this->MMG_model->update($where,$table,$data); } } } if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); }*/ public function add_payment_entry_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $layout_id = $this->input->post('layout_id'); $site_id = $this->input->post('site_id'); $tax_type = $this->input->post('tax_type'); $pay_mode_date = $this->input->post('pay_mode_date'); $pay_mode_no = $this->input->post('pay_mode_no'); $pay_mode_amt = $this->input->post('pay_mode_amt'); $bank_name = $this->input->post('bank_name'); $payment_mode = $this->input->post('payment_mode'); $level_id = $this->input->post("level_id"); $total_amount = $this->input->post("total_amount"); $paid_amount = $this->input->post("paid_amount"); $prev_balance = $this->input->post("prev_balance"); $payment_given = $this->input->post('payment_given'); $total_balance = $this->input->post('total_balance'); $edit_id = $this->input->post('edit_id'); $created_at = $date; if($tax_type == "without_tax") { $table = 'mmg_payment_entry'; $where = array('layout_id'=>$layout_id,'site_id'=>$site_id,'tax_type'=>'without_tax','delete_status'=>'ACTIVE'); $result2=$this->MMG_model->get_where_row($table,$where); if(empty($result2)) { foreach ($level_id as $key => $value) { $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'total_payment_amount' =>$total_amount[$key], 'without_tax_paid_amount' =>$payment_given[$key], 'balance' =>$total_balance[$key], 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, 'level_id' =>$value, ); $table = 'mmg_payment_entry'; $result = $this->MMG_model->insert($data,$table); $table2 = 'mmg_sales_payment_entry'; $result = $this->MMG_model->insert($data,$table2); } } else { foreach ($edit_id as $key => $value) { $total_paid_amount = $paid_amount[$key]+$payment_given[$key]; //$total_payment = $total_amount[$key]+$total_balance[$key]; $balance = $total_amount[$key]-$total_paid_amount; $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'total_payment_amount' =>$total_amount[$key], 'without_tax_paid_amount' =>$total_paid_amount, 'balance' =>$balance, 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, 'level_id' =>$level_id[$key], ); $table = 'mmg_payment_entry'; $where = array('id'=>$value); $result = $this->MMG_model->update($where,$table,$data); $data2 = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'total_payment_amount' =>$total_amount[$key], 'without_tax_paid_amount' =>$payment_given[$key], 'balance' =>$total_balance[$key], 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, 'level_id' =>$level_id[$key], ); $table2 = 'mmg_sales_payment_entry'; $result = $this->MMG_model->insert($data2,$table2); } } } else { $table = 'mmg_payment_entry'; $where = array('layout_id'=>$layout_id,'site_id'=>$site_id,'tax_type'=>'tax','delete_status'=>'ACTIVE'); $result2=$this->MMG_model->get_where_row($table,$where); if(empty($result2)) { foreach ($level_id as $key => $value) { $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'percentage' =>$total_amount[$key], 'tax_paid_amount' =>$payment_given[$key], 'balance' =>$total_balance[$key], 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, 'level_id' =>$value, ); $table = 'mmg_payment_entry'; $result = $this->MMG_model->insert($data,$table); $table2 = 'mmg_sales_payment_entry'; $result = $this->MMG_model->insert($data,$table2); } } else { foreach ($edit_id as $key => $value) { $total_paid_amount = $paid_amount[$key]+$payment_given[$key]; //$total_payment = $total_amount[$key]+$total_balance[$key]; $balance = $total_amount[$key]-$total_paid_amount; $data = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'percentage' =>$total_amount[$key], 'tax_paid_amount' =>$total_paid_amount, 'balance' =>$balance, 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, 'level_id' =>$level_id[$key], ); $table = 'mmg_payment_entry'; $where = array('id'=>$value); $result = $this->MMG_model->update($where,$table,$data); $data2 = array('layout_id' =>$layout_id, 'site_id' =>$site_id, 'percentage' =>$total_amount[$key], 'tax_paid_amount' =>$payment_given[$key], 'balance' =>$total_balance[$key], 'tax_type' =>$tax_type, 'created_at' =>$created_at, 'created_by' =>$id, 'payment_no' =>$pay_mode_no, 'payment_date' =>$pay_mode_date, 'total_amount_paid' =>$pay_mode_amt, 'bank_name' =>$bank_name, 'payment_mode' =>$payment_mode, 'level_id' =>$level_id[$key], ); $table2 = 'mmg_sales_payment_entry'; $result = $this->MMG_model->insert($data2,$table2); } } } if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_site_based_on_layout_enquiry_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $result = $this->MMG_model->get_site_based_on_layout_enquiry($layout_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_site_based_on_layout_booking_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $result = $this->MMG_model->get_site_based_on_layout_booking($layout_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_upload_documents_get() { $id =$this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_bookings'; $where = array('customer_id'=>$id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_trends_bank_names_get() { $id =$this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_bank_creation'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result2($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_trends_bank_groups_get() { $id =$this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_bank_group'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result2($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_for_payment_entry_get() { $id =$this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $site_id = $this->input->get('site_id'); $result=$this->MMG_model->get_customer_for_payment_entry($layout_id,$site_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_saled_sites_based_on_layout_get() { $id =$this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $result=$this->MMG_model->get_saled_sites_based_on_layout($layout_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_payment_followups_post() { $description = $this->input->post('description'); $followuser_id = $this->input->post('followuser_id'); $follow_date = $this->input->post('follow_date'); $newfollow_date = date("Y-m-d", strtotime($follow_date)); $progress = $this->input->post('progress'); $employee = $this->input->post('employee'); $department = $this->input->post('department'); $layout_id = $this->input->post('layout_id'); $site_id = $this->input->post('site_id'); $created_by = $this->input->post('created_by'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $data=array('layout_id'=>$layout_id,'site_id'=>$site_id,'created_time'=>$date,'created_by'=>$created_by,'customer_id'=>$followuser_id,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'emp_assigned'=>$employee,'emp_department'=>$department,'created_at'=>$date,'created_by'=>$created_by,'delete_status'=>'ACTIVE'); $table='mmg_payment_followup'; $result = $this->MMG_model->insert($data,$table); if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_payment_followup_list_get() { $id =$this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $user_id = $this->input->get('user_id'); $result = $this->MMG_model->get_payment_followup_list($user_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_civil_levels_get() { $id =$this->input->get('id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_civil_master"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_todays_customer_followup_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $result = $this->MMG_model->get_todays_customer_followup_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_revised_budget_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->post('login_id'); $cust_name =$this->input->post('cust_name'); $layout =$this->input->post('layout'); $site_number =$this->input->post('site_number'); $gf_built_up =$this->input->post('gf_builtup'); $gf_balcony =$this->input->post('gf_semi_builtup'); $gf_days =$this->input->post('gf_days'); $gf_mf_built_up =$this->input->post('mf_builtup'); $gf_mf_balcony =$this->input->post('mf_semi_buildup'); $gf_mf_days =$this->input->post('mf_days'); $total_sq_ft =$this->input->post('total_sq_ft'); $per_sq_ft =$this->input->post('per_sq_ft'); $total_construction_cost =$this->input->post('total_construction_cost'); $site_sq_ft =$this->input->post('site_sq_ft'); $total_site_cost =$this->input->post('total_site_cost'); $main_grand_total =$this->input->post('main_grand_total'); $difference =$this->input->post('difference'); $const_site_total =$this->input->post('const_site_total'); $doc_charge =$this->input->post('doc_charge'); $katha_charge =$this->input->post('katha_charge'); $mooda_plan_section =$this->input->post('mooda_plan_section'); $cr_charges =$this->input->post('cr_charges'); $valuation_legal_charge =$this->input->post('valuation_legal_charge'); $reg_exp_charge =$this->input->post('reg_exp_charge'); $commission_percentage =$this->input->post('commission_percentage'); $commission_amount =$this->input->post('commission_amount'); $maintainace_charge =$this->input->post('maintainace_charge'); $interior_charge =$this->input->post('interior_charge'); $architect_charge =$this->input->post('architect_charge'); $total_amount =$this->input->post('total_amount'); $saledeed_charge =$this->input->post('saledeed_charge'); $stamp_duty_percentage =$this->input->post('stamp_duty_percentage'); $stamp_duty_amount =$this->input->post('stamp_duty_amount'); $reg_cost =$this->input->post('reg_cost'); //$saledeed_value =$this->input->post('saledeed_value'); $doc_charge_amount =$this->input->post('doc_charge_amount'); $stamp_duty_charge =$this->input->post('stamp_duty_charge'); $remaining_payment =$this->input->post('remaining_payment'); $grand_total =$this->input->post('grand_total'); $level_id =$this->input->post('level_id'); $percentage =$this->input->post('percentage'); $total_value =$this->input->post('total_value'); $total_percentage =$this->input->post('total_percentage'); $total_payment_cost =$this->input->post('total_payment_cost'); $edit_id =$this->input->post('edit_id'); $note =$this->input->post('note'); $add_dedduct =$this->input->post('add_dedduct'); $additional_area_cost =$this->input->post('additional_area_cost'); $revised_amount =$this->input->post('revised_amount'); $total_additional_cost =$this->input->post('total_additional_cost'); $level_id_tax =$this->input->post('level_id_tax'); $percentage_tax =$this->input->post('percentage_tax'); $total_value_tax =$this->input->post('total_value_tax'); $total_customer_cost =$this->input->post('total_customer_cost'); $sale_id =$this->input->post('sale_id'); $created_at = $date; $table_name = "mmg_revised_budget"; $where = array('sale_id'=>$sale_id,'delete_status'=>'ACTIVE'); $res = $this->MMG_model->get_where_row($table_name,$where); if(empty($res)) { $data =array('sale_id' =>$sale_id, 'layout_name_id' =>$layout, 'site_no_id' =>$site_number, 'customer_name_id' =>$cust_name, 'gf_built_up' =>$gf_built_up, 'gf_balcony' =>$gf_balcony, 'gf_days' =>$gf_days, 'gf_mf_built_up' =>$gf_mf_built_up, 'gf_mf_balcony' =>$gf_mf_balcony, 'gf_mf_days' =>$gf_mf_days, 'total_sq_ft' =>$total_sq_ft, 'per_sq_ft' =>$per_sq_ft, 'total_construction_cost' =>$total_construction_cost, //'sq_ft' =>$sq_ft, 'site_sq_ft' =>$site_sq_ft, //'total_site_cost' =>$total_site_cost, // 'total_value' =>$main_grand_total, 'difference' =>$difference, //'const_site_total' =>$const_site_total, 'doc_charge' =>$doc_charge , 'katha_charge' =>$katha_charge, 'mooda_plan_section ' =>$mooda_plan_section, 'cr_charges ' =>$cr_charges, 'valuation_legal_charge' =>$valuation_legal_charge, 'reg_exp_charge' =>$reg_exp_charge, //'commission_percentage' =>$commission_percentage, //'commission_amount' =>$commission_amount, 'maintainace_charge' =>$maintainace_charge, 'interior_charge' =>$interior_charge, 'architect_charge' =>$architect_charge, 'total_amount' =>$total_amount, 'saledeed_charge' =>$saledeed_charge, 'stamp_duty_percentage' =>$stamp_duty_percentage, 'stamp_duty_amount' =>$stamp_duty_amount, 'reg_cost' =>$reg_cost, //'saledeed_value' =>$saledeed_value , 'doc_charge_amount' =>$doc_charge_amount, 'stamp_duty_charge' =>$stamp_duty_charge, 'remaining_payment' =>$remaining_payment, 'grand_total' =>$grand_total, 'created_on' =>$created_at, 'created_by' =>$id, 'note' =>$note, 'status' =>'', 'add_dedduct' =>$add_dedduct, 'additional_area_cost' =>$additional_area_cost, 'revised_amount' =>$revised_amount, 'total_additional_cost' =>$total_additional_cost, 'total_customer_cost' =>$total_customer_cost, ); $table = 'mmg_revised_budget'; $result=$this->MMG_model->insert($data,$table); } else { $data =array( 'layout_name_id' =>$layout, 'site_no_id' =>$site_number, 'customer_name_id' =>$cust_name, 'gf_built_up' =>$gf_built_up, 'gf_balcony' =>$gf_balcony, 'gf_days' =>$gf_days, 'gf_mf_built_up' =>$gf_mf_built_up, 'gf_mf_balcony' =>$gf_mf_balcony, 'gf_mf_days' =>$gf_mf_days, 'total_sq_ft' =>$total_sq_ft, 'per_sq_ft' =>$per_sq_ft, 'total_construction_cost' =>$total_construction_cost, //'sq_ft' =>$sq_ft, 'site_sq_ft' =>$site_sq_ft, //'total_site_cost' =>$total_site_cost, // 'total_value' =>$main_grand_total, 'difference' =>$difference, //'const_site_total' =>$const_site_total, 'doc_charge' =>$doc_charge , 'katha_charge' =>$katha_charge, 'mooda_plan_section ' =>$mooda_plan_section, 'cr_charges ' =>$cr_charges, 'valuation_legal_charge' =>$valuation_legal_charge, 'reg_exp_charge' =>$reg_exp_charge, //'commission_percentage' =>$commission_percentage, //'commission_amount' =>$commission_amount, 'maintainace_charge' =>$maintainace_charge, 'interior_charge' =>$interior_charge, 'architect_charge' =>$architect_charge, 'total_amount' =>$total_amount, 'saledeed_charge' =>$saledeed_charge, 'stamp_duty_percentage' =>$stamp_duty_percentage, 'stamp_duty_amount' =>$stamp_duty_amount, 'reg_cost' =>$reg_cost, //'saledeed_value' =>$saledeed_value , 'doc_charge_amount' =>$doc_charge_amount, 'stamp_duty_charge' =>$stamp_duty_charge, 'remaining_payment' =>$remaining_payment, 'grand_total' =>$grand_total, 'created_on' =>$created_at, 'created_by' =>$id, 'status' =>'Approved', 'note' =>$note, 'add_dedduct' =>$add_dedduct, 'additional_area_cost' =>$additional_area_cost, 'revised_amount' =>$revised_amount, 'total_additional_cost' =>$total_additional_cost, 'total_customer_cost' =>$total_customer_cost); $table = 'mmg_revised_budget'; $where = array('sale_id'=>$sale_id,'delete_status'=>'ACTIVE'); $result =$this->MMG_model->update($where,$table,$data); } $res2 = $this->MMG_model->delete_revise_payment($cust_name,$layout,$site_number); if(!empty($level_id)) { foreach ($level_id as $key => $value) { if(!empty($value)) { $data2 =array( 'layout_id' =>$layout, 'site_id' =>$site_number, 'customer_id' =>$cust_name, 'final_cost' =>$grand_total, 'level_id' =>$level_id[$key], 'percentage' =>$percentage[$key], 'total_payment_amount' =>$total_value[$key], 'percentage_tax' =>$percentage_tax[$key], 'total_payment_amount_tax' =>$total_value_tax[$key], 'created_at' =>$created_at, 'created_by' =>$id, 'total_payment_cost' =>$total_payment_cost, 'total_percentage' =>$total_percentage); $table2 = 'mmg_revise_payment_details'; $result=$this->MMG_model->insert($data2,$table2); } } } if($result) { $message=['status'=>'Success','message'=>'Added Successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_sales_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->post('login_id'); $role_id =$this->input->post('role_id'); $cust_name =$this->input->post('cust_name'); $layout =$this->input->post('layout'); $site_number =$this->input->post('site_number'); $gf_built_up =$this->input->post('gf_builtup'); $gf_balcony =$this->input->post('gf_semi_builtup'); $gf_days =$this->input->post('gf_days'); $gf_mf_built_up =$this->input->post('mf_builtup'); $gf_mf_balcony =$this->input->post('mf_semi_buildup'); $gf_mf_days =$this->input->post('mf_days'); $total_sq_ft =$this->input->post('total_sq_ft'); $per_sq_ft =$this->input->post('per_sq_ft'); $total_construction_cost =$this->input->post('total_construction_cost'); $sq_ft =$this->input->post('sq_ft'); $site_sq_ft =$this->input->post('site_sq_ft'); $total_site_cost =$this->input->post('total_site_cost'); $main_grand_total =$this->input->post('main_grand_total'); $difference =$this->input->post('difference'); $const_site_total =$this->input->post('const_site_total'); $doc_charge =$this->input->post('doc_charge'); $katha_charge =$this->input->post('katha_charge'); $mooda_plan_section =$this->input->post('mooda_plan_section'); $cr_charges =$this->input->post('cr_charges'); $valuation_legal_charge =$this->input->post('valuation_legal_charge'); $reg_exp_charge =$this->input->post('reg_exp_charge'); $commission_percentage =$this->input->post('commission_percentage'); $commission_amount =$this->input->post('commission_amount'); $maintainace_charge =$this->input->post('maintainace_charge'); $interior_charge =$this->input->post('interior_charge'); $architect_charge =$this->input->post('architect_charge'); $total_amount =$this->input->post('total_amount'); $saledeed_charge =$this->input->post('saledeed_charge'); $stamp_duty_percentage =$this->input->post('stamp_duty_percentage'); $stamp_duty_amount =$this->input->post('stamp_duty_amount'); $reg_cost =$this->input->post('reg_cost'); $saledeed_value =$this->input->post('saledeed_value'); $doc_charge_amount =$this->input->post('doc_charge_amount'); $stamp_duty_charge =$this->input->post('stamp_duty_charge'); $remaining_payment =$this->input->post('remaining_payment'); $grand_total =$this->input->post('grand_total'); $total_cost =$this->input->post('total_cost'); $level_id =$this->input->post('level_id'); $percentage =$this->input->post('percentage'); $total_value =$this->input->post('total_value'); $total_percentage =$this->input->post('total_percentage'); $total_payment_cost =$this->input->post('total_payment_cost'); $edit_id =$this->input->post('edit_id'); $note =$this->input->post('note'); $level_id_tax =$this->input->post('level_id_tax'); $percentage_tax =$this->input->post('percentage_tax'); $total_value_tax =$this->input->post('total_value_tax'); $employee =$this->input->post('employee'); $created_at = $date; $table_name = "mmg_sales"; $where = array('customer_name_id'=>$cust_name,'delete_status'=>'ACTIVE','site_no_id'=>$site_number,'layout_name_id'=>$layout); $res = $this->MMG_model->get_where_row($table_name,$where); if(empty($res)) { $data =array('employee'=>$employee, 'layout_name_id' =>$layout, 'site_no_id' =>$site_number, 'customer_name_id' =>$cust_name, 'gf_built_up' =>$gf_built_up, 'gf_balcony' =>$gf_balcony, 'gf_days' =>$gf_days, 'gf_mf_built_up' =>$gf_mf_built_up, 'gf_mf_balcony' =>$gf_mf_balcony, 'gf_mf_days' =>$gf_mf_days, 'total_sq_ft' =>$total_sq_ft, 'per_sq_ft' =>$per_sq_ft, 'total_construction_cost' =>$total_construction_cost, 'sq_ft' =>$sq_ft, 'site_sq_ft' =>$site_sq_ft, 'total_site_cost' =>$total_site_cost, // 'total_value' =>$main_grand_total, 'difference' =>$difference, 'const_site_total' =>$const_site_total, 'doc_charge' =>$doc_charge , 'katha_charge' =>$katha_charge, 'mooda_plan_section ' =>$mooda_plan_section, 'cr_charges ' =>$cr_charges, 'valuation_legal_charge' =>$valuation_legal_charge, 'reg_exp_charge' =>$reg_exp_charge, 'commission_percentage' =>$commission_percentage, 'commission_amount' =>$commission_amount, 'maintainace_charge' =>$maintainace_charge, 'interior_charge' =>$interior_charge, 'architect_charge' =>$architect_charge, 'total_amount' =>$total_amount, 'saledeed_charge' =>$saledeed_charge, 'stamp_duty_percentage' =>$stamp_duty_percentage, 'stamp_duty_amount' =>$stamp_duty_amount, 'reg_cost' =>$reg_cost, 'saledeed_value' =>$saledeed_value , 'doc_charge_amount' =>$doc_charge_amount, 'stamp_duty_charge' =>$stamp_duty_charge, 'remaining_payment' =>$remaining_payment, 'grand_total' =>$grand_total, 'total_cost' =>$total_cost, 'created_on' =>$created_at, 'created_by' =>$id, 'note' =>$note); $table = 'mmg_sales'; $result=$this->MMG_model->insert($data,$table); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$cust_name); $get_customers =$this->MMG_model->get_where_row($table,$where); if(!empty($get_customers)) { $msg = "Dear ".$get_customers->name." your Site/Plot registration process is completed. To collect sale deed, please visit our office within 2 days. MMG Constructions LLP Contact No. ".$get_customers->phone; $sms_message_new = $msg; $headers = ['Content-Type' => 'application/x-www-form-urlencoded', 'charset' => 'utf-8']; /* $url = "http://sms.jayblues.com/http-api.php?";*/ $url = "http://mysmsshop.in/http-api.php?"; $postData2 = array('username'=> 'mmgconstructions', 'password'=>'New$$888', 'senderid'=>'MMGCON', //'unicode'=>2, 'route'=>1, 'message' => $sms_message_new, 'number' => $get_customers->phone, ); $ch2 = curl_init(); curl_setopt_array($ch2, array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER =>$headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData2 )); $output1 = curl_exec($ch2); if(curl_errno($ch2)) { echo 'error:' . curl_error($ch2); } curl_close($ch2); } } else { if($role_id == 1) { $status = "APPROVED"; } else { $status = ""; } $data =array('employee'=>$employee, 'layout_name_id' =>$layout, 'site_no_id' =>$site_number, 'customer_name_id' =>$cust_name, 'gf_built_up' =>$gf_built_up, 'gf_balcony' =>$gf_balcony, 'gf_days' =>$gf_days, 'gf_mf_built_up' =>$gf_mf_built_up, 'gf_mf_balcony' =>$gf_mf_balcony, 'gf_mf_days' =>$gf_mf_days, 'total_sq_ft' =>$total_sq_ft, 'per_sq_ft' =>$per_sq_ft, 'total_construction_cost' =>$total_construction_cost, 'sq_ft' =>$sq_ft, 'site_sq_ft' =>$site_sq_ft, 'total_site_cost' =>$total_site_cost, // 'total_value' =>$main_grand_total, 'difference' =>$difference, 'const_site_total' =>$const_site_total, 'doc_charge' =>$doc_charge , 'katha_charge' =>$katha_charge, 'mooda_plan_section ' =>$mooda_plan_section, 'cr_charges ' =>$cr_charges, 'valuation_legal_charge' =>$valuation_legal_charge, 'reg_exp_charge' =>$reg_exp_charge, 'commission_percentage' =>$commission_percentage, 'commission_amount' =>$commission_amount, 'maintainace_charge' =>$maintainace_charge, 'interior_charge' =>$interior_charge, 'architect_charge' =>$architect_charge, 'total_amount' =>$total_amount, 'saledeed_charge' =>$saledeed_charge, 'stamp_duty_percentage' =>$stamp_duty_percentage, 'stamp_duty_amount' =>$stamp_duty_amount, 'reg_cost' =>$reg_cost, 'saledeed_value' =>$saledeed_value , 'doc_charge_amount' =>$doc_charge_amount, 'stamp_duty_charge' =>$stamp_duty_charge, 'remaining_payment' =>$remaining_payment, 'grand_total' =>$grand_total, 'total_cost' =>$total_cost, 'created_on' =>$created_at, 'created_by' =>$id, 'status' =>$status, 'note' =>$note); $table = 'mmg_sales'; $where = array('customer_name_id'=>$cust_name,'delete_status'=>'ACTIVE','site_no_id'=>$site_number); $result =$this->MMG_model->update($where,$table,$data); } $table_name = "mmg_payment_details"; $res2 = $this->MMG_model->get_payment_validation($cust_name,$site_number); if(!empty($level_id)) { foreach ($level_id as $key => $value) { if(!empty($value)) { $data2 =array( 'layout_id' =>$layout, 'site_id' =>$site_number, 'customer_id' =>$cust_name, 'total_site_cost' =>$total_site_cost, 'total_construction_cost' =>$total_construction_cost, 'final_cost' =>$grand_total, 'level_id' =>$level_id[$key], 'percentage' =>$percentage[$key], 'total_payment_amount' =>$total_value[$key], 'percentage_tax' =>$percentage_tax[$key], 'total_payment_amount_tax' =>$total_value_tax[$key], 'created_at' =>$created_at, 'created_by' =>$id, 'total_payment_cost' =>$total_payment_cost, 'total_percentage' =>$total_percentage); $table2 = 'mmg_payment_details'; $result=$this->MMG_model->insert($data2,$table2); } } } $table_name = "mmg_withtax_payment_details"; $res2 = $this->MMG_model->get_payment_validation_withtax($cust_name); if(!empty($percentage_tax)) { foreach ($percentage_tax as $key => $value) { if(!empty($value)) { $data2 =array( 'layout_id' =>$layout, 'site_id' =>$site_number, 'customer_id' =>$cust_name, 'total_site_cost' =>$total_site_cost, 'total_construction_cost' =>$total_construction_cost, 'final_cost' =>$grand_total, 'level_id' =>$level_id_tax[$key], 'percentage' =>$value, 'total_payment_amount' =>$total_value_tax[$key], 'created_at' =>$created_at, 'created_by' =>$id, /*'total_payment_cost' =>$total_payment_cost, 'total_percentage' =>$total_percentage*/); $table2 = 'mmg_withtax_payment_details'; $result=$this->MMG_model->insert($data2,$table2); } } } if($result) { $message=['status'=>'Success','message'=>'Added Successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_withtax_payment_details_get() { $customer_id=$this->input->get('customer_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_withtax_payment_details($customer_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_ledger_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $group_name = $this->input->post('group_name'); $name = $this->input->post('name'); $credit = $this->input->post('credit'); $debit = $this->input->post('debit'); $sub_group_name = $this->input->post('sub_group_name'); $opl = $this->input->post('opl'); $credit_debit = $this->input->post('credit_debit'); $sub_group_id = $this->input->post('sub_group_id'); $address = $this->input->post('address'); $country = $this->input->post('country'); $state = $this->input->post('state'); $dealer = $this->input->post('dealer'); $frequently = $this->input->post('frequently'); $gstin = $this->input->post('gstin'); $it_pan = $this->input->post('it_pan'); $aadhar = $this->input->post('aadhar'); $email = $this->input->post('email'); $mobile = $this->input->post('mobile'); $tel = $this->input->post('tel'); $contact = $this->input->post('contact'); $data = array( 'group_id' =>$group_name, 'created_at' =>$date, 'created_by' =>$id, 'credit_debit' =>$credit_debit, 'opl' =>$opl, 'name' =>$name, 'sub_under_group_id' =>$sub_group_name, 'sub_group_id' =>$sub_group_id, 'address' =>$address, 'country' =>$country, 'state' =>$state, 'dealer' =>$dealer, 'frequently' =>$frequently, 'gstin' =>$gstin, 'aadhar' =>$aadhar, 'it_pan' =>$it_pan, 'email' =>$email, 'mobile' =>$mobile, 'tel' =>$tel, 'contact' =>$contact, ); $table = 'mmg_ledger'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_ledger_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_ledger'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_ledger_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_ledger_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $edit_id = $this->input->get('edit_id'); $data = array('id'=>$edit_id,'delete_status'=>'ACTIVE'); $table= 'mmg_ledger'; $result = $this->MMG_model->get_edit_ledger_list($edit_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_ledger_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->input_stream('login_id'); $edit_id = $this->input->input_stream('edit_id'); $group_name = $this->input->input_stream('group_name'); $sub_group_name = $this->input->input_stream('sub_group_name'); $name = $this->input->input_stream('name'); $credit = $this->input->input_stream('credit'); $opl = $this->input->input_stream('opl'); $sub_group_id = $this->input->input_stream('sub_group_id'); $address = $this->input->input_stream('address'); $country = $this->input->input_stream('country'); $state = $this->input->input_stream('state'); $dealer = $this->input->input_stream('dealer'); $frequently = $this->input->input_stream('frequently'); $gstin = $this->input->input_stream('gstin'); $it_pan = $this->input->input_stream('it_pan'); $aadhar = $this->input->input_stream('aadhar'); $email = $this->input->input_stream('email'); $mobile = $this->input->input_stream('mobile'); $tel = $this->input->input_stream('tel'); $contact = $this->input->input_stream('contact'); $created_at = date('Y-m-d H:i:s'); $table='mmg_ledger'; $condition = array('id'=>$edit_id); $data_update= array( 'group_id' =>$group_name, 'credit_debit' =>$credit, 'name' =>$name, 'opl' =>$opl, 'sub_under_group_id' =>$sub_group_name, 'sub_group_id' =>$sub_group_id, 'address' =>$address, 'country' =>$country, 'state' =>$state, 'dealer' =>$dealer, 'frequently' =>$frequently, 'gstin' =>$gstin, 'aadhar' =>$aadhar, 'it_pan' =>$it_pan, 'email' =>$email, 'mobile' =>$mobile, 'tel' =>$tel, 'contact' =>$contact, 'updated_at' =>$created_at, 'updated_by' =>$login_id ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','result'=>$result,'message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_ledger_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_ledger'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_all_holiday_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $table = 'mmg_holiday_details'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_holiday_post() { $date = $this->input->post('date'); $signature = $this->input->post('signature'); $pubKey = $this->input->post('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $id = $this->input->post('id'); $delete_id = $this->input->post('delete_id'); $date=date('Y-m-d H:i:s'); $table = "mmg_holiday_details"; $where = array('id'=>$id); $data = array('deleted_at'=>$date,'deleted_by'=>$delete_id,'delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_monthwise_holiday_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $month=$this->input->get('month'); $result=$this->MMG_model->get_monthwise_holiady_list($month); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function employee_leave_applicant_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result=$this->MMG_model->employee_leave_applicant($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_sub_group_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_sub_group'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_group_based_sub_group_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $sub_group_id=$this->input->get('sub_group_id'); $result=$this->MMG_model->get_group_based_sub_group($sub_group_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_template_amount_based_layout_site_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout= $this->input->get('layout'); $site= $this->input->get('site'); $tax_type= $this->input->get('tax_type'); $result = $this->MMG_model->get_template_amount_based_layout_site($layout,$site,$tax_type); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_sub_under_group_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $under_sub_group = $this->input->post('under_sub_group'); $sub_group = $this->input->post('sub_group'); $secondary_group_name = $this->input->post('secondary_group_name'); $group_ids = $this->input->post('group_ids'); if($secondary_group_name == "N") { $data = array('sub_under_group'=>$under_sub_group,'delete_status'=>'ACTIVE'); $table= 'mmg_sub_under_group'; $result = $this->MMG_model->get_where_row($table,$data); if(empty($result)) { $created_at = date('Y-m-d H:i:s'); $data = array('sub_under_group' => $under_sub_group, 'sub_group_id' =>$sub_group, 'created_at' =>$created_at, 'created_by' =>$id, 'secondary_group_name' =>$secondary_group_name, ); $table = 'mmg_sub_under_group'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=>'Under Group Alredy Exists']; } } else if($secondary_group_name == "Y") { $data = array('sub_group'=>$under_sub_group,'delete_status'=>'ACTIVE'); $table= 'mmg_sub_group'; $result = $this->MMG_model->get_where_row($table,$data); if(empty($result)) { $created_at = date('Y-m-d H:i:s'); $data = array('group_id' =>$group_ids, 'sub_group' =>$under_sub_group, 'created_at' =>$created_at, 'created_by' =>$id, 'primary_group_name' =>$secondary_group_name, ); $table = 'mmg_sub_group'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=>'Under Group Alredy Exists']; } } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_under_sub_group_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_sub_group'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_under_sub_group_list(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_sub_under_group_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_sub_under_group'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_sub_under_group_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $edit_id = $this->input->get('edit_id'); $data = array('id'=>$edit_id,'delete_status'=>'ACTIVE'); $table= 'mmg_sub_under_group'; $result = $this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_sub_under_group_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->input_stream('login_id'); $under_sub_group = $this->input->input_stream('under_sub_group'); $sub_group = $this->input->input_stream('sub_group'); $secondary_group_name = $this->input->input_stream('secondary_group_name'); $edit_id = $this->input->input_stream('edit_id'); $table='mmg_sub_under_group'; $condition = array('id'=>$edit_id); $created_at = date('Y-m-d H:i:s'); $data = array('sub_under_group' => $under_sub_group, 'sub_group_id' =>$sub_group, 'updated_at' =>$created_at, 'updated_by' =>$id, 'secondary_group_name' =>$secondary_group_name, ); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','result'=>$result,'message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_sub_under_group_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $data = array('delete_status'=>'ACTIVE'); $table= 'mmg_sub_under_group'; $result = $this->MMG_model->get_where_result($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_maingroup_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_group_master'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_main_group_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_group_master'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_main_group_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $edit_id = $this->input->get('edit_id'); $data = array('id'=>$edit_id,'delete_status'=>'ACTIVE'); $table= 'mmg_group_master'; $result = $this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_main_group_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->input_stream('login_id'); $edit_id = $this->input->input_stream('edit_id'); $main_group = $this->input->input_stream('main_group'); $udpated_at = date('Y-m-d H:i:s'); $table='mmg_group_master'; $condition = array('id'=>$edit_id); $data_update= array( 'group_name' =>$main_group, 'updated_at' =>$udpated_at, 'updated_by' =>$login_id, ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','result'=>$result,'message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function layout_disapproval_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->post('id'); $approved_by = $this->input->post('approved_by'); $approved_on = date('Y-m-d H:i:s'); $table = "mmg_layouts"; $where = array('id'=>$layout_id); $data = array('status'=>'NOT_APPROVED','approved_by'=>$approved_by,' approved_on'=>$approved_on ); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'DisApproved Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Could Not DisApprove..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function Add_sub_godown_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('login_id'); $godown_id = $this->input->post('godown_id'); $subgodown_name = $this->input->post('godown_name'); $created_at = $date; $data = array('parent_id' =>$godown_id, 'godown_name' =>$subgodown_name, 'select_type' =>'SubGodown', 'subgo_created_on'=>$created_at, 'subgo_created_by'=>$id, ); $table = 'mmg_sites'; $result = $this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something Went Wrong..try again']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function getsub_godown_name_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity =='success') { $id =$this->input->get('id'); $result=$this->MMG_model->get_subgrid_data($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_sub_godown_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $id = $this->input->get('id'); $table ='mmg_sites'; $data =array('id'=>$id,'delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_subgo_details_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $id = $this->input->input_stream('sub_id'); $subg_name = $this->input->input_stream('subg_name'); $udpated_at = date('Y-m-d H:i:s'); $table ='mmg_sites'; $where =array('id'=>$id,'delete_status'=>'ACTIVE'); $data = array('godown_name'=>$subg_name); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Updated Successfully ']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_sugo_details_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id =$this->input->input_stream('id'); $table ='mmg_sites'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result =$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function booking_cancel_post() { $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $cust_id = $this->input->post('cust_id'); $radioValues = $this->input->post('radioValues'); if($radioValues == "new_saled") { $table = "mmg_sales"; $where = array('customer_name_id'=>$cust_id); $data = array('new_saled_status'=>'CANCEL','status'=>''); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Cancelled Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else if($radioValues == "saled") { $cust_id = $this->input->post('cust_id'); $table = "mmg_sales"; $where = array('customer_name_id'=>$cust_id); $data = array('saled_status'=>'CANCEL'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Cancelled Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else if($radioValues == "approved_sales") { $table = "mmg_sales"; $where = array('customer_name_id'=>$cust_id); $data = array('approved_saled_status'=>'CANCEL','status'=>''); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Cancelled Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_booking_total_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = 'mmg_bookings'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result,'total_booking'=>count($result)]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_sales_total_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = 'mmg_sales'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result,'total_sales'=>count($result)]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_layout_total_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = 'mmg_layouts'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result,'total_layout'=>count($result)]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_total_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result,'total_customer'=>count($result)]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_payment_total_get() { $date = $this->input->get('date'); $signature = $this->input->get('signature'); $pubKey = $this->input->get('pubKey'); $hmacsecurity = $this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity == 'success') { $table = 'mmg_payment'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result,'total_payment'=>count($result)]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_budget_followups_post() { $description = $this->input->post('description'); $followuser_id = $this->input->post('followuser_id'); $follow_date = $this->input->post('follow_date'); $newfollow_date = date("Y-m-d", strtotime($follow_date)); $progress = $this->input->post('progress'); $employee = $this->input->post('employee'); $department = $this->input->post('department'); $layout_id = $this->input->post('layout_id'); $file_name = $this->input->post('file_name'); $site_id = $this->input->post('site_id'); if(!empty($file_name)) { $file_name = $this->input->post('file_name'); } else { $file_name = ""; } $file = $this->input->post('file'); if(!empty($file)) { $file = $this->input->post('file'); } else { $file = ""; } $created_by = $this->input->post('created_by'); $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { if($progress == "Booking" || $progress == "Finalized Reject") { $table1='mmg_budget'; $data1=array('delete_status'=>'INACTIVE'); $condition1=array('id'=>$followuser_id); $this->MMG_model->update($condition1,$table1,$data1); } else { } $date = date('H:i:s', time()); $data=array('layout_id' =>$layout_id, 'created_time' =>$date, 'created_by' =>$created_by, 'customer_id' =>$followuser_id, 'follow_date' =>$newfollow_date, 'description' =>$description, 'progress' =>$progress, 'emp_assigned' =>$employee, 'emp_department' =>$department, 'file_name' =>$file_name, 'file' =>$file, 'created_at' =>date('Y-m-d'), 'created_by' =>$created_by, 'delete_status' =>'ACTIVE', 'site_id' =>$site_id); $table='mmg_budget_followup'; $result = $this->MMG_model->insert($data,$table); $file_name=$this->input->post('file'); $file_attachment_name=$this->input->post('file_name'); $data2=array('document' =>$file_name, 'file_attachment_name' =>$file_attachment_name, 'layout_id' =>$layout_id, 'site_id' =>$site_id, 'created_by' =>$created_by, 'created_at' =>$date, 'customer_id' =>$followuser_id, 'follow_up' =>'Revised'); $table2='mmg_customer_documents'; $result2 = $this->MMG_model->insert($data2,$table2); if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function file_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_file_names(); if(!empty($result)) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_file_attachment_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $file_name = $this->input->post('file_name'); $created_at = date('Y-m-d H:i:s'); $data = array('name' =>$file_name, 'created_by' =>$id, 'created_at' =>$created_at); $where = array('name'=>$file_name,'delete_status'=>'ACTIVE'); $table = 'mmg_file_attachment'; $res = $this->MMG_model->get_where_row($table,$where); if(empty($res)) { $result=$this->MMG_model->insert($data,$table); if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=>'file name Already Exists']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_file_attachment_list_get() { $date =$this->input->get('date'); $signature =$this->input->get('signature'); $pubKey =$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_file_attachment'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_file_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $edit_id = $this->input->get('edit_id'); $table ='mmg_file_attachment'; $data =array('id'=>$edit_id,'delete_status'=>'ACTIVE'); $result =$this->MMG_model->get_where_row($table,$data); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function Update_file_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $login_id = $this->input->input_stream('login_id'); $edit_id = $this->input->input_stream('edit_id'); $file_name = $this->input->input_stream('file_name'); $udpated_at = date('Y-m-d H:i:s'); $table='mmg_file_attachment'; $where=array('id'=>$edit_id,'delete_status'=>'ACTIVE'); $data= array('name' =>$file_name, 'updated_at' =>$udpated_at, 'updated_by' =>$login_id); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','result'=>$result,'message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_file_list_put() { $date =$this->input->input_stream('date'); $signature =$this->input->input_stream('signature'); $pubKey =$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table ='mmg_file_attachment'; $data =array('delete_status'=>'INACTIVE'); $where =array('id'=>$id); $result=$this->MMG_model->update($where,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message,REST_Controller::HTTP_OK); } public function get_duplicate_customer_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table ='mmg_customer'; $data =array('duplicate_cust'=>'Duplicate visit','delete_status'=>'ACTIVE'); $result =$this->MMG_model->get_duplicate_customer(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_for_records_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id=$this->input->get('layout_id'); $site_id=$this->input->get('site_id'); $result =$this->MMG_model->get_customer_for_records($layout_id,$site_id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_document_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer=$this->input->get('customer'); $layout=$this->input->get('layout'); $site=$this->input->get('site'); $result =$this->MMG_model->get_customer_document_list($customer,$layout,$site); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_marketing_employee_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result =$this->MMG_model->get_marketing_employee_names(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_sales_employee_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result =$this->MMG_model->get_sales_employee_names(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_sitevisit_employee_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result =$this->MMG_model->get_customer_sitevisit_employee_names(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_duplicate_customer_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result=$this->MMG_model->get_duplicate_customer_list($id); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_duplicate_customer_count_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_duplicate_customer'; $where = array('delete_status'=>'ACTIVE'); $result=$this->MMG_model->get_where_result($table,$where); if($result) { $message=['status'=>'Success','message'=>$result,'total_customer'=>count($result)]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_finalized_reject_employee_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result =$this->MMG_model->get_finalized_reject_employee_names(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_conversation_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout=$this->input->get('layout_id'); $site=$this->input->get('site_id'); $result =$this->MMG_model->get_customer_conversation_list($layout,$site); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_phone_based_duplicate_customer_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $phone=$this->input->get('phone'); $id=$this->input->get('id'); $result=$this->MMG_model->get_phone_based_duplicate_customer($id,$phone); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_details_for_revise_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $sale_id = $this->input->get('sale_id'); $customer_id = $this->input->get('customer_id'); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$customer_id); $cust_id=$this->MMG_model->get_where_row($table,$where); if($cust_id->ref_person != "") { if($cust_id->ref_type==10) { $table = 'mmg_customer'; $where2 = array('delete_status'=>'ACTIVE','id'=>$cust_id->ref_person); $refer_person1=$this->MMG_model->get_where_row($table,$where2); $refer_person['name']=$refer_person1->name; } else if($cust_id->ref_type==23) { $table = 'mmg_employees'; $where2 = array('delete_status'=>'ACTIVE','emp_id'=>$cust_id->ref_person); $refer_person2=$this->MMG_model->get_where_row($table,$where2); if(!empty($refer_person2)) { $refer_person['name']=$refer_person2->first_name; } else { $refer_person['name']=""; } } else if($cust_id->ref_type==24) { $table = 'mmg_employees'; $where2 = array('delete_status'=>'ACTIVE','emp_id'=>$cust_id->ref_person); $refer_person1=$this->MMG_model->get_where_row($table,$where2); if(!empty($refer_person1)) { $refer_person['name']=$refer_person1->first_name; } else { $refer_person['name']=""; } } } else { $refer_person['name'] = ""; } $result=$this->MMG_model->get_customer_details_for_revise($sale_id); if($result) { $message = ['status'=>'Success','message'=>$result,'reference_person'=>$refer_person]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_revised_saved_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_revised_saved_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_revised_approved_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_revised_approved_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_revised_new_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_revised_new_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_revised_payment_details_get() { $customer_id=$this->input->get('customer_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_revised_payment_details($customer_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_channel_partners_emp_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result=$this->MMG_model->get_channel_partners_emp(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function layout_all_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_land_owner"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_all_layouts_name(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function revised_disaaprove_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $sales_id = $this->input->get('sales_id'); $where =array('customer_name_id'=>$sales_id); $data =array('status'=>'Unapprove'); $table ='mmg_revised_budget'; $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>"Unapproved"]; } else { $message = ['status'=>'Fail','message'=>'Failure']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_details_based_phoneno_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $phone_no_search = $this->input->get('phone_no_search'); $id = $this->input->get('id'); $result=$this->MMG_model->get_customer_details_based_phoneno_list($phone_no_search,$id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_accounts_department_employee_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_employees"; $where = array('delete_status'=>'ACTIVE'); $result = $this->MMG_model->get_accounts_department_employee(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function datewise_attendance_report_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $report_date=$this->input->get('report_date'); $to_date=$this->input->get('to_date'); $employee=$this->input->get('employee'); $result=$this->MMG_model->datewise_attendance_report_list($report_date,$to_date,$employee,$date); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_saledeed_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id=$this->input->get('customer_id'); $site_id=$this->input->get('site_id'); $layout_id=$this->input->get('layout_id'); $result=$this->MMG_model->get_saledeed_details($customer_id,$site_id,$layout_id); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_saledeed_details_for_amount_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id=$this->input->get('customer_id'); $site_id=$this->input->get('site_id'); $layout_id=$this->input->get('layout_id'); $result=$this->MMG_model->get_saledeed_details_for_amount($customer_id,$site_id,$layout_id); //print_r($result);die(); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_sales_list_post() { $sales_id = $this->input->post('sales_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_sales"; $where = array('id'=>$sales_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_booking_follow_list_post() { $sales_id = $this->input->post('sales_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_booking_followup"; $where = array('id'=>$sales_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_sitevisit_list_post() { $booking_id = $this->input->post('booking_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = "mmg_customer_site_visiting_followup"; $where = array('id'=>$booking_id); $data = array('delete_status'=>'INACTIVE'); $result = $this->MMG_model->update($where,$table,$data); if($result) { $message = ['status'=>'Success','message'=>'Deleted Successfully..']; } else { $message = ['status'=>'Fail','message'=>'Unsuccessful..']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_customer_document_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->get('id'); $where = array('id'=>$id); $table = 'mmg_customer_documents'; $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No data Found']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_customer_document_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $edit_id = $this->input->input_stream('edit_id'); $doc = $this->input->input_stream('doc'); $login_id = $this->input->input_stream('login_id'); $udpated_at = date('Y-m-d H:i:s'); $where = array('id'=>$edit_id); $table = 'mmg_customer_documents'; $res = $this->MMG_model->get_where_row($table,$where); if(!empty($doc)) { $document = $doc; $documents = preg_replace('/\s+/', '_', $document); } else { $document = $res->document; $documents = preg_replace('/\s+/', '_', $document); } $condition=array('id'=>$edit_id); $data_update= array('document'=>$documents, 'updated_at'=>$udpated_at, 'updated_by'=>$login_id, ); $result=$this->MMG_model->update($condition,$table,$data_update); if($result) { $message=['status'=>'Success','message'=>$result]; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function delete_customer_document_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->input_stream('id'); $table='mmg_customer_documents'; $data=array('delete_status'=>'INACTIVE'); $condition=array('id'=>$id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Deleted Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function budget_followup_list_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $data=array('delete_status'=>'ACTIVE'); if($user_id!=0) { $data['customer_id']=$user_id; } $site_id=$this->input->get('site_id'); $layout_id=$this->input->get('layout_id'); $result = $this->MMG_model->get_budget_followup_list($user_id,$site_id,$layout_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function architecture_followup_list_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $data=array('delete_status'=>'ACTIVE'); if($user_id!=0) { $data['customer_id']=$user_id; } $site_id=$this->input->get('site_id'); $layout_id=$this->input->get('layout_id'); $result = $this->MMG_model->get_architecture_followup_list($user_id,$site_id,$layout_id); if($result) { $message = ['status'=>'Success','message'=>'Data found','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_architecture_followups_post() { $description = $this->input->post('description'); $followuser_id = $this->input->post('followuser_id'); $follow_date = $this->input->post('follow_date'); $progress = $this->input->post('progress'); $employee = $this->input->post('employee'); $department = $this->input->post('department'); $newfollow_date = date("Y-m-d", strtotime($follow_date)); $created_by = $this->input->post('created_by'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $datetime = new DateTime($date); $time = $datetime->format('H:i'); $site_id=$this->input->post('site_id'); $layout_id=$this->input->post('layout_id'); $data=array('site_id'=>$site_id,'layout_id'=>$layout_id,'created_by'=>$created_by,'customer_id'=>$followuser_id,'follow_date'=>$newfollow_date,'description'=>$description,'progress'=>$progress,'emp_assigned'=>$employee,'emp_department'=>$department,'created_at'=>date('Y-m-d'),'created_by'=>$created_by,'created_time'=>$time,'delete_status'=>'ACTIVE'); $table='mmg_architecture_followup'; $result = $this->MMG_model->insert($data,$table); $file_name=$this->input->post('file'); $file_attachment_name=$this->input->post('file_name'); $data2=array('document' =>$file_name, 'file_attachment_name' =>$file_attachment_name, 'layout_id' =>$layout_id, 'site_id' =>$site_id, 'created_by' =>$created_by, 'created_at' =>$date, 'customer_id' =>$followuser_id, 'follow_up' =>'Enquiry'); $table2='mmg_customer_documents'; $result2 = $this->MMG_model->insert($data2,$table2); $file_name=$this->input->post('file'); $file_attachment_name=$this->input->post('file_name'); $data2=array('document' =>$file_name, 'file_attachment_name' =>$file_attachment_name, 'layout_id' =>$layout_id, 'site_id' =>$site_id, 'created_by' =>$created_by, 'created_at' =>$date, 'customer_id' =>$followuser_id, 'follow_up' =>'Architecture'); $table2='mmg_customer_documents'; $result2 = $this->MMG_model->insert($data2,$table2); if($result) { $message = ['status'=>'Success','message'=>'Inserted successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>0]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function update_revised_budget_post() { $row_id=json_decode($this->input->post('row_id')); $row_input=json_decode($this->input->post('row_input')); $select_type=json_decode($this->input->post('select_type')); $meterial=json_decode($this->input->post('meterial')); $l_name=json_decode($this->input->post('l_name')); $b_name=json_decode($this->input->post('b_name')); $d_name=json_decode($this->input->post('d_name')); $no_name=json_decode($this->input->post('no_name')); $total_name=json_decode($this->input->post('total_name')); $unit_name=json_decode($this->input->post('unit_name')); $ratio_name=json_decode($this->input->post('ratio_name')); $rf_name=json_decode($this->input->post('rf_name')); $qty_name=json_decode($this->input->post('qty_name')); $unit_qty_name=json_decode($this->input->post('unit_qty_name')); $tamt_name=json_decode($this->input->post('tamt_name')); $gst_name=json_decode($this->input->post('gst_name')); $gst_amt_name=json_decode($this->input->post('gst_amt_name')); $final_amount_name=json_decode($this->input->post('final_amount_name')); $l_c_without_gst_name=json_decode($this->input->post('l_c_without_gst_name')); $l_c_fourty_without_gst_name=json_decode($this->input->post('l_c_fourty_without_gst_name')); $rate_unit_name=json_decode($this->input->post('rate_unit_name')); $insertion_count=json_decode($this->input->post('insertion_count')); $type_of_work_name=json_decode($this->input->post('type_of_work_name')); $heading_table=$this->input->post('heading_table'); $revised_id=$this->input->post('revised_id'); $level_id =json_decode($this->input->post('level_id')); $product_group_id =json_decode($this->input->post('product_group_id')); $product_id =json_decode($this->input->post('product_id')); $unit_id =json_decode($this->input->post('unit_id')); $gf_built_up =$this->input->post('gf_built_up'); $gf_balcony =$this->input->post('gf_balcony'); $gf_days =$this->input->post('gf_days'); $gf_mf_built_up =$this->input->post('gf_mf_built_up'); $gf_mf_balcony =$this->input->post('gf_mf_balcony'); $gf_mf_days =$this->input->post('gf_mf_days'); $edit_id =$this->input->post('edit_id'); $all_ids =$this->input->post('all_ids'); $edit =$this->input->post('edit'); $user_id = $this->input->post('user_id'); $date=$this->input->post('date'); $signature=$this->input->post('signature'); $pubKey=$this->input->post('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_revised_design'; $condition=array('delete_status'=>'ACTIVE'); $order_by='id'; $get_row=$this->MMG_model->get_where_row_orderby($table,$condition,$order_by); if(!empty($get_row)) { $insertion_id=$get_row->insertion_count+1; } else { $insertion_id=1; } $selected_ids =$this->input->post('selected_ids'); if($edit == "insert") { foreach($select_type as $key=>$value) { $selected_ids =$this->input->post('selected_ids'); if(!empty($selected_ids[$key])) { if($selected_ids[$key] == "on") { if(!empty($meterial[$key])) { $meterial[$key]=$meterial[$key]; } else { $meterial[$key]=''; } if(!empty($product_id[$key])) { $product_id[$key]=$product_id[$key]; } else { $product_id[$key]=''; } if(!empty($level_id[$key])) { $level_id[$key]=$level_id[$key]; } else { $level_id[$key]=''; } if(!empty($product_group_id[$key])) { $product_group_id[$key]=$product_group_id[$key]; } else { $product_group_id[$key]=''; } if(!empty($unit_id[$key])) { $unit_id[$key]=$unit_id[$key]; } else { $unit_id[$key]=''; } $stri = (string)$l_name[$key]; if(!empty($stri[0])) { if($stri[0] == ".") { $l_name[$key] = '0'.$l_name[$key]; } else { $l_name[$key] = $l_name[$key]; } } else { $l_name[$key] = $l_name[$key]; } $b = (string)$b_name[$key]; if(!empty($b[0])) { if($b[0] == ".") { $b_name[$key] = '0'.$b_name[$key]; } else { $b_name[$key] = $b_name[$key]; } } else { $b_name[$key] = $b_name[$key]; } $d = (string)$d_name[$key]; if(!empty($d[0])) { if($d[0] == ".") { $d_name[$key] = '0'.$d_name[$key]; } else { $d_name[$key] = $d_name[$key]; } } else { $d_name[$key] = $d_name[$key]; } $no = (string)$no_name[$key]; if(!empty($no[0])) { if($no[0] == ".") { $no_name[$key] = '0'.$no_name[$key]; } else { $no_name[$key] = $no_name[$key]; } } else { $no_name[$key] = $no_name[$key]; } $ratio = (string)$ratio_name[$key]; if(!empty($ratio[0])) { if($ratio[0] == ".") { $ratio_name[$key] = '0'.$ratio_name[$key]; } else { $ratio_name[$key] = $ratio_name[$key]; } } else { $ratio_name[$key] = $ratio_name[$key]; } $rf = (string)$rf_name[$key]; if(!empty($rf[0])) { if($rf[0] == ".") { $rf_name[$key] = '0'.$rf_name[$key]; } else { $rf_name[$key] = $rf_name[$key]; } } else { $rf_name[$key] = $rf_name[$key]; } $rate = (string)$rate_unit_name[$key]; if(!empty($rate[0])) { if($rate[0] == ".") { $rate_unit_name[$key] = '0'.$rate_unit_name[$key]; } else { $rate_unit_name[$key] = $rate_unit_name[$key]; } } else { $rate_unit_name[$key] = $rate_unit_name[$key]; } $data= array( 'table_heading'=>$heading_table, 'type_of_work'=>$select_type[$key], 'type_of_work_name'=>$type_of_work_name[$key], 'l_data'=>$l_name[$key], 'b_data'=>$b_name[$key], 'd_data'=>$d_name[$key], 'number'=>$no_name[$key], 'total'=>$total_name[$key], 'ratio_unit'=>$ratio_name[$key], 'rf_data'=>$rf_name[$key], 'quantity'=>$qty_name[$key], 'unit_quantity'=>$unit_qty_name[$key], 'total_amount'=>$tamt_name[$key], 'gst'=>$gst_name[$key], 'gst_amount'=>$gst_amt_name[$key], 'final_amount'=>$final_amount_name[$key], 'insertion_count'=>$insertion_id, 'created_at'=>date('Y-m-d H:i:s'),'created_by'=>$user_id,'delete_status'=>'ACTIVE', 'revised_id'=>$revised_id, 'product_id' =>$product_id[$key], 'level_id' =>$level_id[$key], 'product_type_id' =>$product_group_id[$key], 'unit_total' =>$unit_id[$key], 'material' =>$meterial[$key], 'rate_unit' =>$rate_unit_name[$key]); $table='mmg_revised_design'; $result = $this->MMG_model->insert($data,$table); if($result) { $message = ['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to update data, Try again!','result'=>0]; } } } } } else { $get_row2=$this->MMG_model->delete_revised_design($revised_id); $table='mmg_revised_design'; $condition=array('delete_status'=>'ACTIVE','revised_id'=>$revised_id); $order_by='id'; $get_row=$this->MMG_model->get_where_row_orderby($table,$condition,$order_by); if(empty($get_row)) { foreach($select_type as $key=>$value) { if(!empty($meterial[$key])) { $meterial[$key]=$meterial[$key]; } else { $meterial[$key]=''; } if(!empty($product_id[$key])) { $product_id[$key]=$product_id[$key]; } else { $product_id[$key]=''; } if(!empty($level_id[$key])) { $level_id[$key]=$level_id[$key]; } else { $level_id[$key]=''; } if(!empty($product_group_id[$key])) { $product_group_id[$key]=$product_group_id[$key]; } else { $product_group_id[$key]=''; } if(!empty($unit_id[$key])) { $unit_id[$key]=$unit_id[$key]; } else { $unit_id[$key]=''; } $stri = (string)$l_name[$key]; if(!empty($stri[0])) { if($stri[0] == ".") { $l_name[$key] = '0'.$l_name[$key]; } else { $l_name[$key] = $l_name[$key]; } } else { $l_name[$key] = $l_name[$key]; } $b = (string)$b_name[$key]; if(!empty($b[0])) { if($b[0] == ".") { $b_name[$key] = '0'.$b_name[$key]; } else { $b_name[$key] = $b_name[$key]; } } else { $b_name[$key] = $b_name[$key]; } $d = (string)$d_name[$key]; if(!empty($d[0])) { if($d[0] == ".") { $d_name[$key] = '0'.$d_name[$key]; } else { $d_name[$key] = $d_name[$key]; } } else { $d_name[$key] = $d_name[$key]; } $no = (string)$no_name[$key]; if(!empty($no[0])) { if($no[0] == ".") { $no_name[$key] = '0'.$no_name[$key]; } else { $no_name[$key] = $no_name[$key]; } } else { $no_name[$key] = $no_name[$key]; } $ratio = (string)$ratio_name[$key]; if(!empty($ratio[0])) { if($ratio[0] == ".") { $ratio_name[$key] = '0'.$ratio_name[$key]; } else { $ratio_name[$key] = $ratio_name[$key]; } } else { $ratio_name[$key] = $ratio_name[$key]; } $rf = (string)$rf_name[$key]; if(!empty($rf[0])) { if($rf[0] == ".") { $rf_name[$key] = '0'.$rf_name[$key]; } else { $rf_name[$key] = $rf_name[$key]; } } else { $rf_name[$key] = $rf_name[$key]; } $rate = (string)$rate_unit_name[$key]; if(!empty($rate[0])) { if($rate[0] == ".") { $rate_unit_name[$key] = '0'.$rate_unit_name[$key]; } else { $rate_unit_name[$key] = $rate_unit_name[$key]; } } else { $rate_unit_name[$key] = $rate_unit_name[$key]; } $data= array( 'table_heading'=>$heading_table, 'type_of_work'=>$select_type[$key], 'type_of_work_name'=>$type_of_work_name[$key], 'l_data'=>$l_name[$key], 'b_data'=>$b_name[$key], 'd_data'=>$d_name[$key], 'number'=>$no_name[$key], 'total'=>$total_name[$key], 'ratio_unit'=>$ratio_name[$key], 'rf_data'=>$rf_name[$key], 'quantity'=>$qty_name[$key], 'unit_quantity'=>$unit_qty_name[$key], 'total_amount'=>$tamt_name[$key], 'gst'=>$gst_name[$key], 'gst_amount'=>$gst_amt_name[$key], 'final_amount'=>$final_amount_name[$key], 'insertion_count'=>$insertion_id, 'created_at'=>date('Y-m-d H:i:s'),'created_by'=>$user_id,'delete_status'=>'ACTIVE', 'revised_id'=>$revised_id, 'product_id' =>$product_id[$key], 'level_id' =>$level_id[$key], 'product_type_id' =>$product_group_id[$key], 'unit_total' =>$unit_id[$key], 'material' =>$meterial[$key], 'rate_unit' =>$rate_unit_name[$key]); $table='mmg_revised_design'; $result = $this->MMG_model->insert($data,$table); if($result) { $message = ['status'=>'Success','message'=>'Updated successfully','result'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to update data, Try again!','result'=>0]; } } } else { $message = ['status'=>'Fail','message'=>'Table heading is already exits,Please rename heading.','result'=>0]; } } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_architecture_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_architecture_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_execution_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_execution_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_revised_details_get() { $user_id=$this->input->get('user_id'); $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $result = $this->MMG_model->get_revised_details(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Fail to insert data, Try again!','result'=>array()]; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_site_based_on_layout_for_records_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $layout_id = $this->input->get('layout_id'); $result = $this->MMG_model->get_site_based_on_layout_for_records($layout_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_edit_revised_design_data_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $revised_id = $this->input->get('revised_id'); $result = $this->MMG_model->get_edit_revised_design_data($revised_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function approved_registration_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->input_stream('customer_id'); $site_id = $this->input->input_stream('site_id'); $layout_id = $this->input->input_stream('layout_id'); $status = $this->input->input_stream('status'); $table='mmg_saledeed_details'; $data=array('status'=>$status); $condition=array('customer_id'=>$customer_id,'site_id'=>$site_id,'layout_id'=>$layout_id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Approved Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_approved_registration_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_approved_registration_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_registration_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_registration_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_dashboard_old_layout_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_dashboard_old_layout_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_dashboard_booking_layout_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_dashboard_booking_layout_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_leave_employee_names_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_leave_employee_names($date); $result1 = $this->MMG_model->get_reminder_site_visit($date); $result2 = $this->MMG_model->get_reminder_registration($date); if($id) { $message = ['status'=>'Success','message'=>$result,'site_visit_reminder'=>$result1,'registration_reminder'=>$result2]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_total_customer_upto_booking_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_total_customer_upto_booking($id); if($result) { $message = ['status'=>'Success','message'=>count($result)]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_old_layout_total_customer_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_old_layout_total_customer($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_booking_layout_total_customer_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_booking_layout_total_customer($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_all_customer_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_type = $this->input->get('customer_type'); $result=$this->MMG_model->get_all_customer($customer_type); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_old_new_layouts_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_type = $this->input->get('customer_type'); $result=$this->MMG_model->get_old_new_layouts($customer_type); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_registration_done_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_registration_done_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_saled_customer_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_saled_customer($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_dashboard_sales_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id= $this->input->get('id'); $result = $this->MMG_model->get_dashboard_sales_list($id); //print_r($data); die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function sendsmsto_site_registration_cust_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $cust_type= $this->input->get('cust_type'); if($cust_type == "site_visit") { $result = $this->MMG_model->get_send_reminder_site_visit($date); if(!empty($result)) { foreach ($result as $key => $value) { $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$value->customer_id); $get_customers =$this->MMG_model->get_where_row($table,$where); if(!empty($get_customers)) { $msg = "Dear ".$get_customers->name. ", This is a friendly reminder confirming your visit to our site dated ".$value->follow_date." we expect to see you soon!! If you need to reschedule, call us at ".$get_customers->phone." Team MMG Constructions LLP"; $sms_message_new = $msg; $headers = ['Content-Type' => 'application/x-www-form-urlencoded', 'charset' => 'utf-8']; /* $url = "http://sms.jayblues.com/http-api.php?";*/ $url = "http://mysmsshop.in/http-api.php?"; $postData2 = array('username'=> 'mmgconstructions', 'password'=>'New$$888', 'senderid'=>'MMGCON', //'unicode'=>2, 'route'=>1, 'message' => $sms_message_new, 'number' => $get_customers->phone, ); $ch2 = curl_init(); curl_setopt_array($ch2, array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER =>$headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData2 )); $output1 = curl_exec($ch2); if(curl_errno($ch2)) { echo 'error:' . curl_error($ch2); } curl_close($ch2); } } } } else if($cust_type == "registration") { $result = $this->MMG_model->get_send_reminder_registration($date); if(!empty($result)) { foreach ($result as $key => $value) { $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$value->customer_id); $get_customers =$this->MMG_model->get_where_row($table,$where); if(!empty($get_customers)) { $msg = "MG Constructions LLP would be glad to take this opportunity to confirm your schedule for the site/Plot registration process dated on ".$value->follow_date." Thank you!! MMG Constructions LLP Contact No. ".$get_customers->phone; $sms_message_new = $msg; $headers = ['Content-Type' => 'application/x-www-form-urlencoded', 'charset' => 'utf-8']; /* $url = "http://sms.jayblues.com/http-api.php?";*/ $url = "http://mysmsshop.in/http-api.php?"; $postData2 = array('username'=> 'mmgconstructions', 'password'=>'New$$888', 'senderid'=>'MMGCON', //'unicode'=>2, 'route'=>1, 'message' => $sms_message_new, 'number' => $get_customers->phone ); $ch2 = curl_init(); curl_setopt_array($ch2, array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER =>$headers, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData2 )); $output1 = curl_exec($ch2); if(curl_errno($ch2)) { echo 'error:' . curl_error($ch2); } curl_close($ch2); } } } } if($result) { $message = ['status'=>'Success','message'=>'Successfully Send']; } else { $message = ['status'=>'Fail','message'=>'SMS Not Send']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_exp_letter_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id= $this->input->get('emp_id'); $result = $this->MMG_model->get_employee_with_department($emp_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_loan_progress_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result = $this->MMG_model->get_loan_progress_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function edit_saleagreement_details_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $site_id=$this->input->get('site_id'); $result = $this->MMG_model->edit_saleagreement_details($site_id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_sale_agreement_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $location = $this->input->post('location'); $saledeed_date = $this->input->post('saledeed_date'); $allotment_Date = $this->input->post('allotment_Date'); $sale_price = $this->input->post('sale_price'); $advanced_amount = $this->input->post('advanced_amount'); $balance = $this->input->post('balance'); $site_id = $this->input->post('site_id'); $loan_arranged_by = $this->input->post('loan_arranged_by'); $witness1 = $this->input->post('witness1'); $witness2 = $this->input->post('witness2'); $gender = $this->input->post('gender'); $family_gender = $this->input->post('family_gender'); $family_name = $this->input->post('family_name'); $age = $this->input->post('age'); $booking_adress = $this->input->post('booking_adress'); $family_type = $this->input->post('family_type'); $gender2 = $this->input->post('gender2'); $family_gender2 = $this->input->post('family_gender2'); $family_name2 = $this->input->post('family_name2'); $age2 = $this->input->post('age2'); $booking_adress2 = $this->input->post('booking_adress2'); $family_type2 = $this->input->post('family_type2'); $cust_name = $this->input->post('cust_name'); $adhar_no = $this->input->post('adhar_no'); $pan_no = $this->input->post('pan_no'); $table3 = 'mmg_bookings'; $condition3=array('site_number'=>$site_id,'delete_status' =>'ACTIVE'); $get_row3 =$this->MMG_model->get_where_row($table3,$condition3); if(!empty($get_row3)) { $layout_id = $get_row3->layout_id; $customer_id = $get_row3->customer_id; } $created_at = date('Y-m-d H:i:s'); $data = array('sale_price' =>$sale_price, 'advanced_amount' =>$advanced_amount, 'balance' =>$balance, 'saledeed_date' =>$saledeed_date, 'allotment_Date' =>$allotment_Date, 'created_by' =>$id, 'created_at' =>$created_at, 'site_id' =>$site_id, 'layout_id' =>$layout_id, 'customer_id' =>$customer_id, 'witness1' =>$witness1, 'witness2' =>$witness2, 'family_name' =>$family_name, 'gender' =>$gender, 'family_gender' =>$family_gender, 'age' =>$age, 'address' =>$booking_adress, 'family_type' =>$family_type, 'family_name2' =>$family_name2, 'gender2' =>$gender2, 'family_gender2' =>$family_gender2, 'age2' =>$age2, 'address2' =>$booking_adress2, 'family_type2' =>$family_type2, 'cust_name' =>$cust_name, 'adhar_no' =>$adhar_no, 'pan_no' =>$pan_no); $table2 = "mmg_bookings"; $where2 = array('site_number'=>$site_id,'delete_status' =>'ACTIVE'); $data2 = array('address'=>$booking_adress); $result = $this->MMG_model->update($where2,$table2,$data2); $table = 'mmg_sale_agreement_details'; $condition=array('customer_id'=>$customer_id,'layout_id'=>$layout_id,'site_id'=>$site_id,'delete_status' =>'ACTIVE'); $check_user=$this->MMG_model->get_where_row($table,$condition); if(empty($check_user)) { $result=$this->MMG_model->insert($data,$table); } else { $result=$this->MMG_model->update($condition,$table,$data); } if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_saledeed_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $location = $this->input->post('location'); $saledeed_date = $this->input->post('saledeed_date'); $saledeed_date = $this->input->post('saledeed_date'); $allotment_Date = $this->input->post('allotment_Date'); $amount = $this->input->post('amount'); $type = $this->input->post('type'); $number = $this->input->post('number'); $bank_date = $this->input->post('bank_date'); $bank_name = $this->input->post('bank_name'); $addres = $this->input->post('addres'); $site_id = $this->input->post('site_id'); $layout_id = $this->input->post('layout_id'); $customer_id = $this->input->post('customer_id'); $loan_arranged_by = $this->input->post('loan_arranged_by'); $witness1 = $this->input->post('witness1'); $witness2 = $this->input->post('witness2'); $gender = $this->input->post('gender'); $family_gender = $this->input->post('family_gender'); $family_name = $this->input->post('family_name'); $age = $this->input->post('age'); $booking_adress = $this->input->post('booking_adress'); $family_type = $this->input->post('family_type'); $gender2 = $this->input->post('gender2'); $family_gender2 = $this->input->post('family_gender2'); $family_name2 = $this->input->post('family_name2'); $age2 = $this->input->post('age2'); $booking_adress2 = $this->input->post('booking_adress2'); $family_type2 = $this->input->post('family_type2'); $cust_name = $this->input->post('cust_name'); $adhar_no = $this->input->post('adhar_no'); $pan_no = $this->input->post('pan_no'); $array=array(); foreach ($amount as $key => $value) { $data['amount'] = $value; $data['type'] = $type[$key]; $data['number'] = $number[$key]; $data['bank_date'] = $bank_date[$key]; $data['bank_name'] = $bank_name[$key]; $data['addres'] = $addres[$key]; $data['loan_arranged_by'] = $loan_arranged_by[$key]; array_push($array,$data); } $account_details = json_encode($array); $created_at = date('Y-m-d H:i:s'); $data = array('account_details' =>$account_details, 'saledeed_date' =>$saledeed_date, 'allotment_Date' =>$allotment_Date, 'created_by' =>$id, 'created_at' =>$created_at, 'site_id' =>$site_id, 'layout_id' =>$layout_id, 'customer_id' =>$customer_id, 'witness1' =>$witness1, 'witness2' =>$witness2, 'family_name' =>$family_name, 'gender' =>$gender, 'family_gender' =>$family_gender, 'age' =>$age, 'adress' =>$booking_adress, 'family_type' =>$family_type, 'family_name2' =>$family_name2, 'gender2' =>$gender2, 'family_gender2' =>$family_gender2, 'age2' =>$age2, 'address2' =>$booking_adress2, 'family_type2' =>$family_type2, 'cust_name' =>$cust_name, 'adhar_no' =>$adhar_no, 'pan_no' =>$pan_no); $table2 = "mmg_bookings"; $where2 = array('site_number'=>$site_id,'delete_status' =>'ACTIVE'); $data2 = array('address'=>$booking_adress); $result = $this->MMG_model->update($where2,$table2,$data2); $table = 'mmg_saledeed_details'; $condition=array('customer_id'=>$customer_id,'layout_id'=>$layout_id,'site_id'=>$site_id,'delete_status' =>'ACTIVE'); $check_user=$this->MMG_model->get_where_row($table,$condition); if(empty($check_user)) { $result=$this->MMG_model->insert($data,$table); } else { $result=$this->MMG_model->update($condition,$table,$data); } if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function approved_sale_agreement_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $site_id = $this->input->input_stream('site_id'); $status = $this->input->input_stream('status'); $table='mmg_sale_agreement_details'; $data=array('status'=>$status); $condition=array('site_id'=>$site_id); $result=$this->MMG_model->update($condition,$table,$data); if($result) { $message=['status'=>'Success','message'=>'Approved Successfully']; } else { $message=['status'=>'Fail','message'=>'Not Deleted']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_approved_loan_progress_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result = $this->MMG_model->get_approved_loan_progress_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_salary_slip_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id = $this->input->get('emp_id'); $months = $this->input->get('months'); $year = $this->input->get('year'); $result = $this->MMG_model->get_salary_slip($emp_id,$months,$year,$date); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } /* public function get_salary_slip_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $emp_id = $this->input->get('emp_id'); $months = $this->input->get('months'); $year = $this->input->get('year'); $result = $this->MMG_model->get_salary_slip($emp_id,$months,$year,$date); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } */ public function get_approved_plan_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $p_id = $this->input->get('p_id'); $table = 'mmg_layouts'; $where = array('land_owners'=>$p_id,'delete_status'=>'ACTIVE','layout_status'=>'PROCESSING'); $result = $this->MMG_model->get_where_row($table,$where); // $result = $this->MMG_model->get_salary_slip($emp_id,$months,$year,$date); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Approved plan not found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function sites_status_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $p_id = $this->input->get('p_id'); $result = $this->MMG_model->sites_status_list_get($p_id); // $result = $this->MMG_model->get_salary_slip($emp_id,$months,$year,$date); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'Approved plan not found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customer_facebook_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_facebook_leads'; $where=array(); $result = $this->MMG_model->customer_facebook(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'not found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customer_website_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table='mmg_website_customer'; $result = $this->MMG_model->customer_website(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'not found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function customer_99acres_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $url = "http://www.99acres.com/99api/v1/getmy99Response/OeAuXClO43hwseaXEQ/uid/"; $request = "<?xml version='1.0'?><query><user_name>MMGCONSTRUCTIONS99</user_name><pswd>mmgP@ssw0rd</pswd><start_date>2021-09-04 00:00:00</start_date><end_date>2021-09-06 00:00:00</end_date></query>"; $allParams = array('xml'=>$request); // function get99AcresLeads($allParams,$url){ $crl = curl_init($url); curl_setopt ($crl, CURLOPT_POST, 1); curl_setopt ($crl, CURLOPT_POSTFIELDS, $allParams); curl_setopt ($crl, CURLOPT_RETURNTRANSFER,1); $leads = curl_exec ($crl); // } print_r($leads); die(); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'not found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_website_customer_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $table = "mmg_website_customer"; $where = array('id'=>$customer_id); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_facebook_customer_name_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->get('customer_id'); $table = "mmg_facebook_leads"; $where = array('id'=>$customer_id); $result = $this->MMG_model->get_where_row($table,$where); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_customer_agreement_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $location = $this->input->post('location'); $saledeed_date = $this->input->post('saledeed_date'); $allotment_Date = $this->input->post('allotment_Date'); $sale_price = $this->input->post('sale_price'); $advanced_amount = $this->input->post('advanced_amount'); $balance = $this->input->post('balance'); $site_id = $this->input->post('site_id'); $loan_arranged_by = $this->input->post('loan_arranged_by'); $witness1 = $this->input->post('witness1'); $witness2 = $this->input->post('witness2'); $gender = $this->input->post('gender'); $family_gender = $this->input->post('family_gender'); $family_name = $this->input->post('family_name'); $age = $this->input->post('age'); $booking_adress = $this->input->post('booking_adress'); $family_type = $this->input->post('family_type'); $gender2 = $this->input->post('gender2'); $family_gender2 = $this->input->post('family_gender2'); $family_name2 = $this->input->post('family_name2'); $age2 = $this->input->post('age2'); $booking_adress2 = $this->input->post('booking_adress2'); $family_type2 = $this->input->post('family_type2'); $cust_name = $this->input->post('cust_name'); $adhar_no = $this->input->post('adhar_no'); $pan_no = $this->input->post('pan_no'); $table3 = 'mmg_bookings'; $condition3=array('site_number'=>$site_id,'delete_status' =>'ACTIVE'); $get_row3 =$this->MMG_model->get_where_row($table3,$condition3); if(!empty($get_row3)) { $layout_id = $get_row3->layout_id; $customer_id = $get_row3->customer_id; } $created_at = date('Y-m-d H:i:s'); $data = array('sale_price' =>$sale_price, 'advanced_amount' =>$advanced_amount, 'balance' =>$balance, 'saledeed_date' =>$saledeed_date, 'allotment_Date' =>$allotment_Date, 'created_by' =>$id, 'created_at' =>$created_at, 'site_id' =>$site_id, 'layout_id' =>$layout_id, 'customer_id' =>$customer_id, 'witness1' =>$witness1, 'witness2' =>$witness2, 'family_name' =>$family_name, 'gender' =>$gender, 'family_gender' =>$family_gender, 'age' =>$age, 'address' =>$booking_adress, 'family_type' =>$family_type, 'family_name2' =>$family_name2, 'gender2' =>$gender2, 'family_gender2' =>$family_gender2, 'age2' =>$age2, 'address2' =>$booking_adress2, 'family_type2' =>$family_type2, 'cust_name' =>$cust_name, 'adhar_no' =>$adhar_no, 'pan_no' =>$pan_no); $table2 = "mmg_bookings"; $where2 = array('site_number'=>$site_id,'delete_status' =>'ACTIVE'); $data2 = array('address'=>$booking_adress); $result = $this->MMG_model->update($where2,$table2,$data2); $table = 'mmg_customer_agreement_details'; $condition=array('customer_id'=>$customer_id,'layout_id'=>$layout_id,'site_id'=>$site_id,'delete_status' =>'ACTIVE'); $check_user=$this->MMG_model->get_where_row($table,$condition); if(empty($check_user)) { $result=$this->MMG_model->insert($data,$table); } else { $result=$this->MMG_model->update($condition,$table,$data); } if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_customer_sale_agreement_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result = $this->MMG_model->get_customer_sale_agreement_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_bank_sale_agreement_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result = $this->MMG_model->get_bank_sale_agreement_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function add_bank_agreement_details_post() { $date =$this->input->post('date'); $signature =$this->input->post('signature'); $pubKey =$this->input->post('pubKey'); $hmacsecurity =$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id = $this->input->post('id'); $location = $this->input->post('location'); $saledeed_date = $this->input->post('saledeed_date'); $allotment_Date = $this->input->post('allotment_Date'); $sale_price = $this->input->post('sale_price'); $advanced_amount = $this->input->post('advanced_amount'); $balance = $this->input->post('balance'); $site_id = $this->input->post('site_id'); $loan_arranged_by = $this->input->post('loan_arranged_by'); $witness1 = $this->input->post('witness1'); $witness2 = $this->input->post('witness2'); $gender = $this->input->post('gender'); $family_gender = $this->input->post('family_gender'); $family_name = $this->input->post('family_name'); $age = $this->input->post('age'); $booking_adress = $this->input->post('booking_adress'); $family_type = $this->input->post('family_type'); $gender2 = $this->input->post('gender2'); $family_gender2 = $this->input->post('family_gender2'); $family_name2 = $this->input->post('family_name2'); $age2 = $this->input->post('age2'); $booking_adress2 = $this->input->post('booking_adress2'); $family_type2 = $this->input->post('family_type2'); $cust_name = $this->input->post('cust_name'); $adhar_no = $this->input->post('adhar_no'); $pan_no = $this->input->post('pan_no'); $table3 = 'mmg_bookings'; $condition3=array('site_number'=>$site_id,'delete_status' =>'ACTIVE'); $get_row3 =$this->MMG_model->get_where_row($table3,$condition3); if(!empty($get_row3)) { $layout_id = $get_row3->layout_id; $customer_id = $get_row3->customer_id; } $created_at = date('Y-m-d H:i:s'); $data = array('sale_price' =>$sale_price, 'advanced_amount' =>$advanced_amount, 'balance' =>$balance, 'saledeed_date' =>$saledeed_date, 'allotment_Date' =>$allotment_Date, 'created_by' =>$id, 'created_at' =>$created_at, 'site_id' =>$site_id, 'layout_id' =>$layout_id, 'customer_id' =>$customer_id, 'witness1' =>$witness1, 'witness2' =>$witness2, 'family_name' =>$family_name, 'gender' =>$gender, 'family_gender' =>$family_gender, 'age' =>$age, 'address' =>$booking_adress, 'family_type' =>$family_type, 'family_name2' =>$family_name2, 'gender2' =>$gender2, 'family_gender2' =>$family_gender2, 'age2' =>$age2, 'address2' =>$booking_adress2, 'family_type2' =>$family_type2, 'cust_name' =>$cust_name, 'adhar_no' =>$adhar_no, 'pan_no' =>$pan_no); $table2 = "mmg_bookings"; $where2 = array('site_number'=>$site_id,'delete_status' =>'ACTIVE'); $data2 = array('address'=>$booking_adress); $result = $this->MMG_model->update($where2,$table2,$data2); $table = 'mmg_bank_agreement_details'; $condition=array('customer_id'=>$customer_id,'layout_id'=>$layout_id,'site_id'=>$site_id,'delete_status' =>'ACTIVE'); $check_user=$this->MMG_model->get_where_row($table,$condition); if(empty($check_user)) { $result=$this->MMG_model->insert($data,$table); } else { $result=$this->MMG_model->update($condition,$table,$data); } if($result) { $message=['status'=>'Success','message'=>'Added successfully','result'=>$result]; } else { $message=['status'=>'Fail','message'=>'Something went wrong.. try again']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_approved_customer_sale_agreement_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result = $this->MMG_model->get_approved_customer_sale_agreement_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function get_approved_bank_sale_agreement_list_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $id=$this->input->get('id'); $result = $this->MMG_model->get_approved_bank_sale_agreement_list($id); if($result) { $message = ['status'=>'Success','message'=>$result]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } public function insert_duplicate_customer_put() { $date=$this->input->input_stream('date'); $signature=$this->input->input_stream('signature'); $pubKey=$this->input->input_stream('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $customer_id = $this->input->input_stream('customer_id'); $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','id'=>$customer_id); $res=$this->MMG_model->get_where_row($table,$where); $data = array('name' =>$res->name, 'phone' =>$res->phone, 'alt_phone' =>$res->alt_phone, 'email' =>$res->email, 'remarks' =>$res->remarks, 'otp' =>$res->otp, 'password' =>$res->password, 'enquiry_status' =>1, 'site_visiting_status' =>1, 'created_by' =>$res->created_by, 'created_on' =>$res->created_on, 'department_id' =>$res->department_id, 'ref_layout_id' =>$res->ref_layout_id, 'ref_site_number' =>$res->ref_site_number, 'ref_person' =>$res->ref_person, 'nri_no' =>$res->nri_no, 'ref_type' =>$res->ref_type, 'enquiry_date' =>$res->enquiry_date, 'enquiry_layout' =>$res->enquiry_layout); $table1 = "mmg_duplicate_customer"; $result=$this->MMG_model->insert($data,$table1); if($result) { $table = "mmg_customer"; $where = array('id'=>$customer_id); $result = $this->MMG_model->delete_data($table,$where); $message=['status'=>'Success','result'=>$result,'message'=>'Updated Successfully']; } else { $message=['status'=>'Fail','message'=>'No changes to Update']; } } else { $message=['status'=>'Fail','message'=> 'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); } /* public function insertdata_get() { $date=$this->input->get('date'); $signature=$this->input->get('signature'); $pubKey=$this->input->get('pubKey'); $hmacsecurity=$this->Hmac_model->hmac_rest_authentication($date,$signature,$pubKey); if($hmacsecurity=='success') { $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','progress'=>'Reject'); $result=$this->MMG_model->get_where_result($table,$where); $table1= 'mmg_reject_followup'; foreach ($result as $value) { $data=array('site_id'=>$value->site_id,'layout_id'=>$value->layout_id,'created_by'=>$value->created_by,'customer_id'=>$value->customer_id,'follow_date'=>$value->follow_date,'description'=>$value->description,'progress'=>$value->progress,'employee_assigned'=>$value->employee_assigned,'depart_assigned'=>$value->depart_assigned,'created_at'=>$value->created_at,'created_by'=>$value->created_by,'created_time'=>$value->created_time,'delete_status'=>'ACTIVE'); $result2 = $this->MMG_model->insert($data,$table1); } $table = 'mmg_customer'; $where = array('delete_status'=>'ACTIVE','duplicate_cust'=>'Duplicate'); $result=$this->MMG_model->get_where_result($table,$where); foreach ($result as $res) { $data = array('name' =>$res->name, 'phone' =>$res->phone, 'alt_phone' =>$res->alt_phone, 'email' =>$res->email, 'remarks' =>$res->remarks, 'otp' =>$res->otp, 'password' =>$res->password, 'enquiry_status' =>1, 'site_visiting_status' =>1, 'created_by' =>$res->created_by, 'created_on' =>$res->created_on, 'department_id' =>$res->department_id, 'ref_layout_id' =>$res->ref_layout_id, 'ref_site_number' =>$res->ref_site_number, 'ref_person' =>$res->ref_person, 'nri_no' =>$res->nri_no, 'ref_type' =>$res->ref_type, 'enquiry_date' =>$res->enquiry_date, 'enquiry_layout' =>$res->enquiry_layout); $table1 = "mmg_duplicate_customer"; $result=$this->MMG_model->insert($data,$table1); $table = "mmg_customer"; $where = array('id'=>$res->id,'delete_status'=>'ACTIVE','duplicate_cust'=>'Duplicate'); $result2 = $this->MMG_model->delete_data($table,$where); } if($result2) { $message = ['status'=>'Success','message'=>$result2]; } else { $message = ['status'=>'Fail','message'=>'No data found']; } } else { $message=['status'=>'Fail','message'=>'Unauthorised url']; } $this->set_response($message, REST_Controller::HTTP_OK); }*/ } ?>