db->table('pt_co_share_details pt_co') ->select(' pt_co.id, pt_co.pt_id, pt_co.exp_amt, pt.id AS policy_transaction_id, pt.endorsement_no, c.client_name, pt.created_at, pt_co.insurer_id, pt_co.insurer_branch_id, pt.policy_no, pt.policy_issue_date, pt.policy_start_date, pt.policy_end_date, pt.status, pt_co.bp_amt, pt_co.tp_amt, pt_co.tep_amt, pt_co.exp_amt, pt_co.statement_id ') ->join('policy_transaction pt', 'pt_co.pt_id = pt.id') ->join('clients c', 'pt.client_id = c.id') ->where('pt_co.is_active', 1) ->where('pt.is_active', 1) // ->where('MONTH(pt.month)', $month) // ->where('YEAR(pt.month)', $year) ->where('pt_co.insurer_id', $insurer_id) ->where('pt_co.insurer_branch_id', $insurer_branch_id) // ->where('pt_co.statement_id is null') ->where('pt.status','completed') ->where('DATE(pt.created_at) >=', $sixMonthsAgo) ->where('DATE(pt.created_at) <=', $currentDate) // ->where('pt_co.exp_amt', 0.00) // ->orWhere('pt_co.exp_amt is null') ->get() ->getResultArray(); } }