diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index c58a6fef..e1fe7977 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -123,6 +123,7 @@ class TicketController extends BaseController '((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form', '((SETTLED_LETTER))' => 'settle_letter', '((APPROVED_LETTER))' => 'approved_letter', + '((APPROVED_DESCRIBTION))' => 'approved_description', ]; $this->extraFields = [ 1 => ['non_id_reason'], @@ -132,13 +133,13 @@ class TicketController extends BaseController 5 => ['claim_number', 'registration_date'], 7 => ['query_received_date'], 8 => ['denial_reason','denial_date'], - 9 => ['approved_amount','approved_date', 'approved_letter'], + 9 => ['approved_amount','approved_date', 'approved_letter', "approved_description"], 11 => ['utr_details', 'settled_date', 'settle_letter'], - 40 => ['approved_amount','approved_date', 'approved_letter'], + 40 => ['approved_amount','approved_date', 'approved_letter', "approved_description"], 44 => ['utr_details', 'settled_date', 'settle_letter'], - 30 => ['approved_amount','approved_date', 'approved_letter'], + 30 => ['approved_amount','approved_date', 'approved_letter', "approved_description"], 34 => ['utr_details', 'settled_date', 'settle_letter'], - 20 => ['approved_amount','approved_date', 'approved_letter'], + 20 => ['approved_amount','approved_date', 'approved_letter', "approved_description"], 24 => ['utr_details', 'settled_date', 'settle_letter'], 14 => ['return_remark', 'awb_no_courier_name'], 48 => ['return_remark', 'awb_no_courier_name'], @@ -173,6 +174,9 @@ class TicketController extends BaseController public function ticketList() { $data['ticket_type'] = $this->ticketType; + $data['modeOFIntimate'] = $this->modeOFIntimate; + $data['priorityType'] = $this->priorityType; + $data['claimType'] = $this->claimType; if ($this->request->is('get')) { $data['page_name'] = "Claims"; $data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll(); @@ -199,13 +203,13 @@ class TicketController extends BaseController } public function ticketSearch($action = null) - { + { $db = db_connect(); $subquery = $db->table('ticket_master tm') - ->select([ - 'tm.id AS ticket_id', - "CASE + ->select([ + 'tm.id AS ticket_id', + "CASE WHEN DATEDIFF( CURDATE(), COALESCE(latest_history.created_at, tm.created_at) @@ -220,17 +224,17 @@ class TicketController extends BaseController ) BETWEEN 13 AND 20 THEN '13-20 Days' ELSE 'Above 20 Days' END AS tat" - ]) - ->join( - '(SELECT th.ticket_id, MAX(th.created_at) AS created_at + ]) + ->join( + '(SELECT th.ticket_id, MAX(th.created_at) AS created_at FROM ticket_history th WHERE th.field_name = "claim_status_id" GROUP BY th.ticket_id) AS latest_history', - 'latest_history.ticket_id = tm.id', - 'left' - ) - ->where('tm.is_active', 1) - ->groupBy('tm.id, tm.created_at, latest_history.created_at'); + 'latest_history.ticket_id = tm.id', + 'left' + ) + ->where('tm.is_active', 1) + ->groupBy('tm.id, tm.created_at, latest_history.created_at'); //action 1 get last 100 rows, action 2 filter and get all rows related to that and action 3 gets according to dashboard @@ -248,12 +252,63 @@ class TicketController extends BaseController 'tm.tpa_no', 'tm.emp_name', 'tm.emp_code', + 'tm.relationship', 'i.name AS insurer_name', 'c.client_name', 'tm.insured_name', 'c.short_name', 'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date', - 'COALESCE(tat_category.tat, "0-6 Days") AS tat' + 'COALESCE(tat_category.tat, "0-6 Days") AS tat', + + 'tm.claim_status_id', + + '(SELECT first_name FROM user_profiles WHERE user_profiles.id = tm.acm_id) AS acm_name', + '(SELECT name FROM insurers WHERE insurers.id = tm.insurer_id) AS insurer_name', + '(SELECT name FROM tpa WHERE tpa.id = tm.tpa_id) AS tpa_name', + + 'tm.acm_id', + 'tm.insurer_id', + 'tm.tpa_id', + 'tm.client_policy_id', + + 'tm.policy_no', + 'tm.priority', + 'tm.relationship', + 'tm.emp_mobile', + 'tm.emp_mail', + 'tm.emp_personal_mail', + 'tm.mode_of_intimation', + 'tm.claim_type', + 'tm.hospital_name', + 'tm.doa', + 'tm.dod', + 'tm.claim_amount', + 'tm.pod_no', + 'tm.date_of_join', + 'tm.date_of_incep', + 'tm.dob', + 'tm.date_of_accident', + 'tm.date_of_death', + 'tm.date_of_intimat', + 'tm.si_amt', + 'tm.raised_date', + 'tm.registration_date', + 'tm.query_received_date', + 'tm.denial_date', + 'tm.approved_date', + 'tm.settled_date', + 'tm.denial_reason', + 'tm.approved_letter', + 'tm.approved_amount', + 'tm.utr_details', + 'tm.settle_letter', + 'tm.return_remark', + 'tm.cancel_remark', + 'tm.awb_no_courier_name', + 'tm.non_id_reason', + 'tm.pay_initiate_date', + 'tm.approved_description' + ]) ->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left') ->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left') @@ -262,13 +317,12 @@ class TicketController extends BaseController ->where('tm.is_active', 1) ->orderBy('tm.id', 'DESC'); - $data = $query->get()->getResultArray(); + $data = $query->get()->getResultArray(); // dd(db_connect()->getLastQuery()); return $data; - - }else if ($action == 3) { + } else if ($action == 3) { $ids = $this->request->getPost('ids'); $ids = array_filter(explode(',', $ids)); @@ -290,41 +344,90 @@ class TicketController extends BaseController } } // print_rr($where); - + } $query = $db->table('ticket_master tm') - ->select([ - 'tm.id', - 'tm.ticket_type_id', - 'tcs.claim_status AS status', - 'tm.claim_number AS claim_no', - 'tm.claim_status_id', - 'tm.is_head_approved', - 'tm.tpa_id', - 'tm.tpa_no', - 'tm.emp_name', - 'tm.emp_code', - 'i.name AS insurer_name', - 'c.client_name', - 'tm.insured_name', - 'c.short_name', - 'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date', - 'COALESCE(tat_category.tat, "0-6 Days") AS tat' - ]) - ->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left') - ->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left') - ->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left') - ->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left') - ->where('tm.is_active', 1) - ->where($where) - ->orderBy('tm.id', 'DESC'); + ->select([ + 'tm.id', + 'tm.ticket_type_id', + 'tcs.claim_status AS status', + 'tm.claim_number AS claim_no', + 'tm.claim_status_id', + 'tm.is_head_approved', + 'tm.tpa_id', + 'tm.tpa_no', + 'tm.emp_name', + 'tm.emp_code', + 'tm.relationship', + 'i.name AS insurer_name', + 'c.client_name', + 'tm.insured_name', + 'c.short_name', + 'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date', + 'COALESCE(tat_category.tat, "0-6 Days") AS tat', - $data = $query->get()->getResultArray(); - // print_rr($data); - // log_message('error',' Claims Master Data '.json_encode($data));die(); - // print_rr($data);die(); + '(SELECT first_name FROM user_profiles WHERE user_profiles.id = tm.acm_id) AS acm_name', + '(SELECT name FROM insurers WHERE insurers.id = tm.insurer_id) AS insurer_name', + '(SELECT name FROM tpa WHERE tpa.id = tm.tpa_id) AS tpa_name', - return $data; + 'tm.claim_status_id', + 'tm.acm_id', + 'tm.insurer_id', + 'tm.tpa_id', + 'tm.client_policy_id', + 'tm.policy_no', + 'tm.priority', + 'tm.relationship', + 'tm.emp_mobile', + 'tm.emp_mail', + 'tm.emp_personal_mail', + 'tm.mode_of_intimation', + 'tm.claim_type', + 'tm.hospital_name', + 'tm.doa', + 'tm.dod', + 'tm.claim_amount', + 'tm.pod_no', + 'tm.date_of_join', + 'tm.date_of_incep', + 'tm.dob', + 'tm.date_of_accident', + 'tm.date_of_death', + 'tm.date_of_intimat', + 'tm.si_amt', + 'tm.raised_date', + 'tm.registration_date', + 'tm.query_received_date', + 'tm.denial_date', + 'tm.approved_date', + 'tm.settled_date', + 'tm.denial_reason', + 'tm.approved_letter', + 'tm.approved_amount', + 'tm.utr_details', + 'tm.settle_letter', + 'tm.return_remark', + 'tm.cancel_remark', + 'tm.awb_no_courier_name', + 'tm.non_id_reason', + 'tm.pay_initiate_date', + 'tm.approved_description' + + ]) + ->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left') + ->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left') + ->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left') + ->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left') + ->where('tm.is_active', 1) + ->where($where) + ->orderBy('tm.id', 'DESC'); + + $data = $query->get()->getResultArray(); + // print_rr($data); + // log_message('error',' Claims Master Data '.json_encode($data));die(); + // print_rr($data);die(); + + return $data; } public function ticket_form($ticket_type) diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 7e011952..d28fd81f 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -74,7 +74,9 @@ class TicketMasterModel extends Model 'head_rejection_reason', 'pay_initiate_date', 'emp_personal_mail', - 'client_policy_id' + 'client_policy_id', + + 'approved_description' ]; diff --git a/app/Views/ticket_form_gmc.php b/app/Views/ticket_form_gmc.php index 6ab344ba..6e90c394 100644 --- a/app/Views/ticket_form_gmc.php +++ b/app/Views/ticket_form_gmc.php @@ -336,6 +336,12 @@ value="= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter"> +
+ + +