?
Current Path : /home1/savoy/public_html/savoyglobal.net/sibs_draft/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/sibs_draft/system/application/controllers/policies.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <?php class Policies extends BaseController { function Policies() { parent::BaseController(); $this->load->model('mastermodel'); $this->load->model('settingsmodel'); $this->load->model('documentsmodel'); $this->load->model('customermodel'); $this->load->model('policiesmodel'); $this->load->model('accountingsmodel'); $this->load->library('Fpaginate'); $this->load->helper('url'); $this->load->model('hrmodel'); } 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 viewtemplate($cover_id,$template_type_id) { $data['viewinfo']=$this->documentsmodel->viewtemplate($cover_id,$template_type_id); $this->load->view('Policies/viewtemplate',$data); } function view($type="") { if($type=='ajax') { $this->load->view('refinesearch'); } } function ajaxload($page,$table,$pagenum="",$selectsearch="",$search="") { $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 { $search=str_replace("~"," ",$search); $search=str_replace("_","/",$search); $data['searchoption']=$selectsearch; if($selectsearch == 'date') { $qdate=$this->mastermodel->convdatformat($search); $search=$qdate; } $data['searchtxt']=$search; $data['property']='search'; $data['count']=$this->policiesmodel->get_data_search($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->policiesmodel->get_data_search($table,$search,$selectsearch,$data['pagenum'],$data['perpage']); $data['viewinfo']= ""; } $data['action']='add'; $data['norecords']=$this->policiesmodel->norecords(''.$table.''); $data['directory']=$this->mastermodel->getdatas('directory'); $data['methods']=$this->mastermodel->getdatas('payment_methods'); $this->load->view('Policies/'.$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 { $search=str_replace("~"," ",$search); $search=str_replace("_","/",$search); $data['searchoption']=$selectsearch; if($selectsearch == 'date') { $qdate=$this->mastermodel->convdatformat($search); $search=$qdate; } $data['searchtxt']=$search; $data['property']='search'; $data['count']=$this->policiesmodel->get_data_searchnew($table,$search,$selectsearch,'true'); $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->policiesmodel->get_data_searchnew($table,$search,$selectsearch,'false',$data['pagenum'],$data['perpage']); $data['viewinfo']= ""; } $data['action']='add'; $data['norecords']=$this->policiesmodel->norecords(''.$table.''); $data['directory']=$this->mastermodel->getdatas('directory'); $data['methods']=$this->mastermodel->getdatas('payment_methods'); $this->load->view('Policies/'.$page.'',$data); } function addrenewal() { $this->load->library('form_validation'); $this->form_validation->set_rules('policyid','Policy no','required'); if ($this->form_validation->run() == FALSE ) { redirect('master/index/24/5'); //$this->index('24', '5'); } else { $res=$this->policiesmodel->insertrenewal(); redirect('master/index/24/5'); // $this->index('24', '5'); if($res==1) { $this->load->view('Policies/success'); } } } function addendorsement() { $this->load->library('form_validation'); $this->form_validation->set_rules('policyno','Policy no','required'); if ($this->form_validation->run() == FALSE ) { redirect('master/index/25/5'); // $this->index('25', '5'); } else { $res=$this->policiesmodel->insertendorsement(); redirect('master/index/25/5'); //$this->index('25', '5'); if($res==1) { $this->load->view('Policies/success'); } } } function addcancellation() { $date=$_POST['date']; $pid=$_POST['policyid']; $date= $this->mastermodel->convdatformat($date); $check=$this->policiesmodel->check_cancel_date($pid,$date); if($check==0) { $this->index('26', '5'); $this->load->view('Policies/checkdate'); } else { $this->load->library('form_validation'); $this->form_validation->set_rules('policyno','Policy no','required'); if ($this->form_validation->run() == FALSE ) { redirect('master/index/26/5'); // $this->index('26', '5'); } else { $res=$this->policiesmodel->insertcancellation(); redirect('master/index/26/5'); //$this->index('26', '5'); if($res==1) { $this->load->view('Policies/success'); } } } } function adddeclaration() { $this->load->library('form_validation'); //$this->form_validation->set_rules('cover','Type Of Cover','required'); $this->form_validation->set_rules('certificateno','Type Of Cover','required'); $this->form_validation->set_rules('insured','Type Of Cover','required'); $this->form_validation->set_rules('quotation_ref','Type Of Cover','required'); if ($this->form_validation->run() == FALSE ) { redirect('master/index/27/5'); // $this->index('27', '5'); } else { $res= $this->policiesmodel->adddeclaration(); echo $res; //$this->index('21', '4'); // redirect('policies/index/27/5'); } } function block_duplicates($q_no) { $q_id= str_replace("~","/",$q_no); $test= $this->mastermodel->block_duplicates('policynote','quotation_ref',$q_id); echo $test; } function addpolicynote() { $this->load->library('form_validation'); $this->form_validation->set_rules('policyno','Policy no','required'); if ($this->form_validation->run() == FALSE ) { $this->index('28', '5'); } else { $q_no=$_POST['quotation_ref']; $res=$this->policiesmodel->insertpolicynote(); //$this->index('28', '5'); if($res==1) { $this->load->view('Policies/success'); } redirect('master/index/28/5'); } } function edit($page,$table,$field,$id,$declid="") { $data['viewinfo']=$this->mastermodel->get_data($table,$id,$field); $data['action']='update'; $data['directory']=$this->mastermodel->getdatas('directory'); $data['renewal_files']=$this->mastermodel->get_data('renewal_files',$id,'renewalid'); $data['endorsement_files']=$this->mastermodel->get_data('endorsement_files',$id,'endorsementid'); $data['cancellation_files']=$this->mastermodel->get_data('cancellation_files',$id,'cancellationid'); $data['id']=$id; $data['declid']=$declid; $data['methods']=$this->mastermodel->getdatas('payment_methods'); $this->load->view('Policies/'.$page.'',$data); } function editpolicynote() { $res = $this->policiesmodel->updatepolicynote('policynote'); redirect('master/index/28/5'); // $this->index('28', '5'); if($res==1) { $this->load->view('Policies/success'); } } function editrenewal() { $res = $this->policiesmodel->updaterenewal('renewal'); redirect('master/index/24/5'); //$this->index('24', '5'); if($res==1) { $this->load->view('Policies/success'); } } function editendorsement() { $res = $this->policiesmodel->updateendorsement('endorsement'); redirect('master/index/25/5'); // $this->index('25', '5'); if($res==1) { $this->load->view('Policies/success'); } } function editcancellation() { $date=$_POST['date']; $pid=$_POST['policyid']; $date= $this->mastermodel->convdatformat($date); $check=$this->policiesmodel->check_cancel_date($pid,$date); if($check==0) { $this->index('26', '5'); $this->load->view('Policies/checkdate'); } else { $res = $this->policiesmodel->updatecancellation('cancellation'); redirect('master/index/26/5'); //$this->index('26', '5'); if($res==1) { $this->load->view('Policies/success'); } } } function editdeclaration() { $this->load->library('form_validation'); //$this->form_validation->set_rules('cover','Type Of Cover','required'); //$this->form_validation->set_rules('business','Type Of Cover','required'); $this->form_validation->set_rules('insured','Type Of Cover','required'); $this->form_validation->set_rules('quotation_ref','Type Of Cover','required'); if ($this->form_validation->run() == FALSE ) { redirect('master/index/27/5'); //$this->index('27', '5'); } else { $res = $this->policiesmodel->updatedeclaration(); echo $res; } } function delete($table,$id,$menu) { $data=$this->mastermodel->check_permissions(3); if(!$data) { $this->index($menu, '5'); $this->load->view('Master/nopermission'); } else { try { $res=$this->mastermodel->deletedata($table,$id);; if($res!=1) { throw new Exception("Error"); } $this->index($menu, '5'); } catch(Exception $exception) { $this->index($menu, '5'); $this->load->view('Master/checkexist'); } } } function listsearchquot($field="",$criteria="") { $data['viewinfo']=$this->policiesmodel->quotationlist($field,$criteria); $this->load->view('Policies/loadquotlist',$data); } function listsearchpoli($field="",$criteria="") { $criteria=str_replace("~"," ",$criteria); $criteria=str_replace("_","/",$criteria); $data['viewinfo']=$this->policiesmodel->policylist($field,$criteria); $this->load->view('Policies/loadpolilist',$data); } function listsearchpolicyno($field="",$criteria="") { $criteria=str_replace("~"," ",$criteria); $criteria=str_replace("_","/",$criteria); $data['viewinfo']=$this->policiesmodel->policylistdec($field,$criteria); $this->load->view('Policies/loadpolicydeclaration',$data); } function single($page,$table,$field,$filetable,$filefield,$id) { $data['viewinfo']=$this->mastermodel->get_data($table,$id,$field); $data['id']=$id; $data['tablename']=$filetable; $data['fieldname']=$filefield; $this->load->view('Policies/'.$page.'',$data); } function viewquotationdeclaration($page,$field,$id) { $data['declaration']=$this->mastermodel->get_data_srow('declaration',$id,$field); $data['declaration_form']=$this->mastermodel->get_data('declaration_form',$id,'declaration_id'); $data['declaration_sum_insured']=$this->mastermodel->get_data('declaration_sum_insured',$id,'declaration_id'); $data['declaration_section']=$this->mastermodel->get_data('declaration_section',$id,'declaration_id'); $data['declaration_premiumdetails']=$this->mastermodel->get_data_srow('declaration_premiumdetails',$id,'declaration_id'); $data['declaration_mofconveyance']=$this->mastermodel->get_data('declaration_mofconveyance',$id,'declaration_id'); $data['declaration_voyage']=$this->mastermodel->get_data('declaration_voyage',$id,'declaration_id'); $data['declaration_project_period']=$this->mastermodel->get_data_srow('declaration_project_period',$id,'declaration_id'); $data['action']='view'; $data['id']=$id; $data['tablename']='declaration_files'; $data['fieldname']='declaration_id'; $this->load->view('Policies/'.$page.'',$data); } function showstatus($page,$id) { $data['id']=$id; $this->load->view('Policies/'.$page.'',$data); } function editstatus($page,$table,$field,$id,$brid="") { $data['viewstatus']=$this->mastermodel->get_data($table,$id,$field); //$data['action']='update'; if(!empty($brid)) { $data['id']=$brid; } else { $data['id']=$id; } $data['lis']=$id; $this->load->view('Policies/'.$page.'',$data); } function savestatus() { $this->policiesmodel->updatedeclstatus(); } function updatedeclarationstatus() { $this->policiesmodel->updatedeclarationstatus(); } function insertdeclstatus() { $this->policiesmodel->insertdeclstatus(); } function pdfquotationdeclaration($page,$field,$id) { $this->load->plugin('to_pdf'); //$this->load->helper('pdf'); //prep_pdf(); $data['declaration']=$this->mastermodel->get_data_srow('declaration',$id,$field); $data['declaration_form']=$this->mastermodel->get_data('declaration_form',$id,'declaration_id'); $data['declaration_sum_insured']=$this->mastermodel->get_data('declaration_sum_insured',$id,'declaration_id'); $data['declaration_section']=$this->mastermodel->get_data('declaration_section',$id,'declaration_id'); $data['declaration_premiumdetails']=$this->mastermodel->get_data_srow('declaration_premiumdetails',$id,'declaration_id'); $data['declaration_mofconveyance']=$this->mastermodel->get_data('declaration_mofconveyance',$id,'declaration_id'); $data['declaration_voyage']=$this->mastermodel->get_data('declaration_voyage',$id,'declaration_id'); $data['declaration_project_period']=$this->mastermodel->get_data_srow('declaration_project_period',$id,'declaration_id'); $data['action']='pdf'; $data['id']=$id; $this->load->view('Policies/'.$page.'',$data); } function cancel_policy() { $this->policiesmodel->cancel_policy(); } function cancel_count($pid) { $this->policiesmodel->cancel_count($pid); } function checkpremium($policyid,$premiumchange) { $actpremium=$this->policiesmodel->checkpremium($policyid); if($premiumchange>$actpremium) { echo 1; } else { echo 0; } } function check_cancel_date($pid,$date) { $date= $this->mastermodel->convdatformat($date); echo $this->policiesmodel->check_cancel_date($pid,$date); } function payment($page,$plid,$endid) { $data['viewinfo']=$this->policiesmodel->getendorsementpayment($endid,$plid); $data['placingid']=$plid; $data['endid']=$endid; $this->load->view('Policies/'.$page.'',$data); } function paymentcancelation($page,$plid,$cancid) { $data['viewinfo']=$this->policiesmodel->getcancellationpayment($cancid,$plid); $data['placingid']=$plid; $data['cancid']=$cancid; $this->load->view('Policies/'.$page.'',$data); } function addendpolicy($endid) { $data['endid']=$endid; $this->load->view('Policies/addendpolicy',$data); } function addendpolicyno() { $res=$this->policiesmodel->addendpolicyno(); if($res>=1) { echo "Endorsement Policy No Added"; } else { echo "Error While Adding"; } } function adddeclcert($decid) { $data['decid']=$decid; $this->load->view('Policies/adddeclcert',$data); } function adddeclcertno() { $res=$this->policiesmodel->adddeclcertno(); if($res>=1) { echo "Certificate No Added"; } else { echo "Error While Adding"; } } function addcanpolicy($endid) { $data['endid']=$endid; $this->load->view('Policies/addcanpolicy',$data); } function addcanpolicyno() { $res=$this->policiesmodel->addcanpolicyno(); if($res>=1) { echo "Cancellation Policy No Added"; } else { echo "Error While Adding"; } } function addquickpolicynote($polyid) { $data['polyid']=$polyid; $this->load->view('Policies/addquickpolicynote',$data); } function addquickpolicynoteno() { $res=$this->policiesmodel->addquickpolicynoteno(); if($res>=1) { echo "Policy No Added"; } else { echo "Error While Adding"; } } function declpayment($page,$table,$field,$id,$premium="") { $data['viewinfo']=$this->mastermodel->get_data($table,$id,$field); //$data['brokerage']=$brokerage; $data['action']='payment'; $data['id']=$id; $this->load->view('Policies/'.$page.'',$data); } function insertdeclarationpayment() { $this->policiesmodel->insertdeclarationpayment(); redirect('master/index/27/5'); } function viewpaymentdl($page,$table,$field,$id,$premium="") { $data['viewinfo']=$this->mastermodel->get_data($table,$id,$field); $data['methods']=$this->mastermodel->getdatas('payment_methods'); //$data['brokerage']=$brokerage; $data['action']='payment'; $data['id']=$id; $this->load->view('Policies/'.$page.'',$data); } function findpolicybyno($code) { $code=str_replace("~","/",$code); $data=$this->policiesmodel->findpolicybyno($code); echo $data; } }