diff --git a/app/Controllers/InvoiceController.php b/app/Controllers/InvoiceController.php index 46b5d82..1553b31 100644 --- a/app/Controllers/InvoiceController.php +++ b/app/Controllers/InvoiceController.php @@ -35,14 +35,18 @@ class InvoiceController extends ResourceController { try { - $data = $this->InvoiceModel->select('partner_invoice.*, PB.name as broker_name, pos.name as pos_name, - FORMAT(partner_invoice.invoice_amount, 2, "en_IN") AS invoice_amount_indian_format, - DATE_FORMAT(partner_invoice.invoice_date, "%d-%m-%Y") AS invoice_date_ui_format') - ->join('partner_brokers PB', 'PB.id = partner_invoice.broker_id', 'left') - ->join('partner_pos pos', 'pos.id = partner_invoice.pos_id', 'left') - ->where('partner_invoice.is_active', 1) - ->orderBy('partner_invoice.id', 'DESC') - ->findAll(); + $data = $this->InvoiceModel + ->select('partner_invoice.*, + PB.name as broker_name, + pos.name as pos_name, + FORMAT(partner_invoice.invoice_amount, 2, "en_IN") AS invoice_amount_indian_format, + DATE_FORMAT(partner_invoice.invoice_date, "%d-%m-%Y") AS invoice_date_ui_format, + ') + ->join('partner_brokers PB', 'PB.id = partner_invoice.broker_id', 'left') + ->join('partner_pos pos', 'pos.id = partner_invoice.pos_id', 'left') + ->where('partner_invoice.is_active', 1) + ->orderBy('partner_invoice.id', 'DESC') + ->findAll(); return $this->respond(['status' => 'success', 'code' => 200,'data' => $data ], 200); diff --git a/app/Controllers/PolicyController.php b/app/Controllers/PolicyController.php index b6cc847..d7d0953 100644 --- a/app/Controllers/PolicyController.php +++ b/app/Controllers/PolicyController.php @@ -995,9 +995,9 @@ class PolicyController extends ResourceController $type = $this->request->getGet('type'); $policyId = $this->request->getGet('policy_id'); - if($type == 'commission') + if($type == 'read') { - $readDoc = $this->calculateCommission($policyId , false); + $readDoc = $this->checkPolicyDoc($policyId , false); if($readDoc['status'] == 'success') { @@ -1061,9 +1061,9 @@ class PolicyController extends ResourceController return $this->respond(['status'=>$readDoc['status'], 'data'=> $readDoc ], 200); - }else if($type == 'read') + }else if($type == 'commission') { - return $this->checkPolicyDoc($policyId , true); + return $this->calculateCommission($policyId , true); } }