db->table('client_policy') ->select('insurers.name as insurer_name, insurers.short_name as insurer_short') ->select('tpa.name as tpa_name, tpa.short_name as tpa_short') ->select('policies.name as policy_name') ->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code') ->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code') ->join('insurers', 'insurers.id = client_policy.insurer_id') ->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id') ->join('tpa', 'tpa.id = client_policy.tpa_id') ->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id') ->join('policies', 'policies.id = client_policy.policy_id') ->where('client_policy.id', $id) ->get() ->getResult(); } public function getClientPolicyByClientId($client_id){ return $this->db->table('client_policy') ->select('client_policy.*') ->select('insurers.name as insurer_name, insurers.short_name as insurer_short') ->select('tpa.name as tpa_name, tpa.short_name as tpa_short') ->select('policies.name as policy_name') ->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code') ->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code') ->join('insurers', 'insurers.id = client_policy.insurer_id') ->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id') ->join('tpa', 'tpa.id = client_policy.tpa_id') ->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id') ->join('policies', 'policies.id = client_policy.policy_id') ->where('client_policy.client_id', $client_id) ->get() ->getResult(); } public function getPolicyPremium($policy_id){ return $this->db->table('policies') ->select('policy_type.*') ->join('policy_type', 'policy_type.id = policies.policy_type_id') ->where('policies.id', $policy_id) ->get() ->getResult(); } public function getPolicyPremiumPolicyTypeId($policy_type_id){ return $this->db->table('policies') ->select('policy_type.*') ->join('policy_type', 'policy_type.id = policies.policy_type_id') ->where('policies.id', $policy_type_id) ->get() ->getResult(); } public function getPolicyTermsJson($client_id,$policy_id) { return $this->select('policy_terms') ->where('client_id',$client_id) ->where('policy_id',$policy_id) ->get() ->getResult(); } }