whoami7 - Manager
:
/
proc
/
self
/
root
/
home
/
papecmvm
/
www
/
application
/
controllers
/
webapp
/
Upload File:
files >> //proc/self/root/home/papecmvm/www/application/controllers/webapp/People.php
<?php use Aws\S3\S3Client; use Aws\S3\Exception\S3Exception; use Aws\CommandPool; if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH."third_party/aws/autoload.php"; class People extends CI_Controller { function __construct() { parent::__construct(); $userdata = $this->session->userdata('reg_info'); if(!isset($userdata)) { $base = base_url(); redirect($base); } $this->load->model('app', "model"); $CI = & get_instance(); $this->db = $CI->load->database('default', TRUE); $this->db2 = $CI->load->database('db2', TRUE); //aws $bucketname = 'paperpushbucket'; $key = 'AKIAJJ72VRLHXBD272YQ'; $secret = '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'; $this->s3 = S3Client::factory( array( 'credentials' => array( 'key' => $key, 'secret' => $secret ), 'version' => 'latest', 'region' => 'ap-south-1' ) ); } public function office($offset = '0') { $where = array('type!=' => 'customer'); //$cnt_data['data']=$this->model->DetailData('tbl_registration', $where); $names = array('customer', 'superadmin'); $this->db2->select('*'); $this->db2->from('tbl_registration'); if($_SESSION['reg_info'][0]['type'] == 'admin'){ $this->db2->where_not_in('type', $names); }else{ $this->db2->where($where); } //$this->db2->where_not_in('type', $names); $cnt_data['data'] = $this->db2->get()->result_array(); //echo "<pre>";print_r($cnt_data['data']);die; $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/office'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $userdata['data'] = $this->model->get_pagination_where_admin_office('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>";print_r($userdata['data']);die; $userdata['type'] = 'office'; $this->load->view("webapp/office",$userdata); } public function customer($offset = 0) { if(isset($_GET['showactive']) && $_GET['showactive'] == "1"){ $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> User is Activated. </div>'); //redirect('webapp/people/customer'); } /*$where = array('type' => 'customer'); $cnt_data['data']=$this->model->DetailData('tbl_registration', $where);*/ $where = array('r.type' => 'customer'); $rids = $this->getAssignedCustomer_teamleader($_SESSION['reg_info'][0]['rid']); $this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); if($_SESSION['reg_info'][0]['type'] == 'admin' || $_SESSION['reg_info'][0]['type'] == 'superadmin'){ $this->db2->where($where); }else{ $this->db2->where("r.type" , "customer"); $this->db2->where_in("r.rid" , $rids); } $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $cnt_data['data'] = $this->db2->get()->result_array(); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/customer'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $userdata['data'] = $this->model->get_pagination_where_Cust('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>";print_r($userdata['data']);die; $userdata['type'] = 'customer'; $userdata['customer'] = 'Customer'; /*$this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); $this->db2->where('r.type', 'customer'); $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $userdata['Assign_Team_Leader'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($userdata['Assign_Team_Leader']); die;*/ $this->db2->select('a.rid,a.name'); $this->db2->from('tbl_registration as a'); $this->db2->where('type', 'team_leader'); $userdata['Team_Leader'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($userdata['Team_Leader']); die; $userdata['All_Customer'] = $this->db2->get_where('tbl_registration', array('type'=>'customer'))->num_rows(); $userdata['EmailVerified'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'1'))->num_rows(); $userdata['EmailPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'0'))->num_rows(); $userdata['PaymentDone'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'1'))->num_rows(); $userdata['PaymentPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'0'))->num_rows(); //echo "<pre>"; print_r($userdata['EmailPending']); die; $this->load->view("webapp/office",$userdata); } public function getAssignedCustomer_teamleader($lid){ $this->db2->select("customer_id"); $this->db2->from("tbl_assign_customer_teamleader"); $this->db2->where("leader_id" , $lid ); $data = $this->db2->get()->result_array(); $temp = [] ; if(!empty($data)){ foreach($data as $k => $v){ $temp[] = $v['customer_id']; } }else{ $temp[] = ""; } return $temp ; } public function assignto(){ //$temp = [] ; if($_POST['assignto'] != "" && $_POST['rids'] != ""){ $assignedIDS = $this->getAssignedCustomer_teamleader($_POST['assignto']); $count = count($_POST['rids']); $customer_id = $_POST['rids']; for($i=0; $i<$count; $i++){ if($customer_id[$i] != ""){ if(in_array($customer_id[$i] , $assignedIDS )){ continue; } $this->db2->select("customer_id"); $this->db2->from("tbl_assign_customer_teamleader"); $this->db2->where("leader_id !=" , $_POST['assignto'] ); $this->db2->where("customer_id" , $customer_id[$i] ); $id2s = $this->db2->get()->row_array(); /*echo "<pre>"; print_r($id2s['customer_id']); die;*/ if(empty($id2s)){ $insertdata=array( 'leader_id'=>$_POST['assignto'], 'customer_id'=>$customer_id[$i], ); $this->model->insertData('tbl_assign_customer_teamleader',$insertdata); }else{ //$temp[] = $id2s['customer_id'] ; $where_upa = array('customer_id' => $customer_id[$i] ); $insertdata_upa=array( 'leader_id'=>$_POST['assignto'], 'customer_id'=>$customer_id[$i], ); $this->model->UpdateData('tbl_assign_customer_teamleader', $insertdata_upa, $where_upa); } } } /*if(count($temp) > 0){ $this->db2->select("group_concat(name) notassignedname"); $this->db2->from("tbl_registration"); $this->db2->where_in("rid" , $temp ); $notassignedname = $this->db2->get()->row_array(); $names = $notassignedname['notassignedname']; }else{ $names = '' ; }*/ $array['status'] = 'success'; $array['message'] = 'Customer Assign Successfully'; //$array['not_assigned'] = $temp; //$array['not_assigned_name'] = $names; }else if($_POST['assignto'] == "" && $_POST['rids'] != ""){ $array['status'] = 'error'; $array['message'] = 'Please Select Team Leader Name'; //$array['not_assigned'] = $temp; //$array['not_assigned_name'] = ''; }else if($_POST['assignto'] != "" && $_POST['rids'] == ""){ $array['status'] = 'error'; $array['message'] = 'Please Select Customer Name'; //$array['not_assigned'] = $temp; //$array['not_assigned_name'] = ''; }else if($_POST['assignto'] == "" && $_POST['rids'] == ""){ $array['status'] = 'error'; $array['message'] = 'Please Select Team Leader and Customer Name'; //$array['not_assigned'] = $temp; //$array['not_assigned_name'] = ''; }else{ $array['status'] = 'error'; $array['message'] = 'You are not Assign this Customer'; //$array['not_assigned'] = $temp; //$array['not_assigned_name'] = ''; } echo json_encode($array); //DIE; } public function view($encrypted_id) { $id = $this->model->decryptdata($encrypted_id); $where=array('rid' => $id); $userdata['data'] = $this->model->DetailData('tbl_registration', $where); $cur_year = date('Y'); $this->db2->order_by('id', 'DESC'); $this->db2->limit(12); $userdata['log'] = $this->db2->get_where('tbl_cust_log', $where)->result_array(); $where2=array('type' => 'office_user'); $userdata['office_user'] = $this->model->DetailData('tbl_registration', $where2); //$where3=array('afrom' => $id); $userdata['access_folder'] = $this->model->getAccess($id); $userdata['encrypted_id'] = $encrypted_id; //echo "<pre>"; print_r($userdata['access_folder']); die; $where = array('code' => $userdata['data'][0]['folder_code']); $userdata['struct'] = $this->db2->get_where('cust_upload_structure', $where)->result_array(); $userdata['code'] = $userdata['data'][0]['folder_code']; $where_current = array('code' => $userdata['data'][0]['folder_code'], 'year'=>$cur_year); $userdata['current_ser'] = $this->db2->get_where('cust_upload_structure', $where_current)->row_array(); //echo "<pre>"; print_r($userdata['struct']); die; $this->db2->select('*'); $this->db2->from('cust_upload_notify'); $this->db2->where('n_from', $id); $this->db2->limit(10); $userdata['logs'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($userdata); die; $this->load->view("webapp/view_people",$userdata); } public function add_user(){ if($this->input->post('save')=='save'){ $email = $this->input->post('email'); /*$where = array('email' => $email, 'type!=' => 'customer'); $chk_email = $this->model->DetailData('tbl_registration', $where);*/ $username = $this->input->post('username'); $where = array('username' => $username, 'type!=' => 'customer'); $chk_username = $this->model->DetailData('tbl_registration', $where); $cnt = count($chk_username); if($cnt == '0'){ $pass = $this->input->post('phone'); $password = md5($pass); $config['upload_path'] = './webapp/profile/'; $config['allowed_types']= 'gif|jpg|png|jpeg'; $config['encrypt_name'] = TRUE; $this->upload->initialize($config); $this->load->library('upload', $config); $this->upload->do_upload('photo'); $data = $this->upload->data(); $photo = $data['file_name']; $insertdata=array( 'pass'=>$password, 'name'=>$this->input->post('name'), 'email'=>$email, 'username'=>$username, 'mobile'=>$this->input->post('phone'), 'photo'=>$photo, 'type'=>$this->input->post('type'), 'reg_from'=>'system', 'status'=>'1' ); $this->model->insertData('tbl_registration',$insertdata); $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> User has been added. </div>'); redirect('webapp/people/office'); }else{ $this->session->set_flashdata('msg', ' <div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Error!</strong> User Name is already available. </div>'); redirect('webapp/people/office'); } }else{ $this->load->view('webapp/add_user'); } } public function search(){ $search = $this->input->post('src'); $where = array('type!=' => 'customer'); $names = array('customer', 'superadmin'); $this->db2->select('*'); $this->db2->like('name', $search); if($_SESSION['reg_info'][0]['type'] == 'admin'){ $this->db2->where_not_in('type', $names); }else{ $this->db2->where($where); } //$this->db2->where('type!=', 'customer'); $result = $this->db2->get('tbl_registration')->result_array(); foreach ($result as $key => $value) { $encrypted_id = $this->model->encryptdata($value['rid']); if($value['type'] == 'team_leader'){ $label = "Team Leader"; }elseif($value['type'] == 'office_user'){ $label = "Office User"; }elseif($value['type'] == 'admin'){ $label = "Admin"; }elseif($value['type'] == 'superadmin'){ $label = "Super Admin"; } if($value['status'] == '1'){ $es = '<span class="badge bg-green">Verified</span>'; }else{ $es = '<span class="badge bg-red">pending</span>'; } echo '<tr> <td class="text-capitalize"><a href="'.base_url()."webapp/people/view/".$encrypted_id.'">'.$value["name"].'</a><br><span class="text-danger">'.$label.'</span></td> <td>'.$value["email"].'</td> <td>'.$value["username"].'</td> <td>'.$value["mobile"].'</td> <td>'.$es.'</td> <td>'; echo '<a href="'.base_url().'webapp/people/updateUser/'.$encrypted_id.'" class="btn btn-primary"><i class="fa fa-pencil-square-o"></i></a> '; if($value['type'] != 'admin'){ if($value['status'] == '1'){ echo '<a href="'.base_url().'webapp/people/deactive/'.$encrypted_id.'" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Click here to deactive" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i></a>'; }else{ echo '<a href="'.base_url().'webapp/people/active/'.$encrypted_id.'" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Click here to active" aria-hidden="true"><i class="fa fa-check" aria-hidden="true"></i></a>'; } } '</td> </tr>'; } } public function json_office_rec($offset = '0') { $where = array('type!=' => 'customer'); //$cnt_data['data']=$this->model->DetailData('tbl_registration', $where); $names = array('customer', 'superadmin'); $this->db2->select('*'); $this->db2->from('tbl_registration'); if($_SESSION['reg_info'][0]['type'] == 'admin'){ $this->db2->where_not_in('type', $names); }else{ $this->db2->where($where); } $cnt_data['data'] = $this->db2->get()->result_array(); //echo "<pre>";print_r($cnt_data['data']);die; $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/json_office_rec'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $result = $this->model->get_pagination_where_admin_office('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>"; print_r($result); die; foreach ($result as $key => $value) { $encrypted_id = $this->model->encryptdata($value['rid']); if($value['type'] == 'team_leader'){ $label = "Team Leader"; }elseif($value['type'] == 'office_user'){ $label = "Office User"; }elseif($value['type'] == 'admin'){ $label = "Admin"; }elseif($value['type'] == 'superadmin'){ $label = "Super Admin"; } if($value['status'] == '1'){ $es = '<span class="badge bg-green">Verified</span>'; }else{ $es = '<span class="badge bg-red">pending</span>'; } echo '<tr> <td class="text-capitalize"><a href="'.base_url()."webapp/people/view/".$encrypted_id.'">'.$value["name"].'</a><br><span class="text-danger">'.$label.'</span></td> <td>'.$value["email"].'</td> <td>'.$value["username"].'</td> <td>'.$value["mobile"].'</td> <td>'.$es.'</td> <td>'; echo '<a href="'.base_url().'webapp/people/updateUser/'.$encrypted_id.'" class="btn btn-primary"><i class="fa fa-pencil-square-o"></i></a> '; if($value['type'] != 'admin'){ if($value['status'] == '1'){ echo '<a href="'.base_url().'webapp/people/deactive/'.$encrypted_id.'" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Click here to deactive" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i></a>'; }else{ echo '<a href="'.base_url().'webapp/people/active/'.$encrypted_id.'" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Click here to active" aria-hidden="true"><i class="fa fa-check" aria-hidden="true"></i></a>'; } } '</td> </tr>'; } } public function search_cust(){ $search = $this->input->post('src'); /*$this->db2->select('*'); $this->db2->where('type', 'customer'); $this->db2->like('name', $search); $result = $this->db2->get('tbl_registration')->result_array();*/ //echo "<pre>"; print_r($result); die; $this->db2->select('r.*,i.name as leadername'); $this->db2->where('r.type', 'customer'); $this->db2->like('r.name', $search); $this->db2->from('tbl_registration as r'); $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $result = $this->db2->get()->result_array(); //echo "<pre>"; print_r($result); die; foreach ($result as $key => $value) { $encrypted_id = $this->model->encryptdata($value['rid']); if($value['status'] == '1'){ $email_status = '<span class="badge bg-green">Verified</span>'; }else{ $email_status = '<span class="badge bg-red">Pending</span>'; } if($value['payment_status'] == '1'){ $payment_status = '<span class="badge bg-green">Done</span>'; }else{ $payment_status = '<span class="badge bg-red">Pending</span>'; } $chk = '<input type="checkbox" class="customrid" onchange="setrids()" name="rid[]" value="'.$value["rid"].'" >'; echo '<tr> <td>'.$chk.'</td> <td class="text-capitalize"><a href="'.base_url()."webapp/people/view/".$encrypted_id.'">'.$value["name"].'</a></td> <td>'.$value["leadername"].'</td> <td>'.$value["email"].'</td> <td>'.$value["username"].'</td> <td>'.$value["mobile"].'</td> <td>'.$email_status.'</td> <td>'.$payment_status.'</td> <td>'; echo '<a href="'.base_url().'webapp/people/updateUser/'.$encrypted_id.'" class="btn btn-primary"><i class="fa fa-pencil-square-o"></i></a> '; if($value['type'] != 'admin'){ if($value['payment_status'] == '1'){ echo '<a href="'.base_url().'webapp/people/deactive/'.$encrypted_id.'" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Click here to deactive" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i></a>'; }else{ echo '<a href="'.base_url().'webapp/people/active/'.$encrypted_id.'" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Click here to active" aria-hidden="true"><i class="fa fa-check" aria-hidden="true"></i></a>'; } } '</td> </tr>'; } } public function json_cust_rec($offset = '0') { $where = array('type' => 'customer'); $cnt_data['data']=$this->model->DetailData('tbl_registration', $where); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/json_cust_rec'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); //$result = $this->model->get_pagination_where('tbl_registration', $config['per_page'], $offset, $where); $result = $this->model->get_pagination_where_Cust('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>"; print_r($result); die; foreach ($result as $key => $value) { $encrypted_id = $this->model->encryptdata($value['rid']); if($value['status'] == '1'){ $email_status = '<span class="badge bg-green">Verified</span>'; }else{ $email_status = '<span class="badge bg-red">Pending</span>'; } if($value['payment_status'] == '1'){ $payment_status = '<span class="badge bg-green">Done</span>'; }else{ $payment_status = '<span class="badge bg-red">Pending</span>'; } $chk = '<input type="checkbox" class="customrid" onchange="setrids()" name="rid[]" value="'.$value["rid"].'" >'; echo '<tr> <td>'.$chk.'</td> <td class="text-capitalize"><a href="'.base_url()."webapp/people/view/".$encrypted_id.'">'.$value["name"].'</a></td> <td>'.$value["leadername"].'</td> <td>'.$value["email"].'</td> <td>'.$value["username"].'</td> <td>'.$value["mobile"].'</td> <td>'.$email_status.'</td> <td>'.$payment_status.'</td> <td>'; echo '<a href="'.base_url().'webapp/people/updateUser/'.$encrypted_id.'" class="btn btn-primary"><i class="fa fa-pencil-square-o"></i></a> '; if($value['type'] != 'admin'){ if($value['payment_status'] == '1'){ echo '<a href="'.base_url().'webapp/people/deactive/'.$encrypted_id.'" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Click here to deactive" aria-hidden="true"><i class="fa fa-times" aria-hidden="true"></i></a>'; }else{ echo '<a href="'.base_url().'webapp/people/active/'.$encrypted_id.'" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Click here to active" aria-hidden="true"><i class="fa fa-check" aria-hidden="true"></i></a>'; } } '</td> </tr>'; } } /***************************** Start TeamLeader Cutomer Search ***************************************************/ public function search_cust_team(){ $search = $this->input->post('src'); $rids = $this->getAssignedCustomerCheck($_SESSION['reg_info'][0]['rid']); $this->db2->select('r.*,i.name as leadername'); $this->db2->where("r.type" , "customer"); $this->db2->where_in("r.rid" , $rids); $this->db2->like('r.name', $search); $this->db2->from('tbl_registration as r'); $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $result = $this->db2->get()->result_array(); //echo "<pre>"; print_r($result); die; foreach ($result as $key => $value) { $encrypted_id = $this->model->encryptdata($value['rid']); echo '<tr> <td class="text-capitalize"><a href="'.base_url()."webapp/people/view/".$encrypted_id.'">'.$value["name"].'</a></td> <td>'.$value["email"].'</td> <td>'.$value["username"].'</td> <td>'.$value["mobile"].'</td> <td>'; echo '<a href="'.base_url().'webapp/people/updateUser/'.$encrypted_id.'" class="btn btn-primary"><i class="fa fa-pencil-square-o"></i></a> '; '</td> </tr>'; } } public function json_cust_team_rec($offset = '0') { $where = array('type' => 'customer'); $cnt_data['data']=$this->model->DetailData('tbl_registration', $where); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/json_cust_rec'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $result = $this->model->get_pagination_where_Cust('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>"; print_r($result); die; foreach ($result as $key => $value) { $encrypted_id = $this->model->encryptdata($value['rid']); echo '<tr> <td class="text-capitalize"><a href="'.base_url()."webapp/people/view/".$encrypted_id.'">'.$value["name"].'</a></td> <td>'.$value["email"].'</td> <td>'.$value["username"].'</td> <td>'.$value["mobile"].'</td> <td>'; echo '<a href="'.base_url().'webapp/people/updateUser/'.$encrypted_id.'" class="btn btn-primary"><i class="fa fa-pencil-square-o"></i></a> '; '</td> </tr>'; } } public function getAssignedCustomerCheck($lid){ $this->db2->select("customer_id"); $this->db2->from("tbl_assign_customer_teamleader"); $this->db2->where("leader_id" , $lid ); $data = $this->db2->get()->result_array(); $temp = [] ; if(!empty($data)){ foreach($data as $k => $v){ $temp[] = $v['customer_id']; } }else{ $temp[] = ""; } return $temp ; } /***************************** End TeamLeader Cutomer Search ***************************************************/ public function changePhoto(){ $uid = $this->input->post('uid'); $where = array('rid' => $uid); $user = $this->model->DetailData('tbl_registration', $where); $old_photo = $user[0]['photo']; $config['upload_path'] = './webapp/profile/'; $config['allowed_types']= 'gif|jpg|png|pdf|jpeg'; $config['encrypt_name'] = TRUE; $this->upload->initialize($config); $this->load->library('upload', $config); if($this->upload->do_upload('photo')){ if(!empty($old_photo)){ unlink('webapp/profile/'.$old_photo); } $data = $this->upload->data(); $photo = $data['file_name']; }else{ $photo = $this->input->post('hiddenPhoto'); } $date_incorporation = date("Y-m-d", strtotime($this->input->post('date_incorporation'))); $country = explode('_', $this->input->post('country')); $country = $country[1]; if($country == "India"){ $phone_code = "+91"; $gst = $this->input->post('gst'); $pan = $this->input->post('pan'); $llc_no = $this->input->post('llc_no'); $llp_no = $this->input->post('llp_no'); $cin_no = $this->input->post('cin_no'); $tax_id = ""; $impo_expo_no = $this->input->post('impo_expo_no'); $other_reg_no = $this->input->post('other_reg_no'); }else{ $phone_code = "+1"; $gst = ""; $pan = ""; $llc_no = $this->input->post('llc_no'); $llp_no = $this->input->post('llp_no'); $cin_no = ""; $tax_id = $this->input->post('tax_id'); $impo_expo_no = $this->input->post('impo_expo_no'); $other_reg_no = $this->input->post('other_reg_no'); } $insertdata=array( 'photo' => $photo, 'name' => $this->input->post('name'), 'email' => $this->input->post('email'), 'phone_code' => $phone_code, 'mobile' => $this->input->post('phone'), 'constitution'=>$this->input->post('constitution'), 'business_name'=>$this->input->post('business_name'), 'constitution_other'=>$this->input->post('constitution_other'), 'date_incorporation'=>$date_incorporation, 'nob'=>$this->input->post('nob'), 'ur'=>$this->input->post('ur'), 'ri'=>$this->input->post('ri'), 'gst'=>$gst, 'pan'=>$pan, 'llc_no'=>$llc_no, 'llp_no'=>$llp_no, 'cin_no'=>$cin_no, 'tax_id'=>$tax_id, 'impo_expo_no'=>$impo_expo_no, 'other_reg_no'=>$other_reg_no, 'country'=>$country, 'state'=>$this->input->post('state'), 'address'=>$this->input->post('address') ); $this->model->UpdateData('tbl_registration', $insertdata, $where); /************************************************************************/ $where_fltr=array('rid'=>$uid); $fltrData=$this->model->DetailData('tbl_director',$where_fltr); $fltrData = count($fltrData); if($fltrData >0){ $this->model->DeleteData('tbl_director',$where_fltr); } $count = count($this->input->post('director_name')); $director_name = $this->input->post('director_name'); $din_no = $this->input->post('din_no'); for($i=0; $i<$count; $i++){ if($director_name[$i] != ""){ $insertdata_flo=array( 'rid'=>$uid, 'director_name'=>$director_name[$i], 'din_no'=>$din_no[$i], ); $this->model->insertData('tbl_director', $insertdata_flo); } } /*************************************************************************/ $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> Data has been updated. </div>'); redirect('webapp/users/profile'); } public function updateUser($encrypted_id){ $uid = $this->model->decryptdata($encrypted_id); if($this->input->post('save')=='save'){ //echo "<pre>"; print_r($_POST); die; $where = array('rid' => $uid); $user = $this->model->DetailData('tbl_registration', $where); $old_photo = $user[0]['photo']; $config['upload_path'] = './webapp/profile/'; $config['allowed_types']= 'gif|jpg|png|pdf|jpeg'; $config['encrypt_name'] = TRUE; $this->upload->initialize($config); $this->load->library('upload', $config); if($this->upload->do_upload('photo')){ if(!empty($old_photo)){ unlink('webapp/profile/'.$old_photo); } $data = $this->upload->data(); $photo = $data['file_name']; }else{ $photo = $this->input->post('hiddenPhoto'); } /*$username = $this->input->post('username'); $where_username = array('username' => $username); $query = $this->model->DetailData('tbl_registration', $where_username); $cnt = count($query); if($cnt == 0){ $insertdata=array( 'photo' => $photo, 'name' => $this->input->post('name'), 'email' => $this->input->post('email'), 'username' => $this->input->post('username'), 'mobile' => $this->input->post('phone') ); $this->model->UpdateData('tbl_registration', $insertdata, $where); }else{ $this->session->set_flashdata('msg', ' <div class="alert alert-danger alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Error!</strong> User Name Already Available. </div>'); redirect('webapp/people/office'); }*/ $insertdata=array( 'photo' => $photo, 'name' => $this->input->post('name'), 'email' => $this->input->post('email'), 'mobile' => $this->input->post('phone') ); $this->model->UpdateData('tbl_registration', $insertdata, $where); $this->db2->select("customer_id"); $this->db2->from("tbl_assign_customer_teamleader"); $this->db2->where("leader_id !=" , $_POST['TeamLeader'] ); $this->db2->where("customer_id" , $uid ); $id2s = $this->db2->get()->row_array(); if(empty($id2s)){ $insertdata_ass=array( 'leader_id'=>$_POST['TeamLeader'], 'customer_id'=>$uid, ); $this->model->insertData('tbl_assign_customer_teamleader',$insertdata_ass); }else{ $where2 = array('customer_id' => $uid); $insertdata_ass_upa=array( 'leader_id'=>$_POST['TeamLeader'], 'customer_id'=>$uid, ); $this->model->UpdateData('tbl_assign_customer_teamleader',$insertdata_ass_upa, $where2); } $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> Data has been updated. </div>'); redirect('webapp/people/office'); }else{ /*$where = array('rid' => $uid); $data['user'] = $this->model->DetailData('tbl_registration', $where);*/ $this->db2->select('r.*,i.name as LeaderName,i.rid as LeaderId'); $this->db2->from('tbl_registration as r'); $this->db2->where('r.rid', $uid); $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $data['user'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($data['user']); echo "<br>"; $this->db2->select('a.rid,a.name'); $this->db2->from('tbl_registration as a'); $this->db2->where('type', 'team_leader'); $data['Team_Leader'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($data['Team_Leader']); die; $this->load->view('webapp/add_user', $data); } } public function deactive($encrypted_id){ $uid = $this->model->decryptdata($encrypted_id); $where = array('rid' => $uid); $upd = array('payment_status' => '0'); $this->model->UpdateData('tbl_registration', $upd, $where); $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> User is Deactivated. </div>'); $data = $this->model->DetailData('tbl_registration', $where); $type = $data[0]['type']; if($type == 'customer'){ redirect('webapp/people/customer'); }else{ redirect('webapp/people/office'); } } public function active($encrypted_id){ $uid = $this->model->decryptdata($encrypted_id); $where = array('rid' => $uid); $upd = array('payment_status' => '1'); $this->model->UpdateData('tbl_registration', $upd, $where); $this->session->set_flashdata('msg', ' <div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">×</span></button> <strong>Success!</strong> User is Activated. </div>'); $data = $this->model->DetailData('tbl_registration', $where); $type = $data[0]['type']; if($type == 'customer'){ $name = $data[0]["name"]; $to = $data[0]["email"]; $msg = ' <!DOCTYPE html> <html> <head> <title>PaperPush</title> </head> <body style="font-family: sans-serif;"> <div class="container" style="width:50%; margin: 0 auto; background-color: #eee; box-shadow: 1px 1px 1px 1px #a09191; margin-top: 5rem; margin-bottom: 5rem;"> <div style="color:#fff; background-image: linear-gradient(-20deg, #CF212A 0%, #003865 100%); padding: 10px; text-align: center;"> <h3>Welcome to Paperpush</h3> </div> <div style="padding: 1rem;"> <p><strong>Dear '.$name.',</strong></p> <p><strong>PaperPush is glad to inform you that your account has been activated and now you can start uploading your documents with your account credentials.</strong></p> </div> </div> Regards,<br> Team PaperPush. <p>Note: Please do not reply of this email. This is system generated email. </p> </body> </html>'; $sub = "PaperPush"; $this->model->emailsend($to, $sub, $msg); redirect('webapp/people/customer?showactive=1'); }else{ redirect('webapp/people/office'); } } public function directory($path){ $mypath = $path; $path = explode('-', $path); $data['folder'] = $path[0]; $data['year'] = $path[1]; $data['month'] = $path[2]; $data['voucher'] = $path[3]; $data['mypath'] = $mypath; $this->load->view("webapp/view_directory",$data); } public function directory_used($path){ $mypath = $path; $path = explode('-', $path); $data['folder'] = $path[0]; $data['year'] = $path[1]; $data['month'] = $path[2]; $data['voucher'] = $path[3]; $data['mypath'] = $mypath; $this->load->view("webapp/view_directory_used",$data); } public function directory_scratched($path){ $mypath = $path; $path = explode('-', $path); $data['folder'] = $path[0]; $data['year'] = $path[1]; $data['month'] = $path[2]; $data['voucher'] = $path[3]; $data['mypath'] = $mypath; $this->load->view("webapp/view_directory_scratched",$data); } public function makeUsed(){ $folder = $_POST['folder']; $year = $_POST['year']; $month = $_POST['month']; $voucher = $_POST['voucher']; $name = $_POST['name']; $url1 = base_url().'documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/'.$name; $url2 = './documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/used'; $url3 = './documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/used/'.$name; $url4 = './documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/'.$name; if(is_dir($url2)) { if(rename($url4, $url3)){ echo 'Success'; }else{ echo 'somthing went wrong'; } }else{ mkdir($url2); if(rename($url4, $url3)){ echo 'Success'; }else{ echo 'somthing went wrong'; } } } public function makeScratched(){ $folder = $_POST['folder']; $year = $_POST['year']; $month = $_POST['month']; $voucher = $_POST['voucher']; $name = $_POST['name']; $url1 = base_url().'documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/'.$name; $url2 = './documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/scratched'; $url3 = './documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/scratched/'.$name; $url4 = './documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/'.$name; if(is_dir($url2)) { if(rename($url4, $url3)){ echo 'Success'; }else{ echo 'somthing went wrong'; } }else{ mkdir($url2); if(rename($url4, $url3)){ echo 'Success'; }else{ echo 'somthing went wrong'; } } } public function trashUsed(){ $folder = $_POST['folder']; $year = $_POST['year']; $month = $_POST['month']; $voucher = $_POST['voucher']; $name = $_POST['name']; $url = './documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/used/'.$name; if(unlink($url)){ echo 'Removed'; }else{ echo 'Error'; } } public function trashScratched(){ $folder = $_POST['folder']; $year = $_POST['year']; $month = $_POST['month']; $voucher = $_POST['voucher']; $name = $_POST['name']; $url = './documents/'.$folder.'/'.$year.'/'.$month.'/'.$voucher.'/scratched/'.$name; if(unlink($url)){ echo 'Removed'; }else{ echo 'Error'; } } public function makeStructure_ser(){ //echo '<pre>'; print_r($_POST); die; $user_code = $this->input->post('code'); $year = $this->input->post('year'); $ent = str_replace(' ', '_', $this->input->post('ser_name')); $bucketname = 'paperpushbucket'; $month = ['a_april', 'b_may', 'c_june', 'd_july', 'e_august', 'f_september', 'g_october', 'h_november', 'i_december', 'j_january', 'k_february', 'l_march']; foreach ($month as $value) { $this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/", 'Body' => "", 'ACL' => 'public-read']); } $where = array('code' => $user_code, 'year' => $year); $get = $this->db2->get_where('cust_upload_structure', $where)->row_array(); $stage = $get['stage']; $dec_stage = json_decode($stage); $new_stage=[]; foreach($dec_stage as $key => $val){ $new_stage[]=$val; } $new_stage[]=$ent; $enc_stage = json_encode($new_stage); $upd = array('stage'=>$enc_stage); $this->model->UpdateData('cust_upload_structure',$upd,$where); $array['status'] = 'success'; echo json_encode($array); } public function remService(){ //echo '<pre>'; print_r($_POST); die; $code = $this->input->post('code'); $year = $this->input->post('year'); $posted_stage = $this->input->post('stage'); $where = array('code'=>$code, 'year'=>$year); $get = $this->db2->get_where('cust_upload_structure', $where)->row_array(); //echo '<pre>'; print_r($get); $stage = json_decode($get['stage']); //echo '<pre>'; print_r($stage); if (($key = array_search($posted_stage, $stage)) !== false) { unset($stage[$key]); } $resetArray = array_values($stage); //echo '<pre>'; print_r($resetArray); $jsonArray = json_encode($resetArray); //echo '<pre>'; print_r($jsonArray); //die; $data = array('stage'=>$jsonArray); //echo '<pre>'; print_r($data); die; $this->model->UpdateData('cust_upload_structure', $data, $where); $array['status'] = 'success'; echo json_encode($array); } public function makeStructure_pastDir(){ //echo '<pre>'; print_r($_POST); die; $user_code = $this->input->post('code'); $year = $this->input->post('year'); //$year = '2020'; $check = $this->db2->get_where('cust_upload_structure', array('year'=>$year, 'code'=>$user_code))->num_rows(); if($check == 0){ $array['status'] = 'success'; $entries = ['purchase_invoices', 'sales_invoices', 'cash_payment', 'cash_receipt', 'cheque_paid', 'expense_vouchers', 'debit_notes', 'credit_notes', 'bank_statements', 'cheque_deposited', 'reports', 'others']; $json_entry = json_encode($entries); $data = array( 'code' => $user_code, 'year' => $year, 'stage' => $json_entry ); $this->model->insertData('cust_upload_structure', $data); $bucketname = 'paperpushbucket'; $this->s3->putObject( [ 'Bucket' => $bucketname, 'Key' => $user_code."/", 'Key' => $user_code."/".$year."/", 'Body' => "", 'ACL' => 'public-read' ], ); $month = ['a_april', 'b_may', 'c_june', 'd_july', 'e_august', 'f_september', 'g_october', 'h_november', 'i_december', 'j_january', 'k_february', 'l_march']; foreach ($month as $value) { $this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/", 'Body' => "", 'ACL' => 'public-read']); $entries = ['purchase_invoices', 'sales_invoices', 'cash_payment', 'cash_receipt', 'cheque_paid', 'expense_vouchers', 'debit_notes', 'credit_notes', 'bank_statements', 'cheque_deposited', 'reports', 'others']; foreach ($entries as $ent) { $this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/", 'Body' => "", 'ACL' => 'public-read']); //$this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/completed/", 'Body' => "", 'ACL' => 'public-read']); //$this->s3->putObject(['Bucket' => $bucketname, 'Key' => $user_code."/".$year."/".$value."/".$ent."/rejected/", 'Body' => "", 'ACL' => 'public-read']); } } }else{ $array['status'] = 'error'; $array['msg'] = 'Selected disrectory is alrady available.'; } echo json_encode($array); } public function upload_temp(){ //echo "<pre>"; print_r($_FILES); echo "<pre>"; print_r($_POST); die; $bucketname = 'paperpushbucket'; $code = $this->input->post('code'); $userdata = $this->session->userdata('reg_info'); $rid = $userdata[0]['rid']; $path = $code.'/Templates'; $count = count($_FILES['doc']['size']); for($i = 0; $i < $count; $i++){ $filename = $_FILES['doc']['name'][$i]; $ext = pathinfo($filename, PATHINFO_EXTENSION); $ext = strtolower($ext); if(!empty($ext)){ if($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'pdf' || $ext == 'csv' || $ext == 'xls' || $ext == 'xlsb' || $ext == 'xlsx'){ //echo "<pre>"; print_r($_FILES); die; $rand =rand(10,100); $target_file = preg_replace("/[^a-z0-9\_\-\.]/i", '', $_FILES['doc']['name'][$i]); $new_file = $rand.'_'.$target_file; $file_name = $_FILES['doc']['name'][$i]; $temp_file_location = $_FILES['doc']['tmp_name'][$i]; //$ct = ['image/jpg', 'image/jpeg', 'image/png', 'application/csv']; if($ext == 'pdf' || $ext == 'PDF'){ $this->s3->putObject([ 'Bucket' => $bucketname, 'Key' => $path.'/'.$new_file, 'SourceFile' => $temp_file_location, 'ContentType' => 'application/pdf', //'Body' => fopen($temp_file_location, 'rb'), 'ACL' => 'public-read', ]); }else{ $this->s3->putObject([ 'Bucket' => $bucketname, 'Key' => $path.'/'.$new_file, 'SourceFile' => $temp_file_location, //'ContentType' => 'image/jpg', //'Body' => fopen($temp_file_location, 'rb'), 'ACL' => 'public-read', ]); } //insert in table $data = array( 'ct_from' => $rid, 'ct_code' => $code, 'ct_filename' => $new_file, 'datetime' => date('Y-m-d H:i:s'), ); $this->model->insertData('cust_templates', $data); } } } } public function view_temp(){ $code=$this->input->post('code'); $data = $this->db2->get_where('cust_templates', array('ct_code'=>$code))->result_array(); if(!empty($data)){ $html=''; $html.='<ul class="list-unstyled">'; $i=0; foreach($data as $k => $v){ $i++; $path = $code.'/Templates/'.$v["ct_filename"]; $html.='<li>'.$i.') <a href="https://paperpushbucket.s3.ap-south-1.amazonaws.com/'.$path.'">'.$v["ct_filename"].'</a></li>'; } $html.='</ul>'; }else{ $html='Files not available'; } $array['html'] = $html; echo json_encode($array); } public function remUsr(){ $aid=$this->input->post('aid'); $where = array('aid' => $aid); $this->model->DeleteData('tbl_access', $where); $array['status'] = 'success'; echo json_encode($array); } public function orderStatus($id, $status){ if($status == '0'){ $sts = 'Verified'; $tt = '1'; $oo = '0'; $class = 'green'; } $data = array('status' => $tt, 'otp'=>$oo); $where = array('rid' => $id); $this->model->updateData('tbl_registration', $data, $where); $click = "order_status(".$id." , ".$tt." )"; $os = '<span style="cursor:pointer" class="badge bg-'.$class.'">'.$sts.'</span>'; $data['html'] = $os; $data['new_sts'] = $tt; echo json_encode($data); } public function EmailVerified($offset = 0){ $where_n = array('r.type' => 'customer','r.status' => '1'); $rids = $this->getAssignedCustomer_teamleader($_SESSION['reg_info'][0]['rid']); $this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); if($_SESSION['reg_info'][0]['type'] == 'admin' || $_SESSION['reg_info'][0]['type'] == 'superadmin'){ $this->db2->where($where_n); }else{ $this->db2->where("r.type" , "customer"); $this->db2->where_in("r.rid" , $rids); } $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $cnt_data['data'] = $this->db2->get()->result_array(); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/EmailVerified'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $userdata['data'] = $this->model->get_pagination_where_Cust_EmailVerified('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>";print_r($userdata['data']);die; $userdata['type'] = 'customer'; $userdata['customer'] = 'Customer'; $this->db2->select('a.rid,a.name'); $this->db2->from('tbl_registration as a'); $this->db2->where('type', 'team_leader'); $userdata['Team_Leader'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($userdata['Team_Leader']); die; $userdata['All_Customer'] = $this->db2->get_where('tbl_registration', array('type'=>'customer'))->num_rows(); $userdata['EmailVerified'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'1'))->num_rows(); $userdata['EmailPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'0'))->num_rows(); $userdata['PaymentDone'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'1'))->num_rows(); $userdata['PaymentPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'0'))->num_rows(); //echo "<pre>"; print_r($userdata['EmailPending']); die; $this->load->view("webapp/office",$userdata); } public function EmailPending($offset = 0){ $where_n = array('r.type' => 'customer','r.status' => '0'); $rids = $this->getAssignedCustomer_teamleader($_SESSION['reg_info'][0]['rid']); $this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); if($_SESSION['reg_info'][0]['type'] == 'admin' || $_SESSION['reg_info'][0]['type'] == 'superadmin'){ $this->db2->where($where_n); }else{ $this->db2->where("r.type" , "customer"); $this->db2->where_in("r.rid" , $rids); } $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $cnt_data['data'] = $this->db2->get()->result_array(); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/EmailPending'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $userdata['data'] = $this->model->get_pagination_where_Cust_EmailPending('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>";print_r($userdata['data']);die; $userdata['type'] = 'customer'; $userdata['customer'] = 'Customer'; $this->db2->select('a.rid,a.name'); $this->db2->from('tbl_registration as a'); $this->db2->where('type', 'team_leader'); $userdata['Team_Leader'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($userdata['Team_Leader']); die; $userdata['All_Customer'] = $this->db2->get_where('tbl_registration', array('type'=>'customer'))->num_rows(); $userdata['EmailVerified'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'1'))->num_rows(); $userdata['EmailPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'0'))->num_rows(); $userdata['PaymentDone'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'1'))->num_rows(); $userdata['PaymentPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'0'))->num_rows(); //echo "<pre>"; print_r($userdata['EmailPending']); die; $this->load->view("webapp/office",$userdata); } public function PaymentDone($offset = 0){ $where_n = array('r.type' => 'customer','r.payment_status' => '1'); $rids = $this->getAssignedCustomer_teamleader($_SESSION['reg_info'][0]['rid']); $this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); if($_SESSION['reg_info'][0]['type'] == 'admin' || $_SESSION['reg_info'][0]['type'] == 'superadmin'){ $this->db2->where($where_n); }else{ $this->db2->where("r.type" , "customer"); $this->db2->where_in("r.rid" , $rids); } $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $cnt_data['data'] = $this->db2->get()->result_array(); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/PaymentDone'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $userdata['data'] = $this->model->get_pagination_where_Cust_PaymentDone('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>";print_r($userdata['data']);die; $userdata['type'] = 'customer'; $userdata['customer'] = 'Customer'; $this->db2->select('a.rid,a.name'); $this->db2->from('tbl_registration as a'); $this->db2->where('type', 'team_leader'); $userdata['Team_Leader'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($userdata['Team_Leader']); die; $userdata['All_Customer'] = $this->db2->get_where('tbl_registration', array('type'=>'customer'))->num_rows(); $userdata['EmailVerified'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'1'))->num_rows(); $userdata['EmailPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'0'))->num_rows(); $userdata['PaymentDone'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'1'))->num_rows(); $userdata['PaymentPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'0'))->num_rows(); //echo "<pre>"; print_r($userdata['EmailPending']); die; $this->load->view("webapp/office",$userdata); } public function PaymentPending($offset = 0){ $where_n = array('r.type' => 'customer','r.payment_status' => '0'); $rids = $this->getAssignedCustomer_teamleader($_SESSION['reg_info'][0]['rid']); $this->db2->select('r.*,i.name as leadername'); $this->db2->from('tbl_registration as r'); if($_SESSION['reg_info'][0]['type'] == 'admin' || $_SESSION['reg_info'][0]['type'] == 'superadmin'){ $this->db2->where($where_n); }else{ $this->db2->where("r.type" , "customer"); $this->db2->where_in("r.rid" , $rids); } $this->db2->join('tbl_assign_customer_teamleader as b', 'b.customer_id = r.rid', 'left'); $this->db2->join('tbl_registration as i', 'i.rid = b.leader_id', 'left'); $cnt_data['data'] = $this->db2->get()->result_array(); $cnt=count($cnt_data['data']); $this->load->library('pagination'); $config['base_url'] = base_url().'webapp/people/PaymentPending'; $config['total_rows'] = $cnt; $config['per_page'] = 20; $config['full_tag_open'] = '<div class="pagination"><ul class="list-inline">'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Last »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Next →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Previous'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $this->pagination->initialize($config); $userdata['data'] = $this->model->get_pagination_where_Cust_PaymentPending('tbl_registration', $config['per_page'], $offset, $where); //echo "<pre>";print_r($userdata['data']);die; $userdata['type'] = 'customer'; $userdata['customer'] = 'Customer'; $this->db2->select('a.rid,a.name'); $this->db2->from('tbl_registration as a'); $this->db2->where('type', 'team_leader'); $userdata['Team_Leader'] = $this->db2->get()->result_array(); //echo "<pre>"; print_r($userdata['Team_Leader']); die; $userdata['All_Customer'] = $this->db2->get_where('tbl_registration', array('type'=>'customer'))->num_rows(); $userdata['EmailVerified'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'1'))->num_rows(); $userdata['EmailPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','status'=>'0'))->num_rows(); $userdata['PaymentDone'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'1'))->num_rows(); $userdata['PaymentPending'] = $this->db2->get_where('tbl_registration', array('type'=>'customer','payment_status'=>'0'))->num_rows(); //echo "<pre>"; print_r($userdata['EmailPending']); die; $this->load->view("webapp/office",$userdata); } }
Copyright ©2021 || Defacer Indonesia