?
Current Path : /home1/savoy/public_html/savoyglobal.net/drafthr/system/application/models/ |
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/models/claimsmodel.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ class claimsmodel extends Model { function claimsmodel() { parent::Model(); } function norecords($tabname) { $data = array(); $sql = "select MAX(id) as maxid from $tabname"; // echo $sql; $res = mysql_query($sql); $row = mysql_fetch_array($res); $numcode = $row['maxid']; if ($numcode != '') { return $numcode; } else { return 0; } } function insertclaim() { $claimsref = $_POST['claimsref']."/".$_POST['claimref']; $query=$this->db->query("insert into claim(date,policyid,dateofloss,intimationdate,claimsref,claimspolicyno,descofloss,estimatedamt,status,currency) values('$_POST[date]','$_POST[policyid]','$_POST[dateofloss]','$_POST[intimationdate]','".$claimsref."','$_POST[claimspolicyno]','$_POST[descofloss]','$_POST[estimatedamt]','$_POST[status]','$_POST[currency]')") ; $claimsid=mysql_insert_id(); $date[1]=$_POST['txt_conDate_1']; $desc[1]=$_POST['txt_conDesc_1']; $rem[1]=$_POST['txt_conRem_1']; $x = 2; while (isset($_POST['txt_conDate_'.$x])) { $date[$x]=$_POST['txt_conDate_'.$x]; $desc[$x]=$_POST['txt_conDesc_'.$x]; $rem[$x]=$_POST['txt_conRem_'.$x]; $x++; } $i=1; while($x!=1) { $query=$this->db->query("insert into claimdetails values ('', '$claimsid','$date[$i]','$desc[$i]','$rem[$i]')"); $x--; $i++; } $desc[1]=$_POST['txt_conDescSet_1']; $amt[1]=$_POST['txt_conAmt_1']; $x = 2; while (isset($_POST['txt_conDescSet_'.$x])) { $desc[$x]=$_POST['txt_conDescSet_'.$x]; $amt[$x]=$_POST['txt_conAmt_'.$x]; $x++; } $i=1; while($x!=1) { $query=$this->db->query("insert into claimsettlement values ('', '$claimsid','$desc[$i]','$amt[$i]')"); $x--; $i++; } } function insertclaimforms() { $query=$this->db->query("insert into claimforms (cover_id,company_id,formname) values('$_POST[cover_id]','$_POST[company_id]','$_POST[formname]')") ; $claimformid=mysql_insert_id(); if($query>0) { return 1; } else { return 0; } } function updateclaimforms() { $query=$this->db->query("update claimforms set cover_id='$_POST[cover_id]', company_id = '$_POST[company_id]', formname = '$_POST[formname]' where id='$_POST[claimformsid]'"); $claimformid=$_POST['claimformsid']; } function updateclaim() { $sql="update claim set policyid='$_POST[policyid]',date='$_POST[date]', dateofloss = '$_POST[dateofloss]', intimationdate = '$_POST[intimationdate]', claimsref = '$_POST[claimsref]', claimspolicyno = '$_POST[claimspolicyno]', descofloss = '$_POST[descofloss]', estimatedamt = '$_POST[estimatedamt]',currency = '$_POST[currency]',status='$_POST[status]' where id='$_POST[claimid]'"; $query=$this->db->query($sql); $this->db->query("delete from claimdetails where claimid='$_POST[claimid]'"); $this->db->query("delete from claimsettlement where claimid='$_POST[claimid]'"); $claimsid=$_POST['claimid']; $x = 1; while (isset($_POST['txt_conDate_'.$x])) { $date[$x]=$_POST['txt_conDate_'.$x]; $desc[$x]=$_POST['txt_conDesc_'.$x]; $rem[$x]=$_POST['txt_conRem_'.$x]; $x++; } $i=1; while($x!=1) { $query=$this->db->query("insert into claimdetails values ('', '$claimsid','$date[$i]','$desc[$i]','$rem[$i]')"); $x--; $i++; } $x = 1; while (isset($_POST['txt_conDescSet_'.$x])) { $desc[$x]=$_POST['txt_conDescSet_'.$x]; $amt[$x]=$_POST['txt_conAmt_'.$x]; $x++; } $i=1; while($x!=1) { $query=$this->db->query("insert into claimsettlement values ('', '$claimsid','$desc[$i]','$amt[$i]')"); $x--; $i++; } } function get_data_search($table,$id,$field,$page,$per_page) { $staffids=$this->mastermodel->tracestaff(); $staffids=implode(',', $staffids); if ($this->mastermodel->ret_private()) { $where=' where staffid in ('.$staffids.') and'; } else { $where=' where '; } if($page) { $start = ($page-1)*$per_page; } else { $start=0; } if($field == "cover_id") { $qry = "select id from covers where cover like '".$id."%'"; $sql = "select * from $table where $field in ($qry) limit $start,$per_page"; } else if($field == "typeofcover") { $sql = "select distinct c.id,c.claimsref,c.claimspolicyno,c.policyid from $table c join policynote p on c.policyid=p.id join broking_slip b on p.quotation_ref=b.quotation_ref join staffcustomer s on b.customer_id=s.customerid inner join covers on covers.id=b.cover_id where cover like '".$id."%' limit $start,$per_page"; } else if($field == "customername") { $sql = "select distinct c.id,c.claimsref,c.claimspolicyno,c.policyid from $table c join policynote p on c.policyid=p.id join broking_slip b on p.quotation_ref=b.quotation_ref join staffcustomer s on b.customer_id=s.customerid LEFT JOIN customer_corp_info as cc ON cc.customer_id = s.customerid LEFT JOIN customer_personal_ind as cp ON cp.customer_id = s.customerid where (cp.insured like '".$id."%' or cc.insured like '".$id."%' ) limit $start,$per_page"; } else if($field == "company_id") { $qry = "select id from insurance_company where company_name like '".$id."%'"; $res = mysql_query($qry); $ro = mysql_fetch_array($res); $sql = "select * from $table where $field in ($qry) limit $start,$per_page"; } else { if($table=='claim') $sql = "select distinct c.id,c.claimsref,c.claimspolicyno,c.policyid from $table c join policynote p on c.policyid=p.id join broking_slip b on p.quotation_ref=b.quotation_ref join staffcustomer s on b.customer_id=s.customerid $where $field like '".$id."%' limit $start,$per_page"; else $sql = "select * from $table where $field like '".$id."%' limit $start,$per_page"; } return $sql; } function get_data_search_all($table,$id,$field) { $staffids=$this->mastermodel->tracestaff(); $staffids=implode(',', $staffids); if ($this->mastermodel->ret_private()) { $where=' where staffid in ('.$staffids.') and'; } else { $where=' where '; } if($field == "cover_id") { $qry = "select id from covers where cover like '".$id."%'"; $sql = "select * from $table where $field in ($qry)"; } else if($field == "typeofcover") { $sql = "select distinct c.id,c.claimsref,c.claimspolicyno,c.policyid from $table c join policynote p on c.policyid=p.id join broking_slip b on p.quotation_ref=b.quotation_ref join staffcustomer s on b.customer_id=s.customerid inner join covers on covers.id=b.cover_id where cover like '".$id."%'"; } else if($field == "customername") { $sql = "select distinct c.id,c.claimsref,c.claimspolicyno,c.policyid from $table c join policynote p on c.policyid=p.id join broking_slip b on p.quotation_ref=b.quotation_ref join staffcustomer s on b.customer_id=s.customerid LEFT JOIN customer_corp_info as cc ON cc.customer_id = s.customerid LEFT JOIN customer_personal_ind as cp ON cp.customer_id = s.customerid where (cp.insured like '".$id."%' or cc.insured like '".$id."%' ) group by c.policyid "; } else if($field == "company_id") { $qry = "select id from insurance_company where company_name like '".$id."%'"; $res = mysql_query($qry); $ro = mysql_fetch_array($res); $sql = "select * from $table where $field in ($qry)"; } else { if($table=='claim') $sql = "select distinct c.id,c.claimsref,c.claimspolicyno,c.policyid from $table c join policynote p on c.policyid=p.id join broking_slip b on p.quotation_ref=b.quotation_ref join staffcustomer s on b.customer_id=s.customerid $where $field like '".$id."%'"; else $sql = "select * from $table where $field like '".$id."%'"; } //echo $sql; $res = mysql_query($sql); return mysql_num_rows($res); } function addclaimpolicyno() { $endid=$_POST['endid']; $endpolicyno=$_POST['endpolicyno']; $query=$this->db->query("update claim set claimspolicyno = '$endpolicyno' where id='$endid'"); return $query; } } ?>