diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php
index 09274d01..8b2a80bb 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -1193,9 +1193,6 @@ class PolicyTransactionController extends BaseController
// $data['is_cd_reduce_from_bds'] = 1;
// }
- $data['is_cd_reduce_from_bds'] = ($data['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0;
-
-
if (empty($data['data_received_date'])) {
$data['data_received_date'] = null;
} else {
@@ -1255,6 +1252,8 @@ class PolicyTransactionController extends BaseController
$client_branch_id = $issue_type['client_branch_id'];
}
+ $data['is_cd_reduce_from_bds'] = (isset($issue_type['policy_type_id']) && $issue_type['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0;
+
// if($data['bro_payable_by'] == ""){
// $data['bro_payable_by'] = $issue_type['bro_payable_by'];
// }
@@ -1324,13 +1323,16 @@ class PolicyTransactionController extends BaseController
}
private function updateEndorsementTransaction($id, $data)
- {
+ {
+ $old_endorse_data = $this->policyTransactionModel->where('id', $id)->where('is_active', 1)->first();
$update = $this->policyTransactionModel->where('id', $id)->set($data)->update();
if ($update) {
$this->insertTransactionStatus($id, $data, 1);
- $this->handleCompletedStatus($data, $id);
+ if($old_endorse_data['status'] != "completed"){
+ $this->handleCompletedStatus($data, $id);
+ }
$this->insertOrUpdateCoShareDetails($data, $id);
@@ -1344,11 +1346,10 @@ class PolicyTransactionController extends BaseController
{
if ($data['client_type'] == 1 && $data['status'] == 'completed' && $data['is_cd_reduce_from_bds'] == 1) {
- $tolamt = $data['total'][0] ?? 0;
+ $tolamt = (int) $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 (BDS)';
-
$cd_tranction_data = [
'amount' => $tolamt,
'sub_type_id' => $data['action_type'] == 'deletion' ? 3 : 4,
diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php
index bb1b877d..b15d5cc0 100644
--- a/app/Views/policy_transaction_endorsement_form.php
+++ b/app/Views/policy_transaction_endorsement_form.php
@@ -363,11 +363,11 @@
Is Leader? |
-
+
| CD Acc No |
-
+
| CD Amount |
@@ -602,20 +602,32 @@ $(document).ready(function(){
var end_date = $(this).find('option:selected').attr('data-ed');
var policy_type_id = $(this).find('option:selected').attr('data-ptid');
- if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){
- $('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
- }else{
- $('#is_cd_reduce_from_bds').prop('disabled',false)
- }
+ // if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){
+ // $('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false)
+ // }else{
+ // $('#is_cd_reduce_from_bds').prop('disabled',false)
+ // }
if( policy_type_id > 7 ){
$('#tpa_endorse_div').hide();
- $('#no_of_insured_endorse_div').hide();
- $('#no_of_dependents_endorse_div').hide();
+ $('#table_tr_34').show();
+ $('#table_tr_37').show();
}else{
$('#tpa_endorse_div').show();
+ $('#table_tr_34').hide();
+ $('#table_tr_37').hide();
+ }
+
+
+ if(policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5){
$('#no_of_insured_endorse_div').show();
$('#no_of_dependents_endorse_div').show();
+ }else if(policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7) {
+ $('#no_of_insured_endorse_div').show();
+ $('#no_of_dependents_endorse_div').hide();
+ }else{
+ $('#no_of_insured_endorse_div').hide();
+ $('#no_of_dependents_endorse_div').hide();
}
@@ -822,8 +834,13 @@ $('#client_type').on('change', function() {
if (selectedClientType == 2) {
$('.branchdiv').hide();
+ $('#table_tr_34').hide();
+ $('#table_tr_37').hide();
} else {
$('.branchdiv').show();
+ $('#table_tr_34').show();
+ $('#table_tr_37').show();
+
}
console.log('selectedClientType', selectedClientType);
@@ -850,8 +867,14 @@ $('#client_type').on('change', function() {
}
+ $('#client_policy_id').empty().append($('