EVOLUTION-NINJA
Edit File: controller_old.php
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class controller extends CI_Controller { function __construct() { parent:: __construct(); $this->load->model('model'); $this->output->set_header('Last-Modified:'.gmdate('D, d M Y H:i:s').'GMT'); $this->output->set_header('Cache-Control: no-store, no-cache, must-revalidate'); $this->output->set_header('Cache-Control: post-check=0, pre-check=0',false); $this->output->set_header('Pragma: no-cache'); } public function index() { $this->load->view('login'); } public function admin() { $w=array('id'=>1); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); $this->load->view('admin_index',$data); } public function login() { $table='profile'; $email=$this->input->post('email'); $password=$this->input->post('password'); $where=array('uid'=>$email,'password'=>$password); $user=$this->model->get_where_row($table,$where); $table1='supervisor'; $where1=array('usercode'=>$email,'password'=>$password); $user1=$this->model->get_where_row($table1,$where1); if(count($user)>0) { $session=array('id'=>$user->id,'uid'=>$user->uid,'role'=>$user->role,'region'=>$user->region,'company_name'=>$user->company_name,'mobile'=>$user->mobile,'email'=>$user->email,'password'=>$user->password); $this->session->set_userdata($session); $table='profile'; $where=array('uid'=>$email,'password'=>$password); $data['details']=$this->model->get_where_row($table,$where); $table='news'; $data['news']=$this->model->get_all_data($table); $this->load->view('news',$data); } elseif(count($user1)>0) { if($user1->role==1) { $session=array('id'=>$user1->id,'region'=>$user1->region,'usercode'=>$user1->usercode,'username'=>$user1->username,'password'=>$user1->password,'email'=>$user1->email,'department'=>$user1->department,'role'=>$user1->role); $this->session->set_userdata($session); $table1='supervisor'; $where1=array('usercode'=>$email,'password'=>$password); $data['details']=$this->model->get_where_row($table1,$where1); $table='news'; $data['news']=$this->model->get_all_data($table); //print_r($data['details']); $this->load->view('admin_index',$data); } elseif($user1->role==8) { $session=array('id'=>$user1->id,'usercode'=>$user1->usercode,'region'=>$user1->region,'username'=>$user1->username,'password'=>$user1->password,'email'=>$user1->email,'department'=>$user1->department,'role'=>$user1->role); $this->session->set_userdata($session); $table1='supervisor'; $where1=array('usercode'=>$email,'password'=>$password); $data['details']=$this->model->get_where_row($table1,$where1); $table='news'; $data['news']=$this->model->get_all_data($table); //print_r($data['details']); $this->load->view('regional_index',$data); } else { $session=array('id'=>$user1->id,'usercode'=>$user1->usercode,'region'=>$user1->region,'username'=>$user1->username,'password'=>$user1->password,'email'=>$user1->email,'department'=>$user1->department,'role'=>$user1->role); $this->session->set_userdata($session); $table1='supervisor'; $where1=array('usercode'=>$email,'password'=>$password); $data['details']=$this->model->get_where_row($table1,$where1); $table='news'; $data['news']=$this->model->get_all_data($table); //print_r($data['details']); $this->load->view('news',$data); } } else { redirect('controller/index?status=invalid'); } } public function product() { $table='news'; $data['news']=$this->model->get_all_data($table); //print_r($data['details']); $this->load->view('admin_index',$data); } public function forgotpass() { $this->load->view('forgot_password'); } public function forgot_password() { $uid = $this->input->post('email'); $login_table = 'profile'; $login_table1 = 'supervisor'; $check_email = array('uid'=>$uid ); $check_email1 = array('usercode'=>$uid ); $checkingemail = $this->model->get_where_row($login_table,$check_email); $checkingemail1 = $this->model->get_where_row($login_table1,$check_email); if($checkingemail) { $email=$checkingemail->email; $this->load->library('email'); $this->email->set_mailtype('html'); $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $password = substr( str_shuffle( $chars ), 0, 8 ); $password1= md5($password); $table='profile'; $data=array('password'=>$password); $query =$this->model->update_new($check_email,$table,$data); $msg = "Hello"." ".$checkingemail->first_name.','.'<br/><br/>'."Your Temporary Password is"." ".$password.'<br/><br/>'."Thank you".'<br/>'."Myvote Team"; $this->email->from('yindabpportal@yaskawa.in', 'Yaskawa'); $this->email->to($checkingemail->email); $this->email->subject('Yaskawa Temporary Password'); $data['message'] = $msg; $this->email->message($msg); $this->email->send(); $msg="Temporary Password is sent your email please check or No Records found with credentials"; redirect('controller/index'); } elseif($checkingemail1) { $email=$checkingemail1->email; $this->load->library('email'); $this->email->set_mailtype('html'); $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $password = substr( str_shuffle( $chars ), 0, 8 ); $password1= md5($password); $table='supervisor'; $data=array('password'=>$password); $query =$this->model->update_new($check_email,$table,$data); $msg = "Hello"." ".$checkingemail->first_name.','.'<br/><br/>'."Your Temporary Password is"." ".$password.'<br/><br/>'."Thank you".'<br/>'."Myvote Team"; $this->email->from('yindabpportal@yaskawa.in', 'Yaskawa'); $this->email->to($checkingemail->email); $this->email->subject('Yaskawa Temporary Password'); $data['message'] = $msg; $this->email->message($msg); $this->email->send(); $msg="Temporary Password is sent your email please check or No Records found with credentials"; redirect('controller/index'); } else { $msg="Please check your Email id."; redirect('controller/index'); } } public function change_password() { $this->load->view('change_password'); } public function change_old_password() { if($this->session->userdata('user_id')== ''){redirect('conroller/index');} //$id=$this->input->post('user_id'); $new=$this->input->post('new'); $userid=$this->session->userdata('user_id'); $table="profile"; $where=array('user_id'=>$userid); $data=array('password'=>$new); $this->model->update_new($where,$table,$data); redirect('controller/manage_user'); } public function profile() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); $this->load->view('profile',$data); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); $this->load->view('supervisor_profile',$data); } } public function profile_insert() { $ui=$this->input->post('ui'); $company_name=$this->input->post('first_name'); $address=$this->input->post('address'); $city=$this->input->post('city'); $state=$this->input->post('state'); $pin=$this->input->post('pin'); $landline=$this->input->post('landline'); $mobile1=$this->input->post('mobile1'); $mobile2=$this->input->post('mobile2'); $email1=$this->input->post('email1'); $email2=$this->input->post('email2'); $pan=$this->input->post('pan'); $tin=$this->input->post('tin'); $role=$this->input->post('role'); $pass1=$this->input->post('password'); //$pass2=$this->input->post('pass2'); if(is_uploaded_file($_FILES['image']['tmp_name'])) { $sourcePath = $_FILES['image']['tmp_name']; $targetPath = "uploads/".$_FILES['image']['name']; move_uploaded_file($_FILES['image']['tmp_name'],$targetPath); } $table='profile'; $where=array('uid'=>$ui); $unique=$this->model->get_where_row($table,$where); if(count($unique)>0) { return true; } else{ $data=array('uid'=>$ui,'company_name'=>$company_name,'address'=>$address,'city'=>$city,'state'=>$state,'pin'=>$pin,'landline'=>$landline,'mobile'=>$mobile1,'alt_mobile'=>$mobile2,'email'=>$email1,'alt_email'=>$email2,'password'=>$pass1,'pan'=>$pan,'tin'=>$tin,'attachments'=>$targetPath,'role'=>$role); $this->model->insert($table,$data); return false; } } public function update_profile() { $id=$this->session->userdata('id'); $company_name=$this->input->post('username'); $mobile1=$this->input->post('mobile'); $email1=$this->input->post('email'); $table='supervisor'; $where=array('id'=>$id); $data=array('phone'=>$mobile1,'email'=>$email1,'username'=>$company_name); $this->model->update_new($where,$table,$data); redirect('controller/profile'); } public function profile_update() { $id=$this->session->userdata('id'); $ui=$this->input->post('ui'); $company_name=$this->input->post('first_name'); $address=$this->input->post('address'); $city=$this->input->post('city'); $state=$this->input->post('state'); $pin=$this->input->post('pin'); $landline=$this->input->post('landline'); $mobile1=$this->input->post('mobile1'); $mobile2=$this->input->post('mobile2'); $email1=$this->input->post('email1'); $email2=$this->input->post('email2'); $pan=$this->input->post('pan'); $tin=$this->input->post('tin'); $role=$this->input->post('role'); $pass1=$this->input->post('password'); //$pass2=$this->input->post('pass2'); if(is_uploaded_file($_FILES['image']['tmp_name'])) { $sourcePath = $_FILES['image']['tmp_name']; $targetPath = "uploads/".$_FILES['image']['name']; move_uploaded_file($_FILES['image']['tmp_name'],$targetPath); } $table='profile'; $where=array('id'=>$id,'uid'=>$ui); $unique=$this->model->get_where_row($table,$where); if(count($unique)>0) { return false; } else { $table='profile'; $where1=array('id'=>$id,'uid'=>$ui); $data1=array('uid'=>$ui,'company_name'=>$company_name,'address'=>$address,'city'=>$city,'state'=>$state,'pin'=>$pin,'landline'=>$landline,'mobile'=>$mobile1,'alt_mobile'=>$mobile2,'email'=>$email1,'alt_email'=>$email2,'password'=>$pass1,'pan'=>$pan,'tin'=>$tin,'attachments'=>$targetPath,'role'=>$role); $this->model->update_new($where1,$table,$data1); return true; } } public function stock_updates() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $tab="stock_info"; $data['time']=$this->model->get_time($tab); $this->load->view('stock_updates',$data); } public function po_acknowledgemets() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $id1=$this->session->userdata('uid'); $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); $table='po_info'; $data['acknowledgemets']=$this->model->partner_code($table,$id1); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); $data['acknowledgemets']=""; } $this->load->view('po_acknowledgemets',$data); } public function outstanding_display_insert() { /*$table='fin_outstanding'; $id=$this->session->userdata('uid'); $details=$this->model->partner_code($table,$id); echo json_encode($details);*/ $id=$this->session->userdata('uid'); $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0); $table='fin_outstanding'; $count = $this->model->partner_code($table,$whers,$id); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->partner_code,$row->partner_name,$row->invoice_number,$row->invoice_ref_no,$row->invoicedate,$row->invoice_value,$row->due_date); $i++; } echo json_encode($responce); } public function outstanding_statement() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $tab="fin_outstanding"; $data['time']=$this->model->get_time($tab); $this->load->view('outstanding_statement',$data); } public function overdue_statement() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $tab="fin_overdue"; $data['time']=$this->model->get_time($tab); $this->load->view('overdue_statement',$data); } public function drive_catalogues() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $table="manuals"; $data['products']=$this->model->products(); $data['manuals']=$this->model->get_all_data($table); $data['time']=$this->model->get_time($table); $this->load->view('drive_catalogues',$data); } public function drive_catalogues_import() { $product_name=$this->input->post('product_name'); $category=$this->input->post('category'); $document_type=$this->input->post('document_type'); $parent_type=$this->input->post('parent_type'); $option_card_name=$this->input->post('option_card_name'); if(is_uploaded_file($_FILES['attachment']['tmp_name'])) { $sourcePath = $_FILES['attachment']['tmp_name']; $targetPath = "uploads/mannual_uploads/".$_FILES['attachment']['name']; move_uploaded_file($_FILES['attachment']['tmp_name'],$targetPath); } else { $targetPath=""; } $attachment=$targetPath; $data=array('product_name'=>$product_name,'category'=>$category,'document_type'=>$document_type,'document_sub_type'=>$parent_type,'option_card_name'=>$option_card_name,'attachment'=>$attachment); $table='manuals'; $this->model->insert($table,$data); $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $tab="manuals"; $data['time']=$this->model->get_time($tab); $this->load->view('driver_mannual_upload',$data); } public function case_stories() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $id1=$this->session->userdata('uid'); $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); $table='case_stories'; $data['case']=$this->model->partner_code($table,$id1); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $this->load->view('case_stories',$data); } public function c_forms() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $tab="fin_cforms"; $data['time']=$this->model->get_time($tab); $this->load->view('c_forms',$data); } public function news() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $table='news'; $data['news']=$this->model->get_all_data($table); $this->load->view('news',$data); } public function news_view() { $table='news'; $data['news']=$this->model->get_all_data($table); $this->load->view('admin_news_view',$data); } public function news_upload() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $this->load->view('news_upload',$data); } public function news_insert() { $title=$this->input->post('title'); $desc=$this->input->post('desc'); $url=$this->input->post('url'); $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($_FILES) { $path=$_FILES['file']['name']; $target5='uploads/'; $stamp=getdate(); $target5.=$stamp[0].basename($_FILES['file']['name']); $file3=$target5; move_uploaded_file($_FILES['file']['tmp_name'],$target5); } else { $file3=" "; } $data=array('news_title'=>$title,'news_description'=>$desc,'url'=>$url,'news_document'=>$file3); $table='news'; $this->model->insert($table,$data); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $this->load->view('news_upload',$data); } public function po_import() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $table='po_info'; $data['time']=$this->model->get_time($table); $this->load->view('po_import',$data); } public function inventory_import() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $table='stock_info'; $data['view_data']= $this->model->get_all_data($table); $data['time']=$this->model->get_time($table); $this->load->view('inventory_import',$data); } public function case_stories_import() { //$partner_code=$this->input->post('partner_code'); $industry=$this->input->post('industry'); $application=$this->input->post('application'); $product_type=$this->input->post('product_type'); $document_name=$this->input->post('document_name'); //$document=$this->input->post('document'); if(is_uploaded_file($_FILES['document']['tmp_name'])) { $document = $_FILES['document']['tmp_name']; $document = "uploads/case_uploads/".$_FILES['document']['name']; move_uploaded_file($_FILES['document']['tmp_name'],$document); } else { $document=""; } $data=array('industry'=>$industry,'application'=>$application,'product_type'=>$product_type,'document_name'=>$document_name,'document'=>$document); $table='case_stories'; $this->model->insert($table,$data); redirect('controller/case_stories_upload'); } public function supervisor_view() { $table="master_data"; $where=array('type'=>2); $data['supervisor']=$this->model->fetch_where_data($table,$where); $table1="region"; $data['region']=$this->model->get_all_data($table1); $data['time']=$this->model->get_time($table1); $table2="master_data"; $where2=array('id'=>2); $data['role']=$this->model->fetch_where_data($table2,$where2); $tab="supervisor"; $data['time']=$this->model->get_time($tab); $this->load->view('supervisor_view',$data); } public function reg_supervisor_view() { $table="master_data"; $data['supervisor']=$this->model->get_all_data($table); $table2="master_data"; $where2=array('id'=>2); $data['role']=$this->model->fetch_where_data($table2,$where2); $this->load->view('reg_supervisor_view',$data); } public function supervisor_view_insert() { /*if ($_REQUEST['_search'] == 'false') { $table='supervisor'; $where=array('status'=>0,'role'=>2); $details=$this->model->fetch_where_data($table,$where); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; }*/ $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; $whers=array('status'=>0); $table1='supervisor'; $count = $this->model->fetch_where_data($table1,$whers); $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table1); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->usercode,$row->region,$row->username,$row->email,$row->password,$row->phone,$row->department,$row->role); $i++; } echo json_encode($responce); } public function reg_supervisor_view_insert() { if ($_REQUEST['_search'] == 'false') { $region=$this->session->userdata('region'); $table='supervisor'; $where=array('status'=>0,'region'=>$region); $details=$this->model->fetch_where_data($table,$where); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; } } public function supervisor_view_add() { $cc=$this->input->post('cc'); $usercode=$this->input->post('usercode'); $region=$this->input->post('region'); $username=$this->input->post('username'); $email=$this->input->post('email'); $password=$this->input->post('password'); $phone=$this->input->post('phone'); $department=$this->input->post('department'); $role=$this->input->post('role'); //$image=$this->input->post('image'); //$createdate=$this->input->post('createdate'); //$status=$this->input->post('status'); $rate=array('usercode'=>$usercode,'region'=>$region,'username'=>$username,'email'=>$email,'password'=>$password,'phone'=>$phone,'department'=>$department,'role'=>$role); $table='supervisor'; $where=array('department'=>$department); $det=$this->model->fetch_where_data($table,$where); if((count($det))>2) { return false; } else { $this->model->insert($table,$rate); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, Added new supervisor:".$username.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } return true; } public function supervisor_view_edit() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $usercode=$this->input->post('usercode'); $region=$this->input->post('region'); $username=$this->input->post('username'); $email=$this->input->post('email'); $password=$this->input->post('password'); $phone=$this->input->post('phone'); $department=$this->input->post('department'); $role=$this->input->post('role'); //$image=$this->input->post('image'); //$createdate=$this->input->post('createdate'); //$status=$this->input->post('status'); $rate=array('usercode'=>$usercode,'region'=>$region,'username'=>$username,'email'=>$email,'password'=>$password,'phone'=>$phone,'department'=>$department,'role'=>$role); $table='supervisor'; $where=array('id'=>$id); $data=$this->model->get_where_row($table,$where); if(count($data)>0) { $this->model->update_new($where,$table,$rate); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, Edited supervisor:".$username.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } else return ""; } public function supervisor_view_delete() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $table='supervisor'; $where=array('id'=>$id); $this->model->delete($table,$where); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, Deleted supervisor:".$username.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function abp_view() { $table='profile'; $data['id']=$this->model->get_all_data($table); $table1='master_data'; $where=array('id'=>3); $data['abp_role']=$this->model->fetch_where_data($table1,$where); $table2='region'; $data['region']=$this->model->get_all_data($table2); $tab="supervisor"; $data['time']=$this->model->get_time($tab); $this->load->view('abp_view',$data); } public function reg_abp_view() { $table='profile'; $data['id']=$this->model->get_all_data($table); $this->load->view('reg_abp_view',$data); } public function abp_view_insert() { /*if ($_REQUEST['_search'] == 'false') { $table='profile'; $where=array('status'=>0); $details=$this->model->fetch_where_data($table,$where); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; }*/ $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; $whers=array('status'=>0); $table='profile'; $count = $this->model->fetch_where_data($table,$whers); $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->uid,$row->role,$row->region,$row->company_name,$row->address,$row->city,$row->state,$row->pin,$row->landline,$row->mobile,$row->alt_mobile,$row->email,$row->alt_email,$row->password,$row->pan,$row->tin); $i++; } echo json_encode($responce); } public function reg_abp_view_insert() { if ($_REQUEST['_search'] == 'false') { $region=$this->session->userdata('region'); $table='profile'; $where=array('status'=>0,'region'=>$region); $details=$this->model->fetch_where_data($table,$where); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; } } public function abp_view_add() { $cc=$this->input->post('cc'); $uid=$this->input->post('uid'); $region=$this->input->post('region'); $role=$this->input->post('role'); $company_name=$this->input->post('company_name'); $address=$this->input->post('address'); $city=$this->input->post('city'); $state=$this->input->post('state'); $pin=$this->input->post('pin'); $landline=$this->input->post('landline'); $mobile=$this->input->post('mobile'); $alt_mobile=$this->input->post('alt_mobile'); $email=$this->input->post('email'); $alt_email=$this->input->post('alt_email'); $password=$this->input->post('password'); $pan=$this->input->post('pan'); $tin=$this->input->post('tin'); //$attachments=$this->input->post('attachments'); $rate=array('uid'=>$uid,'role'=>$role,'region'=>$region,'company_name'=>$company_name,'address'=>$address,'city'=>$city,'state'=>$state,'pin'=>$pin,'landline'=>$landline,'mobile'=>$mobile,'alt_mobile'=>$alt_mobile,'email'=>$email,'alt_email'=>$alt_email,'pan'=>$pan,'password'=>$password,'tin'=>$tin); $table='profile'; $this->model->insert($table,$rate); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, yaskawa added new ABP:".$company_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('New ABP information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function abp_view_edit() { /*$id=$this->input->post('id'); $uid=$this->input->post('uid'); $role=$this->input->post('role'); $company_name=$this->input->post('company_name'); $address=$this->input->post('address'); $city=$this->input->post('city'); $state=$this->input->post('state'); $pin=$this->input->post('pin'); $landline=$this->input->post('landline'); $mobile=$this->input->post('mobile'); $alt_mobile=$this->input->post('alt_mobile'); $email=$this->input->post('email'); $alt_email=$this->input->post('alt_email'); $password=$this->input->post('password'); $pan=$this->input->post('pan'); $tin=$this->input->post('tin'); $attachments=$this->input->post('attachments'); $rate=array('uid'=>$uid,'role'=>$role,'company_name'=>$company_name,'address'=>$address,'city'=>$city,'state'=>$state,'pin'=>$pin,'landline'=>$landline,'mobile'=>$mobile,'alt_mobile'=>$alt_mobile,'email'=>$email,'alt_email'=>$alt_email,'pan'=>$pan,'password'=>$password,'tin'=>$tin,'attachments'=>$attachments); $table='profile'; $where=array('id'=>$id); $data=$this->model->get_where_row($table,$where); if(count($data)>0) { $this->model->update_new($where,$table,$rate); } else return "";*/ $cc=$this->input->post('cc'); $id=$this->input->post('id'); $uid=$this->input->post('uid'); $region=$this->input->post('region'); $role=$this->input->post('role'); $company_name=$this->input->post('company_name'); $address=$this->input->post('address'); $city=$this->input->post('city'); $state=$this->input->post('state'); $pin=$this->input->post('pin'); $landline=$this->input->post('landline'); $mobile=$this->input->post('mobile'); $alt_mobile=$this->input->post('alt_mobile'); $email=$this->input->post('email'); $alt_email=$this->input->post('alt_email'); $password=$this->input->post('password'); $pan=$this->input->post('pan'); $tin=$this->input->post('tin'); //$attachments=$this->input->post('attachments'); $rate=array('uid'=>$uid,'role'=>$role,'region'=>$region,'company_name'=>$company_name,'address'=>$address,'city'=>$city,'state'=>$state,'pin'=>$pin,'landline'=>$landline,'mobile'=>$mobile,'alt_mobile'=>$alt_mobile,'email'=>$email,'alt_email'=>$alt_email,'pan'=>$pan,'password'=>$password,'tin'=>$tin); $table='profile'; $where=array('id'=>$id); $data=$this->model->get_where_row($table,$where); if(count($data)>0) { $this->model->update_new($where,$table,$rate); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hai, your profile is updated:".$partner_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Updation information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } else { return ""; } } public function abp_view_delete() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $table='profile'; $where=array('id'=>$id); $this->model->delete($table,$where); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, your ABP has been deleted :".$company_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Deleted information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function stock_updates_view() { $t="stock_info"; $data['time']=$this->model->get_time($t); $this->load->view('stock_updates_view',$data); } public function reg_stock_updates_view() { $t="stock_info"; $data['time']=$this->model->get_time($t); $this->load->view('reg_stock_updates_view',$data); } public function stock_updates_view_insert() { /* if ($_REQUEST['_search'] == 'false') { $table='stock_info'; $where=array('status'=>0); $details=$this->model->fetch_where_data($table,$where); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'stock_id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; }*/ $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0); $table='stock_info'; $count = $this->model->fetch_where_data($table,$whers); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->stock_id; $responce["rows"][$i]['cell']=array($row->stock_id,$row->material,$row->material_description,$row->quantity_in_stock,$row->open_po,$row->in_transit_stock,$row->month_planned_qty,$row->remarks); $i++; } echo json_encode($responce); } public function stock_updates_abp() { if ($_REQUEST['_search'] == 'false') { $ui=$this->input->post('ui'); $table='stock_info'; $where=array('partner_code'=>$ui,'status'=>0); $details=$this->model->fetch_where_data($table,$where); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'stock_id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; } } public function stock_info_insert_add() { $stock_id = $this->input->post('stock_id'); //$partner_code = $this->input->post('partner_code'); $material = $this->input->post('material'); $material_description = $this->input->post('material_description'); $quantity_in_stock = $this->input->post('quantity_in_stock'); $open_po = $this->input->post('open_po'); $in_transit_stock = $this->input->post('in_transit_stock'); $month_planned_qty = $this->input->post('month_planned_qty'); $remarks = $this->input->post('remarks'); $rate=array('material'=>$material,'material_description'=>$material_description,'quantity_in_stock'=>$quantity_in_stock,'open_po'=>$open_po,'in_transit_stock'=>$in_transit_stock,'month_planned_qty'=>$month_planned_qty,'remarks'=>$remarks); $table='stock_info'; $this->model->insert($table,$rate); return true; } public function stock_info_insert_edit() { $stock_id = $this->input->post('stock_id'); //$partner_code = $this->input->post('partner_code'); $material = $this->input->post('material'); $material_description = $this->input->post('material_description'); $quantity_in_stock = $this->input->post('quantity_in_stock'); $open_po = $this->input->post('open_po'); $in_transit_stock = $this->input->post('in_transit_stock'); $month_planned_qty = $this->input->post('month_planned_qty'); $remarks = $this->input->post('remarks'); $rate=array('material'=>$material,'material_description'=>$material_description,'quantity_in_stock'=>$quantity_in_stock,'open_po'=>$open_po,'in_transit_stock'=>$in_transit_stock,'month_planned_qty'=>$month_planned_qty,'remarks'=>$remarks); $table='stock_info'; $where=array('stock_id'=>$stock_id); $data=$this->model->get_where_row($table,$where); if(count($data)>0) { $this->model->update_new($where,$table,$rate); } else return ""; } public function stock_info_insert_delete() { $stock_id = $this->input->post('stock_id'); $table='stock_info'; $where=array('stock_id'=>$stock_id); $data=$this->model->delete($table,$where); return true; } public function po_view() { $t="po_info"; $data['time']=$this->model->get_time($t); $this->load->view('po_view',$data); } public function reg_po_view() { $tab="po_info"; $data['time']=$this->model->get_time($tab); $this->load->view('reg_po_view',$data); } public function po_view_insert() { /*if ($_REQUEST['_search'] == 'false') { $table='po_info'; $where=array('status'=>0); $details=$this->model->fetch_where_data($table,$where); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'po_id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; }*/ $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'po_id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0); $table1='po_info'; $count = $this->model->fetch_where_data($table1,$whers); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table1); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->po_id; $responce["rows"][$i]['cell']=array($row->po_id,$row->po_number,$row->reference_code,$row->acknowledgement,$row->createdate); $i++; } echo json_encode($responce); } public function po_info_insert_add() { $cc=$this->input->post('cc'); $po_id = $this->input->post('po_id'); $stock_id = $this->input->post('stock_id'); $po_number = $this->input->post('po_number'); $date = $this->input->post('date'); $acknowledgement = $this->input->post('acknowledgement'); $createdate = $this->input->post('createdate'); $rate=array('po_number'=>$po_number,'acknowledgement'=>$acknowledgement); $table='po_info'; $this->model->insert($table,$rate); $table1='profile'; $where1=array('id'=>$po_id); $date['get']=$this->model->get_where_row($table1,$where1); $email=$date['get']->email; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, new information is added:".$partner_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function po_info_insert_edit() { $cc=$this->input->post('cc'); $po_id = $this->input->post('po_id'); $stock_id = $this->input->post('stock_id'); $po_number = $this->input->post('po_number'); $date = $this->input->post('date'); $acknowledgement = $this->input->post('acknowledgement'); $createdate = $this->input->post('createdate'); $rate=array('po_number'=>$po_number,'acknowledgement'=>$acknowledgement,'createdate'=>$createdate); $table='po_info'; $where=array('po_id'=>$po_id); $data=$this->model->get_where_row($table,$where); if(count($data)>0) { $this->model->update_new($where,$table,$rate); $table1='profile'; $where1=array('id'=>$po_id); $date['get']=$this->model->get_where_row($table1,$where1); $email=$date['get']->email; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, information is edited:".$partner_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } else return ""; } public function po_info_insert_delete() { $cc=$this->input->post('cc'); $po_id = $this->input->post('po_id'); $table='po_info'; $where=array('po_id'=>$po_id); $data=$this->model->delete($table,$where); $table1='profile'; $where1=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where1); $email=$date['get']->email; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, information is edited.email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function import() { date_default_timezone_set('Asia/Kolkata'); include '../PHPExcel/IOFactory.php'; if(isset($_FILES['file']['name'])){ $file_name = $_FILES['file']['name']; $ext = pathinfo($file_name, PATHINFO_EXTENSION); if($ext == "xlsx") { $file_name = $_FILES['file']['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(); } else{ echo '<p style="color:red;">Please upload file with xlsx extension only</p>'; } } $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); $arrayCount = count($allDataInSheet); // Here get total count of row in that Excel sheet $table='stock_info'; $this->model->table_truncate($table); if(count($allDataInSheet)>0){ for($i=2;$i<=$arrayCount;$i++){ //$partner_code = trim($allDataInSheet[$i]["A"]); $material = trim($allDataInSheet[$i]["A"]); $material_description = trim($allDataInSheet[$i]["B"]); $quantity_in_stock = trim($allDataInSheet[$i]["C"]); $open_po = trim($allDataInSheet[$i]["D"]); $in_transit_stock = trim($allDataInSheet[$i]["E"]); $month_planned_qty = trim($allDataInSheet[$i]["F"]); $remarks = trim($allDataInSheet[$i]["G"]); $data=array('material'=>$material,'material_description'=>$material_description,'quantity_in_stock'=>$quantity_in_stock,'open_po'=>$open_po,'in_transit_stock'=>$in_transit_stock,'month_planned_qty'=>$month_planned_qty,'remarks'=>$remarks); $this->model->insert($table,$data); } redirect('controller/inventory_import'); } } public function imported() { date_default_timezone_set('Asia/Kolkata'); include '../PHPExcel/IOFactory.php'; if(isset($_FILES['file']['name'])){ $file_name = $_FILES['file']['name']; $ext = pathinfo($file_name, PATHINFO_EXTENSION); if($ext == "xls") { $file_name = $_FILES['file']['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(); } else{ echo '<p style="color:red;">Please upload file with xls extension only</p>'; } } $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); $arrayCount = count($allDataInSheet); // Here get total count of row in that Excel sheet $table='fin_outstanding'; $this->model->table_truncate($table); if(count($allDataInSheet)>0){ for($i=2;$i<=$arrayCount;$i++){ $partner_code = trim($allDataInSheet[$i]["A"]); $partner_name = trim($allDataInSheet[$i]["B"]); $invoice_number = trim($allDataInSheet[$i]["C"]); $invoice_ref_no = trim($allDataInSheet[$i]["D"]); $invoicedate = trim($allDataInSheet[$i]["E"]); $invoice_value = trim($allDataInSheet[$i]["F"]); $due_date = trim($allDataInSheet[$i]["G"]); $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'invoice_number'=>$invoice_number,'invoice_ref_no'=>$invoice_ref_no,'invoicedate'=>$invoicedate,'invoice_value'=>$invoice_value,'due_date'=>$due_date); $this->model->insert($table,$data); $emails=$this->model->outstanding_email(); foreach($emails as $email) { $email=$email->email; //$partner_name=$email->partner_name; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi,Your Finance Outstanding statements is updated."; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->subject('Finance Outstanding information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } } redirect('controller/outstanding_statement'); } } public function importie() { date_default_timezone_set('Asia/Kolkata'); include '../PHPExcel/IOFactory.php'; if(isset($_FILES['file']['name'])){ $file_name = $_FILES['file']['name']; $ext = pathinfo($file_name, PATHINFO_EXTENSION); if($ext == "xls") { $file_name = $_FILES['file']['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(); } else{ echo '<p style="color:red;">Please upload file with xls extension only</p>'; } } $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); $arrayCount = count($allDataInSheet); // Here get total count of row in that Excel sheet $table='fin_overdue'; $this->model->table_truncate($table); if(count($allDataInSheet)>0){ for($i=2;$i<=$arrayCount;$i++){ $partner_code = trim($allDataInSheet[$i]["A"]); $partner_name = trim($allDataInSheet[$i]["B"]); $invoice_number = trim($allDataInSheet[$i]["C"]); $invoice_ref_no = trim($allDataInSheet[$i]["D"]); $invoicedate = trim($allDataInSheet[$i]["E"]); $invoice_value = trim($allDataInSheet[$i]["F"]); $due_date = trim($allDataInSheet[$i]["G"]); $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'invoice_number'=>$invoice_number,'invoice_ref_no'=>$invoice_ref_no,'invoicedate'=>$invoicedate,'invoice_value'=>$invoice_value,'due_date'=>$due_date); $this->model->insert($table,$data); $emails=$this->model->overdue_email(); foreach($emails as $email) { $email=$email->email; //$partner_name=$email->partner_name; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi,Your Finance Overdue statements is updated."; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->subject('Finance Overdue information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } } redirect('controller/overdue_statement'); } } public function c_form() { date_default_timezone_set('Asia/Kolkata'); include '../PHPExcel/IOFactory.php'; if(isset($_FILES['file']['name'])){ $file_name = $_FILES['file']['name']; $ext = pathinfo($file_name, PATHINFO_EXTENSION); if($ext == "xlsx") { $file_name = $_FILES['file']['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(); } else{ echo '<p style="color:red;">Please upload file with xlsx extension only</p>'; } } $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); $arrayCount = count($allDataInSheet); // Here get total count of row in that Excel sheet $table='fin_cforms'; $this->model->table_truncate($table); if(count($allDataInSheet)>0){ for($i=2;$i<=$arrayCount;$i++){ $partner_code = trim($allDataInSheet[$i]["A"]); $partner_name = trim($allDataInSheet[$i]["B"]); $month = trim($allDataInSheet[$i]["C"]); $quarter = trim($allDataInSheet[$i]["D"]); $invoice_number = trim($allDataInSheet[$i]["E"]); $date = trim($allDataInSheet[$i]["F"]); $invoicedate = trim($allDataInSheet[$i]["G"]); $taxable_amount = trim($allDataInSheet[$i]["H"]); $cst = trim($allDataInSheet[$i]["I"]); $invoice_value = trim($allDataInSheet[$i]["J"]); $state = trim($allDataInSheet[$i]["K"]); $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'month'=>$month,'quarter'=>$quarter,'invoice_number'=>$invoice_number,'date'=>$date,'invoicedate'=>$invoicedate,'taxable_amount'=>$taxable_amount,'cst'=>$cst,'invoice_value'=>$invoice_value,'state'=>$state); $this->model->insert($table,$data); $emails=$this->model->cform_email(); foreach($emails as $email) { $email=$email->email; //$partner_name=$email->partner_name; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi,Your C-Forms statements is updated."; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->subject('C-Forms information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } } redirect('controller/c_forms'); } } public function importe() { if(isset($_POST["import"])) { if(is_uploaded_file($_FILES['file']['tmp_name'])) { $sourcePath = $_FILES['file']['tmp_name']; $targetPath = "uploads/po_uploads/".$_FILES['file']['name']; move_uploaded_file($_FILES['file']['tmp_name'],$targetPath); } else { $targetPath=""; } $insert_variables = array( 'po_number' => $this->input->post('po'), 'partner_code' => $this->input->post('code'), 'reference_code' => $this->input->post('refernce'), 'acknowledgement' => $targetPath, ); $table='po_info'; $data=$this->model->insert($table,$insert_variables); } redirect('controller/po_import'); } public function outstanding_statements_display() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); $table='fin_outstanding'; $data['outstandings']=$this->model->get_all_data($table); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $this->load->view('outstanding_statements_display',$data); } public function overdue_statements_display() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); $table='fin_overdue'; $data['overdues']=$this->model->get_all_data($table); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $this->load->view('overdue_statements_display',$data); } public function c_forms_display() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); $table='fin_cforms'; $data['cforms']=$this->model->get_all_data($table); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $this->load->view('c_forms_display',$data); } public function drive_mannual_upload() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $tab="manuals"; $data['time']=$this->model->get_time($tab); $this->load->view('driver_mannual_upload',$data); } public function case_stories_upload() { $role=$this->session->userdata('role'); $id=$this->session->userdata('id'); if($role==3) { $w=array('id'=>$id); $t='profile'; $data['details']=$this->model->get_where_row($t,$w); } else { $w=array('id'=>$id); $t='supervisor'; $data['details']=$this->model->get_where_row($t,$w); } $tab="case_stories"; $data['time']=$this->model->get_time($tab); $this->load->view('case_stories_upload',$data); } public function outstanding_view() { $t="fin_outstanding"; $data['time']=$this->model->get_time($t); $this->load->view('outstanding_statement_view',$data); } public function reg_outstanding_view() { $t="fin_outstanding"; $data['time']=$this->model->get_time($t); $this->load->view('reg_outstanding_statement_view',$data); } public function outstanding_insert() { /*$table='fin_outstanding'; $where=array('status'=>0); $details=$this->model->fetch_where_data($table,$where); echo json_encode($details);*/ $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; $whers=array('status'=>0); $table='fin_outstanding'; $count = $this->model->fetch_where_data($table,$whers); $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->partner_code,$row->partner_name,$row->invoice_number,$row->invoice_ref_no,$row->invoicedate,$row->invoice_value,$row->due_date); $i++; } echo json_encode($responce); } public function outstanding_add() { $cc=$this->input->post('cc'); $partner_code=$this->input->post('partner_code'); $partner_name=$this->input->post('partner_name'); $invoice_number=$this->input->post('invoice_number'); $invoice_ref_no=$this->input->post('invoice_ref_no'); $invoicedate=$this->input->post('invoicedate'); $invoice_value=$this->input->post('invoice_value'); $due_date=$this->input->post('due_date'); $table1='profile'; $where=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where); $email=$date['get']->email; $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'invoice_number'=>$invoice_number,'invoice_ref_no'=>$invoice_ref_no,'invoicedate'=>$invoicedate,'invoice_value'=>$invoice_value,'due_date'=>$due_date); $table='fin_outstanding'; $this->model->insert($table,$data); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, new information is added:".$partner_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function outstanding_edit() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $partner_code=$this->input->post('partner_code'); $partner_name=$this->input->post('partner_name'); $invoice_number=$this->input->post('invoice_number'); $invoice_ref_no=$this->input->post('invoice_ref_no'); $invoicedate=$this->input->post('invoicedate'); $invoice_value=$this->input->post('invoice_value'); $due_date=$this->input->post('due_date'); $table1='profile'; $where=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where); $email=$date['get']->email; $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'invoice_number'=>$invoice_number,'invoice_ref_no'=>$invoice_ref_no,'invoicedate'=>$invoicedate,'invoice_value'=>$invoice_value,'due_date'=>$due_date); $table='fin_outstanding'; $where=array('id'=>$id); $this->model->update_new($where,$table,$data); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, information is updated:".$partner_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function outstanding_delete() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $table1='profile'; $where1=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where1); $email=$date['get']->email; $table='fin_outstanding'; $where=array('id'=>$id); $this->model->delete($table,$where); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, New out standing statement is added:"."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Deleted information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function overdue_view() { $t="fin_overdue"; $data['time']=$this->model->get_time($t); $this->load->view('overdue_statement_view',$data); } public function reg_overdue_view() { $t="fin_overdue"; $data['time']=$this->model->get_time($t); $this->load->view('reg_overdue_statement_view',$data); } public function overdue_insert() { /*$table='fin_overdue'; $where=array('status'=>0); $details=$this->model->fetch_where_data($table,$where); echo json_encode($details);*/ $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; $whers=array('status'=>0); $table='fin_overdue'; $count = $this->model->fetch_where_data($table,$whers); $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->partner_code,$row->partner_name,$row->invoice_number,$row->invoice_ref_no,$row->invoicedate,$row->invoice_value,$row->due_date); $i++; } echo json_encode($responce); } public function overdue_add() { $cc=$this->input->post('cc'); $partner_code=$this->input->post('partner_code'); $partner_name=$this->input->post('partner_name'); $invoice_number=$this->input->post('invoice_number'); $invoice_ref_no=$this->input->post('invoice_ref_no'); if($this->input->post('invoicedate')!="") { //$date=date("Y-m-d",strtotime($date1)); list($date, $month, $year) = explode("/", $this->input->post('invoicedate')); $date = $year . '-' . $month . '-' . $date; } $invoicedate=$date; $invoice_value=$this->input->post('invoice_value'); if($this->input->post('due_date')!="") { //$date=date("Y-m-d",strtotime($date1)); list($date, $month, $year) = explode("/", $this->input->post('due_date')); $dates = $year . '-' . $month . '-' . $date; } $due_date=$dates; $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'invoice_number'=>$invoice_number,'invoice_ref_no'=>$invoice_ref_no,'invoicedate'=>$invoicedate,'invoice_value'=>$invoice_value,'due_date'=>$due_date); $table='fin_overdue'; $this->model->insert($table,$data); $table1='profile'; $where=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where); $email=$date['get']->email; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, new information is added:".$partner_name."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function overdue_edit() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $partner_code=$this->input->post('partner_code'); $partner_name=$this->input->post('partner_name'); $invoice_number=$this->input->post('invoice_number'); $invoice_ref_no=$this->input->post('invoice_ref_no'); $invoicedate=$this->input->post('invoicedate'); $invoice_value=$this->input->post('invoice_value'); $due_date=$this->input->post('due_date'); $table1='profile'; $where1=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where1); $email=$date['get']->email; $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'invoice_number'=>$invoice_number,'invoice_ref_no'=>$invoice_ref_no,'invoicedate'=>$invoicedate,'invoice_value'=>$invoice_value,'due_date'=>$due_date); $table='fin_overdue'; $where=array('id'=>$id); $this->model->update_new($where,$table,$data); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, new information is added:".$partner_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function overdue_delete() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $table='fin_overdue'; $where=array('id'=>$id); $this->model->delete($table,$where); $table1='profile'; $where=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where); $email=$date['get']->email; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, new information is added.email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function cform_view() { $t="fin_cforms"; $data['time']=$this->model->get_time($t); $this->load->view('c_forms_view',$data); } public function reg_cform_view() { $t-"fin_cforms"; $data['time']=$this->model->get_time($t); $this->load->view('reg_c_forms_view',$data); } public function cform_insert() { $table='fin_cforms'; $where=array('status'=>0); $details=$this->model->fetch_where_data($table,$where); echo json_encode($details); } public function cform_add() { $cc=$this->input->post('cc'); $partner_code=$this->input->post('partner_code'); $partner_name=$this->input->post('partner_name'); $month=$this->input->post('month'); $quarter=$this->input->post('quarter'); $invoice_number=$this->input->post('invoice_number'); $date=$this->input->post('date'); $invoicedate=$this->input->post('invoicedate'); $taxable_amount=$this->input->post('taxable_amount'); $cst=$this->input->post('cst'); $invoice_value=$this->input->post('invoice_value'); $state=$this->input->post('state'); $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'month'=>$month,'quarter'=>$quarter,'invoice_number'=>$invoice_number,'date'=>$date,'invoicedate'=>$invoicedate,'taxable_amount'=>$taxable_amount,'cst'=>$cst,'invoicedate'=>$invoicedate,'invoice_value'=>$invoice_value,'state'=>$state); $table='fin_cforms'; $this->model->insert($table,$data); $table1='profile'; $where1=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where1); $email=$date['get']->email; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, new information is added:".$partner_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function cform_edit() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $partner_code=$this->input->post('partner_code'); $partner_name=$this->input->post('partner_name'); $month=$this->input->post('month'); $quarter=$this->input->post('quarter'); $invoice_number=$this->input->post('invoice_number'); $date=$this->input->post('date'); $invoicedate=$this->input->post('invoicedate'); $taxable_amount=$this->input->post('taxable_amount'); $cst=$this->input->post('cst'); $invoice_value=$this->input->post('invoice_value'); $state=$this->input->post('state'); $data=array('partner_code'=>$partner_code,'partner_name'=>$partner_name,'month'=>$month,'quarter'=>$quarter,'invoice_number'=>$invoice_number,'date'=>$date,'invoicedate'=>$invoicedate,'taxable_amount'=>$taxable_amount,'cst'=>$cst,'invoicedate'=>$invoicedate,'invoice_value'=>$invoice_value,'state'=>$state); $table='fin_cforms'; $where=array('id'=>$id); $this->model->update_new($where,$table,$data); $table1='profile'; $where1=array('id'=>$partner_code); $date['get']=$this->model->get_where_row($table1,$where1); $email=$date['get']->email; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, information is edited:".$partner_name.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function cform_delete() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $table='fin_cforms'; $where=array('id'=>$id); $this->model->delete($table,$where); $table1='profile'; $where1=array('id'=>$id); $date['get']=$this->model->get_where_row($table1,$where1); $email=$date['get']->email; $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, information is edited.email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); return true; } public function drive_catalogues_view() { $t="manuals"; $data['time']=$this->model->get_time($t); $this->load->view('drive_catalogues_view',$data); } public function reg_drive_catalogues_view() { $t="manuals"; $data['time']=$this->model->get_time($t); $this->load->view('reg_drive_catalogues_view',$data); } public function drive_catalogues_insert() { /*$table='manuals'; $where=array('status'=>0); $details=$this->model->fetch_where_data($table,$where); echo json_encode($details);*/ $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; $whers=array('status'=>0); $table='manuals'; $count = $this->model->fetch_where_data($table,$whers); $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->product_name,$row->category,$row->document_type,$row->document_sub_type,$row->option_card_name,$row->attachment); $i++; } echo json_encode($responce); } public function drive_catalogues_add() { $product_name=$this->input->post('product_name'); $category=$this->input->post('category'); $document_type=$this->input->post('document_type'); $parent_type=$this->input->post('parent_type'); $option_card_name=$this->input->post('option_card_name'); if(is_uploaded_file($_FILES['attachment']['tmp_name'])) { $sourcePath = $_FILES['attachment']['tmp_name']; $targetPath = "uploads/mannual_uploads".$_FILES['attachment']['name']; move_uploaded_file($_FILES['attachment']['tmp_name'],$targetPath); } else { $targetPath=""; } $attachment=$targetPath; $data=array('product_name'=>$product_name,'category'=>$category,'document_type'=>$document_type,'document_sub_type'=>$parent_type,'option_card_name'=>$option_card_name,'attachment'=>$attachment); $table='manuals'; $this->model->insert($table,$data); return true; } public function drive_catalogues_edit() { $id=$this->input->post('id'); $product_name=$this->input->post('product_name'); $category=$this->input->post('category'); $document_type=$this->input->post('document_type'); $parent_type=$this->input->post('parent_type'); $option_card_name=$this->input->post('option_card_name'); $attachment=$this->input->post('attachment'); $data=array('product_name'=>$product_name,'category'=>$category,'document_type'=>$document_type,'document_sub_type'=>$parent_type,'option_card_name'=>$option_card_name,'attachment'=>$attachment); $table='manuals'; $where=array('id'=>$id); $this->model->update_new($where,$table,$data); return true; } public function drive_catalogues_delete() { $id=$this->input->post('id'); $table='manuals'; $where=array('id'=>$id); $this->model->delete($table,$where); return true; } public function case_stories_view() { $t="case_stories"; $data['time']=$this->model->get_time($t); $this->load->view('case_stories_view',$data); } public function reg_case_stories_view() { $t="case_stories"; $data['time']=$this->model->get_time($t); $this->load->view('reg_case_stories_view',$data); } public function case_stories_insert() { /*$table='case_stories'; $where=array('status'=>0); $details=$this->model->fetch_where_data($table,$where); echo json_encode($details);*/ $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; $whers=array('status'=>0); $table='case_stories'; $count = $this->model->fetch_where_data($table,$whers); $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->case_id; $responce["rows"][$i]['cell']=array($row->case_id,$row->industry,$row->application,$row->product_type,$row->document_name,$row->document); $i++; } echo json_encode($responce); } public function case_stories_add() { //$partner_code=$this->input->post('partner_code'); $industry=$this->input->post('industry'); $application=$this->input->post('application'); $product_type=$this->input->post('product_type'); $document_name=$this->input->post('document_name'); $document=$this->input->post('document'); $data=array('industry'=>$industry,'application'=>$application,'product_type'=>$product_type,'document_name'=>$document_name,'document'=>$document); $table='case_stories'; $this->model->insert($table,$data); return true; } public function case_stories_edit() { $id=$this->input->post('case_id'); //$partner_code=$this->input->post('partner_code'); $industry=$this->input->post('industry'); $application=$this->input->post('application'); $product_type=$this->input->post('product_type'); $document_name=$this->input->post('document_name'); $document=$this->input->post('document'); $data=array('industry'=>$industry,'application'=>$application,'product_type'=>$product_type,'document_name'=>$document_name,'document'=>$document); $table='case_stories'; $where=array('case_id'=>$id); $this->model->update_new($where,$table,$data); } public function case_stories_delete() { $id=$this->input->post('case_id'); $table='case_stories'; $where=array('case_id'=>$id); $this->model->delete($table,$where); return true; } public function download1() { $this->load->helper('download'); $path ='./application/sample_excel/Sample_Stock_Info.xlsx'; ob_clean(); $data = file_get_contents($path); // Read the file's contents $name = 'Sample_Stock_Info.xlsx'; force_download($name, $data); redirect('controller/inventory_import'); } public function download2() { $this->load->helper('download'); $path ='./application/sample_excel/FIN_Outstanding.xls'; ob_clean(); $data = file_get_contents($path); // Read the file's contents $name = 'Sample_out_standing.xls'; force_download($name, $data); redirect('controller/outstanding_statement'); } public function download3() { $this->load->helper('download'); $path ='./application/sample_excel/Sample ABP Overdue Statement.xls'; ob_clean(); $data = file_get_contents($path); // Read the file's contents $name = 'Sample_overdue_statement.xls'; force_download($name, $data); redirect('controller/overdue_statement'); } public function download4() { $this->load->helper('download'); $path ='./application/sample_excel/Sample ABP C forms.xlsx'; ob_clean(); $data = file_get_contents($path); // Read the file's contents $name = 'Sample ABP C forms.xlsx'; force_download($name, $data); redirect('controller/c_forms'); } public function autocomplete() { $keyword=$this->input->post('category'); $data1=$this->model->GetRowlog($keyword); //print_r($keyword); foreach($data1 as $row) { $data[]=$row->category; } echo json_encode($data); } public function product_view() { $page = $this->input->post('page'); $limit = $this->input->post('rows'); $sidx = $this->input->post('sidx'); $sord = $this->input->post('sord'); $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0); $table1='product_list'; $count = $this->model->fetch_where_data($table1,$whers); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table1); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->product,$row->createdate); $i++; } echo json_encode($responce); } public function product_add() { $product=$this->input->post('product'); $createdate=$this->input->post('createdate'); $rate=array('product'=>$product); $table='product_list'; $det=$this->model->fetch_where_data($table,$rate); if((count($det))>0) { return false; } else { $this->model->insert($table,$rate); } return true; } public function product_edit() { $id=$this->input->post('id'); $product=$this->input->post('product'); $createdate=$this->input->post('createdate'); $rate=array('product'=>$product); $table='product_list'; $where=array('id'=>$id); $data=$this->model->get_where_row($table,$where); if(count($data)>0) { $this->model->update_new($where,$table,$rate); } else return ""; } public function product_delete() { $id=$this->input->post('id'); $table='product_list'; $where=array('id'=>$id); $this->model->delete($table,$where); return true; } public function category_view() { $page = $this->input->post('page'); $limit = $this->input->post('rows'); $sidx = $this->input->post('sidx'); $sord = $this->input->post('sord'); $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0); $table1='category'; $count = $this->model->fetch_where_data($table1,$whers); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table1); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->category,$row->createdate); $i++; } echo json_encode($responce); } public function category_add() { $category=$this->input->post('category'); $createdate=$this->input->post('createdate'); $rate=array('category'=>$category); $table='category'; $det=$this->model->fetch_where_data($table,$rate); if((count($det))>0) { return false; } else { $this->model->insert($table,$rate); } return true; } public function category_edit() { $id=$this->input->post('id'); $category=$this->input->post('category'); $createdate=$this->input->post('createdate'); $rate=array('category'=>$category); $table='category'; $where=array('id'=>$id); $data=$this->model->get_where_row($table,$where); if(count($data)>0) { $this->model->update_new($where,$table,$rate); } else return ""; } public function category_delete() { $id=$this->input->post('id'); $table='category'; $where=array('id'=>$id); $this->model->delete($table,$where); return true; } public function drive_catalogues_insert1() { $id=$this->session->userdata('region'); $table='manuals'; $where=array('status'=>0); $details=$this->model->get_drive($id); echo json_encode($details); } public function cform_insert1() { $id=$this->session->userdata('region'); $table='fin_cforms'; $where=array('status'=>0); $details=$this->model->get_cform($id); echo json_encode($details); } public function outstanding_insert1() { $id=$this->session->userdata('region'); $table='fin_outstanding'; $where=array('partner_code'=>$id); $details=$this->model->region_get_outed($id); //print_r($details); echo json_encode($details); } public function po_view_insert1() { $id=$this->session->userdata('region'); if ($_REQUEST['_search'] == 'false') { $table='po_info'; $where=array('status'=>0,'partner_code'=>$id); $details=$this->model->region_get_po($id); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'po_id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; } } public function stock_updates_view_insert1() { $id=$this->session->userdata('region'); if ($_REQUEST['_search'] == 'false') { $table='stock_info'; $details=$this->model->get_all_data($table); //print_r($details); echo json_encode($details); $page = isset($_POST['page'])?$_POST['page']:2; $limit = isset($_POST['rows'])?$_POST['rows']:5; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'stock_id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; } } public function overdue_insert1() { $id=$this->session->userdata('region'); //print_r($id); $table='fin_overdue'; $where=array('partner_code'=>$id); $details=$this->model->region_get($id); echo json_encode($details); } public function stock_updates_display_abp() { /*$id=$this->session->userdata('uid'); $table='stock_info'; $details=$this->model->partner_code($table,$id); echo json_encode($details);*/ $id=$this->session->userdata('uid'); $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0); $table='stock_info'; $count = $this->model->partner_code($table,$whers,$id); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->stock_id; $responce["rows"][$i]['cell']=array($row->material,$row->material_description,$row->quantity_in_stock,$row->open_po,$row->in_transit_stock,$row->month_planned_qty,$row->remarks); $i++; } echo json_encode($responce); } public function overdue_display_insert() { /*$table='fin_overdue'; $id=$this->session->userdata('uid'); $details=$this->model->partner_code($table,$id); echo json_encode($details);*/ $id=$this->session->userdata('uid'); $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0); $table='fin_overdue'; $count = $this->model->partner_code($table,$whers,$id); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->partner_code,$row->partner_name,$row->invoice_number,$row->invoice_ref_no,$row->invoicedate,$row->invoice_value,$row->due_date); $i++; } echo json_encode($responce); } public function cform_display_insert() { /*$id=$this->session->userdata('uid'); $table='fin_cforms'; $details=$this->model->partner_code($table,$id); echo json_encode($details);*/ $id=$this->session->userdata('uid'); $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0); $table='fin_cforms'; $count = $this->model->partner_code($table,$whers,$id); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->partner_code,$row->partner_name,$row->month,$row->quarter,$row->invoice_number,$row->date,$row->invoicedate,$row->taxable_amount,$row->cst,$row->invoice_value,$row->state); $i++; } echo json_encode($responce); } public function logout() { $this->session->sess_destroy(); redirect('controller/index'); } public function region_view() { $table="master_data"; $where=array('type'=>2); $data['supervisor']=$this->model->fetch_where_data($table,$where); $table1="region"; $data['region']=$this->model->get_all_data($table1); $table2="master_data"; $where2=array('id'=>8); $data['role']=$this->model->fetch_where_data($table2,$where2); $tab="supervisor"; $data['time']=$this->model->get_time($tab); $this->load->view('region_view',$data); } public function region_view_insert() { $page = isset($_POST['page'])?$_POST['page']:1; $limit = isset($_POST['rows'])?$_POST['rows']:10; $sidx = isset($_POST['sidx'])?$_POST['sidx']:'id'; $sord = isset($_POST['sord'])?$_POST['sord']:''; $start = $limit*$page - $limit; $start = ($start<0)?0:$start; $where = ""; $searchField = isset($_POST['searchField']) ? $_POST['searchField'] : false; $searchOper = isset($_POST['searchOper']) ? $_POST['searchOper']: false; $searchString = isset($_POST['searchString']) ? $_POST['searchString'] : false; if(!$sidx) $sidx =1; //$count = $this->db->count_all_results('rate'); $whers=array('status'=>0,'role'=>8); $table1='supervisor'; $count = $this->model->fetch_where_data($table1,$whers); //echo $count; $count=count($count); if( $count > 0 ) { $total_pages = ceil($count/$limit); //echo $total_pages; } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $query = $this->model->getdata($start,$limit,$sidx,$sord,$whers,$table1); //print_r($query); $responce = array(); $responce["page"] = $page; $responce["total"] = $total_pages; $responce["records"] = $count; $i=0; foreach($query as $row) { $responce["rows"][$i]['id']=$row->id; $responce["rows"][$i]['cell']=array($row->id,$row->usercode,$row->region,$row->username,$row->email,$row->password,$row->phone,$row->role); $i++; } echo json_encode($responce); } public function region_view_add() { $cc=$this->input->post('cc'); $usercode=$this->input->post('usercode'); $region=$this->input->post('region'); $username=$this->input->post('username'); $email=$this->input->post('email'); $password=$this->input->post('password'); $phone=$this->input->post('phone'); //$department=$this->input->post('department'); $role=$this->input->post('role'); //$image=$this->input->post('image'); //$createdate=$this->input->post('createdate'); //$status=$this->input->post('status'); $rate=array('usercode'=>$usercode,'username'=>$username,'email'=>$email,'password'=>$password,'phone'=>$phone,'role'=>$role,'region'=>$region); //print_r($rate); $table='supervisor'; $where=array('role'=>8); $det=$this->model->fetch_where_data($table,$where); if((count($det))>0) { $this->model->insert($table,$rate); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, Added new supervisor:".$username.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } return true; } public function region_view_edit() { $cc=$this->input->post('cc'); $id=$this->input->post('id'); $usercode=$this->input->post('usercode'); $region=$this->input->post('region'); $username=$this->input->post('username'); $email=$this->input->post('email'); $password=$this->input->post('password'); $phone=$this->input->post('phone'); //$department=$this->input->post('department'); $role=$this->input->post('role'); //$image=$this->input->post('image'); //$createdate=$this->input->post('createdate'); //$status=$this->input->post('status'); $rate=array('usercode'=>$usercode,'username'=>$username,'email'=>$email,'password'=>$password,'phone'=>$phone,'role'=>$role,'region'=>$region); $table='supervisor'; $where=array('id'=>$id); $data=$this->model->get_where_row($table,$where); if(count($data)>0) { $this->model->update_new($where,$table,$rate); $this->load->library('email'); $this->email->set_mailtype('html'); $msg = "Hi, Edited supervisor:".$username.','."email:".$email; $this->email->from('yindabpportal@yaskawa.in', 'yaskawa'); $this->email->to($email, 'yaskawa'); $this->email->cc($cc); $this->email->subject('Added information'); // //$data['message'] = $msg; $this->email->message($msg); $this->email->send(); } else return ""; } public function auto_product() { $keyword=$this->input->post('product_name'); $data1=$this->model->Get($keyword); //print_r($data1); foreach($data1 as $row) { $data[]=$row->product; } echo json_encode($data); } public function reg_news_view() { $reg=$this->session->userdata('region'); $table='news'; $data['news']=$this->model->get_all_data($table); $this->load->view('region_news_view',$data); } } ?>