EVOLUTION-NINJA
Edit File: Yaskawa.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class yaskawa extends CI_Controller{ //index view public function index() { $this->load->view('admin/login'); } //Login page public function admin_login() { $this->load->view('admin/login'); } //Admin login public function login() { $email = $this->input->post('email'); $password = md5($this->input->post('password')); $pass_word = $this->input->post('password'); $remember = $this->input->post('remember'); $result = $this->yaskawa_model->admin_login($email,$password); if($result) { if($result->user_type_id == '1') { $this->session->set_userdata('admin',$result->user_name); $this->session->set_userdata('admin_id',$result->user_id); $this->session->set_userdata('user_type',$result->user_type_name); $this->session->set_userdata('user_type_id',$result->user_type_id); $this->session->set_userdata('role_id',$result->role_id); echo json_encode(array( 'result' => 1, 'user_type' => $this->session->userdata('user_type'), 'user_name' => $this->session->userdata('admin'), 'admin_id' => $this->session->userdata('admin_id'), 'user_type_id' => $this->session->userdata('user_type_id'), 'role_id' => $this->session->userdata('role_id'), )); if($remember==1) { $this->load->helper('cookie'); set_cookie("password", $pass_word, time()+86500); set_cookie("email", $email, time()+86500); set_cookie("remember", $remember, time()+86500); } } else if($result->user_type_id == '2') { $this->session->set_userdata('user',$result->user_name); $this->session->set_userdata('user_name',$result->user_name); $this->session->set_userdata('admin_id',$result->user_id); $this->session->set_userdata('user_type',$result->user_type_name); $this->session->set_userdata('role_id',$result->role_id); echo json_encode(array( 'result' => 1, 'user_type' => $this->session->userdata('user_type'), 'user_name' => $this->session->userdata('user_name'), 'admin_id' => $this->session->userdata('user_id'), 'role_id' => $this->session->userdata('role_id'), )); if($remember==1) { $this->load->helper('cookie'); set_cookie("password", $password, time()+86500); set_cookie("email", $email, time()+86500); set_cookie("remember", $remember, time()+86500); } } else { echo json_encode(array('result'=>0,'message'=>"Wrong login credentials")); } } else { echo json_encode(array('result'=>0,'message'=>"Wrong login credentials")); } } //Logout public function logout() { $this->session->sess_destroy(); redirect('/admin-login'); } //Admin dashboard public function admin_dashboard() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/index',$data); } else { redirect('/'); } } //add_new_leads view public function new_lead() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['source_details']=$this->yaskawa_model->get_lead_source_details(); $data['status_details']=$this->yaskawa_model->get_lead_status_details(); $data['lead_ratings']=$this->yaskawa_model->get_lead_ratings_details(); $data['honorific']=$this->yaskawa_model->get_honorific(); $data['customer_type']=$this->yaskawa_model->get_customer_type(); $data['lead_process']=$this->yaskawa_model->get_lead_process(); $data['industry_details']=$this->yaskawa_model->get_lead_industry_details(); $this->load->view('admin/add_new_leads',$data); } else { redirect('/'); } } //add_new_leads view public function lead_list() { $lead_ids=$this->input->post('lead_ids'); $this->yaskawa_model->deleteleads($lead_ids); $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['lead_list'] = $this->yaskawa_model->get_all_leads($role_id); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/new_lead_list',$result); } else { redirect('/'); } } //add_new_leads view // public function add_new_leads() // { // $admin_id = $this->session->userdata('admin_id'); // if($admin_id) // { // $data['user_type_id'] = $this->access_id(); // $data['access'] = $this->access_details(); // $data['company_details']=$this->yaskawa_model->fetch_company_details(); // $this->load->view('admin/add_new_lead',$data); // } // else // { // redirect('/'); // } // } //lead_module view public function lead_module() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_module',$data); } else { redirect('/'); } } //list_lead_module view public function list_lead_module() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/list_lead_module',$data); } else { redirect('/'); } } //add_employees view public function add_employees() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['dept_list'] = $this->yaskawa_model->get_all_departments(); $data['e_id']=$this->yaskawa_model->get_emp_id(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/add_new_employee',$data); } else { redirect('/'); } } //add_department view public function add_department() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['dept_list'] = $this->yaskawa_model->get_all_departments(); $result['emp_list'] =$this->yaskawa_model->employee_list(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/add_department',$result); } else { redirect('/'); } } //add_new_leads view public function add_designation() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['desig_list'] = $this->yaskawa_model->get_all_designation(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/add_designation',$result); } else { redirect('/'); } } //lead_feeds view public function lead_contact() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_contact',$data); } else { redirect('/'); } } //lead_feeds view public function calender() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/calender',$data); } else { redirect('/'); } } //all_reports view public function all_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="report_menu"; $where=array('report_status'=>'ACTIVE','delete_status'=>'ACTIVE'); $data['contents']=$this->yaskawa_model->get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/all_reports',$data); } else { redirect('/'); } } //recent_reports view public function recent_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/recent_reports',$data); } else { redirect('/'); } } //recent_reports_me view public function recent_reports_me() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/recent_reports_me',$data); } else { redirect('/'); } } //shared_reports view public function shared_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/shared_reports',$data); } else { redirect('/'); } } //potential_reports view public function potential_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="report_menu"; $where=array('report_status'=>'ACTIVE','type'=>'Potential Reports'); $data['contents']=$this->yaskawa_model->get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_reports',$data); } else { redirect('/'); } } //lead_reports view public function lead_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="report_menu"; $where=array('report_status'=>'ACTIVE','type'=>'Lead Reports'); $data['contents']=$this->yaskawa_model->get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_reports',$data); } else { redirect('/'); } } //activity_reports view public function activity_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="report_menu"; $where=array('report_status'=>'ACTIVE','type'=>'Activity Reports'); $data['contents']=$this->yaskawa_model->get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/activity_reports',$data); } else { redirect('/'); } } //sales_matrics_reports view public function sales_matrics_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="report_menu"; $where=array('report_status'=>'ACTIVE','type'=>'Sales Metrics Reports'); $data['contents']=$this->yaskawa_model->get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_matrics_report',$data); } else { redirect('/'); } } //recently_deleted_reports view public function recently_deleted_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="report_menu"; $where=array('report_status'=>'ACTIVE','delete_status'=>'DEACTIVE'); $data['content']=$this->yaskawa_model->get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/recently_deleted_reports',$data); } else { redirect('/'); } } //recently_deleted_reports view public function potential_performance_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_performance_reports',$data); } else { redirect('/'); } } //recently_deleted_reports view public function potential_lead_source() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_lead_source',$data); } else { redirect('/'); } } //recently_deleted_reports view public function potential_sales_this_month() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_sales_this_month',$data); } else { redirect('/'); } } //recently_deleted_reports view public function potential_todays_sales() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_todays_sales',$data); } else { redirect('/'); } } //recently_deleted_reports view public function lead_industry_list() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_industry_list',$data); } else { redirect('/'); } } //recently_deleted_reports view public function lead_ownership_list() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_ownership_list',$data); } else { redirect('/'); } } //recently_deleted_reports view public function lead_converted_list() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_converted_list',$data); } else { redirect('/'); } } //recently_deleted_reports view public function lead_todays_list() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_todays_list',$data); } else { redirect('/'); } } //recently_deleted_reports view public function lead_status_list() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_status_list',$data); } else { redirect('/'); } } //recently_deleted_reports view public function lead_source_list() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_source_list',$data); } else { redirect('/'); } } //recently_deleted_reports view public function activity_task_event_list() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/activity_task_event_list',$data); } else { redirect('/'); } } //recently_deleted_reports view public function sales_across_owners() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_across_owners',$data); } else { redirect('/'); } } //recently_deleted_reports view public function sales_count_across_owners() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_count_across_owners',$data); } else { redirect('/'); } } //recently_deleted_reports view public function sales_across_industry() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_across_industry',$data); } else { redirect('/'); } } //recently_deleted_reports view public function sales_across_source() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_across_source',$data); } else { redirect('/'); } } //Sachin-part public function auto() { $keyword=$this->input->get('term'); $key=substr($keyword,1); $data1=$this->yaskawa_model->Get_search($key); //print_r($data1); foreach($data1 as $row) { $data[]=$row->lead_owner; } echo json_encode($data); } //lead_feeds view public function lead_feeds() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['comment']=$this->yaskawa_model->get_all_comments(); // print_r($result['comment']); // die(); $result['udata']=$this->yaskawa_model->get_all_users(); $result['send_data']=$this->yaskawa_model->feed_data($admin_id); $result['login_person_data']=$this->yaskawa_model->login_person($admin_id); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_feeds',$result); } else { redirect('/'); } } public function admin_functions() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $user_data['user_type_id'] = $this->access_id(); $user_data['access'] = $this->access_details(); $user_data['users']=$this->yaskawa_model->number_of_users(); $user_data['company_details']=$this->yaskawa_model->fetch_company_details(); $user_data['login_person_data']=$this->yaskawa_model->login_person($admin_id); $user_data['roles_list_admin'] = $this->yaskawa_model->get_all_roles_admin(); $this->load->view('admin/admin_user',$user_data); } else { redirect('/'); } } public function insert_feeds() { $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $send_at = $date->format('Y-m-d H:i:s'); $date = $date->format('Y-m-d'); $sender_id = $this->session->userdata('admin_id'); $user_id = $this->input->post('user_id'); $message = $this->input->post('text'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['upload']['name'])) { $file_name = ""; } else { $target='document_uploads/'; $target.=time().$_FILES['upload']['name']; $file_name=time().$_FILES['upload']['name']; $image=$target; move_uploaded_file($_FILES['upload']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $feeds_details=array( 'sender_id' => $sender_id, 'receiver_id' => $user_id, 'message' => $message, 'send_date_time' => $send_at, 'document_name' => $file_name, 'date' => $date, 'delete_status' =>'ACTIVE' ); $result=$this->yaskawa_model->feed_insert($feeds_details); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } //sachin part public function feeds_data_filter(){ $days=$this->input->post('days'); $dt = new DateTime(); if($days=="today"){ $days=$dt->format('Y-m-d'); $result=$this->yaskawa_model->feeds_records($days); $ar=array(); foreach ($result as $key => $value) { $data['user_name'] = $value->sender_name; $data['comment'] = $value->message; $data['admin_pic'] = $value->admin_pic; $data['document_name'] = $value->document_name; $data['receiver_name'] = $value->receiver_name; $data['send_date_time'] = $value->send_date_time; $where=$value->feeds_id; //echo $where; $table="feeds_comment"; $data['subcomment']=$this->yaskawa_model->feeds_records1($where,$table); array_push($ar,$data); } if($ar){ echo json_encode(array('date_result'=>$ar,'result'=>1)); } else { echo json_encode(array('date_result'=>$result,'result'=>0)); } }else if($days=="yesterday"){ $days=date("Y-m-d", strtotime("-1 day")); $result=$this->yaskawa_model->feeds_records($days); $ar=array(); foreach ($result as $key => $value) { $data['user_name']=$value->sender_name; $data['comment']=$value->message; $data['admin_pic']=$value->admin_pic; $data['document_name']=$value->document_name; $data['receiver_name']=$value->receiver_name; $data['send_date_time']=$value->send_date_time; $where=$value->feeds_id; //echo $where; $table="feeds_comment"; $data['subcomment']=$this->yaskawa_model->feeds_records1($where,$table); array_push($ar,$data); } if($ar){ echo json_encode(array('date_result'=>$ar,'result'=>1)); } else { echo json_encode(array('date_result'=>$result,'result'=>0)); } }else if($days=="lastweek"){ $date= new DateTime('now', new DateTimeZone('Asia/Kolkata')); $result=$this->yaskawa_model->feeds_lastweek__records(); $ar1=array(); foreach ($result as $key => $value) { $data['user_name']=$value->sender_name; $data['comment']=$value->message; $data['admin_pic']=$value->admin_pic; $data['document_name']=$value->document_name; $data['receiver_name']=$value->receiver_name; $data['send_date_time']=$value->send_date_time; $where=$value->feeds_id; //echo $where; $table="feeds_comment"; $data['subcomment']=$this->yaskawa_model->feeds_lastweek__records1($where,$table); array_push($ar1,$data); } if($ar1){ echo json_encode(array('date_result'=>$ar1,'result'=>1)); } else { echo json_encode(array('date_result'=>$result,'result'=>0)); } }else if($days=="current-month"){ $date= new DateTime('now', new DateTimeZone('Asia/Kolkata')); $current_month = $date->format('m'); $result=$this->yaskawa_model->currentmonth_feeds_records($current_month); $ar2=array(); foreach ($result as $key => $value) { $data['user_name']=$value->sender_name; $data['comment']=$value->message; $data['admin_pic']=$value->admin_pic; $data['document_name']=$value->document_name; $data['receiver_name']=$value->receiver_name; $data['send_date_time']=$value->send_date_time; $where=$value->feeds_id; //echo $where; $table="feeds_comment"; $data['subcomment']=$this->yaskawa_model->currentmonth_feeds_records1($where,$table,$current_month); array_push($ar2,$data); } if($ar2){ echo json_encode(array('date_result'=>$ar2,'result'=>1)); } else { echo json_encode(array('date_result'=>$result,'result'=>0)); } }else if($days=="lastmonth"){ $date= new DateTime('now', new DateTimeZone('Asia/Kolkata')); $date = $date->format("Y-m-d"); $lastmonth=date("m", strtotime("-1 MONTH")); $result=$this->yaskawa_model->feeds_lastmonth__records($lastmonth); $ar3=array(); foreach ($result as $key => $value) { $data['user_name']=$value->sender_name; $data['comment']=$value->message; $data['admin_pic']=$value->admin_pic; $data['document_name']=$value->document_name; $data['receiver_name']=$value->receiver_name; $data['send_date_time']=$value->send_date_time; $where=$value->feeds_id; //echo $where; $table="feeds_comment"; $data['subcomment']=$this->yaskawa_model->currentmonth_feeds_records1($where,$table,$lastmonth); array_push($ar3,$data); } if($ar3){ echo json_encode(array('date_result'=>$ar3,'result'=>1)); } else { echo json_encode(array('date_result'=>$result,'result'=>0)); } } } //Add New Leads public function add_new_lead() { $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); $lead_owner = $this->input->post('lead_owner'); $company_name = $this->input->post('company_name'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $lead_title = $this->input->post('lead_title'); $email = $this->input->post('email'); $phone = $this->input->post('phone'); $fax = $this->input->post('fax'); $mobile = $this->input->post('mobile'); $website = $this->input->post('website'); $lead_source = $this->input->post('lead_source'); $industry = $this->input->post('industry'); $no_of_employees = $this->input->post('no_of_employees'); $annual_revenue = $this->input->post('annual_revenue'); $ratings = $this->input->post('ratings'); $email_otp = $this->input->post('email_otp'); $skype_id = $this->input->post('skype_id'); $sec_email = $this->input->post('sec_email'); $twitter = $this->input->post('twitter'); $street = $this->input->post('street'); $city = $this->input->post('city'); $state = $this->input->post('state'); $zip_code = $this->input->post('zip_code'); $country = $this->input->post('country'); $Cperson = $this->input->post('Cperson'); $Cphone = $this->input->post('Cphone'); $cType = $this->input->post('cType'); $lprocess = $this->input->post('lprocess'); $description = $this->input->post('description'); $lead_status = $this->input->post('lead_status'); $this->load->library('image_lib'); $file_name = ""; $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $lead_details = array( 'user_id' => $admin_id, 'role_id' => $role_id, 'lead_owner' => $lead_owner, 'company_name' => $company_name, 'first_name' => $first_name, 'last_name' => $last_name, 'lead_title' => $lead_title, 'email' => $email, 'phone' => $phone, 'website' => $website, 'fax' => $fax, 'mobile' => $mobile, 'lead_source' => $lead_source, 'lead_status' => $lead_status, 'industry' => $industry, 'no_of_employees' => $no_of_employees, 'annual_revenue' => $annual_revenue, 'ratings' => $ratings, 'email_otp' => $email_otp, 'skype_id' => $skype_id, 'sec_email' => $sec_email, 'twitter' => $twitter, 'street' => $street, 'city' => $city, 'state' => $state, 'zip_code' => $zip_code, 'country' => $country, 'Cperson' => $Cperson, 'Cphone' => $Cphone, 'cType' => $cType, 'lprocess' => $lprocess, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->add_leads($lead_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Lead added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //lead list public function leads_list() { $result = $this->yaskawa_model->get_all_leads(); $menu = $this->yaskawa_model->get_menu(); // print_r($menu); // die(); if($result) { echo json_encode(array('menu'=>$menu,'leads_list'=>$result,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } //Delete lead public function delete_lead() { $lead_id = $this->input->post('lead_id'); $data = array('delete_status'=>'INACTIVE'); $result = $this->yaskawa_model->delete_lead($lead_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } //Edit lead public function edit_lead() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['lead_details'] = $this->yaskawa_model->edit_lead_details($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/edit_content_form',$data); } else { redirect('/'); } } //Update lead public function update_lead() { $lead_id = $this->input->post('lead_id'); $lead_owner = $this->input->post('lead_owner'); $company_name = $this->input->post('company_name'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $lead_title = $this->input->post('lead_title'); $email = $this->input->post('email'); $phone = $this->input->post('phone'); $fax = $this->input->post('fax'); $mobile = $this->input->post('mobile'); $website = $this->input->post('website'); $lead_source = $this->input->post('lead_source'); $industry = $this->input->post('industry'); $no_of_employees = $this->input->post('no_of_employees'); $annual_revenue = $this->input->post('annual_revenue'); $ratings = $this->input->post('ratings'); $email_otp = $this->input->post('email_otp'); $skype_id = $this->input->post('skype_id'); $sec_email = $this->input->post('sec_email'); $twitter = $this->input->post('twitter'); $street = $this->input->post('street'); $city = $this->input->post('city'); $state = $this->input->post('state'); $zip_code = $this->input->post('zip_code'); $country = $this->input->post('country'); $description = $this->input->post('description'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updated_at = $date->format('Y-m-d H:i:s'); $lead_details = array( 'lead_owner' => $lead_owner, 'company_name' => $company_name, 'first_name' => $first_name, 'last_name' => $last_name, 'lead_title' => $lead_title, 'email' => $email, 'phone' => $phone, 'website' => $website, 'fax' => $fax, 'mobile' => $mobile, 'lead_source' => $lead_source, 'industry' => $industry, 'no_of_employees' => $no_of_employees, 'annual_revenue' => $annual_revenue, 'ratings' => $ratings, 'email_otp' => $email_otp, 'skype_id' => $skype_id, 'sec_email' => $sec_email, 'twitter' => $twitter, 'street' => $street, 'city' => $city, 'state' => $state, 'zip_code' => $zip_code, 'country' => $country, 'description' => $description, 'delete_status' => 'ACTIVE', 'updated_at' => $updated_at ); $result = $this->yaskawa_model->update_lead($lead_id,$lead_details); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>"Updated successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } } //Add New Employee public function add_new_employees() { $employee_id = $this->input->post('employee_id'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $email_id = $this->input->post('email_id'); $nick_name = $this->input->post('nick_name'); $department = $this->input->post('department'); $reporting_to = $this->input->post('reporting_to'); $source_of_hire = $this->input->post('source_of_hire'); $location = $this->input->post('location'); $title = $this->input->post('title'); $date_of_joining = $this->input->post('date_of_joining'); $seating_location = $this->input->post('seating_location'); $work_phone = $this->input->post('work_phone'); $extension = $this->input->post('extension'); $employee_status = $this->input->post('employee_status'); $employee_type = $this->input->post('employee_type'); $employee_role = $this->input->post('employee_role'); $pan_no = $this->input->post('pan_no'); $date_of_birth = $this->input->post('date_of_birth'); $address = $this->input->post('address'); $residential_address = $this->input->post('residential_address'); $marital_status = $this->input->post('marital_status'); $job_description = $this->input->post('job_description'); $about_me = $this->input->post('about_me'); $date_of_exit = $this->input->post('date_of_exit'); $gender = $this->input->post('gender'); $pre_com_name = $this->input->post('pre_com_name'); $job_title = $this->input->post('job_title'); $from_date = $this->input->post('from_date'); $to_date = $this->input->post('to_date'); $work_job_description = $this->input->post('work_job_description'); $school_name = $this->input->post('school_name'); $diplamo_degree = $this->input->post('diplamo_degree'); $field_of_study = $this->input->post('field_of_study'); $date_of_completion = $this->input->post('date_of_completion'); $additional_notes = $this->input->post('additional_notes'); $interests = $this->input->post('interests'); $dependent_name = $this->input->post('dependent_name'); $dependent_relationship = $this->input->post('dependent_relationship'); $dependent_dob = $this->input->post('dependent_dob'); $pre_company = serialize($pre_com_name); $job_tit = serialize($job_title); $fromdate = serialize($from_date); $todate = serialize($to_date); $work_job_desc = serialize($work_job_description); $schoolname = serialize($school_name); $diplamodegree = serialize($diplamo_degree); $fieldofstudy = serialize($field_of_study); $dateofcompletion = serialize($date_of_completion); $additionalnotes = serialize($additional_notes); $interest = serialize($interests); $dependentname = serialize($dependent_name); $dependentrelationship = serialize($dependent_relationship); $dependentdob = serialize($dependent_dob); $this->load->library('image_lib'); $file_name = ""; $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $employee_details = array( 'employee_id' => $employee_id, 'first_name' => $first_name, 'last_name' => $last_name, 'email_id' => $email_id, 'nick_name' => $nick_name, 'department' => $department, 'reporting_to' => $reporting_to, 'source_of_hire' => $source_of_hire, 'location' => $location, 'title' => $title, 'date_of_joining' => $date_of_joining, 'seating_location' => $seating_location, 'work_phone' => $work_phone, 'extension' => $extension, 'employee_status' => $employee_status, 'employee_type' => $employee_type, 'employee_role' => $employee_role, 'pan_no' => $pan_no, 'date_of_birth' => $date_of_birth, 'address' => $address, 'residential_address' => $residential_address, 'marital_status' => $marital_status, 'job_description' => $job_description, 'about_me' => $about_me, 'date_of_exit' => $date_of_exit, 'gender' => $gender, 'pre_company_name' => $pre_company, 'job_title' => $job_tit, 'from_date' => $fromdate, 'to_date' => $todate, 'work_job_description' => $work_job_desc, 'school_name' => $schoolname, 'diplamo_degree' => $diplamodegree, 'field_of_study' => $fieldofstudy, 'date_of_completion' => $dateofcompletion, 'additional_notes' => $additionalnotes, 'interests' => $interest, 'dependent_name' => $dependentname, 'dependent_relationship' => $dependentrelationship, 'dependent_dob' => $dependentdob, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->add_employee($employee_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Employee added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //employee list public function employee_list() { $result = $this->yaskawa_model->get_all_employees(); if($result) { echo json_encode(array('employee_list'=>$result,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } //Add New department public function add_new_department() { $department_name = $this->input->post('department_name'); $email_id = $this->input->post('email_id'); $department_lead = $this->input->post('department_lead'); $parent_department = $this->input->post('parent_department'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $department_details = array( 'department_name' => $department_name, 'email_id' => $email_id, 'department_lead' => $department_lead, 'parent_department' => $parent_department, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->add_department($department_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Department added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //department list public function department_list() { $result = $this->yaskawa_model->get_all_departments(); if($result) { echo json_encode(array('department_list'=>$result,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } //Delete department public function delete_department() { $department_id = $this->input->post('department_id'); $data = array('delete_status'=>'INACTIVE'); $result = $this->yaskawa_model->delete_department($department_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } //Edit department public function edit_department() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $department_id = $this->uri->segment(2); $data['emp_details'] = $this->yaskawa_model->edit_department_details($department_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/edit_content_form',$data); } else { redirect('/'); } } //update department public function update_department() { $department_id = $this->input->post('department_id'); $department_name = $this->input->post('department_name'); $email_id = $this->input->post('email_id'); $department_lead = $this->input->post('department_lead'); $parent_department = $this->input->post('parent_department'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updated_at = $date->format('Y-m-d H:i:s'); $department_details = array( 'department_name' => $department_name, 'email_id' => $email_id, 'department_lead' => $department_lead, 'parent_department' => $parent_department, 'delete_status' => 'ACTIVE', 'updated_at' => $updated_at ); $result = $this->yaskawa_model->update_department($department_id,$department_details); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>"Updated successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } } //Add New designation public function add_new_designation() { $designation_name = $this->input->post('designation_name'); $email_id = $this->input->post('email_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $designation_details = array( 'designation_name' => $designation_name, 'email_id' => $email_id, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->add_designation($designation_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Designation added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //designation list public function designation_list() { $result = $this->yaskawa_model->get_all_designation(); if($result) { echo json_encode(array('designation_list'=>$result,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } //Delete department public function delete_designation() { $designation_id = $this->input->post('designation_id'); $data = array('delete_status'=>'INACTIVE'); $result = $this->yaskawa_model->delete_designation($designation_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } //Edit designation public function edit_designation() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $designation_id = $this->uri->segment(2); $data['des_details'] = $this->yaskawa_model->edit_designation_details($designation_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/edit_content_form',$data); } else { redirect('/'); } } //update department public function update_designation() { $designation_name = $this->input->post('designation_name'); $email_id = $this->input->post('email_id'); $designation_id = $this->input->post('designation_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updated_at = $date->format('Y-m-d H:i:s'); $designation_details = array( 'designation_name' => $designation_name, 'email_id' => $email_id, 'delete_status' => 'ACTIVE', 'updated_at' => $updated_at ); $result = $this->yaskawa_model->update_designation($designation_id,$designation_details); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>"Updated successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } } //menu_list public function menu_list() { $result = $this->yaskawa_model->get_all_menu(); if($result) { echo json_encode(array('menu_list'=>$result,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } //menu_details public function menu_details() { $menu_id = $this->input->post('id'); $alt_name = $this->input->post('alt_name'); $menu_status = array('status'=>'1'); $result = $this->yaskawa_model->update_menu_status($menu_id,$menu_status); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } //single_lead_view public function single_lead_view() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['user_details']=$this->yaskawa_model->get_user_details(); //$data['lead_details1'] = $this->yaskawa_model->leads_track_owners(); $data['customer_type']=$this->yaskawa_model->get_customer_type(); $data['single_details'] = $this->yaskawa_model->single_lead_details($lead_id); $data['pic_details'] = $this->yaskawa_model->get_pic_details($lead_id); $data['lead_details'] = $this->yaskawa_model->get_event_call_details($lead_id); $data['closed_details'] = $this->yaskawa_model->get_event_closed_details($lead_id); $data['notes_details'] = $this->yaskawa_model->get_notes_details($lead_id); $data['attachment_details'] = $this->yaskawa_model->get_attachment_details($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_information',$data); } else { redirect('/'); } } //lead_information view public function closed_activity() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $task_id = $this->uri->segment(2); $dat=array('delete_status'=>'Closed'); $this->yaskawa_model->update_status($task_id,$dat); $det=$this->yaskawa_model->get_row($task_id); $lead_id=$det->lead_id; $data['user_details']=$this->yaskawa_model->get_user_details(); $data['customer_type']=$this->yaskawa_model->get_customer_type(); $data['single_details'] = $this->yaskawa_model->single_lead_details($lead_id); $data['pic_details'] = $this->yaskawa_model->get_pic_details($lead_id); $data['lead_details'] = $this->yaskawa_model->get_event_call_details($lead_id); $data['closed_details'] = $this->yaskawa_model->get_event_closed_details($lead_id); $data['notes_details'] = $this->yaskawa_model->get_notes_details($lead_id); $data['attachment_details'] = $this->yaskawa_model->get_attachment_details($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); // print_r($data['attachment_details']); // die(); $this->load->view('admin/lead_information',$data); } else { redirect('/'); } } public function account_info() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $id = $this->uri->segment(2); $data['user_name']= $this->session->userdata('user_name'); $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['single_details'] = $this->yaskawa_model->single_lead_details($id); $data['account_details'] = $this->yaskawa_model->single_account_details($id); $data['quotation_details'] = $this->yaskawa_model->get_quotation_details($id); $data['converted_status'] = $this->yaskawa_model->get_converted_status($id); $data['notes_details'] = $this->yaskawa_model->get_account_notes_details($id); $data['task_details'] = $this->yaskawa_model->get_account_task_details($id); $data['closed_details'] = $this->yaskawa_model->get_acc_closed_details($id); $data['lead_ratings'] = $this->yaskawa_model->get_lead_ratings_details(); $data['contact_data']=$this->yaskawa_model->contact_list(); $data['potential_data']=$this->yaskawa_model->select_new_potential(); $data['account_type'] = $this->yaskawa_model->get_account_type(); $data['industry_details'] = $this->yaskawa_model->get_lead_industry_details(); $data['acc_attachment_details'] = $this->yaskawa_model->get_acc_attachment_details($id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/account_info',$data); } else { redirect('/'); } } //import excel file to db public function import_leads() { $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); include '../PHPExcel/IOFactory.php'; if(isset($_FILES['import_leads']['name'])) { $file_name = $_FILES['import_leads']['name']; $ext = pathinfo($file_name, PATHINFO_EXTENSION); if($ext == "xlsx" || $ext == "xls") { $file_name = $_FILES['import_leads']['tmp_name']; $inputFileName = $file_name; try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch (Exception $e) { die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); } $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); $arrayCount = count($allDataInSheet); // Here get total count of row in that Excel sheet $table = 'leads'; //$this->erp_model->table_truncate($table); if(count($allDataInSheet)>0){ for($i = 2;$i <= $arrayCount;$i++){ //$sl_no = trim($allDataInSheet[$i]["A"]); $lead_owner = trim($allDataInSheet[$i]["B"]); $company_name = trim($allDataInSheet[$i]["C"]); $first_name = trim($allDataInSheet[$i]["D"]); $last_name = trim($allDataInSheet[$i]["E"]); $lead_title = trim($allDataInSheet[$i]["F"]); $email = trim($allDataInSheet[$i]["G"]); $phone = trim($allDataInSheet[$i]["H"]); $fax = trim($allDataInSheet[$i]["I"]); $mobile = trim($allDataInSheet[$i]["J"]); $website = trim($allDataInSheet[$i]["K"]); $lead_source = trim($allDataInSheet[$i]["L"]); $industry = trim($allDataInSheet[$i]["M"]); $no_of_employees = trim($allDataInSheet[$i]["N"]); $annual_revenue = trim($allDataInSheet[$i]["O"]); $ratings = trim($allDataInSheet[$i]["P"]); $email_otp = trim($allDataInSheet[$i]["Q"]); $skype_id = trim($allDataInSheet[$i]["R"]); $sec_email = trim($allDataInSheet[$i]["S"]); $twitter = trim($allDataInSheet[$i]["T"]); $street = trim($allDataInSheet[$i]["U"]); $city = trim($allDataInSheet[$i]["V"]); $state = trim($allDataInSheet[$i]["W"]); $zip_code = trim($allDataInSheet[$i]["X"]); $country = trim($allDataInSheet[$i]["Y"]); $description = trim($allDataInSheet[$i]["Z"]); $data =array( 'lead_owner' => $lead_owner, 'company_name' => $company_name, 'first_name' => $first_name, 'last_name' => $last_name, 'lead_title' => $lead_title, 'email' => $email, 'phone' => $phone, 'fax' => $fax, 'mobile' => $mobile, 'website' => $website, 'lead_source' => $lead_source, 'industry' => $industry, 'no_of_employees' => $no_of_employees, 'annual_revenue' => $annual_revenue, 'ratings' => $ratings, 'email_otp' => $email_otp, 'skype_id' => $skype_id, 'sec_email' => $sec_email, 'twitter' => $twitter, 'street' => $street, 'city' => $city, 'state' => $state, 'zip_code' => $zip_code, 'country' => $country, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_at ' => $created_at ); $result = $this->yaskawa_model->import_lead_data($data); } echo json_encode(array('result'=>1,'message'=>"Leads added successfully")); } } } else { echo json_encode(array('result'=>3,'message'=>"Please upload file with xlsx extension only")); } } public function todays_sales() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['details'] = $this->yaskawa_model->todays_sales(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_todays_sales',$data); } else { redirect('/'); } } public function month_sale() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['details'] = $this->yaskawa_model->month_sale(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_sales_this_month',$data); } else { redirect('/'); } } public function task_event() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['details'] = $this->yaskawa_model->task($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/activity_task_event_list',$data); } else { redirect('/'); } } public function event_task() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['details'] = $this->yaskawa_model->task($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/activity_task_event_list',$data); } else { redirect('/'); } } public function call_status() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['details'] = $this->yaskawa_model->call_status($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/activity_call_status',$data); } else { redirect('/'); } } public function sales_source() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['details'] = $this->yaskawa_model->sales_source(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_lead_source',$data); } else { redirect('/'); } } public function converted_leads() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['details'] = $this->yaskawa_model->acc_converted_leads(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_converted_list',$data); } else { redirect('/'); } } public function ownership() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['lead_owner_data']=$this->yaskawa_model->ownership(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_ownership_list',$result); } else { redirect('/'); } } //industry_leads view public function industry_leads() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['industry_leads'] = $this->yaskawa_model->leads_by_industry(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_industry_list',$result); } else { redirect('/'); } } //recently_deleted_reports view public function today_leads() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['today_leads'] = $this->yaskawa_model->todays_leads_list(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_todays_list',$result); } else { redirect('/'); } } //lead_status view public function lead_status() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['lead_status'] = $this->yaskawa_model->leads_by_status(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_status_list',$result); } else { redirect('/'); } } //favorite_reports view public function favorite_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['fav_reoprts'] = $this->yaskawa_model->favorite_reports(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/favorite_reports',$result); } else { redirect('/'); } } //leads_source view public function leads_source() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['lead_source'] = $this->yaskawa_model->leads_by_source(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_source_list',$result); } else { redirect('/'); } } //sales_across_owner view public function lead_conversion() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['sales_across_owner']=$this->yaskawa_model->sales_across_owner(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_across_owners',$result); } else { redirect('/'); } } //sales_count_across_owners view public function conversion_count() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['sales_across_owner']=$this->yaskawa_model->sales_across_owner(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_count_across_owners',$result); } else { redirect('/'); } } //sales_across_source view public function conversion_source() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['sales_across_source']=$this->yaskawa_model->sales_across_source(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_across_source',$result); } else { redirect('/'); } } //sales_across_industry view public function conversion_industry() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['sales_across_owner']=$this->yaskawa_model->sales_across_owner(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_across_industry',$result); } else { redirect('/'); } } public function personal_settings() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['login_person_data']=$this->yaskawa_model->login_person($admin_id); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/profile_setting',$result); } else { redirect('/'); } } public function email_settings() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['email_details'] = $this->yaskawa_model->get_all_email_settings(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/email_settings',$result); } else { redirect('/'); } } public function users() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $user_data['user_type_id'] = $this->access_id(); $user_data['access'] = $this->access_details(); $user_data['users']=$this->yaskawa_model->number_of_users(); $user_data['company_details']=$this->yaskawa_model->fetch_company_details(); $user_data['login_person_data']=$this->yaskawa_model->login_person($admin_id); $user_data['roles_list_admin'] = $this->yaskawa_model->get_all_roles_admin(); $this->load->view('admin/admin_user',$user_data); } else { redirect('/'); } } public function security_control() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); //$result['menu'] = $this->yaskawa_model->get_all_menus(); $result['role_name'] = $this->yaskawa_model->add_new_roles2(); //$result['sub_menu1'] = $this->yaskawa_model->get_all_sub_menus(); //$result['sub_menu2'] = $this->yaskawa_model->get_all_sub_menus1(); //print_r($result['sub_menu1']); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/security_control',$result); } else { redirect('/'); } } public function tree_structure(){ $result = $this->yaskawa_model->tree_structure(); // print_r($result); // die(); if($result) { echo json_encode(array('result'=>1,'tree_structure'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function accounts() { $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['accounts_data'] = $this->yaskawa_model->select_new_accounts($role_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_account',$data); } else { redirect('/'); } } //delete remove_records public function remove_records() { $record_ids=$this->input->post('report_ids'); $data=array('delete_status'=>'DEACTIVE'); $this->yaskawa_model->delete_report($record_ids,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } //delete remove_reports public function remove_reports() { $record_ids=$this->input->post('report_ids'); $data=array('delete_status'=>'DELETED'); $this->yaskawa_model->delete_report($record_ids,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } // delete restore_reports public function restore_reports() { $record_ids=$this->input->post('report_ids'); $data=array('delete_status'=>'ACTIVE'); $this->yaskawa_model->delete_report($record_ids,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } // delete delete_potential_data public function delete_potential_data() { $record_ids=$this->input->post('report_ids'); $data=array('type'=>'POTENTIAL_DEACTIVE'); $this->yaskawa_model->delete_report($record_ids,$data); } // delete delete_lead_report public function delete_lead_report() { $record_ids=$this->input->post('report_ids'); $data=array('type'=>'LEAD_DEACTIVE'); $this->yaskawa_model->delete_report($record_ids,$data); } // delete delete_activity_report public function delete_activity_report() { $record_ids=$this->input->post('report_ids'); $data=array('type'=>'ACTIVITY_DEACTIVE'); $this->yaskawa_model->delete_report($record_ids,$data); } // delete sales_matric_report public function sales_matric_report() { $record_ids=$this->input->post('report_ids'); $data=array('type'=>'SALES_DEACTIVE'); $this->yaskawa_model->delete_report($record_ids,$data); } //favorite_reports view public function update_favorite_reports() { $report_id = $this->input->post('report_id'); $data = array('favorite_report'=>'yes'); $result = $this->yaskawa_model->update_favorite_reports($report_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } //favorite_reports view public function move_reports() { $report_id = $this->input->post('report_id'); $report_val = $this->input->post('report_val'); $data = array('type'=> $report_val); foreach ($report_id as $key => $value) { $var = $value; $result = $this->yaskawa_model->move_reports_folder($var,$data); } if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function add_new_roles() { $role_name = $this->input->post('role_name'); $report_to = $this->input->post('report_to'); $zone = $this->input->post('zone'); $description = $this->input->post('description'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $data = $this->yaskawa_model->add_new_roles1($report_to); $role_details = array( 'role_name' => $role_name, 'report_to' => $data->role_id, 'zone' => $zone, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); if($data) { $result = $this->yaskawa_model->add_new_roles_check($role_name); if($result) { if($data->role_id == $result->report_to) { echo json_encode(array('result'=>1,'id'=>$result,'message'=>"Roles added successfully")); } else { $result = $this->yaskawa_model->add_new_roles($role_details); if($result) { echo json_encode(array('result'=>2,'id'=>$result,'message'=>"Roles added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } } else { $result = $this->yaskawa_model->add_new_roles($role_details); if($result) { echo json_encode(array('result'=>2,'id'=>$result,'message'=>"Roles added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } } else { $result = $this->yaskawa_model->add_new_roles($role_details); if($result) { echo json_encode(array('result'=>2,'id'=>$result,'message'=>"Roles added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } } public function redirect_roles() { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $role_id = $this->uri->segment(3); $result['roles'] = $this->yaskawa_model->get_roles(); $result['details'] = $this->yaskawa_model->get_role_data($role_id); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/security_control_roles',$result); } //update update_roles public function update_roles() { $role_id = $this->input->post('role_id'); $role_name = $this->input->post('role_name'); $report_to = $this->input->post('report_to'); $description = $this->input->post('description'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updated_at = $date->format('Y-m-d H:i:s'); $role_details = array( 'role_name' => $role_name, 'report_to' => $report_to, 'description' => $description, 'delete_status' => 'ACTIVE', 'updated_at' => $updated_at ); $result = $this->yaskawa_model->update_roles($role_id,$role_details); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>"Updated successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } } //Delete delete_roles public function delete_roles() { $role_id = $this->input->post('role_id'); $data = array('delete_status'=>'INACTIVE'); $result = $this->yaskawa_model->delete_role($role_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } //organizing_email_address public function organizing_email_address() { $display_name = $this->input->post('display_name'); $email = $this->input->post('email'); $can_see = $this->input->post('can_see'); // $confirm_status = $this->input->post('confirm_status'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $email_address_details = array( 'display_name' => $display_name, 'email_address' => $email, //'confirm_status' => $confirm_status, 'who_can_see' => $can_see, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->insert_email_settings($email_address_details); //$result1 = $this->yaskawa_model->get_all_email_settings(); if($result) { echo json_encode(array('emailsetting'=>$result,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function added_new_users(){ { $role_id = $this->input->post('role_id'); $fname = $this->input->post('fname'); $lname = $this->input->post('lname'); $email = $this->input->post('email'); $role = $this->input->post('role'); $profile_pic = $this->input->post('profile_pic'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['profile_pic']['name'])) { $file_name = ""; } else { $target='profile_pictures/'; $target.=time().$_FILES['profile_pic']['name']; $file_name=time().$_FILES['profile_pic']['name']; $image=$target; move_uploaded_file($_FILES['profile_pic']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } //$email=$checkingemail->email; $this->load->library('email'); $this->email->set_mailtype('html'); $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $password = substr( str_shuffle( $chars ), 0, 8 ); $password1= md5($password); $data=array('password'=>$password); $query =$this->yaskawa_model->update_emp_password($email,$data); $msg = "Hello"."Yaskawa username is".$email.','.'<br/><br/>'."Your Temporary Password is"." ".$password.'<br/><br/>'."Thank you".'<br/>'."Myvote Team"; $this->email->from('info@nparrots.com', 'Yaskawa'); $this->email->to($email); $this->email->subject('Yaskawa Temporary Password'); $data['message'] = $msg; $this->email->message($msg); $this->email->send(); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $insert=array( 'user_name' => $fname, 'user_type_id' => '2', 'department_id' => '3', 'last_name' => $lname, 'email' => $email, 'role_id' => $role_id, 'role' => $role, 'password' => md5('password'), 'profile_pick' => $file_name, 'created_at' => $created_at, ); $result = $this->yaskawa_model->insert_new_users($insert); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } } // fetch user_details public function details(){ $user_id=$this->input->post('user_id'); $user_data=$this->yaskawa_model->user_details($user_id); echo json_encode($user_data); } // fetch user_data_update public function user_data_update(){ $uid = $this->input->post('user_id'); $alias = $this->input->post('alias'); $phone = $this->input->post('phone'); $mobile = $this->input->post('mobile'); $fax = $this->input->post('fax'); $website = $this->input->post('website'); $Date = $this->input->post('Date_of_Birth'); $newDate = date("Y-m-d", strtotime($Date)); $street = $this->input->post('street'); $city = $this->input->post('city'); $state = $this->input->post('state'); $zip_code = $this->input->post('zip_code'); $country = $this->input->post('country'); $udate = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $update_at = $udate->format('Y-m-d H:i:s'); $update_data=array( 'Alias' => $alias, 'Phone' => $phone, 'Mobile' => $mobile, 'Fax' => $fax, 'Website' => $website, 'Date_of_Birth' => $newDate, 'Street' => $street, 'City' => $city, 'State' => $state, 'Zip_Code' => $zip_code, 'Country' => $country, 'updated_at' => $update_at, ); $result=$this->yaskawa_model->user_details_update($uid,$update_data); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } // insert insert_company_details public function insert_company_details(){ $cname = $this->input->post('cname'); $Alias = $this->input->post('Alias'); $ecount = $this->input->post('ecount'); $Phone = $this->input->post('Phone'); $Mobile = $this->input->post('Mobile'); $Fax = $this->input->post('Fax'); $Website = $this->input->post('Website'); $Description = $this->input->post('Description'); $Super_Admin = $this->input->post('Super_Admin'); $Street = $this->input->post('Street'); $City = $this->input->post('City'); $State = $this->input->post('State'); $Zip_Code = $this->input->post('Zip_Code'); $Country = $this->input->post('Country'); $cdate = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $create_at = $cdate->format('Y-m-d H:i:s'); $company_details=array( 'Company_Name' => $cname, 'Alias' => $Alias, 'Employee_Count' => $ecount, 'Phone' => $Phone, 'Mobile' => $Mobile, 'Fax' => $Fax, 'Website' => $Website, 'Description' => $Description, 'Super_Admin' => $Super_Admin, 'Street' => $Street, 'City' => $City, 'State' => $State, 'Zip_Code' => $Zip_Code, 'Country' => $Country, 'create_at' => $create_at ); $result=$this->yaskawa_model->company_details($company_details); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } //Users list public function get_users_list() { $username = $this->input->post('username'); $result = $this->yaskawa_model->get_users_list($username); if($result) { echo json_encode(array('get_users_list'=>$result,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function sender_upload_files(){ $sender_id = $this->session->userdata('admin_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $send_at = $date->format('Y-m-d H:i:s'); $receiverids = $this->input->post('receiver-ids'); $message = $this->input->post('admin_message'); $feeds_id = $this->input->post('feedsids'); $comm_date = $date->format('Y-m-d'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['admin_upload']['name'])) { $file_name = ""; } else { $target='document_uploads/'; $target.=time().$_FILES['admin_upload']['name']; $file_name=time().$_FILES['admin_upload']['name']; $image=$target; move_uploaded_file($_FILES['admin_upload']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; //$this->image_lib->resize(); } } $comment_details=array( 'feeds_id' => $feeds_id, 'send_id' => $sender_id, 'receive_id' => $receiverids, 'comment' => $message, 'send_at' => $send_at, 'file_name' => $file_name, 'comm_date' => $comm_date ); $result=$this->yaskawa_model->comment_feeds($comment_details); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } //attach_notes public function attach_notes() { $lead_notes = $this->input->post('lead_notes'); $attach_file = $this->input->post('attach_file'); $lead_id = $this->input->post('lead_id'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['attach_file']['name'])) { $file_name = ""; } else { $target='attach_file/'; $target.=time().$_FILES['attach_file']['name']; $file_name=time().$_FILES['attach_file']['name']; $image=$target; move_uploaded_file($_FILES['attach_file']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $notes_details = array( 'lead_id' => $lead_id, 'lead_notes' => $lead_notes, 'attach_file' => $file_name, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($notes_details); // die(); $result = $this->yaskawa_model->add_lead_notes($notes_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Notes added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //attach_notes public function attach_accountnotes() { $lead_notes = $this->input->post('lead_notes'); $attach_file = $this->input->post('attach_file'); $lead_id = $this->input->post('lead_id'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['attach_file']['name'])) { $file_name = ""; } else { $target='attach_file/'; $target.=time().$_FILES['attach_file']['name']; $file_name=time().$_FILES['attach_file']['name']; $image=$target; move_uploaded_file($_FILES['attach_file']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $notes_details = array( 'lead_id' => $lead_id, 'lead_notes' => $lead_notes, 'attach_file' => $file_name, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($notes_details); // die(); $result = $this->yaskawa_model->add_account_notes($notes_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Notes added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //attach_files public function attach_files() { $attach_file = $this->input->post('attach_file'); $lead_id = $this->input->post('lead_id'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['attach_file']['name'])) { $file_name = ""; } else { $target='attach_file/'; $target.=time().$_FILES['attach_file']['name']; $file_name=time().$_FILES['attach_file']['name']; $image=$target; move_uploaded_file($_FILES['attach_file']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $attachment_details = array( 'lead_id' => $lead_id, 'type' =>'Attached File', 'attach_file' => $file_name, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($attachment_details); // die(); $result = $this->yaskawa_model->add_lead_attachments($attachment_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //attach_files public function attach_linl_url() { $link_url = $this->input->post('new_task'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $url_details = array( 'lead_id' => $lead_id, 'type' =>'Link URL', 'link_url' => $link_url, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($url_details); // die(); $result = $this->yaskawa_model->add_lead_attachments($url_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //new_task public function new_task() { $subject = $this->input->post('subject'); $due_date = $this->input->post('due_date'); $priority = $this->input->post('priority'); $owner = $this->input->post('owner'); //$start_date = $this->input->post('start_date'); //$end_date = $this->input->post('end_date'); $status = $this->input->post('status'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $task_details = array( 'lead_id' => $lead_id, 'type' => 'Task', 'subject' => $subject, 'due_date' => $due_date, 'priority' => $priority, 'owner' => $owner, //'start_date' => date('Y-m-d', strtotime($start_date)), //'end_date' => date('Y-m-d', strtotime($end_date)), 'status' => $status, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($task_details); // die(); $result = $this->yaskawa_model->add_new_task($task_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //new_events public function new_events() { $event_name = $this->input->post('event_name'); $all_day = $this->input->post('all_day'); $from_date = $this->input->post('from_date'); $to_date = $this->input->post('to_date'); $host = $this->input->post('host'); $related_to = $this->input->post('related_to'); $lead = $this->input->post('lead'); //$repeat = $this->input->post('repeat'); $description = $this->input->post('description'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $event_details = array( 'lead_id' => $lead_id, 'type' => 'Event', 'subject' => $event_name, 'all_day' => $all_day, 'start_date' => $from_date, 'end_date' => $to_date, 'host' => $host, 'related_to' => $related_to, 'owner' => $lead, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($event_details); // die(); $result = $this->yaskawa_model->add_new_task($event_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //new_calls public function new_calls() { $lead_id = $this->input->post('lead_id'); $subject = $this->input->post('subject'); $call_type = $this->input->post('call_type'); $call_purpose = $this->input->post('call_purpose'); $contact_num = $this->input->post('contact_name'); $call_details = $this->input->post('call_details'); $call_duration = $this->input->post('call_duration'); $description = $this->input->post('description'); $call_result = $this->input->post('call_result'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $call_details = array( 'lead_id' => $lead_id, 'type' => 'Call', 'subject' => $subject, 'call_type' => $call_type, 'call_purpose' => $call_purpose, 'contact_name' => $contact_num, 'call_details' => $call_details, 'call_duration' => $call_duration, 'description' => $description, 'call_result' => $call_result, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($call_details); // die(); $result = $this->yaskawa_model->add_new_task($call_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //upload_profile_pic public function upload_profile_pic() { $profile_pic = $this->input->post('profile_pic'); $lead_id = $this->input->post('lead_id'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['profile_pic']['name'])) { $file_name = ""; } else { $target='profile_pictures/'; $target.=time().$_FILES['profile_pic']['name']; $file_name=time().$_FILES['profile_pic']['name']; $image=$target; move_uploaded_file($_FILES['profile_pic']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $image_details = array( 'lead_id' => $lead_id, 'profile_pic' => $file_name, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($image_details); // die(); $result = $this->yaskawa_model->add_profile_pic($image_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //Edit send_mail public function send_mail() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['mail_details'] = $this->yaskawa_model->get_all_mail(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/send_mail',$data); } else { redirect('/'); } } //send_mail_user public function send_mail_user() { $email_settings_id = $this->input->post('email_settings_id'); $to_whom = $this->input->post('to_whom'); $subject = $this->input->post('subject'); //$lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $this->load->library('email'); $this->email->set_mailtype('html'); $this->email->from($email_settings_id); $this->email->to($to_whom); $this->email->subject($subject); $this->email->send(); } //attach_accountfiles public function attach_accountfiles() { $attach_file = $this->input->post('attach_file'); $lead_id = $this->input->post('lead_id'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['attach_file']['name'])) { $file_name = ""; } else { $target='attach_file/'; $target.=time().$_FILES['attach_file']['name']; $file_name=time().$_FILES['attach_file']['name']; $image=$target; move_uploaded_file($_FILES['attach_file']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $attachment_details = array( 'lead_id' => $lead_id, 'type' =>'Attached File', 'attach_file' => $file_name, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($attachment_details); // die(); $result = $this->yaskawa_model->add_lead_account_attachment($attachment_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //attach_accountlinl_url public function attach_accountlinl_url() { $link_url = $this->input->post('linkurl'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $url_details = array( 'lead_id' => $lead_id, 'type' =>'Link URL', 'link_url' => $link_url, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($url_details); // die(); $result = $this->yaskawa_model->add_lead_account_attachment($url_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //new_accounttask public function new_accounttask() { $subject = $this->input->post('subject'); $due_date = date('Y-m-d', strtotime($this->input->post('due_date'))); $priority = $this->input->post('priority'); $owner = $this->input->post('owner'); //$start_date = $this->input->post('start_date'); //$end_date = $this->input->post('end_date'); $status = $this->input->post('status'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $task_details = array( 'lead_id' => $lead_id, 'type' =>'Task', 'subject' => $subject, 'due_date' => $due_date, 'priority' => $priority, 'owner' => $owner, //'start_date' => date('Y-m-d', strtotime($start_date)), //'end_date' => date('Y-m-d', strtotime($end_date)), 'status' => $status, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($task_details); // die(); $result = $this->yaskawa_model->add_new_account_task($task_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //new_accountevents public function new_accountevents() { $event_name = $this->input->post('event_name'); $all_day = $this->input->post('all_day'); $from_date = date('Y-m-d', strtotime($this->input->post('from_date'))); $to_date = date('Y-m-d', strtotime($this->input->post('to_date'))); $host = $this->input->post('host'); $related_to = $this->input->post('related_to'); $lead = $this->input->post('lead'); //$repeat = $this->input->post('repeat'); $description = $this->input->post('description'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $event_details = array( 'lead_id' => $lead_id, 'type' =>'Event', 'subject' => $event_name, 'all_day' => $all_day, 'start_date' => $from_date, 'end_date' => $to_date, 'owner' => $host, 'related_to' => $related_to, 'lead' => $lead, //'repeat' => $repeat, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($event_details); // die(); $result = $this->yaskawa_model->add_new_account_task($event_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } //new_accountcalls public function new_accountcalls() { $lead_id = $this->input->post('lead_id'); $subject = $this->input->post('subject'); $call_type = $this->input->post('call_type'); $call_purpose = $this->input->post('call_purpose'); $contact_num = $this->input->post('contact_name'); $call_details = $this->input->post('call_details'); //$call_timer = $this->input->post('call_timer'); $call_duration = $this->input->post('call_duration'); $description = $this->input->post('description'); $call_result = $this->input->post('call_result'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $call_details = array( 'lead_id' => $lead_id, 'type' =>'Call', 'subject' => $subject, 'call_type' => $call_type, 'call_purpose' => $call_purpose, 'contact_name' => $contact_num, 'call_details' => $call_details, //'call_timer' => $call_timer, 'call_duration' => $call_duration, 'description' => $description, 'call_result' => $call_result, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($call_details); // die(); $result = $this->yaskawa_model->add_new_account_task($call_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } // send_account_mail public function send_account_mail() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['mail_details'] = $this->yaskawa_model->get_all_mail(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/account_send_mail',$data); } else { redirect('/'); } } //account_mail public function account_mail() { $email_settings = $this->input->post('email_settings'); $to_whom = $this->input->post('to_whom'); $subject = $this->input->post('subject'); //$lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $this->load->library('email'); $this->email->set_mailtype('html'); $this->email->from($email_settings); $this->email->to($to_whom); $this->email->subject($subject); $this->email->send(); } public function add_quotations() { $quo_date = date('Y-m-d', strtotime($this->input->post('quo_date'))); $res_date = date('Y-m-d', strtotime($this->input->post('response_date'))); $probability = $this->input->post('probability'); $amount = $this->input->post('amount'); $description = $this->input->post('description'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $quotation_details = array( 'lead_id' => $lead_id, 'quo_date' => $quo_date, 'response_date' => $res_date, 'probability' => $probability, 'amount' => $amount, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->add_new_quotations($quotation_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Notes added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } // convert_status public function convert_status() { $quotation_id = $this->input->post('id'); $data = array('convert_status'=>'CONVERTED'); $result = $this->yaskawa_model->convert_status($quotation_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } //recently_deleted_reports view public function employees_list() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['employee_list'] = $this->yaskawa_model->get_all_employees(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/employee_list',$result); } else { redirect('/'); } } // delete_employee public function delete_employee() { $emp_id = $this->input->post('id'); $data = array('delete_status'=>'INACTIVE'); $result = $this->yaskawa_model->delete_employee($emp_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } //import excel file to db public function import_employees() { $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); include '../PHPExcel/IOFactory.php'; if(isset($_FILES['import_employee']['name'])) { $file_name = $_FILES['import_employee']['name']; $ext = pathinfo($file_name, PATHINFO_EXTENSION); if($ext == "xlsx" || $ext == "xls") { $file_name = $_FILES['import_employee']['tmp_name']; $inputFileName = $file_name; try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch (Exception $e) { die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); } $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); $arrayCount = count($allDataInSheet); // Here get total count of row in that Excel sheet $table = 'leads'; //$this->erp_model->table_truncate($table); if(count($allDataInSheet)>0){ for($i = 2;$i <= $arrayCount;$i++){ //$emp_id = trim($allDataInSheet[$i]["A"]); $employee_id = trim($allDataInSheet[$i]["B"]); $first_name = trim($allDataInSheet[$i]["C"]); $last_name = trim($allDataInSheet[$i]["D"]); $email_id = trim($allDataInSheet[$i]["E"]); $nick_name = trim($allDataInSheet[$i]["F"]); $department = trim($allDataInSheet[$i]["G"]); $reporting_to = trim($allDataInSheet[$i]["H"]); $source_of_hire = trim($allDataInSheet[$i]["I"]); $location = trim($allDataInSheet[$i]["J"]); $title = trim($allDataInSheet[$i]["K"]); $date_of_joining = trim($allDataInSheet[$i]["L"]); $seating_location = trim($allDataInSheet[$i]["M"]); $work_phone = trim($allDataInSheet[$i]["N"]); $extension = trim($allDataInSheet[$i]["O"]); $employee_status = trim($allDataInSheet[$i]["P"]); $employee_type = trim($allDataInSheet[$i]["Q"]); $employee_role = trim($allDataInSheet[$i]["R"]); $pan_no = trim($allDataInSheet[$i]["S"]); $date_of_birth = trim($allDataInSheet[$i]["T"]); $address = trim($allDataInSheet[$i]["U"]); $residential_address = trim($allDataInSheet[$i]["V"]); $marital_status = trim($allDataInSheet[$i]["W"]); $job_description = trim($allDataInSheet[$i]["X"]); $about_me = trim($allDataInSheet[$i]["Y"]); $date_of_exit = trim($allDataInSheet[$i]["Z"]); $gender = trim($allDataInSheet[$i]["AA"]); //$pre_company_name = trim($allDataInSheet[$i]["AB"]); //$job_title = trim($allDataInSheet[$i]["AC"]); $from_date = trim($allDataInSheet[$i]["AD"]); $to_date = trim($allDataInSheet[$i]["AE"]); //$work_job_description = trim($allDataInSheet[$i]["AF"]); //$school_name = trim($allDataInSheet[$i]["AG"]); //$diplamo_degree = trim($allDataInSheet[$i]["AH"]); //$field_of_study = trim($allDataInSheet[$i]["AI"]); $date_of_completion = trim($allDataInSheet[$i]["AJ"]); //$additional_notes = trim($allDataInSheet[$i]["AK"]); //$interests = trim($allDataInSheet[$i]["AL"]); //$dependent_name = trim($allDataInSheet[$i]["AM"]); //$dependent_relationship = trim($allDataInSheet[$i]["AN"]); $dependent_dob = trim($allDataInSheet[$i]["AO"]); $data =array( 'employee_id' => $employee_id, 'first_name' => $first_name, 'last_name' => $last_name, 'email_id' => $email_id, 'nick_name' => $nick_name, 'department' => $department, 'reporting_to' => $reporting_to, 'source_of_hire' => $source_of_hire, 'location' => $location, 'title' => $title, 'date_of_joining' => $date_of_joining, 'seating_location' => $seating_location, 'work_phone' => $work_phone, 'extension' => $extension, 'employee_status' => $employee_status, 'employee_type' => $employee_type, 'employee_role' => $employee_role, 'pan_no' => $pan_no, 'date_of_birth' => $date_of_birth, 'address' => $address, 'residential_address' => $residential_address, 'marital_status' => $marital_status, 'job_description' => $job_description, 'about_me' => $about_me, 'date_of_exit' => $date_of_exit, 'gender' => $gender, //'pre_company_name' => $pre_company_name, //'job_title' => $job_title, 'from_date' => $from_date, 'to_date' => $to_date, //'work_job_description' => $work_job_description, //'school_name' => $school_name, //'diplamo_degree' => $diplamo_degree, //'field_of_study' => $field_of_study, 'date_of_completion' => $date_of_completion, //'additional_notes' => $additional_notes, //'interests' => $interests, //'dependent_name' => $dependent_name, //'dependent_relationship' => $dependent_relationship, //'dependent_dob' => $dependent_dob, 'delete_status' => 'ACTIVE', 'created_at ' => $created_at ); $result = $this->yaskawa_model->import_employee_data($data); } echo json_encode(array('result'=>1,'message'=>"Leads added successfully")); } } } else { echo json_encode(array('result'=>3,'message'=>"Please upload file with xlsx extension only")); } } //single_employee_view public function single_employee_view() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $emp_id = $this->uri->segment(2); $data['employee_details'] = $this->yaskawa_model->single_employee_details($emp_id); $data['job_details'] = unserialize($data['employee_details']->job_title); $data['work_details'] = unserialize($data['employee_details']->work_job_description); $data['school_name'] = unserialize($data['employee_details']->school_name); $data['diplamo_degree'] = unserialize($data['employee_details']->diplamo_degree); $data['field_of_study'] = unserialize($data['employee_details']->field_of_study); $data['additional_notes'] = unserialize($data['employee_details']->additional_notes); $data['interests'] = unserialize($data['employee_details']->interests); $data['dependent_name'] = unserialize($data['employee_details']->dependent_name); $data['dependent_relationship'] = unserialize($data['employee_details']->dependent_relationship); $data['company_details']=$this->yaskawa_model->fetch_company_details(); // print_r($data['additional_notes']); // die(); $this->load->view('admin/employee_info',$data); } else { redirect('/'); } } public function lead_convert() { $lead_id = $this->uri->segment(2); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $converted_at = $date->format('Y-m-d'); $data = array('lead_status'=>'CONVERTED','converted_at'=>$converted_at); $result = $this->yaskawa_model->lead_convert_status($lead_id,$data); if($this->db->affected_rows() > 0) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['single_details'] = $this->yaskawa_model->single_lead_details($lead_id); $data['pic_details'] = $this->yaskawa_model->get_pic_details($lead_id); $data['lead_details'] = $this->yaskawa_model->get_event_call_details($lead_id); $data['closed_details'] = $this->yaskawa_model->get_event_closed_details($lead_id); $data['notes_details'] = $this->yaskawa_model->get_notes_details($lead_id); $data['attachment_details'] = $this->yaskawa_model->get_attachment_details($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); //$this->load->view('admin/lead_information',$data); //redirect('yaskawa/accounts'); $this->load->view('admin/lead_information',$data); } } //acc_closed_activity public function acc_closed_activity() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $task_id = $this->uri->segment(2); $dat=array('delete_status'=>'Closed'); $this->yaskawa_model->acc_update_status($task_id,$dat); $det=$this->yaskawa_model->get_row($task_id); $lead_id=$det->lead_id; $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['single_details'] = $this->yaskawa_model->single_lead_details($lead_id); $data['account_details'] = $this->yaskawa_model->single_account_details($lead_id); $data['quotation_details'] = $this->yaskawa_model->get_quotation_details($lead_id); $data['converted_status'] = $this->yaskawa_model->get_converted_status($lead_id); $data['notes_details'] = $this->yaskawa_model->get_account_notes_details($lead_id); $data['task_details'] = $this->yaskawa_model->get_account_task_details($lead_id); $data['closed_details'] = $this->yaskawa_model->get_acc_closed_details($lead_id); $data['lead_ratings'] = $this->yaskawa_model->get_lead_ratings_details(); $data['contact_data']=$this->yaskawa_model->contact_list(); $data['potential_data']=$this->yaskawa_model->select_new_potential(); $data['account_type'] = $this->yaskawa_model->get_account_type(); $data['industry_details'] = $this->yaskawa_model->get_lead_industry_details(); $data['acc_attachment_details'] = $this->yaskawa_model->get_acc_attachment_details($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/account_info',$data); } else { redirect('/'); } } //edit_quotation public function edit_quotation() { $quotation_id = $this->input->post('id'); $result = $this->yaskawa_model->edit_quotation($quotation_id); if($result) { echo json_encode(array('result'=>1,'edit_details'=>$result,'message'=>"Got edit successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } // update_quotation public function update_quotation() { $quo_date = date("Y-m-d", strtotime($this->input->post('quo_date'))); $invoice_num = $this->input->post('invoice_num'); $invoice_date = date("Y-m-d", strtotime($this->input->post('invoice_date'))); $invoice_amount = $this->input->post('invoice_amount'); $description = $this->input->post('description'); $lead_id = $this->input->post('lead_id'); $quotation_id = $this->input->post('quoteid'); // print_r($quotation_id); // die(); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updated_at = $date->format('Y-m-d H:i:s'); $quotation_details = array( 'lead_id' => $lead_id, 'invoice_num' => $invoice_num, 'invoice_date' => $invoice_date, 'invoice_amount' => $invoice_amount, 'description' => $description, 'delete_status' => 'ACTIVE', 'convert_status' =>'CONVERTED', 'updated_at' => $updated_at ); $result = $this->yaskawa_model->update_quotation($quotation_id,$lead_id,$quotation_details); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>"Updated successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } } public function upload_image() { $this->load->library('image_lib'); $user_ids = $this->input->post('user_ids'); $replace_image = $this->input->post('replace_image'); if($_FILES) { if(empty($_FILES['replace_image']['name'])) { $file_name = ""; } else { $target='profile_pictures/'; $target.=time().$_FILES['replace_image']['name']; $file_name=time().$_FILES['replace_image']['name']; $image=$target; move_uploaded_file($_FILES['replace_image']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $image_details = array( 'profile_pick' => $file_name, ); $result=$this->yaskawa_model->replace_image($user_ids,$image_details); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function lead_upload_image() { $this->load->library('image_lib'); $lead_ids = $this->input->post('lead_ids'); $replace_image = $this->input->post('replace_image'); if($_FILES) { if(empty($_FILES['replace_image']['name'])) { $file_name = ""; } else { $target='profile_pictures/'; $target.=time().$_FILES['replace_image']['name']; $file_name=time().$_FILES['replace_image']['name']; $image=$target; move_uploaded_file($_FILES['replace_image']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $lead_image_details = array( 'profile_pick' => $file_name, ); $result=$this->yaskawa_model->lead_replace_image($lead_ids,$lead_image_details); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function lead_page_back(){ redirect('yaskawa/lead_list'); } //Delete department public function delete_email_organizing() { $email_settings_id = $this->input->post('id'); $data = array('delete_status'=>'INACTIVE'); $result = $this->yaskawa_model->delete_email_organizing($email_settings_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } public function account_inf_back(){ redirect('yaskawa/accounts'); } public function company_details() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $user_data['user_type_id'] = $this->access_id(); $user_data['access'] = $this->access_details(); $user_data['users']=$this->yaskawa_model->number_of_users(); $user_data['login_person_data']=$this->yaskawa_model->login_person($admin_id); $user_data['company_details']=$this->yaskawa_model->fetch_company_details(); //$user_data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/company_settings',$user_data); } else { redirect('/'); } } public function company_logo() { $this->load->library('image_lib'); $cmp_ids = $this->input->post('cmp_ids'); $replace_image = $this->input->post('replace_image'); if($_FILES) { if(empty($_FILES['replace_image']['name'])) { $file_name = ""; } else { $target='profile_pictures/'; $target.=time().$_FILES['replace_image']['name']; $file_name=time().$_FILES['replace_image']['name']; $image=$target; move_uploaded_file($_FILES['replace_image']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $company_image = array( 'company_pic' => $file_name, ); $result=$this->yaskawa_model->company_logo($cmp_ids,$company_image); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function account_page_back(){ redirect('yaskawa/accounts'); } //Edit employee public function edit_employee() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $emp_id = $this->uri->segment(2); $data['dept_list'] = $this->yaskawa_model->get_all_departments(); $data['emp_details'] = $this->yaskawa_model->edit_emp_details($emp_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/edit_employee',$data); } else { redirect('/'); } } //update Employee public function update_employee() { $emp_id = $this->input->post('emp_id'); $employee_id = $this->input->post('employee_id'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $email_id = $this->input->post('email_id'); $nick_name = $this->input->post('nick_name'); $department = $this->input->post('department'); $reporting_to = $this->input->post('reporting_to'); $source_of_hire = $this->input->post('source_of_hire'); $location = $this->input->post('location'); $title = $this->input->post('title'); $date_of_joining = $this->input->post('date_of_joining'); $seating_location = $this->input->post('seating_location'); $work_phone = $this->input->post('work_phone'); $extension = $this->input->post('extension'); $employee_status = $this->input->post('employee_status'); $employee_type = $this->input->post('employee_type'); $employee_role = $this->input->post('employee_role'); $pan_no = $this->input->post('pan_no'); $date_of_birth = $this->input->post('date_of_birth'); $address = $this->input->post('address'); $residential_address = $this->input->post('residential_address'); $marital_status = $this->input->post('marital_status'); $job_description = $this->input->post('job_description'); $about_me = $this->input->post('about_me'); $date_of_exit = $this->input->post('date_of_exit'); $gender = $this->input->post('gender'); $pre_company_name = $this->input->post('pre_company_name'); $job_title = $this->input->post('job_title'); $from_date = $this->input->post('from_date'); $to_date = $this->input->post('to_date'); $work_job_description = $this->input->post('work_job_description'); $school_name = $this->input->post('school_name'); $diplamo_degree = $this->input->post('diplamo_degree'); $field_of_study = $this->input->post('field_of_study'); $date_of_completion = $this->input->post('date_of_completion'); $additional_notes = $this->input->post('additional_notes'); $interests = $this->input->post('interests'); $dependent_name = $this->input->post('dependent_name'); $dependent_relationship = $this->input->post('dependent_relationship'); $dependent_dob = $this->input->post('dependent_dob'); $pre_company =serialize($pre_company_name); $job_tit =serialize($job_title); $fromdate =serialize($from_date); $todate =serialize($to_date); $work_job_desc =serialize($work_job_description); $schoolname =serialize($school_name); $diplamodegree =serialize($diplamo_degree); $fieldofstudy =serialize($field_of_study); $dateofcompletion =serialize($date_of_completion); $additionalnotes =serialize($additional_notes); $interest =serialize($interests); $dependentname =serialize($dependent_name); $dependentrelationship =serialize($dependent_relationship); $dependentdob =serialize($dependent_dob); $this->load->library('image_lib'); $file_name = ""; $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updated_at = $date->format('Y-m-d H:i:s'); $employee_details = array( 'employee_id' => $employee_id, 'first_name' => $first_name, 'last_name' => $last_name, 'email_id' => $email_id, 'nick_name' => $nick_name, 'department' => $department, 'reporting_to' => $reporting_to, 'source_of_hire' => $source_of_hire, 'location' => $location, 'title' => $title, 'date_of_joining' => $date_of_joining, 'seating_location' => $seating_location, 'work_phone' => $work_phone, 'extension' => $extension, 'employee_status' => $employee_status, 'employee_type' => $employee_type, 'employee_role' => $employee_role, 'pan_no' => $pan_no, 'date_of_birth' => $date_of_birth, 'address' => $address, 'residential_address'=> $residential_address, 'marital_status' => $marital_status, 'job_description' => $job_description, 'about_me' => $about_me, 'date_of_exit' => $date_of_exit, 'gender' => $gender, 'pre_company_name' => $pre_company, 'job_title' => $job_tit, 'from_date' => $fromdate, 'to_date' => $todate, 'work_job_description' => $work_job_desc, 'school_name' => $schoolname, 'diplamo_degree' => $diplamodegree, 'field_of_study' => $fieldofstudy, 'date_of_completion' => $dateofcompletion, 'additional_notes' => $additionalnotes, 'interests' => $interest, 'dependent_name' => $dependentname, 'dependent_relationship' => $dependentrelationship, 'dependent_dob' => $dependentdob, 'delete_status' => 'ACTIVE', 'updated_at' => $updated_at ); // print_r($employee_details); // die(); $result = $this->yaskawa_model->update_employee($emp_id,$employee_details); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>"Updated successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } } public function email_authentication(){ $email_authentication=$this->input->post('email_authentication'); $result=$this->yaskawa_model->email_authentication($email_authentication); if($result){ echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } // single_quotation_update public function single_quotation_update() { $quo_date = $this->input->post('quo_date'); $amount = $this->input->post('amount'); $response_date = $this->input->post('response_date'); $probability_range = $this->input->post('probability_range'); $description = $this->input->post('description'); $lead_id = $this->input->post('lead_id'); $quotation_id = $this->input->post('quote_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updated_at = $date->format('Y-m-d H:i:s'); $quotation_details = array( 'lead_id' => $lead_id, 'quo_date' => $quo_date, 'response_date' => $response_date, 'probability' => $probability_range, 'amount' => $amount, 'description' => $description, 'delete_status' => 'ACTIVE', 'updated_at' => $updated_at ); $result = $this->yaskawa_model->single_quotation_update($quotation_id,$quotation_details); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>"Updated successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } } public function users_email_authentication(){ $email_authentication=$this->input->post('email_authentication'); $result=$this->yaskawa_model->users_email_authentication($email_authentication); if($result){ echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function verify_email() { $email = $this->input->post('email'); $result = $this->yaskawa_model->verify_email($email); // print_r($result); // die(); if($result){ echo json_encode(array('result'=>1,'id'=>$result)); } else { echo json_encode(array('result'=>0)); } } //new_events public function reset_password() { //$data['user_type_id'] = $this->access_id(); //$data['access'] = $this->access_details(); $data['user_id'] = $this->uri->segment(3); // print_r($user_id); // die(); $this->load->view('admin/reset_password',$data); } // update_password public function update_password() { $password = $this->input->post('password'); $password1 = $this->input->post('password1'); //$password1 = md5($this->input->post('password1')); $user_id = $this->input->post('user_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $updated_at = $date->format('Y-m-d H:i:s'); if($password == $password1){ $password_details = array( 'password' => md5($password1), 'delete_status' => 'ACTIVE', 'updated_at' => $updated_at ); // print_r($password_details); // die(); $result = $this->yaskawa_model->update_password($user_id,$password_details); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>"Updated successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } }else{ echo json_encode(array('result'=>0,'message'=>"Failed to update. Try again")); } } //////////////Access Control///////////////////// public function access_details() { $admin_id = $this->session->userdata('admin_id'); //$where=array('user_id'=>$id); //$approved_by=$admin_id; $where=array('user_id'=>$admin_id); $approved_by=$admin_id; $table='users'; $where=array('user_id'=>$approved_by); $d=$this->yaskawa_model->get_where_row($table,$where); //print_r($d); //die(); $data['user_type_id']=$d->department_id; $table='yaskawa_access_controls'; $where=array('department_id'=>$data['user_type_id']); return $this->yaskawa_model->get_where_row($table,$where); } public function access_id() { $admin_id = $this->session->userdata('admin_id'); $where=array('user_id'=>$admin_id); $approved_by=$admin_id; $table='users'; $where=array('user_id'=>$approved_by); $d=$this->yaskawa_model->get_where_row($table,$where); return $d->department_id; } public function add_access_menu() { $department_id = $this->input->post('department_id'); $menu_id = $this->input->post('menu_id'); $array = array(); foreach($menu_id as $val) { $array[] = $val; } $menu_ids = serialize($array); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $table = 'yaskawa_access_controls'; $data = array( 'menu_id' => $menu_ids, 'department_id' => $department_id, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $where = array('delete_status'=>'ACTIVE'); $depts = $this->yaskawa_model->get_where_result($table,$where); $dept_array = array(); foreach($depts as $value) { array_push($dept_array, $value->department_id); } if(in_array($department_id,$dept_array)) { $where_dept = array('department_id' => $department_id); $update_data = $data; $result = $this->yaskawa_model->update_access($where_dept,$table,$update_data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Access controls added successfully')); } else { echo json_encode(array('result'=>0)); } } else { $result = $this->yaskawa_model->insert_access($table,$data); if($result) { echo json_encode(array('result'=>1,'message'=>"Access controls added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } } public function add_access() { $data['menu'] = $this->yaskawa_model->get_all_menu_data(); //$data['sub_menu1'] = $this->yaskawa_model->get_all_sub_menu(); //print_r($data['menu']); //die(); $data['departments'] = $this->yaskawa_model->get_all_departments_data(); $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); //print_r($data['access']); //die(); //$data['userdetails'] = $this->session_data_pass(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/add_access',$data); } public function get_menu_list() { $table = 'yaskawa_menu'; $where = array('delete_status'=>'ACTIVE'); $result = $this->yaskawa_model->fetch_where_data($table,$where); //print_r($result); //die(); if($result) { echo json_encode(array('menu_list'=>$result,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function single_department_access() { $table = 'yaskawa_access_controls'; $department_id = $this->input->post('department_id'); $where = array('delete_status' =>'ACTIVE','department_id' =>$department_id); $result = $this->yaskawa_model->get_where_row($table,$where); if($result) { $access = unserialize($result->menu_id); //print_r($access); if($access) { echo json_encode(array('access'=>$access,'result'=>1)); } else { echo json_encode(array('result'=>0)); } } else { echo json_encode(array('result'=>0)); } } public function verify_lead_email() { $email = $this->input->post('email'); $result = $this->yaskawa_model->verify_lead_email_id($email); if($result){ echo json_encode(array('result'=>1,'id'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function verify_employee_email() { $email = $this->input->post('email'); $result = $this->yaskawa_model->verify_employee_email_id($email); if($result){ echo json_encode(array('result'=>1,'id'=>$result)); } else { echo json_encode(array('result'=>0)); } } //profile_info public function profile_info() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['single_details'] = $this->yaskawa_model->single_lead_details($lead_id); $data['pic_details'] = $this->yaskawa_model->get_pic_details($lead_id); $data['lead_details'] = $this->yaskawa_model->get_event_call_details($lead_id); $data['closed_details'] = $this->yaskawa_model->get_event_closed_details($lead_id); $data['notes_details'] = $this->yaskawa_model->get_notes_details($lead_id); $data['attachment_details'] = $this->yaskawa_model->get_attachment_details($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); // print_r($data['attachment_details']); // die(); $this->load->view('admin/profile_view',$data); } else { redirect('/'); } } public function profile_info1() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['single_details'] = $this->yaskawa_model->single_lead_details($lead_id); $data['pic_details'] = $this->yaskawa_model->get_pic_details($lead_id); $data['lead_details'] = $this->yaskawa_model->get_event_call_details($lead_id); $data['closed_details'] = $this->yaskawa_model->get_event_closed_details($lead_id); $data['notes_details'] = $this->yaskawa_model->get_notes_details($lead_id); $data['attachment_details'] = $this->yaskawa_model->get_attachment_details($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); // print_r($data['attachment_details']); // die(); $this->load->view('admin/profile_view1',$data); } else { redirect('/'); } } public function update_company_details(){ $id = $this->input->post('id'); $cname = $this->input->post('cname'); $Alias = $this->input->post('Alias'); $ecount = $this->input->post('ecount'); $Phone = $this->input->post('Phone'); $Mobile = $this->input->post('Mobile'); $Fax = $this->input->post('Fax'); $Website = $this->input->post('Website'); $Description = $this->input->post('Description'); $Super_Admin = $this->input->post('Super_Admin'); $Street = $this->input->post('Street'); $City = $this->input->post('City'); $State = $this->input->post('State'); $Zip_Code = $this->input->post('Zip_Code'); $Country = $this->input->post('Country'); $cdate = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $create_at = $cdate->format('Y-m-d H:i:s'); $company_details=array( 'Company_Name' => $cname, 'Alias' => $Alias, 'Employee_Count' => $ecount, 'Phone' => $Phone, 'Mobile' => $Mobile, 'Fax' => $Fax, 'Website' => $Website, 'Description' => $Description, 'Super_Admin' => $Super_Admin, 'Street' => $Street, 'City' => $City, 'State' => $State, 'Zip_Code' => $Zip_Code, 'Country' => $Country, 'create_at' => $create_at ); $result=$this->yaskawa_model->update_company_details($id,$company_details); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } //Acc_reports view public function Acc_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="acc_report_menu"; $where=array('report_status'=>'ACTIVE','delete_status'=>'ACTIVE'); $data['Acc_contents']=$this->yaskawa_model->Acc_contents($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $data['user_id']= $this->session->userdata('user_type_id'); $this->load->view('admin/Acc_reports',$data); } else { redirect('/'); } } public function Acc_favorite_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['acc_fav_reoprts'] = $this->yaskawa_model->Acc_favorite_reports(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_favorite_reports',$result); } else { redirect('/'); } } public function Acc_today_leads() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['acc_today_leads'] = $this->yaskawa_model->acc_todays_leads_list(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_lead_todays_list',$result); } else { redirect('/'); } } public function Acc_lead_status() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['acc_lead_status'] = $this->yaskawa_model->acc_leads_by_status(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_lead_status_list',$result); } else { redirect('/'); } } public function Acc_industry_leads() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['acc_industry_leads'] = $this->yaskawa_model->acc_leads_by_industry(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_lead_industry_list',$result); } else { redirect('/'); } } public function Acc_sales_source() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['acc_details'] = $this->yaskawa_model->acc_sales_source(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_potential_lead_source',$data); } else { redirect('/'); } } public function Acc_lead_conversion() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['acc_sales_across_owner']=$this->yaskawa_model->acc_sales_across_owner(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_sales_across_owners',$result); } else { redirect('/'); } } public function Acc_conversion_count() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['acc_sales_across_owner']=$this->yaskawa_model->acc_sales_across_owner(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_sales_count_across_owners',$result); } else { redirect('/'); } } public function Acc_conversion_industry() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['acc_sales_across_owner']=$this->yaskawa_model->acc_sales_across_owner(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_sales_across_industry',$result); } else { redirect('/'); } } public function Acc_lead_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="acc_report_menu"; $where=array('report_status'=>'ACTIVE','type'=>'Lead Reports'); $data['Acc_contents']=$this->yaskawa_model->acc_get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_lead_reports',$data); } else { redirect('/'); } } public function Acc_activity_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="acc_report_menu"; $where=array('report_status'=>'ACTIVE','type'=>'Activity Reports'); $data['Acc_contents']=$this->yaskawa_model->acc_get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_activity_reports',$data); } else { redirect('/'); } } public function Acc_sales_matrics_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="acc_report_menu"; $where=array('report_status'=>'ACTIVE','type'=>'Sales Metrics Reports'); $data['Acc_contents']=$this->yaskawa_model->acc_get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_sales_matrics_report',$data); } else { redirect('/'); } } public function Acc_todays_sales() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['acc_details'] = $this->yaskawa_model->acc_todays_sales(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_potential_todays_sales',$data); } else { redirect('/'); } } public function Acc_converted_leads() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['acc_details'] = $this->yaskawa_model->acc_converted_leads(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_lead_converted_list',$data); } else { redirect('/'); } } public function Acc_month_sale() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['acc_details'] = $this->yaskawa_model->acc_month_sale(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_potential_sales_this_month',$data); } else { redirect('/'); } } public function Acc_event_task() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['acc_details'] = $this->yaskawa_model->acc_task($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_activity_task_event_list',$data); } else { redirect('/'); } } public function Acc_call_status() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['acc_details'] = $this->yaskawa_model->acc_call_status($lead_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_activity_call_status',$data); } else { redirect('/'); } } public function Acc_conversion_source() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['acc_sales_across_source']=$this->yaskawa_model->acc_sales_across_source(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_sales_across_source',$result); } else { redirect('/'); } } public function Acc_update_favorite_reports() { $acc_report_id = $this->input->post('acc_report_id'); $data = array('acc_favorite_report'=>'yes'); $result = $this->yaskawa_model->acc_update_favorite_reports($acc_report_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function delete_post() { $feeds_id = $this->uri->segment(2); $data = array('delete_status'=>'INACTIVE'); $this->yaskawa_model->feeds_update_status($feeds_id,$data); redirect('lead-feeds'); } public function notification() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/notification',$data); } else { redirect('/'); } } public function account_notification() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/account_notification',$data); } else { redirect('/'); } } public function quotation_notification() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/quotation_notification',$data); } else { redirect('/'); } } public function invoice_notification() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $lead_id = $this->uri->segment(2); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/invoice_notification',$data); } else { redirect('/'); } } public function get_todays_notifications() { $result = $this->yaskawa_model->get_todays_notifications(); //$results = $this->yaskawa_model->get_quotations(); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function get_alldays_notifications() { $result = $this->yaskawa_model->get_alldays_notifications(); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function get_thisweek_notifications() { $array = array(); $timestamp = time(); for ($i = 0 ; $i < 7 ; $i++) { $dates = date('Y-m-d', $timestamp); $timestamp -= 24 * 3600; array_push($array,$dates); } $result = $this->yaskawa_model->get_thisweek_notifications($array); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getacc_todays_notifications() { $result = $this->yaskawa_model->getacc_todays_notifications(); //$results = $this->yaskawa_model->get_quotations(); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getacc_alldays_notifications() { $result = $this->yaskawa_model->getacc_alldays_notifications(); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getacc_thisweek_notifications() { $array = array(); $timestamp = time(); for ($i = 0 ; $i < 7 ; $i++) { $dates = date('Y-m-d', $timestamp); $timestamp -= 24 * 3600; array_push($array,$dates); } $result = $this->yaskawa_model->getacc_thisweek_notifications($array); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getquot_todays_notifications() { $result = $this->yaskawa_model->getquot_todays_notifications(); //$results = $this->yaskawa_model->get_quotations(); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getquot_alldays_notifications() { $result = $this->yaskawa_model->getquot_alldays_notifications(); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getquot_thisweek_notifications() { $array = array(); $timestamp = time(); for ($i = 0 ; $i < 7 ; $i++) { $dates = date('Y-m-d', $timestamp); $timestamp -= 24 * 3600; array_push($array,$dates); } $result = $this->yaskawa_model->getquot_thisweek_notifications($array); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getinv_todays_notifications() { $result = $this->yaskawa_model->getinv_todays_notifications(); //$results = $this->yaskawa_model->get_quotations(); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getinv_alldays_notifications() { $result = $this->yaskawa_model->getinv_alldays_notifications(); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function getinv_thisweek_notifications() { $array = array(); $timestamp = time(); for ($i = 0 ; $i < 7 ; $i++) { $dates = date('Y-m-d', $timestamp); $timestamp -= 24 * 3600; array_push($array,$dates); } $result = $this->yaskawa_model->getinv_thisweek_notifications($array); if($result) { echo json_encode(array('result'=>1,'total'=>count($result),'notifications'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function smr_data_filter(){ $date=$this->input->post('date'); $created_at = date("m", strtotime($date)); $result=$this->yaskawa_model->smr_data_filter($created_at); if($result) { echo json_encode(array('date_result'=>$result,'result'=>1)); } else { echo json_encode(array('date_result'=>$result,'result'=>0)); } } public function sales_manager_record() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $result['user_type_id'] = $this->access_id(); $result['access'] = $this->access_details(); $result['login_person_data']=$this->yaskawa_model->login_person($admin_id); $result['acc_today_leads'] = $this->yaskawa_model->acc_todays_leads_list(); $result['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/sales_manager_record',$result); } else { redirect('/'); } } public function lead_home() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['today_leads'] = $this->yaskawa_model->today_leads(); $data['home_employee'] = $this->yaskawa_model->home_employee(); // print_r($data['home_employee']); // die(); $data['accounts_list']=$this->yaskawa_model->home_accounts_list(); $data['open_tasks']=$this->yaskawa_model->open_tasks(); $data['user_id']= $this->session->userdata('user_type_id'); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/lead_home',$data); //redirect('yaskawa/lead_home',$data); } else { redirect('/'); } } public function social_media(){ $ids=$this->input->post("ids"); $social_media1=$this->input->post("social_media1"); $social_media2=$this->input->post("social_media2"); $social_media3=$this->input->post("social_media3"); if($social_media1){ $social_media_update=array('Twitter'=>$social_media1); $result=$this->yaskawa_model->social_media($ids,$social_media_update); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } if($social_media2){ $social_media_update=array('Facebook'=>$social_media2); $result=$this->yaskawa_model->social_media($ids,$social_media_update); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } if($social_media3){ $social_media_update=array('Google'=>$social_media3); $result=$this->yaskawa_model->social_media($ids,$social_media_update); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } } public function acc_recently_deleted_reports() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $table="acc_report_menu"; $where=array('report_status'=>'ACTIVE','delete_status'=>'DEACTIVE'); $data['content']=$this->yaskawa_model->acc_get_alldata($table,$where); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/acc_recently_deleted_reports',$data); } else { redirect('/'); } } public function acc_restore_reports() { $acc_report_id=$this->input->post('acc_report_id'); $data=array('delete_status'=>'ACTIVE'); $this->yaskawa_model->acc_delete_report($acc_report_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } public function acc_remove_reports() { $acc_report_id=$this->input->post('acc_report_id'); $data=array('delete_status'=>'DELETED'); $this->yaskawa_model->acc_delete_report($acc_report_id,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } public function acc_remove_records() { $record_ids=$this->input->post('report_ids'); $data=array('delete_status'=>'DEACTIVE'); $this->yaskawa_model->acc_delete_report($record_ids,$data); if($this->db->affected_rows() > 0) { echo json_encode(array('result'=>1,'message'=>'Deleted successfully')); } else { echo json_encode(array('result'=>0)); } } public function delete_lead_source(){ $source_id=$this->input->post('source_id'); $data=array('delete_status'=>'INACTIVE'); $result=$this->yaskawa_model->delete_lead_source($source_id,$data); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function delete_lead_industry(){ $industry_id=$this->input->post('industry_id'); $data=array('delete_status'=>'INACTIVE'); $result=$this->yaskawa_model->delete_lead_industry($industry_id,$data); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function delete_lead_status(){ $status_id=$this->input->post('status_id'); $data=array('delete_status'=>'INACTIVE'); $result=$this->yaskawa_model->delete_lead_status($status_id,$data); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function delete_rating(){ $rating_id=$this->input->post('rating_id'); $data=array('delete_status'=>'INACTIVE'); $result=$this->yaskawa_model->delete_rating($rating_id,$data); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function delete_account_type(){ $account_id=$this->input->post('account_id'); $data=array('delete_status'=>'INACTIVE'); $result=$this->yaskawa_model->delete_account_type($account_id,$data); if($result) { echo json_encode(array('result'=>1,'res'=>$result)); } else { echo json_encode(array('result'=>0)); } } public function lead_details_update() { $lids = $this->input->post('lids'); $lead_owner = $this->input->post('lead_owner'); $company_name = $this->input->post('company_name'); $last_name = $this->input->post('last_name'); $lead_title = $this->input->post('lead_title'); $email = $this->input->post('email'); $phone = $this->input->post('phone'); $fax = $this->input->post('fax'); $mobile = $this->input->post('mobile'); $website = $this->input->post('website'); $lead_source = $this->input->post('lead_source'); $industry = $this->input->post('industry'); $no_of_employees = $this->input->post('no_of_employees'); $annual_revenue = $this->input->post('annual_revenue'); $ratings = $this->input->post('ratings'); $email_otp = $this->input->post('email_otp'); $street = $this->input->post('street'); $city = $this->input->post('city'); $state = $this->input->post('state'); $zip_code = $this->input->post('zip_code'); $country = $this->input->post('country'); $Cperson = $this->input->post('Cperson'); $Cphone = $this->input->post('Cphone'); $cType = $this->input->post('cType'); $lprocess = $this->input->post('lprocess'); $description = $this->input->post('description'); $lead_details_update = array( 'lead_owner' => $lead_owner, 'company_name' => $company_name, 'last_name' => $last_name, 'lead_title' => $lead_title, 'email' => $email, 'phone' => $phone, 'website' => $website, 'fax' => $fax, 'mobile' => $mobile, 'lead_source' => $lead_source, 'industry' => $industry, 'no_of_employees' => $no_of_employees, 'annual_revenue' => $annual_revenue, 'ratings' => $ratings, 'email_otp' => $email_otp, 'street' => $street, 'city' => $city, 'state' => $state, 'zip_code' => $zip_code, 'country' => $country, 'Cperson' => $Cperson, 'Cphone' => $Cphone, 'cType' => $cType, 'lprocess' => $lprocess, 'description' => $description, 'delete_status' => 'ACTIVE', ); $result = $this->yaskawa_model->lead_details_update($lids,$lead_details_update); if($result) { echo json_encode(array('result'=>1,'message'=>"Lead added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function master_page() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $user_data['user_type_id'] = $this->access_id(); $user_data['access'] = $this->access_details(); $user_data['lead_source']=$this->yaskawa_model->get_lead_source_details(); $user_data['lead_ratings']=$this->yaskawa_model->get_lead_ratings_details(); $user_data['lead_status']=$this->yaskawa_model->get_lead_status_details(); $user_data['lead_industry']=$this->yaskawa_model->get_lead_industry_details(); $user_data['honorific']=$this->yaskawa_model->get_honorific(); $user_data['customer_type']=$this->yaskawa_model->get_customer_type(); $user_data['lead_process']=$this->yaskawa_model->get_lead_process(); $user_data['company_details']=$this->yaskawa_model->fetch_company_details(); $user_data['login_person_data']=$this->yaskawa_model->login_person($admin_id); $user_data['roles_list_admin'] = $this->yaskawa_model->get_all_roles_admin(); $user_data['account_type'] = $this->yaskawa_model->get_account_type(); $this->load->view('admin/master_page',$user_data); } else { redirect('/'); } } public function insert_master_page(){ $ids=$this->input->post("ids"); $master_data=$this->input->post('master_data'); if($master_data == 1){ if( $ids == ""){ $enter_data=$this->input->post('enter_data'); $data=array('lead_source_name'=>$enter_data); $result=$this->yaskawa_model->insert_lead_source1($data); redirect('yaskawa/master_page',$result); }else{ $enter_data=$this->input->post('enter_data'); $data=array('lead_source_name'=>$enter_data); $result=$this->yaskawa_model->update_lead_source1($ids,$data); redirect('yaskawa/master_page',$result); } }else if($master_data == 2){ if( $ids == ""){ $enter_data=$this->input->post('enter_data'); $data=array('industry_name'=>$enter_data); $result=$this->yaskawa_model->insert_industry1($data); redirect('yaskawa/master_page',$result); }else{ $enter_data=$this->input->post('enter_data'); $data=array('industry_name'=>$enter_data); $result=$this->yaskawa_model->update_industry1($ids,$data); redirect('yaskawa/master_page',$result); } }else if($master_data == 3){ if($ids == ""){ $enter_data=$this->input->post('enter_data'); $data=array('lead_status_name'=>$enter_data); $result=$this->yaskawa_model->insert_lead_status1($data); redirect('yaskawa/master_page',$result); }else{ $enter_data=$this->input->post('enter_data'); $data=array('lead_status_name'=>$enter_data); $result=$this->yaskawa_model->update_lead_status1($ids,$data); redirect('yaskawa/master_page',$result); } }else if($master_data == 4){ if( $ids == ""){ $enter_data=$this->input->post('enter_data'); $data=array('ratings'=>$enter_data); $result=$this->yaskawa_model->insert_rating1($data); if($result) redirect('yaskawa/master_page',$result); }else{ $enter_data=$this->input->post('enter_data'); $data=array('ratings'=>$enter_data); $result=$this->yaskawa_model->update_rating1($ids,$data); redirect('yaskawa/master_page',$result); } }else if($master_data == 5){ if( $ids == ""){ $enter_data=$this->input->post('enter_data'); $data=array('account_type'=>$enter_data); $result=$this->yaskawa_model->insert_account_type1($data); redirect('yaskawa/master_page',$result); }else{ $enter_data=$this->input->post('enter_data'); $data=array('account_type'=>$enter_data); $result=$this->yaskawa_model->update_account_type1($ids,$data); redirect('yaskawa/master_page',$result); } }else if($master_data == 6){ if( $ids == ""){ $enter_data=$this->input->post('enter_data'); $data=array('honorific'=>$enter_data); $result=$this->yaskawa_model->insert_honorific($data); redirect('yaskawa/master_page',$result); }else{ $enter_data=$this->input->post('enter_data'); $data=array('honorific'=>$enter_data); $result=$this->yaskawa_model->update_honorific1($ids,$data); redirect('yaskawa/master_page',$result); } }else if($master_data == 7){ if( $ids == ""){ $enter_data=$this->input->post('enter_data'); $data=array('customer_type'=>$enter_data); $result=$this->yaskawa_model->insert_customer_type($data); redirect('yaskawa/master_page',$result); }else{ $enter_data=$this->input->post('enter_data'); $data=array('customer_type'=>$enter_data); $result=$this->yaskawa_model->update_customer_type1($ids,$data); redirect('yaskawa/master_page',$result); } }else if($master_data == 8){ if( $ids == ""){ $enter_data=$this->input->post('enter_data'); $data=array('lead_process'=>$enter_data); $result=$this->yaskawa_model->insert_lead_process($data); redirect('yaskawa/master_page',$result); }else{ $enter_data=$this->input->post('enter_data'); $data=array('lead_process'=>$enter_data); $result=$this->yaskawa_model->update_lead_process1($ids,$data); redirect('yaskawa/master_page',$result); } } } public function edit_lead_source(){ $source_id=$this->input->post('source_id'); $data=array('delete_status'=>'ACTIVE'); $result=$this->yaskawa_model->edit_lead_source($source_id,$data); echo json_encode($result); } public function edit_lead_industry(){ $industry_id=$this->input->post('industry_id'); $data=array('delete_status'=>'ACTIVE'); $result=$this->yaskawa_model->edit_lead_industry($industry_id,$data); echo json_encode($result); } public function edit_lead_status(){ $status_id=$this->input->post('status_id'); $data=array('delete_status'=>'ACTIVE'); $result=$this->yaskawa_model->edit_lead_status($status_id,$data); echo json_encode($result); } public function edit_rating(){ $rating_id=$this->input->post('rating_id'); $data=array('delete_status'=>'ACTIVE'); $result=$this->yaskawa_model->edit_rating($rating_id,$data); echo json_encode($result); } public function edit_account_type(){ $account_id=$this->input->post('account_id'); $data=array('delete_status'=>'ACTIVE'); $result=$this->yaskawa_model->edit_account_type($account_id,$data); echo json_encode($result); } public function edit_honorific(){ $honorific_id=$this->input->post('honorific_id'); $data=array('delete_status'=>'ACTIVE'); $result=$this->yaskawa_model->edit_honorific($honorific_id,$data); echo json_encode($result); } public function edit_customer_type(){ $customer_type_id=$this->input->post('customer_type_id'); $data=array('delete_status'=>'ACTIVE'); $result=$this->yaskawa_model->edit_customer_type($customer_type_id,$data); echo json_encode($result); } public function edit_lead_process(){ $lead_process_id=$this->input->post('lead_process_id'); $data=array('delete_status'=>'ACTIVE'); $result=$this->yaskawa_model->edit_lead_process($lead_process_id,$data); echo json_encode($result); } public function add_account(){ $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['user_name']= $this->session->userdata('user_name'); $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['lead_ratings']=$this->yaskawa_model->get_lead_ratings_details(); $data['industry_details']=$this->yaskawa_model->get_lead_industry_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/add_account',$data); } else { redirect('/'); } } public function add_potential(){ $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_name']= $this->session->userdata('user_name'); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['potential_details']=$this->yaskawa_model->select_new_potential($role_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/add_potential',$data); } else { redirect('/'); } } public function potentials_list(){ $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['potential_data']=$this->yaskawa_model->select_new_potential($role_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potentials_list',$data); } else { redirect('/'); } } public function add_new_account(){ $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); $role_id = $this->session->userdata('role_id'); $account_owner = $this->input->post('account_owner'); $rating = $this->input->post('rating'); $name_type = $this->input->post('name_type'); $account_name = $this->input->post('account_name'); $phone = $this->input->post('phone'); $account_site = $this->input->post('account_site'); $fax = $this->input->post('fax'); $parent_account = $this->input->post('parent_account'); $website = $this->input->post('website'); $account_number = $this->input->post('account_number'); $ticker_symbol = $this->input->post('ticker_symbol'); $account_type = $this->input->post('account_type'); $ownership = $this->input->post('ownership'); $industry = $this->input->post('industry'); $employees = $this->input->post('employees'); $annual_revenue = $this->input->post('annual_revenue'); $sic_code = $this->input->post('sic_code'); $billing_street = $this->input->post('billing_street'); $shipping_street = $this->input->post('shipping_street'); $billing_city = $this->input->post('billing_city'); $shipping_city = $this->input->post('shipping_city'); $billing_state = $this->input->post('billing_state'); $shipping_state = $this->input->post('shipping_state'); $billing_code = $this->input->post('billing_code'); $shipping_code = $this->input->post('shipping_code'); $billing_country = $this->input->post('billing_country'); $shipping_country = $this->input->post('shipping_country'); $description = $this->input->post('description'); $data=array( 'user_id' => $admin_id, 'role_id' => $role_id, 'role_id' => $role_id, 'account_owner' => $account_owner, 'rating' => $rating, 'name_type' => $name_type, 'account_name' => $account_name, 'phone' => $phone, 'account_site' => $account_site, 'fax' => $fax, 'parent_account' => $parent_account, 'website' => $website, 'account_number' => $account_number, 'ticker_symbol' => $ticker_symbol, 'account_type' => $account_type, 'ownership' => $ownership, 'industry' => $industry, 'employees' => $employees, 'annual_revenue' => $annual_revenue, 'sic_code' => $sic_code, 'billing_street' => $billing_street, 'shipping_street' => $shipping_street, 'billing_city' => $billing_city, 'shipping_city' => $shipping_city, 'billing_state' => $billing_state, 'shipping_state' => $shipping_state, 'billing_code' => $billing_code, 'shipping_code' => $shipping_code, 'billing_country' => $billing_country, 'shipping_country' => $shipping_country, 'description' => $description, 'delete_status' => 'ACTIVE', ); $result=$this->yaskawa_model->add_new_account($data); if($result) { echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function add_new_potential(){ $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); $potential_owner = $this->input->post('potential_owner'); $amount = $this->input->post('amount'); $potential_type = $this->input->post('potential_type'); $potential_name = $this->input->post('potential_name'); $closing_date = date("Y-m-d", strtotime($this->input->post('closing_date'))); $account_name = $this->input->post('account_name'); $stage = $this->input->post('stage'); $type = $this->input->post('type'); $probability = $this->input->post('probability'); $next_step = $this->input->post('next_step'); $expected_revenue = $this->input->post('expected_revenue'); $lead_source = $this->input->post('lead_source'); $campaign_source = $this->input->post('campaign_source'); $contact_name = $this->input->post('contact_name'); $description = $this->input->post('description'); $data=array( 'user_id' => $admin_id, 'role_id' => $role_id, 'potential_owner' => $potential_owner, 'amount' => $amount, 'potential_type' => $potential_type, 'potential_name' => $potential_name, 'closing_date' => $closing_date, 'account_name' => $account_name, 'stage' => $stage, 'type' => $type, 'probability' => $probability, 'next_step' => $next_step, 'expected_revenue' => $expected_revenue, 'lead_source' => $lead_source, 'campaign_source' => $campaign_source, 'contact_name' => $contact_name, 'description' => $description, 'delete_status' => 'ACTIVE', ); $result=$this->yaskawa_model->add_new_potential($data); if($result) { echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function accounts_details_update() { $acc_lids = $this->input->post('acc_lids'); $account_owner = $this->input->post('account_owner'); $rating = $this->input->post('rating'); $name_type = $this->input->post('name_type'); $account_name = $this->input->post('account_name'); $phone = $this->input->post('phone'); $account_site = $this->input->post('account_site'); $fax = $this->input->post('fax'); $parent_account = $this->input->post('parent_account'); $website = $this->input->post('website'); $account_number = $this->input->post('account_number'); $ticker_symbol = $this->input->post('ticker_symbol'); $account_type = $this->input->post('account_type'); $ownership = $this->input->post('ownership'); $industry = $this->input->post('industry'); $employees = $this->input->post('employees'); $annual_revenue = $this->input->post('annual_revenue'); $sic_code = $this->input->post('sic_code'); $billing_street = $this->input->post('billing_street'); $shipping_street = $this->input->post('shipping_street'); $billing_city = $this->input->post('billing_city'); $shipping_city = $this->input->post('shipping_city'); $billing_state = $this->input->post('billing_state'); $shipping_state = $this->input->post('shipping_state'); $billing_code = $this->input->post('billing_code'); $shipping_code = $this->input->post('shipping_code'); $billing_country = $this->input->post('billing_country'); $shipping_country = $this->input->post('shipping_country'); $description = $this->input->post('description'); $data=array( 'account_owner' => $account_owner, 'rating' => $rating, 'name_type' => $name_type, 'account_name' => $account_name, 'phone' => $phone, 'account_site' => $account_site, 'fax' => $fax, 'parent_account' => $parent_account, 'website' => $website, 'account_number' => $account_number, 'ticker_symbol' => $ticker_symbol, 'account_type' => $account_type, 'ownership' => $ownership, 'industry' => $industry, 'employees' => $employees, 'annual_revenue' => $annual_revenue, 'sic_code' => $sic_code, 'billing_street' => $billing_street, 'shipping_street' => $shipping_street, 'billing_city' => $billing_city, 'shipping_city' => $shipping_city, 'billing_state' => $billing_state, 'shipping_state' => $shipping_state, 'billing_code' => $billing_code, 'shipping_code' => $shipping_code, 'billing_country' => $billing_country, 'shipping_country' => $shipping_country, 'description' => $description, 'delete_status' => 'ACTIVE', ); $result = $this->yaskawa_model->accounts_details_update($acc_lids,$data); if($result) { echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function add_contact(){ $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_name']= $this->session->userdata('user_name'); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['lead_source']=$this->yaskawa_model->get_lead_source_details(); $data['potential_details']=$this->yaskawa_model->select_new_potential($admin_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/add_contact',$data); } else { redirect('/'); } } public function add_new_contact(){ $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); $contact_owner = $this->input->post('contact_owner'); $lead_source = $this->input->post('lead_source'); $name_type = $this->input->post('name_type'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $account_name = $this->input->post('account_name'); $title = $this->input->post('title'); $Email = $this->input->post('Email'); $department = $this->input->post('department'); $phone = $this->input->post('phone'); $home_phone = $this->input->post('home_phone'); $other_phone = $this->input->post('other_phone'); $fax = $this->input->post('fax'); $mobile = $this->input->post('mobile'); $DOB = date("Y-m-d", strtotime($this->input->post('DOB'))); $assistant = $this->input->post('assistant'); $asst_phone = $this->input->post('asst_phone'); $report_to = $this->input->post('report_to'); $email_otp_out = $this->input->post('email_otp_out'); $skype_id = $this->input->post('skype_id'); $secondary_email = $this->input->post('secondary_email'); $twitter = $this->input->post('twitter'); $mailing_street = $this->input->post('mailing_street'); $other_street = $this->input->post('other_street'); $mailing_city = $this->input->post('mailing_city'); $other_city = $this->input->post('other_city'); $mailing_state = $this->input->post('mailing_state'); $other_state = $this->input->post('other_state'); $mailing_zip_code = $this->input->post('mailing_zip_code'); $other_zip_code = $this->input->post('other_zip_code'); $mailing_country = $this->input->post('mailing_country'); $other_country = $this->input->post('other_country'); $description = $this->input->post('description'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $data=array( 'user_id' => $admin_id, 'role_id' => $role_id, 'contact_owner' => $contact_owner, 'lead_source' => $lead_source, 'name_type' => $name_type, 'first_name' => $first_name, 'last_name' => $last_name, 'account_name' => $account_name, 'title' => $title, 'Email' => $Email, 'department' => $department, 'phone' => $phone, 'home_phone' => $home_phone, 'other_phone' => $other_phone, 'fax' => $fax, 'mobile' => $mobile, 'DOB' => $DOB, 'assistant' => $assistant, 'asst_phone' => $asst_phone, 'report_to' => $report_to, 'email_otp_out' => $email_otp_out, 'skype_id' => $skype_id, 'secondary_email' => $secondary_email, 'twitter' => $twitter, 'mailing_street' => $mailing_street, 'other_street' => $other_street, 'mailing_city' => $mailing_city, 'other_city' => $other_city, 'mailing_state' => $mailing_state, 'other_state' => $other_state, 'mailing_zip_code' => $mailing_zip_code, 'other_zip_code' => $other_zip_code, 'mailing_country' => $mailing_country, 'other_country' => $other_country, 'description' => $description, 'created_at' => $created_at, 'delete_status' => 'ACTIVE', ); $result=$this->yaskawa_model->add_new_contact($data); if($result) { echo json_encode(array('result'=>1)); } else { echo json_encode(array('result'=>0)); } } public function contact_info(){ $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $id = $this->uri->segment(2); $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_name']= $this->session->userdata('user_name'); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['attachments']=$this->yaskawa_model->contact_attachments1($id); $data['lead_source']=$this->yaskawa_model->get_lead_source_details(); $data['closed_activities'] = $this->yaskawa_model->contact_closed_details($id); $data['activities']=$this->yaskawa_model->contact_activities1($id); $data['contact_details'] = $this->yaskawa_model->single_contact_details($id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/contact_info',$data); } else { redirect('/'); } } public function closed_contact() { $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $id = $this->uri->segment(2); $dat=array('delete_status'=>'CLOSE'); $this->yaskawa_model->contact_closed($id,$dat); $det=$this->yaskawa_model->get_row1($id); $contact_id=$det->contact_id; $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_name'] = $this->session->userdata('user_name'); $data['user_details'] = $this->yaskawa_model->get_user_details(); $data['lead_source']=$this->yaskawa_model->get_lead_source_details(); $data['closed_activities'] = $this->yaskawa_model->contact_closed_details($contact_id); $data['attachments'] = $this->yaskawa_model->contact_attachments1($contact_id); $data['activities'] = $this->yaskawa_model->contact_activities1($contact_id); $data['contact_details'] = $this->yaskawa_model->single_contact_details($contact_id); $data['company_details'] = $this->yaskawa_model->fetch_company_details(); $this->load->view('admin/contact_info',$data); } else { redirect('/'); } } public function contact_list(){ $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $data['contact_data']=$this->yaskawa_model->contact_list($role_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/contact_list',$data); } else { redirect('/'); } } public function contact_details_update() { $cont_lids = $this->input->post('cont_lids'); $Contact_Owner = $this->input->post('Contact_Owner'); $Lead_Source = $this->input->post('Lead_Source'); $name_type = $this->input->post('name_type'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $account_name = $this->input->post('account_name'); $title = $this->input->post('title'); $Email = $this->input->post('Email'); $department = $this->input->post('department'); $phone = $this->input->post('phone'); $home_phone = $this->input->post('home_phone'); $other_phone = $this->input->post('other_phone'); $fax = $this->input->post('fax'); $mobile = $this->input->post('mobile'); $dob = date("Y-m-d", strtotime($this->input->post('dob'))); $Assistant = $this->input->post('Assistant'); $asst_phone = $this->input->post('asst_phone'); $report_to = $this->input->post('report_to'); $email_otp_out = $this->input->post('email_otp_out'); $skype_id = $this->input->post('skype_id'); $Secondary_email = $this->input->post('Secondary_email'); $twitter = $this->input->post('twitter'); $Mailing_Street = $this->input->post('Mailing_Street'); $Other_Street = $this->input->post('Other_Street'); $Mailing_City = $this->input->post('Mailing_City'); $Other_City = $this->input->post('Other_City'); $Mailing_State = $this->input->post('Mailing_State'); $Other_State = $this->input->post('Other_State'); $Mailing_Code = $this->input->post('Mailing_Code'); $Other_Code = $this->input->post('Other_Code'); $Mailing_Country = $this->input->post('Mailing_Country'); $Other_Country = $this->input->post('Other_Country'); $description = $this->input->post('description'); $data=array( 'contact_owner' => $Contact_Owner, 'lead_source' => $Lead_Source, 'name_type' => $name_type, 'first_name' => $first_name, 'last_name' => $last_name, 'account_name' => $account_name, 'title' => $title, 'Email' => $Email, 'department' => $department, 'phone' => $phone, 'home_phone' => $home_phone, 'other_phone' => $other_phone, 'fax' => $fax, 'mobile' => $mobile, 'DOB' => $dob, 'assistant' => $Assistant, 'asst_phone' => $asst_phone, 'report_to' => $report_to, 'email_otp_out' => $email_otp_out, 'skype_id' => $skype_id, 'secondary_email' => $Secondary_email, 'twitter' => $twitter, 'mailing_street' => $Mailing_Street, 'other_street' => $Other_Street, 'mailing_city' => $Mailing_City, 'other_city' => $Other_City, 'mailing_state' => $Mailing_State, 'other_state' => $Other_State, 'mailing_zip_code' => $Mailing_Code, 'other_zip_code' => $Other_Code, 'mailing_country' => $Mailing_Country, 'other_country' => $Other_Country, 'description' => $description, 'delete_status' => 'ACTIVE', ); $result = $this->yaskawa_model->contact_details_update($cont_lids,$data); if($result) { echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function potential_details_update() { $pot_lids = $this->input->post('pot_lids'); $Potential_Owner = $this->input->post('Potential_Owner'); $amount = $this->input->post('amount'); $potential_type = $this->input->post('potential_type'); $potential_name = $this->input->post('potential_name'); $closing_date = date("Y-m-d", strtotime($this->input->post('closing_date'))); $account_name = $this->input->post('account_name'); $stage = $this->input->post('stage'); $type = $this->input->post('type'); $probability = $this->input->post('probability'); $next_step = $this->input->post('next_step'); $expected_revenue = $this->input->post('expected_revenue'); $lead_source_name = $this->input->post('lead_source_name'); $campaign_source = $this->input->post('campaign_source'); $contact_name = $this->input->post('contact_name'); $description = $this->input->post('description'); $data=array( 'potential_owner' => $Potential_Owner, 'amount' => $amount, 'potential_type' => $potential_type, 'potential_name' => $potential_name, 'closing_date' => $closing_date, 'account_name' => $account_name, 'stage' => $stage, 'type' => $type, 'probability' => $probability, 'next_step' => $next_step, 'expected_revenue' => $expected_revenue, 'lead_source' => $lead_source_name, 'campaign_source' => $campaign_source, 'contact_name' => $contact_name, 'description' => $description, 'delete_status' => 'ACTIVE', ); $result = $this->yaskawa_model->potential_details_update($pot_lids,$data); if($result) { echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function contact_attach_file(){ $contact_id = $this->input->post('contact_id'); $attach_file = $this->input->post('attach_file'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['attach_file']['name'])) { $file_name = ""; } else { $target='attach_file/'; $target.=time().$_FILES['attach_file']['name']; $file_name=time().$_FILES['attach_file']['name']; $image=$target; move_uploaded_file($_FILES['attach_file']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $data=array( "contact_id" => $contact_id, "type" => "Attached File", "attach_file" => $file_name, "delete_status" => "ACTIVE", "created_at" => $created_at, ); $result=$this->yaskawa_model->contact_attachments($data); if($result){ echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function contact_attach_url(){ $contact_id = $this->input->post('contact_id'); $enter_url = $this->input->post('enter_url'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $data=array( "contact_id" => $contact_id, "type" => "Link URL", "link_url" => $enter_url, "delete_status" => "ACTIVE", "created_at" => $created_at, ); $result=$this->yaskawa_model->contact_attachments($data); if($result){ echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function contact_newtask(){ $contact_id = $this->input->post('contact_id'); $subject = $this->input->post('subject'); $due_date = date("Y-m-d", strtotime($this->input->post('due_date'))); $priority = $this->input->post('priority'); $owner = $this->input->post('owner'); $status = $this->input->post('status'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $data=array( "contact_id" => $contact_id, "type" => "Task", "subject" => $subject, "due_date" => $due_date, "priority" => $priority, "owner" => $owner, "status" => $status, "created_at" => $created_at, ); $result=$this->yaskawa_model->contact_activities($data); if($result){ echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function contact_newevents() { $contact_id = $this->input->post('contact_id'); $all_day = $this->input->post('all_day'); $from_date = date("Y-m-d", strtotime($this->input->post('from_date'))); $to_date = date("Y-m-d", strtotime($this->input->post('to_date'))); $host = $this->input->post('host'); $participants = $this->input->post('participants'); $related_to = $this->input->post('related_to'); $lead = $this->input->post('lead'); $description = $this->input->post('description'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $event_details = array( 'contact_id' => $contact_id, 'type' => 'Event', 'all_day' => $all_day, 'start_date' => $from_date, 'end_date' => $to_date, 'host' => $host, 'participants' => $participants, 'related_to' => $related_to, 'lead' => $lead, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->contact_activities($event_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function contact_createcall() { $contact_id = $this->input->post('contact_id'); $subject = $this->input->post('subject'); $call_type = $this->input->post('call_type'); $call_purpose = $this->input->post('call_purpose'); $contact_name = $this->input->post('contact_name'); $call_details = $this->input->post('call_details'); $call_timer = $this->input->post('call_timer'); $call_duration = $this->input->post('call_duration'); $description = $this->input->post('description'); $call_result = $this->input->post('call_result'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $event_details = array( 'contact_id' => $contact_id, 'type' => 'Call', 'subject' => $subject, 'call_type' => $call_type, 'call_purpose' => $call_purpose, 'contact_name' => $contact_name, 'call_details' => $call_details, 'call_timer' => $call_timer, 'call_duration' => $call_duration, 'description' => $description, 'call_result' => $call_result, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($event_details); // die(); $result = $this->yaskawa_model->contact_activities($event_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function potential_info(){ $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $id = $this->uri->segment(2); $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_name']= $this->session->userdata('user_name'); $data['contact_data']=$this->yaskawa_model->contact_list1($id); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['honorific']=$this->yaskawa_model->get_honorific(); $data['stage_history']=$this->yaskawa_model->stage_master_update1($id); $data['competitor']=$this->yaskawa_model->potential_competitor1($id); $data['lead_source']=$this->yaskawa_model->get_lead_source_details(); $data['activities']=$this->yaskawa_model->potential_activities1($id); $data['attachments']=$this->yaskawa_model->potential_attachments1($id); $data['potential_details'] = $this->yaskawa_model->single_potential_details($id); $data['closed_activities'] = $this->yaskawa_model->potential_closed_details($id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_info',$data); } else { redirect('/'); } } public function closed_potential(){ $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $id = $this->uri->segment(2); $dat=array('delete_status'=>'CLOSE'); $this->yaskawa_model->potential_closed($id,$dat); $det=$this->yaskawa_model->get_row2($id); $potential_id=$det->potential_id; $data['honorific']=$this->yaskawa_model->get_honorific(); $data['user_name']= $this->session->userdata('user_name'); $data['contact_data']=$this->yaskawa_model->contact_list1($potential_id); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['stage_history']=$this->yaskawa_model->stage_master_update1($potential_id); $data['lead_source']=$this->yaskawa_model->get_lead_source_details(); $data['competitor']=$this->yaskawa_model->potential_competitor1($potential_id); $data['activities']=$this->yaskawa_model->potential_activities1($potential_id); $data['attachments']=$this->yaskawa_model->potential_attachments1($potential_id); $data['potential_details'] = $this->yaskawa_model->single_potential_details($potential_id); $data['closed_activities'] = $this->yaskawa_model->potential_closed_details($potential_id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_info',$data); } else { redirect('/'); } } public function potential_attach_file(){ $potential_id = $this->input->post('potential_id'); $attach_file = $this->input->post('attach_file'); $this->load->library('image_lib'); $file_name = ""; if($_FILES) { if(empty($_FILES['attach_file']['name'])) { $file_name = ""; } else { $target='attach_file/'; $target.=time().$_FILES['attach_file']['name']; $file_name=time().$_FILES['attach_file']['name']; $image=$target; move_uploaded_file($_FILES['attach_file']['tmp_name'],$target); $config['source_image']=$target; $config['maintain_ratio']=TRUE; // $config['width']=1280; // $config['height']=960; $this->image_lib->initialize($config); //$this->image_lib->resize(); } } $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $data=array( "potential_id" => $potential_id, "type" => "Attached File", "attach_file" => $file_name, "delete_status" => "ACTIVE", "created_at" => $created_at, ); $result=$this->yaskawa_model->potential_attachments($data); if($result){ echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function potential_attach_url(){ $potential_id = $this->input->post('potential_id'); $enter_url = $this->input->post('enter_url'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $data=array( "potential_id" => $potential_id, "type" => "Link URL", "link_url" => $enter_url, "delete_status" => "ACTIVE", "created_at" => $created_at, ); $result=$this->yaskawa_model->potential_attachments($data); if($result){ echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function potential_newtask(){ $potential_id = $this->input->post('potential_id'); $subject = $this->input->post('subject'); $due_date = date("Y-m-d", strtotime($this->input->post('due_date'))); $priority = $this->input->post('priority'); $owner = $this->input->post('owner'); $status = $this->input->post('status'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d H:i:s'); $data=array( "potential_id" => $potential_id, "type" => "Task", "subject" => $subject, "due_date" => $due_date, "priority" => $priority, "owner" => $owner, "status" => $status, "delete_status" => "ACTIVE", "created_at" => $created_at, ); $result=$this->yaskawa_model->potential_activities($data); if($result){ echo json_encode(array('result'=>1,'message'=>"added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function potential_newevents() { $potential_id = $this->input->post('potential_id'); $all_day = $this->input->post('all_day'); $from_date = date("Y-m-d", strtotime($this->input->post('from_date'))); $to_date = date("Y-m-d", strtotime($this->input->post('to_date'))); $host = $this->input->post('host'); $participants = $this->input->post('participants'); $related_to = $this->input->post('related_to'); $lead = $this->input->post('lead'); $description = $this->input->post('description'); $lead_id = $this->input->post('lead_id'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $event_details = array( 'potential_id' => $potential_id, 'type' => 'Event', 'all_day' => $all_day, 'start_date' => $from_date, 'end_date' => $to_date, 'host' => $host, 'participants' => $participants, 'related_to' => $related_to, 'lead' => $lead, 'description' => $description, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->potential_activities($event_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function potetial_createcall() { $potential_id = $this->input->post('potential_id'); $subject = $this->input->post('subject'); $call_type = $this->input->post('call_type'); $call_purpose = $this->input->post('call_purpose'); $contact_name = $this->input->post('contact_name'); $call_details = $this->input->post('call_details'); $call_timer = $this->input->post('call_timer'); $call_duration = $this->input->post('call_duration'); $description = $this->input->post('description'); $call_result = $this->input->post('call_result'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $event_details = array( 'potential_id' => $potential_id, 'type' => 'Call', 'subject' => $subject, 'call_type' => $call_type, 'call_purpose' => $call_purpose, 'contact_name' => $contact_name, 'call_details' => $call_details, 'call_timer' => $call_timer, 'call_duration' => $call_duration, 'description' => $description, 'call_result' => $call_result, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($event_details); // die(); $result = $this->yaskawa_model->potential_activities($event_details); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function create_competitor() { $potential_id = $this->input->post('potential_id'); $competitor_name = $this->input->post('competitor_name'); $Website = $this->input->post('Website'); $Strengths = $this->input->post('Strengths'); $Weaknesses = $this->input->post('Weaknesses'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $competitor = array( 'potential_id' => $potential_id, 'competitor_name' => $competitor_name, 'Website' => $Website, 'Strengths' => $Strengths, 'Weaknesses' => $Weaknesses, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); // print_r($event_details); // die(); $result = $this->yaskawa_model->potential_competitor($competitor); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function potential_contact_mapping(){ $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $id = $this->uri->segment(2); $data['user_name']= $this->session->userdata('user_name'); $data['contact']=$this->yaskawa_model->quick_contact1($id); $data['potential_details'] = $this->yaskawa_model->single_potential_details($id); $data['accounts_data'] = $this->yaskawa_model->select_new_accounts($admin_id); // $data['lead_source']=$this->yaskawa_model->get_lead_source_details(); // $data['potential_details'] = $this->yaskawa_model->single_potential_details($id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_contact_mapping',$data); } else { redirect('/'); } } public function quick_contact(){ $admin_id = $this->session->userdata('admin_id'); $role_id = $this->session->userdata('role_id'); $potential_id = $this->input->post('potential_id'); $contact_owner = $this->input->post('potential_owner'); $first_name = $this->input->post('first_name'); $last_name = $this->input->post('last_name'); $account_id = $this->input->post('account_id'); $account_name = $this->input->post('account_name'); $email = $this->input->post('email'); $phone = $this->input->post('phone'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $created_at = $date->format('Y-m-d'); $quick_contact = array( 'user_id' => $admin_id, 'role_id' => $role_id, 'potential_id' => $potential_id, 'contact_owner' => $contact_owner, 'first_name' => $first_name, 'last_name' => $last_name, 'account_id' => $account_id, 'account_name' => $account_name, 'email' => $email, 'phone' => $phone, 'delete_status' => 'ACTIVE', 'created_at' => $created_at ); $result = $this->yaskawa_model->add_new_contact($quick_contact); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function mapping_details(){ $account_id=$this->input->post('account_id'); $user_data=$this->yaskawa_model->single_account_details($account_id); echo json_encode($user_data); } public function contact_update(){ $account_id=$this->input->post('account_id'); $contact_roles=$this->input->post('contact_roles'); $data=array('contact_roles'=>$contact_roles); $result=$this->yaskawa_model->contact_update($account_id, $data); if($result) { echo json_encode(array('result'=>1,'message'=>"Attachments added successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function potential_contact_edit_mapping(){ $admin_id = $this->session->userdata('admin_id'); if($admin_id) { $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $id = $this->uri->segment(2); $data['user_name']= $this->session->userdata('user_name'); $data['quick_contact'] = $this->yaskawa_model->quick_contact2($id); $data['potential_details'] = $this->yaskawa_model->single_potential_details($id); // $data['lead_source']=$this->yaskawa_model->get_lead_source_details(); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_contact_edit_mapping',$data); } else { redirect('/'); } } public function potential_search(){ $search=$this->input->post('search'); $search=$this->yaskawa_model->potential_search($search); if($search) { echo json_encode(array('search_data'=>$search,'result'=>1)); } else { echo json_encode(array('search_data'=>$search,'result'=>0)); } } public function back_potential_info(){ $data['user_type_id'] = $this->access_id(); $data['access'] = $this->access_details(); $id = $this->uri->segment(2); $data['user_name']= $this->session->userdata('user_name'); $data['contact']=$this->yaskawa_model->quick_contact1($id); $data['user_details']=$this->yaskawa_model->get_user_details(); $data['contact_data']=$this->yaskawa_model->contact_list1($id); $data['competitor']=$this->yaskawa_model->potential_competitor1($id); $data['lead_source']=$this->yaskawa_model->get_lead_source_details(); $data['activities']=$this->yaskawa_model->potential_activities1($id); $data['attachments']=$this->yaskawa_model->potential_attachments1($id); $data['stage_history']=$this->yaskawa_model->stage_master_update1($id); $data['potential_details'] = $this->yaskawa_model->single_potential_details($id); $data['closed_activities'] = $this->yaskawa_model->potential_closed_details($id); $data['company_details']=$this->yaskawa_model->fetch_company_details(); $this->load->view('admin/potential_info',$data); } public function quick_create_contact(){ $pot_lids = $this->input->post('pot_lids'); $camount = $this->input->post('camount'); $closing_date = $this->input->post('closing_date'); $reason_for_loss = $this->input->post('reason_for_loss'); $data = array( 'potential_id' => $pot_lids, 'amount' => $camount, 'closing_date' => $closing_date, 'reason' => $reason_for_loss, 'delete_status' => 'ACTIVE' ); $result = $this->yaskawa_model->potential_details_update($pot_lids,$data); if($result) { echo json_encode(array('result'=>1,'message'=>"Update Successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function update_edit_mapping(){ $contactids=$this->input->post('contactids'); $contact_roles=$this->input->post('contact_roles'); $result = $this->yaskawa_model->update_edit_mapping($contactids,$contact_roles); } public function auto_complete_account_name(){ $keyword=$this->input->get('term'); $data1=$this->yaskawa_model->account_name_search($keyword); foreach($data1 as $row) { $data[]=$row->account_name; } echo json_encode($data); } public function stage_master_update(){ $potential_id=$this->input->post('pot_lids'); $Potential_Owner=$this->input->post('Potential_Owner'); $stage=$this->input->post('stage'); $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $modified_time = $date->format('Y-m-d H:i:s'); $data=array( 'potential_id'=>$potential_id, 'stage'=>$stage, 'modified_by'=>$Potential_Owner, 'modified_time'=>$modified_time, ); $data1=array( 'stage'=>$stage, ); $result=$this->yaskawa_model->potential_details_update($potential_id,$data1); $result=$this->yaskawa_model->stage_master_update($data); if($result) { echo json_encode(array('result'=>1,'message'=>"Update Successfully")); } else { echo json_encode(array('result'=>0,'message'=>"Something went wrong.. try again")); } } public function get_role_details(){ $role=$this->input->post('role'); $result=$this->yaskawa_model->get_role_details($role); echo json_encode($result); } } ?>