diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 336c3d5c..4a2a59d6 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -1063,6 +1063,7 @@ class PolicyTransactionController extends BaseController { $id = $this->request->getPost('id'); $data = $this->preparePolicyTransactionData(); + // print_r($data); die; if (!$id) { return $this->insertEndorsementTransaction($data); @@ -1079,25 +1080,12 @@ class PolicyTransactionController extends BaseController // print_r($data); // die; - // $data_received_date = (string)$this->request->getPost('data_received_date'); - // $closure_date = (string)$this->request->getPost('closure_date'); - // $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)); - - // $month = '01-'.$data['month']; - // $data['month'] = empty($data['month']) ? null : date('Y-m-d', strtotime($month)); - if (!isset($data['policy_with_corr'])) { $data['policy_with_corr'] = 0; } elseif ($data['policy_with_corr']) { $data['policy_with_corr'] = 1; } - if(empty($data['data_received_date'])){ $data['data_received_date'] = null; }else{ @@ -1269,7 +1257,7 @@ class PolicyTransactionController extends BaseController public function getEndorsementDataForEdit($id) { $data = $this->policyTransactionModel - ->select(' + ->select(' policy_transaction.*, clients.short_name as client_short_name, clients.client_type, @@ -1283,52 +1271,43 @@ class PolicyTransactionController extends BaseController ) as last_action_date ') - ->join('clients', 'clients.id = policy_transaction.client_id') - ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left') - ->where('policy_transaction.id', $id) - ->where('policy_transaction.is_active', 1) - ->first(); - - // $data['policy_start_date'] = empty($data['policy_start_date']) ? '' : date('d/m/Y', strtotime($data['s_date'])); - // $data['policy_end_date'] = empty($data['policy_end_date']) ? '' : date('d/m/Y', strtotime($data['e_date'])); - // $data['data_received_date'] = empty($data['data_received_date']) ? '' : date('d/m/Y', strtotime($data['data_received_date'])); - // $data['closure_date'] = empty($data['closure_date']) ? '' : date('d/m/Y', strtotime($data['closure_date'])); - // $data['endorse_eff_date'] = empty($data['endorse_eff_date']) ? '' : date('d/m/Y', strtotime($data['endorse_eff_date'])); - - // $data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '') - // ? date('M/Y', strtotime($data['month'])) - // : null; + ->join('clients', 'clients.id = policy_transaction.client_id') + ->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left') + ->where('policy_transaction.id', $id) + ->where('policy_transaction.is_active', 1) + ->orderBy('id', 'asc') + ->first(); - if(!empty($data['policy_start_date'])){ + if (!empty($data['policy_start_date'])) { $data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y'); } - if(!empty($data['policy_end_date'])){ + if (!empty($data['policy_end_date'])) { $data['policy_end_date'] = change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y'); } - if(!empty($data['data_received_date'])){ + if (!empty($data['data_received_date'])) { $data['data_received_date'] = change_date_format($data['data_received_date'], 'Y-m-d', 'd/m/Y'); } - if(!empty($data['policy_issue_date'])){ + if (!empty($data['policy_issue_date'])) { $data['policy_issue_date'] = change_date_format($data['policy_issue_date'], 'Y-m-d', 'd/m/Y'); } - if(!empty($data['endorse_eff_date'])){ + if (!empty($data['endorse_eff_date'])) { $data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'Y-m-d', 'd/m/Y'); } - if(!empty($data['install_due_date'])){ + if (!empty($data['install_due_date'])) { $data['install_due_date'] = change_date_format($data['install_due_date'], 'Y-m-d', 'd/m/Y'); } - if(!empty($data['last_action_date'])){ + if (!empty($data['last_action_date'])) { $data['last_action_date'] = change_date_format($data['last_action_date'], 'Y-m-d', 'd/m/Y'); } - if(!empty($data['month'])){ + if (!empty($data['month'])) { $data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y'); } @@ -1337,7 +1316,7 @@ class PolicyTransactionController extends BaseController //get PT Co-Share Details $data['pt_co_share_details'] = $this->PTCOShareDetailsModel - ->select(" + ->select(" pt_co_share_details.*, ( @@ -1453,19 +1432,18 @@ class PolicyTransactionController extends BaseController ) AS actual_tep_brokerage_amount ") - ->where('pt_id', $id) - ->where('is_active', 1) - ->orderBy('id', 'asc') - ->findAll(); + ->where('pt_id', $id) + ->where('is_active', 1) + ->orderBy('id', 'asc') + ->findAll(); // print_r($data['endorse_eff_date']); die; - if($data){ + if ($data) { return $this->respond(['status' => true, 'data' => $data], 200); - }else{ + } else { return $this->respond(['status' => false], 200); } - } //------------------------------------------------------------------------------------------------ diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index c9d439b9..6e1ba143 100644 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -120,7 +120,8 @@ - + + @@ -378,9 +379,15 @@
- + +