CHANGE_BDS
This commit is contained in:
parent
f46ee62e77
commit
389d645b93
@ -402,6 +402,8 @@ class PolicyTransactionController extends BaseController
|
||||
private function updateInceptionPolicy($id, $data)
|
||||
{
|
||||
// print_r($data); die;
|
||||
$old_pt_data = $this->policyTransactionModel->where('is_active', 1)->where("id", $id)->first();
|
||||
$old_pt_co_share_data = $this->PTCOShareDetailsModel->where('is_active', 1)->where("id", $id)->first();
|
||||
if ($this->policyTransactionModel->update($id, $data)) {
|
||||
|
||||
$this->insertTransactionStatus($id, $data, 1);
|
||||
@ -429,9 +431,11 @@ class PolicyTransactionController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
|
||||
if ($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1) {
|
||||
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']);
|
||||
if($old_pt_data['status'] != "completed"){
|
||||
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
|
||||
if ($data['client_type'] == 1 && $data['is_cd_reduce_from_bds'] == 1) {
|
||||
$this->processCompletedStatus($data, $data['client_policy_id'], $data['insurer_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -847,14 +851,14 @@ class PolicyTransactionController extends BaseController
|
||||
->findAll();
|
||||
|
||||
$pt_bp_amt = $this->PTCOShareDetailsModel
|
||||
->select('bp_amt')
|
||||
->select('bp_amt, amount')
|
||||
->where('pt_id', $id)
|
||||
->where('co_share_type', 1)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
// dd(db_connect()->getLastQuery() ,$pt_bp_amt);
|
||||
$data['base_cd_amount'] = $pt_bp_amt['bp_amt'] ?? null;
|
||||
$data['base_cd_amount'] = $pt_bp_amt['amount'] ?? null;
|
||||
|
||||
|
||||
$ptFileQuery = $this->PTFileModel
|
||||
|
||||
@ -4831,32 +4831,14 @@
|
||||
let client_type = $('#client_type').val();
|
||||
console.log('client type', client_type);
|
||||
|
||||
let current_bp_amt = $('#base_cd_amount').val() ?? 0;
|
||||
console.log('current_bp_amt', current_bp_amt);
|
||||
|
||||
let base_premium = $(input).val();
|
||||
console.log("base_premium:", base_premium);
|
||||
|
||||
let differnce_bp_amt = 0;
|
||||
|
||||
if (base_premium === current_bp_amt) {
|
||||
differnce_bp_amt = 0;
|
||||
} else {
|
||||
differnce_bp_amt = base_premium - current_bp_amt;
|
||||
console.log("differnce_bp_amt 1:", differnce_bp_amt);
|
||||
if (differnce_bp_amt < 0) {
|
||||
console.log("Negative amount:", differnce_bp_amt);
|
||||
} else {
|
||||
console.log("Positive amount:", differnce_bp_amt);
|
||||
base_premium = differnce_bp_amt
|
||||
}
|
||||
}
|
||||
|
||||
console.log("differnce_bp_amt:", differnce_bp_amt);
|
||||
console.log("base_premium:", base_premium);
|
||||
|
||||
if(client_type == 1){
|
||||
|
||||
let current_total_amt = $('#base_cd_amount').val() ?? 0;
|
||||
console.log('current_total_amt', current_total_amt);
|
||||
|
||||
// Extract increment value from input ID
|
||||
let input_id = input.id;
|
||||
console.log("input_id:", input_id);
|
||||
@ -4864,6 +4846,27 @@
|
||||
let increment = input_id.split("_").pop();
|
||||
console.log("increment:", increment);
|
||||
|
||||
let total_amt = $('#total_amt_' + increment).val();
|
||||
console.log("total_amt:", total_amt);
|
||||
|
||||
let differnce_bp_amt = 0;
|
||||
|
||||
if (total_amt == current_total_amt) {
|
||||
differnce_bp_amt = 0;
|
||||
} else if(total_amt < current_total_amt) {
|
||||
differnce_bp_amt = total_amt - current_total_amt;
|
||||
console.log("differnce_bp_amt 1:", differnce_bp_amt);
|
||||
$('#cd_amt_changed').prop('disabled', false).val(differnce_bp_amt);
|
||||
return;
|
||||
} else {
|
||||
differnce_bp_amt = total_amt - current_total_amt;
|
||||
console.log("differnce_bp_amt 2:", differnce_bp_amt);
|
||||
total_amt = differnce_bp_amt;
|
||||
}
|
||||
|
||||
console.log("differnce_bp_amt:", differnce_bp_amt);
|
||||
console.log("total_amt:", total_amt);
|
||||
|
||||
// Get the corresponding `cd_ac_no` value
|
||||
let cd_ac_no = $('#cd_ac_no_' + increment).val();
|
||||
console.log("cd_ac_no:", cd_ac_no);
|
||||
@ -4878,7 +4881,7 @@
|
||||
|
||||
// Data to send in the AJAX request
|
||||
let requestData = {
|
||||
base_premium: base_premium,
|
||||
base_premium: total_amt,
|
||||
cd_ac_no: cd_ac_no
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user