?
Current Path : /home1/savoy/public_html/savoyglobal.net/drafthr/system/application/controllers/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/savoyglobal.net/drafthr/system/application/controllers/sales.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <?php class Sales extends BaseController { function Sales() { parent::BaseController(); $this->load->model('mastermodel'); $this->load->model('settingsmodel'); $this->load->model('hrmodel'); $this->load->model('customermodel'); $this->load->model('salesmodel'); $this->load->library('Fpaginate'); $this->load->model('documentsmodel'); } function index($menuid="",$modid="") { if(empty($modid)) { $data['modname']='Home'; } else { $mod_id=$this->mastermodel->get_data('modules',$modid,'module_id','sort'); foreach($mod_id as $id) { $modname=$id['module_name']; } $data['modname']=$modname; } if(empty ($menuid)) { $tart='index'; $data['menuname']=''; } else { $tar=$this->mastermodel->get_data('menu',$menuid,'menu_id'); foreach($tar as $target) { $tart=$target['target']; $data['menuname']=$target['caption']; } } $data['modules']=$this->settingsmodel->buildModule(); $data['menus']=$this->settingsmodel->buildMenu($modid); $this->load->view(''.$data['modname'].'/'.$tart.'',$data); } function addstaffcustomer() { $res = $this->salesmodel->addstaffcustomer(); redirect('master/index/16/2'); // $this->index('16', '2'); if($res==1) { $this->load->view('Sales/success'); } } function addtelecalling() { $res = $this->salesmodel->addtelecalling(); redirect('master/index/17/2'); //$this->index('17', '2'); if($res==1) { $this->load->view('Sales/success'); } } function adddailyactivity() { $res = $this->salesmodel->insertdailyactivity(); redirect('master/index/18/2'); //$this->index('18', '2'); if($res==1) { $this->load->view('Sales/success'); } } function addsettarget() { $res = $this->salesmodel->insertsettarget(); redirect('master/index/19/2'); // $this->index('19', '2'); if($res==1) { $this->load->view('Sales/success'); } } function addbranchtarget() { $res = $this->salesmodel->insertbranchtarget(); redirect('master/index/88/2'); // $this->index('19', '2'); if($res==1) { $this->load->view('Sales/success'); } } function addsalesleads() { $res = $this->salesmodel->insertsalesleads(); redirect('master/index/43/2'); //$this->index('43', '2'); if($res==1) { $this->load->view('Sales/success'); } } function view($type="") { if($type=='ajax') { $this->load->view('refinesearch'); } } function ajaxload($page,$table,$pagenum="",$selectsearch="",$search="") { //echo $search; // die(); $data['nooflist']='4'; $data['perpage']='10'; $data['pagenum']=$pagenum; if($data['pagenum']==1 ||$data['pagenum']=="") $data['id']=1; else $data['id']= (($data['pagenum']-1)*$data['perpage'])+1; if($search == "") { $data['property']='view'; $data['count']=$this->mastermodel->count_all(''.$table.''); $data['pages']= ceil($data['count']/$data['perpage']); $arr=$this->fpaginate->paginate( $data['pagenum'], $data['pages'],$data['nooflist']); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $data['viewinfo']=$this->mastermodel->view(''.$table.'',$data['pagenum'],$data['perpage']); $data['searchinfo']= ""; $data['searchtxt']= ""; $data['searchoption']= ""; } else { $data['searchoption']=$selectsearch; $search=str_replace("~"," ",$search); $search=str_replace("_","/",$search); if($selectsearch == 'dateofloss' || $selectsearch == 'intimationdate' || $selectsearch == 'date' || $selectsearch=='repdate'|| $selectsearch=='rendate' || $selectsearch=='startdate' || $selectsearch=='enddate') { $qdate=$this->mastermodel->convdatformat($search); $search=$qdate; } $data['searchtxt']=$search; $data['property']='search'; $data['count']=$this->salesmodel->get_data_search_all($table,$search,$selectsearch); $data['pages']= ceil($data['count']/$data['perpage']); $arr=$this->fpaginate->paginate( $data['pagenum'], $data['pages'],$data['nooflist']); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $data['selectsearch'] = $selectsearch; $data['search'] = $search; $data['searchinfo']=$this->salesmodel->get_data_search($table,$search,$selectsearch,$data['pagenum'],$data['perpage']); $data['viewinfo']= ""; } $data['segment']=$this->mastermodel->getdatas('segment_insurances'); $data['cover_insurance']=$this->mastermodel->getdatas('covers'); $data['curren']=$this->mastermodel->getdatas('country'); $data['action']='add'; $this->load->view('Sales/'.$page.'',$data); } function ajaxloadnew($page,$table,$pagenum="",$selectsearch="",$search="") { $data['nooflist']='4'; $data['perpage']='10'; $data['pagenum']=$pagenum; $_SESSION['pagenum']=$pagenum; $_SESSION['searchoption']=$selectsearch; $_SESSION['searchtxt']=$search; if($data['pagenum']==1 ||$data['pagenum']=="") $data['id']=1; else $data['id']= (($data['pagenum']-1)*$data['perpage'])+1; if($search == "") { $data['property']='view'; $data['count']=$this->mastermodel->count_alldata(''.$table.''); $data['pages']= ceil($data['count']/$data['perpage']); $arr=$this->fpaginate->paginate( $data['pagenum'], $data['pages'],$data['nooflist']); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $data['viewinfo']=$this->mastermodel->viewnew(''.$table.'',$data['pagenum'],$data['perpage']); $data['searchinfo']= ""; $data['searchtxt']= ""; $data['searchoption']= ""; } else { $data['searchoption']=$selectsearch; $search=str_replace("~"," ",$search); $search=str_replace("_","/",$search); if($selectsearch == 'dateofloss' || $selectsearch == 'intimationdate' || $selectsearch == 'enddate' || $selectsearch == 'startdate' || $selectsearch == 'date' || $selectsearch=='repdate'|| $selectsearch=='rendate') { $qdate=$this->mastermodel->convdatformat($search); $search=$qdate; } $data['searchtxt']=$search; $data['property']='search'; $data['count']=$this->salesmodel->get_data_search_all($table,$search,$selectsearch); $data['pages']= ceil($data['count']/$data['perpage']); $arr=$this->fpaginate->paginate( $data['pagenum'], $data['pages'],$data['nooflist']); $data['startpage']=$arr[0]; $data['endpage']=$arr[1]; $data['selectsearch'] = $selectsearch; $data['search'] = $search; $data['searchinfo']=$this->salesmodel->get_data_search($table,$search,$selectsearch,$data['pagenum'],$data['perpage']); $data['viewinfo']= ""; } $data['segment']=$this->mastermodel->getdatas('segment_insurances'); $data['cover_insurance']=$this->mastermodel->getdatas('covers'); $data['curren']=$this->mastermodel->getdatas('country'); $data['action']='add'; $this->load->view('Sales/'.$page.'',$data); } function listSearchcustomer($searchBy,$pagenum,$custname="") { $data['per_page']=6; $data['custname']=$custname; $data['searchBy']=$searchBy; $data['currentpage']=1; if($pagenum!=1) { $data['id']=($pagenum-1) * $data['per_page']+1; } else { $data['id']=1; } $dat['viewinfo']=$this->customermodel->ListofCustomers($custname,$searchBy,$pagenum,$data['per_page']); $data['MaxPage']=$dat['viewinfo']['maxpage']; $data['viewinfo']=$dat['viewinfo']['result']; $this->load->view('Sales/loadcustomerlist',$data); } function listSearchstaff($pagenum,$searchBy="",$staffname="") { //echo 'page no:'. $pagenum .' Searchby:'. $searchBy.' valuie:'.$staffname; $data['per_page']=6; if($pagenum!=1) { $data['id']=($pagenum-1) * $data['per_page']+1; } else { $data['id']=1; } $data['searchBy']=$searchBy; $data['currentpage']=$pagenum; $data['custname']=$staffname; $counts=$this->documentsmodel->count_alls('staffpersonaldetails','id',''); if($counts==0) { $data['Maxpage']=1; } else{ $data['Maxpage']=ceil($counts/$data['per_page']); } $data['viewinfo']=$this->hrmodel->employeelistpagination($pagenum, $data['per_page'],$staffname,$searchBy); $this->load->view('Sales/loadstafflist',$data); } function edit($page,$table,$field,$id) { $data['viewinfo']=$this->mastermodel->get_data($table,$id,$field); $data['viewactivity']=$this->mastermodel->get_data('dailyactivitydetails',$id,'activityid'); $data['action']='update'; $data['id']=$id; $data['curren']=$this->mastermodel->getdatas('country'); $this->load->view('Sales/'.$page.'',$data); } function editstaffcustomer() { $res=$this->salesmodel->updatestaffcustomer('staffcustomer'); redirect('master/index/16/2'); // $this->index('16', '2'); if($res==1) { $this->load->view('Sales/updatesuccess'); } } function edittelecalling() { $res=$this->salesmodel->updatetelecalling('telecalling'); redirect('master/index/17/2'); //$this->index('17', '2'); if($res==1) { $this->load->view('Sales/updatesuccess'); } } function editsettarget() { $res=$this->salesmodel->updatesettarget('settarget'); redirect('master/index/19/2'); //$this->index('19', '2'); if($res==1) { $this->load->view('Sales/updatesuccess'); } } function editbranchtarget() { $res=$this->salesmodel->updatebranchtarget('branchtarget'); redirect('master/index/88/2'); //$this->index('19', '2'); if($res==1) { $this->load->view('Sales/updatesuccess'); } } function editdailyactivity() { $this->load->library('form_validation'); $this->form_validation->set_rules('name','Name','required'); $res=$this->salesmodel->updatedailyactivity(); redirect('master/index/18/2'); //$this->index('18', '2'); if($res==1) { $this->load->view('Sales/updatesuccess'); } } function editsalesleads() { $res=$this->salesmodel->updatesalesleads('salesleads'); redirect('master/index/43/2'); //$this->index('43', '2'); if($res==1) { $this->load->view('Sales/updatesuccess'); } } function delete($table,$id,$menu) { $data=$this->mastermodel->check_permissions(2); if(!$data) { $this->index($menu, '2'); $this->load->view('Master/nopermission'); } else { try { $res=$this->mastermodel->deletedata($table,$id);; if($res!=1) { throw new Exception("Error"); } $this->index($menu, '2'); } catch(Exception $exception) { $this->index($menu, '2'); $this->load->view('Master/checkexist'); } } } function autosugesttext($content="",$text_id,$id_text,$tableName="",$div_id) { $data['result']=$this->salesmodel->getautosugestlist($content,$tableName); $data['text_id']=$text_id; $data['id_text']=$id_text; $data['div_id']=$div_id; $this->load->view('Sales/autocompletescript',$data); } function single($page,$table,$field,$id) { $data['viewinfo']=$this->mastermodel->get_data($table,$id,$field); $data['viewactivity']=$this->mastermodel->get_data('dailyactivitydetails',$id,'activityid'); $data['id']=$id; $data['tablename']='sales_files'; $data['fieldname']='sale_leads_id'; $this->load->view('Sales/'.$page.'',$data); } function findemployeebycode($code) { $data=$this->salesmodel->findemployeebycode($code); echo $data; } } /* End of file welcome.php */ /* Location: ./system/application/controllers/welcome.php */