From ef7a7ec34525dabddee838b86df4eca491f8af76 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Fri, 21 Nov 2025 11:03:07 +0530 Subject: [PATCH] invoice --- app/Controllers/EnquiryController.php | 4 ++-- app/Controllers/InvoiceController.php | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Controllers/EnquiryController.php b/app/Controllers/EnquiryController.php index dc71bc2..9ce5d43 100644 --- a/app/Controllers/EnquiryController.php +++ b/app/Controllers/EnquiryController.php @@ -102,7 +102,7 @@ class EnquiryController extends ResourceController } //Get enquiry details - $enquiry = $this->enquiryModel->select('partner_enquiry.* , I.name as insurer_name , I.short_name , VT.vehicle_type as vehicle_type,PB.name as broker_name ,PA.name as agent_name') + $enquiry = $this->enquiryModel->select('partner_enquiry.* , I.name as insurer_name , I.short_name , VT.vehicle_type as vehicle_type,pe.broker_id ,PB.name as broker_name ,PA.name as agent_name') ->join('insurers I', 'I.id = partner_enquiry.insurer_id', 'left') ->join('vehicle_type VT', 'VT.id = partner_enquiry.vehicle_type_id', 'left') ->join('partner_brokers PB', 'PB.id = partner_enquiry.broker_id', 'left') @@ -116,7 +116,7 @@ class EnquiryController extends ResourceController } //Get related quotations - $quotations = $this->QuotationModel->select('partner_quotation.*, pe.reg_no , I.name as insurer_name, I.short_name , ipti.insurance_plan_type,PB.name as broker_name,PA.name as agent_name' ) + $quotations = $this->QuotationModel->select('partner_quotation.*, pe.reg_no , I.name as insurer_name, I.short_name , ipti.insurance_plan_type,pe.broker_id ,PB.name as broker_name,PA.name as agent_name' ) ->join('partner_enquiry pe', 'pe.id = partner_quotation.enquiry_id', 'left') ->join('insurers I', 'I.id = partner_quotation.insurer_id', 'left') ->join('partner_insurance_plan_type_master ipti', 'ipti.id = partner_quotation.insurance_plan_type_id', 'left') diff --git a/app/Controllers/InvoiceController.php b/app/Controllers/InvoiceController.php index 0d871eb..4e6fe34 100644 --- a/app/Controllers/InvoiceController.php +++ b/app/Controllers/InvoiceController.php @@ -59,7 +59,15 @@ class InvoiceController extends ResourceController return $this->respond(['status' => 'failed', 'code' => 404, 'data' => 'Invoice not found'], 404); } - $items = $this->InvoiceItemModel->where('invoice_id', $id)->where('is_active', 1)->findAll(); + $items = $this->InvoiceItemModel->select('partner_invoice_items.* , pp.issued_date , pe.name as customer_name , pq.premium_amount') + ->join('partner_policy pp','pp.id = partner_invoice_items.policy_id ', 'left') + ->join('partner_enquiry pe','pe.id = pp.enquiry_id ', 'left') + ->join('partner_quotation pq','pq.id = pp.quotation_id ', 'left') + ->where('partner_invoice_items.invoice_id', $id) + ->where('partner_invoice_items.is_active', 1) + ->findAll(); + + return $this->respond([ 'status' => 'success',