diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index e5f9348a..9c941c39 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -214,25 +214,25 @@ class PolicyTransactionController extends BaseController // $data['renewal_date'] = change_date_format($this->request->getPost('renewal_date'), 'd/m/Y', 'Y-m-d') ?? null; // $data['rollover_date'] = change_date_format($this->request->getPost('rollover_date'), 'd/m/Y', 'Y-m-d') ?? null; - $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '') - ? date('d/m/Y', strtotime($data['policy_issue_date'])) - : null; + // $data['policy_issue_date'] = (isset($data['policy_issue_date']) && $data['policy_issue_date'] !== null && $data['policy_issue_date'] !== '') + // ? date('d/m/Y', strtotime($data['policy_issue_date'])) + // : null; - $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '') - ? date('d/m/Y', strtotime($data['policy_start_date'])) - : null; + // $data['policy_start_date'] = (isset($data['policy_start_date']) && $data['policy_start_date'] !== null && $data['policy_start_date'] !== '') + // ? date('d/m/Y', strtotime($data['policy_start_date'])) + // : null; - $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '') - ? date('d/m/Y', strtotime($data['policy_end_date'])) - : null; + // $data['policy_end_date'] = (isset($data['policy_end_date']) && $data['policy_end_date'] !== null && $data['policy_end_date'] !== '') + // ? date('d/m/Y', strtotime($data['policy_end_date'])) + // : null; - $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '') - ? date('d/m/Y', strtotime($data['renewal_date'])) - : null; + // $data['renewal_date'] = (isset($data['renewal_date']) && $data['renewal_date'] !== null && $data['renewal_date'] !== '') + // ? date('d/m/Y', strtotime($data['renewal_date'])) + // : null; - $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '') - ? date('d/m/Y', strtotime($data['rollover_date'])) - : null; + // $data['rollover_date'] = (isset($data['rollover_date']) && $data['rollover_date'] !== null && $data['rollover_date'] !== '') + // ? date('d/m/Y', strtotime($data['rollover_date'])) + // : null; // Separate Insurer and TPA Branch IDs and IDs @@ -268,8 +268,8 @@ class PolicyTransactionController extends BaseController $data['ct_type'] = 1; } - $month = '01-'.(string)$this->request->getPost('month'); - $data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month)); + // $month = '01-'.(string)$this->request->getPost('month'); + // $data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month)); // Determine $is_addon value $data['is_addon'] = in_array($data['policy_type_id'], [1, 2, 6, 7]) ? 1 : @@ -825,12 +825,13 @@ class PolicyTransactionController extends BaseController $endorse_eff_date = (string)$this->request->getPost('endorse_eff_date'); $month = (string)$this->request->getPost('month'); - $data['data_received_date'] = empty($data['data_received_date']) ? null : date('Y-m-d', strtotime($data_received_date)); - $data['closure_date'] = empty($data['closure_date']) ? null : date('Y-m-d', strtotime($closure_date)); - $data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? null : date('Y-m-d', strtotime($endorse_eff_date)); + $data['data_received_date'] = empty($data['data_received_date']) ? null : change_date_format($data_received_date,'d/m/Y','Y-m-d'); + //date('Y-m-d', strtotime($data_received_date)); + $data['closure_date'] = empty($data['closure_date']) ? null : change_date_format($closure_date,'d/m/Y','Y-m-d'); + $data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? null : change_date_format($endorse_eff_date,'d/m/Y','Y-m-d'); - $month = '01-'.$data['month']; - $data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month)); + $month = $data['month'].'/01'; + $data['month'] = empty($data['month']) ? null : change_date_format($month,'M/Y/d','Y-m-d'); // Separate Insurer and TPA Branch IDs and IDs if(isset($data['insurer_id']) && !empty($data['insurer_id'])){ @@ -934,7 +935,7 @@ class PolicyTransactionController extends BaseController { if ($data['status'] == 'completed' && $data['ct_type'] == 2) { - $tolamt = $data['total'][0] ?? 0; + $tolamt = isset($data['total'][0]) && is_numeric($data['total'][0]) ? $data['total'][0] : 0; $description = 'The following amount of Rs. ' . round($tolamt, 2) . '/- has been' . ($data['action_type'] == 'deletion' ? ' Credit ' : ' Debit ') . 'from the policy transaction'; diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index bb94a40e..df32d967 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -479,12 +479,25 @@ class PolicyTransactionModel extends Model pt_co_share_details.exp_amt, pt_co_share_details.variance, insurer_statements.invoice_amount, + insurer_statements.invoice_status, - ROUND((pt_co_share_details.actual_bp_brokerage_amt + pt_co_share_details.actual_tp_brokerage_amt + pt_co_share_details.actual_tep_brokerage_amt), 2) AS realization_amount + ROUND((pt_co_share_details.actual_bp_brokerage_amt + pt_co_share_details.actual_tp_brokerage_amt + pt_co_share_details.actual_tep_brokerage_amt), 2) AS realization_amount2, + + ( + SELECT + (SUM(inv_payment_details.inv_amt) + SUM(inv_payment_details.tds)) AS realization_amount + FROM + inv_payment_details + WHERE + inv_payment_details.statement_id = insurer_statements.id + AND inv_payment_details.is_active = 1 + + ) AS realization_amount, ") ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left') + ->join('inv_payment_details', 'insurer_statements.id = inv_payment_details.statement_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left') ->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left') ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left') diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index 251de501..20d9e41a 100644 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -109,7 +109,7 @@