FIX_BDS_MODULE_ISSUE_AND_LIVE_ISSUE : RV
This commit is contained in:
parent
c180192a52
commit
4ad6c93746
@ -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 :
|
||||
@ -594,7 +594,7 @@ class PolicyTransactionController extends BaseController
|
||||
];
|
||||
}
|
||||
|
||||
print_r($emp_policy_data); die;
|
||||
// print_r($emp_policy_data); die;
|
||||
|
||||
// Insert new records
|
||||
if (!empty($emp_policy_data)) {
|
||||
@ -640,25 +640,30 @@ class PolicyTransactionController extends BaseController
|
||||
->where('policy_transaction.id', $id)
|
||||
->first();
|
||||
|
||||
$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;
|
||||
|
||||
// $data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '')
|
||||
// ? date('M/Y', strtotime($data['month']))
|
||||
// : null;
|
||||
|
||||
|
||||
$data['created_at'] = (isset($data['created_at']) && $data['created_at'] !== null && $data['created_at'] !== '')
|
||||
? date('d/m/Y h:i:s A', strtotime($data['created_at']))
|
||||
@ -668,12 +673,39 @@ class PolicyTransactionController extends BaseController
|
||||
? date('d/m/Y h:i:s A', strtotime($data['updated_at']))
|
||||
: null;
|
||||
|
||||
$data['month'] = (isset($data['month']) && $data['month'] !== null && $data['month'] !== '')
|
||||
? date('M/Y', strtotime($data['month']))
|
||||
: null;
|
||||
|
||||
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['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'])){
|
||||
$data['policy_end_date'] = change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['renewal_date'])){
|
||||
$data['renewal_date'] = change_date_format($data['renewal_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if(!empty($data['rollover_date'])){
|
||||
$data['rollover_date'] = change_date_format($data['rollover_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
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['month'])){
|
||||
$data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// print_r($data); die;
|
||||
|
||||
$data['renewal_policy'] = $this->clientPolicyModel
|
||||
->select('client_policy.*, policy_type.policy_type')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
@ -726,6 +758,9 @@ class PolicyTransactionController extends BaseController
|
||||
// Policy Transaction Endorsement
|
||||
public function viewEndorsement()
|
||||
{
|
||||
// echo '<pre>';
|
||||
// !dd($this->getEndorsementDataForEdit(17));
|
||||
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
|
||||
@ -818,25 +853,48 @@ class PolicyTransactionController extends BaseController
|
||||
private function preparePolicyTransactionData()
|
||||
{
|
||||
$data = $this->request->getPost();
|
||||
// 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');
|
||||
// echo '<pre>';
|
||||
// print_r($data);
|
||||
// die;
|
||||
|
||||
$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');
|
||||
// $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');
|
||||
|
||||
$month = $data['month'].'/01';
|
||||
$data['month'] = empty($data['month']) ? null : change_date_format($month,'M/Y/d','Y-m-d');
|
||||
// $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(!empty($data['data_received_date'])){
|
||||
$data['data_received_date'] = change_date_format($data['data_received_date'], 'd/m/Y', 'Y-m-d');
|
||||
}
|
||||
|
||||
if(!empty($data['closure_date'])){
|
||||
$data['closure_date'] = change_date_format($data['closure_date'], 'd/m/Y', 'Y-m-d');
|
||||
}
|
||||
|
||||
if(!empty($data['endorse_eff_date'])){
|
||||
$data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'd/m/Y', 'Y-m-d');
|
||||
}
|
||||
|
||||
if(!empty($data['month'])){
|
||||
$month = '01/'.$data['month'];
|
||||
$data['month'] = change_date_format($month, 'd/M/Y', 'Y-m-d');
|
||||
}
|
||||
|
||||
// print_r($data); die;
|
||||
|
||||
// Separate Insurer and TPA Branch IDs and IDs
|
||||
if(isset($data['insurer_id']) && !empty($data['insurer_id'])){
|
||||
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $data['insurer_id']);
|
||||
if ($data['tpa']) {
|
||||
if (isset($data['tpa'])) {
|
||||
list($data['tpa_branch_id'], $data['tpa_id']) = explode('-', $data['tpa']);
|
||||
}
|
||||
}
|
||||
@ -855,6 +913,7 @@ class PolicyTransactionController extends BaseController
|
||||
}
|
||||
|
||||
if(!$data['id']){
|
||||
|
||||
$data += [
|
||||
'issuer' => $issue_type['issuer'] ?? null,
|
||||
'client_type' => $data['client_type'] ?? $issue_type['client_type'] ?? null,
|
||||
@ -892,6 +951,7 @@ class PolicyTransactionController extends BaseController
|
||||
|
||||
$data['client_branch_id'] = $client_branch_id;
|
||||
}
|
||||
|
||||
// print_r($issue_type);
|
||||
// print_r($data);
|
||||
// die;
|
||||
@ -935,7 +995,7 @@ class PolicyTransactionController extends BaseController
|
||||
{
|
||||
if ($data['status'] == 'completed' && $data['ct_type'] == 2) {
|
||||
|
||||
$tolamt = isset($data['total'][0]) && is_numeric($data['total'][0]) ? $data['total'][0] : 0;
|
||||
$tolamt = $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';
|
||||
@ -966,27 +1026,53 @@ class PolicyTransactionController extends BaseController
|
||||
policy_transaction.*,
|
||||
clients.short_name as client_short_name,
|
||||
clients.client_type,
|
||||
client_policy.policy_start_date as s_date,
|
||||
client_policy.policy_end_date as e_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)
|
||||
->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;
|
||||
|
||||
// $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;
|
||||
|
||||
|
||||
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'])){
|
||||
$data['policy_end_date'] = change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
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['closure_date'])){
|
||||
$data['closure_date'] = change_date_format($data['closure_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
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['month'])){
|
||||
$data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
|
||||
}
|
||||
|
||||
// print_r($data); die;
|
||||
|
||||
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel->where('pt_id', $id)->where('is_active', 1)->findAll();
|
||||
|
||||
// print_r($data['endorse_eff_date']); die;
|
||||
|
||||
if($data){
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
|
||||
@ -621,20 +621,20 @@ class PolicyTransactionModel extends Model
|
||||
{
|
||||
$builder = $this->db->table('policy_transaction')
|
||||
->select("
|
||||
policy_transaction.id,
|
||||
clients.client_name,
|
||||
insurers.name AS insurer_name,
|
||||
policy_type.policy_type,
|
||||
policy_transaction.policy_no,
|
||||
policy_transaction.endorsement_no,
|
||||
CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
ELSE 'E'
|
||||
END AS action_type,
|
||||
policy_transaction.action_type as action_type_full,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance
|
||||
")
|
||||
policy_transaction.id,
|
||||
clients.client_name,
|
||||
insurers.name AS insurer_name,
|
||||
policy_type.policy_type,
|
||||
policy_transaction.policy_no,
|
||||
policy_transaction.endorsement_no,
|
||||
CASE
|
||||
WHEN policy_transaction.action_type = 'inception' THEN 'I'
|
||||
ELSE 'E'
|
||||
END AS action_type,
|
||||
policy_transaction.action_type AS action_type_full,
|
||||
pt_co_share_details.exp_amt,
|
||||
pt_co_share_details.variance
|
||||
")
|
||||
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
|
||||
->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
|
||||
@ -642,10 +642,9 @@ class PolicyTransactionModel extends Model
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('policy_transaction.status', 'completed')
|
||||
->where('pt_co_share_details.agreed_bp_per IS NULL OR pt_co_share_details.agreed_bp_per = 0')
|
||||
->where('pt_co_share_details.actual_bp_amt IS NULL OR pt_co_share_details.actual_bp_amt = 0')
|
||||
->where('pt_co_share_details.actual_bp_brokerage_amt IS NULL OR pt_co_share_details.actual_bp_brokerage_amt = 0');
|
||||
|
||||
->where('COALESCE(pt_co_share_details.agreed_bp_per, 0) + COALESCE(pt_co_share_details.agreed_tp_per, 0) + COALESCE(pt_co_share_details.agreed_tep_per, 0) = 0')
|
||||
->where('COALESCE(pt_co_share_details.actual_bp_amt, 0) + COALESCE(pt_co_share_details.actual_tp_amt, 0) + COALESCE(pt_co_share_details.actual_tep_amt, 0) = 0')
|
||||
->where('COALESCE(pt_co_share_details.actual_bp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tp_brokerage_amt, 0) + COALESCE(pt_co_share_details.actual_tep_brokerage_amt, 0) = 0');
|
||||
|
||||
|
||||
if ($start_date != 0 && $end_date != 0 && $date_type != 0) {
|
||||
|
||||
@ -237,8 +237,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Initialize Flatpickr for the start date with today's date
|
||||
var openDatePicker = flatpickr("#open_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
@ -717,7 +715,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
}, 1100);
|
||||
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/edit"); ?>');
|
||||
|
||||
@ -836,7 +834,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (res.data.is_addon == 2 || res.data.is_addon == 3) {
|
||||
|
||||
$("#insurer").next(".select2-container").css({
|
||||
@ -870,7 +867,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (res.data.policy_type_id == '1' || res.data.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
||||
$('#tpa').prop('required', false);
|
||||
$('#tpa_danger').hide()
|
||||
@ -879,13 +875,15 @@
|
||||
$('#tpa_danger').show()
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
$('#client_branch').val(res.data.client_branch_id).select2();
|
||||
}, 1000);
|
||||
|
||||
setTimeout(function(){
|
||||
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
||||
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
||||
}, 2000)
|
||||
|
||||
$('#client_branch').val(res.data.client_branch_id).change();
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
@ -911,10 +911,10 @@ $(document).ready(function() {
|
||||
var select = document.getElementById("upload-action-type");
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
select.options[i].disabled = true;
|
||||
if (select.options[i].value === "inception") {
|
||||
if (select.options[i].value === "inception" || select.options[i].value === "enrollment") {
|
||||
select.options[i].disabled = false;
|
||||
}
|
||||
if (select.options[i].value === "") {
|
||||
if (select.options[i].value === "" || select.options[i].value === "enrollment") {
|
||||
select.options[i].disabled = false;
|
||||
}
|
||||
}
|
||||
@ -935,7 +935,7 @@ $(document).ready(function() {
|
||||
console.error('Error fetching data from API:', error);
|
||||
var select = document.getElementById("upload-action-type");
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
if (select.options[i].value === "inception") {
|
||||
if (select.options[i].value === "inception" || select.options[i].value === "enrollment" ) {
|
||||
select.options[i].disabled = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css" rel="stylesheet"> -->
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> -->
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.bundle.min.js"></script>
|
||||
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.bundle.min.js"></script> -->
|
||||
|
||||
<!-- Bootstrap JS (ensure this is included) -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js"></script>
|
||||
|
||||
@ -555,7 +555,7 @@ $(document).ready(function(){
|
||||
}else{
|
||||
addInsurerColumn()
|
||||
}
|
||||
hidePermiumDetailsBasedOnTheTeam();
|
||||
// hidePermiumDetailsBasedOnTheTeam();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -851,11 +851,15 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
||||
setTimeout(function(){
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
$('#client_branch_id').val(res.data.client_branch_id).change();
|
||||
$('#client_policy_id').val(res.data.client_policy_id).change();
|
||||
}, 1000)
|
||||
|
||||
setTimeout(function(){
|
||||
$('#policy_start_date').val(res.data.policy_start_date);
|
||||
$('#policy_end_date').val(res.data.policy_end_date);
|
||||
}, 1500)
|
||||
|
||||
$('#policy_no').val(res.data.policy_no);
|
||||
$('#action_type').val(res.data.action_type);
|
||||
$('#endorsement_no').val(res.data.endorsement_no);
|
||||
@ -864,8 +868,6 @@ function getPolicyTransactionDataForEndorsementEdit(input){
|
||||
$('#emp_count').val(res.data.emp_count);
|
||||
$('#dependent_count').val(res.data.dependent_count);
|
||||
$('#policy_status').val(res.data.status);
|
||||
$('#policy_start_date').val(res.data.policy_start_date);
|
||||
$('#policy_end_date').val(res.data.policy_end_date);
|
||||
$('#endorse_eff_date').val(res.data.endorse_eff_date);
|
||||
$('#month').val(res.data.month);
|
||||
|
||||
@ -926,7 +928,7 @@ function amountCalculation(input) {
|
||||
|
||||
let agreed_bp_per = parseFloat($('#agreed_bp_' + input).val()) || 0;
|
||||
let agreed_tp_per = parseFloat($('#agreed_tp_' + input).val()) || 0;
|
||||
let agreed_tep_per = parseFloat($('#agreed_ter_' + input).val()) || 0;
|
||||
let agreed_tep_per = parseFloat($('#agreed_tep_' + input).val()) || 0;
|
||||
|
||||
let standard_bp_per = parseFloat($('#standard_bp_' + input).val()) || 0;
|
||||
let standard_tp_per = parseFloat($('#standard_tp_' + input).val()) || 0;
|
||||
@ -942,39 +944,52 @@ function amountCalculation(input) {
|
||||
let tpTotal = bp + tp + tep + cop;
|
||||
|
||||
let gst_per_amt = (tpTotal * gst_per) / 100;
|
||||
$('#gst_amount_' + input).val(gst_per_amt.toFixed(2));
|
||||
// $('#gst_amount_' + input).val(gst_per_amt.toFixed(2));
|
||||
$('#gst_amount_' + input).val(!isNaN(gst_per_amt) && isFinite(gst_per_amt) ? gst_per_amt.toFixed(2) : '0.00');
|
||||
|
||||
|
||||
let finalTotal = tpTotal + gst_per_amt + stamp_duty_amt;
|
||||
|
||||
// console.log('Summed Amount:', finalTotal);
|
||||
// $('#total_amt_' + input).val(finalTotal.toFixed(2));
|
||||
$('#total_amt_' + input).val(!isNaN(finalTotal) && isFinite(finalTotal) ? finalTotal.toFixed(2) : '0.00');
|
||||
|
||||
$('#total_amt_' + input).val(finalTotal.toFixed(2));
|
||||
|
||||
let sum_of_agreed_premium = agreed_bp_per + agreed_tp_per + agreed_tep_per;
|
||||
console.log('sum_of_agreed_precentage : ', sum_of_agreed_premium);
|
||||
|
||||
var expectedAmount = 0;
|
||||
|
||||
if(agreed_amount > 0 ){
|
||||
expectedAmount = agreed_amount;
|
||||
console.log('Formula 1 AGREED AMOUNT');
|
||||
}else if(sum_of_agreed_premium > 0){
|
||||
expectedAmount = ((bp + cop) * agreed_bp_per)+ ((tp + tep)*(agreed_tp_per + agreed_tep_per));
|
||||
expectedAmount = expectedAmount / 100;
|
||||
console.log('Formula 2 AGREED BP TP/TEP %');
|
||||
}else{
|
||||
expectedAmount = ((bp + cop) * standard_bp_per)+ ((tp + tep)*(standard_tp_per + standard_tep_per));
|
||||
expectedAmount = expectedAmount / 100;
|
||||
console.log('Formula 3 STANDARD BP TP/TEP %');
|
||||
}
|
||||
|
||||
// console.log('expectedAmount', expectedAmount);
|
||||
console.log('expectedAmount', expectedAmount);
|
||||
|
||||
//Expected Amount
|
||||
$('#exp_amt_' + input).val(expectedAmount.toFixed(2));
|
||||
// $('#exp_amt_' + input).val(expectedAmount.toFixed(2));
|
||||
$('#exp_amt_' + input).val(!isNaN(expectedAmount) && isFinite(expectedAmount) ? expectedAmount.toFixed(2) : '0.00');
|
||||
|
||||
let actual_bp_brokerage_amount = $('#actual_bp_brokerage_amt_' + input).val();
|
||||
let actual_tp_brokerage_amount = $('#actual_tp_brokerage_amt_' + input).val();
|
||||
let actual_tep_brokerage_amount = $('#actual_tep_brokerage_amt_' + input).val();
|
||||
|
||||
let variance = expectedAmount - (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount)
|
||||
let actual_bp_brokerage_amount = parseFloat($('#actual_bp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tp_brokerage_amount = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tep_brokerage_amount = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
|
||||
|
||||
// let variance = expectedAmount - (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount)
|
||||
let variance = (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount) - expectedAmount;
|
||||
|
||||
// $('#variance_' + input).val(variance.toFixed(2));
|
||||
$('#variance_' + input).val(!isNaN(variance) && isFinite(variance) ? variance.toFixed(2) : '0.00');
|
||||
|
||||
$('#variance_' + input).val(variance.toFixed(2));
|
||||
// console.log('variance', variance);
|
||||
}
|
||||
|
||||
@ -992,9 +1007,11 @@ function actualAmountCalculation(input, field = null){
|
||||
let actual_bp_amt = parseFloat($('#actual_bp_amt_' + input).val()) || 0;
|
||||
let actual_tp_amt = parseFloat($('#actual_tp_amt_' + input).val()) || 0;
|
||||
let actual_tep_amt = parseFloat($('#actual_tep_amt_' + input).val()) || 0;
|
||||
|
||||
let actual_bp_per = parseFloat($('#actual_bp_per_' + input).val()) || 0;
|
||||
let actual_tp_per = parseFloat($('#actual_tp_per_' + input).val()) || 0;
|
||||
let actual_tep_per = parseFloat($('#actual_tep_per_' + input).val()) || 0;
|
||||
|
||||
let actual_bp_brokerage_amt = parseFloat($('#actual_bp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tp_brokerage_amt = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tep_brokerage_amt = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
|
||||
@ -1005,24 +1022,49 @@ function actualAmountCalculation(input, field = null){
|
||||
console.log()
|
||||
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
|
||||
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
|
||||
$('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
// $('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
$('#actual_bp_brokerage_amt_' + input).val(!isNaN(actual_bp_brokerage_amount) && isFinite(actual_bp_brokerage_amount) ? actual_bp_brokerage_amount.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
} else if (field === 'bp_broker_amt') {
|
||||
// If brokerage amount is changed, update percentage
|
||||
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
|
||||
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
|
||||
$('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
// $('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
$('#actual_bp_per_' + input).val(!isNaN(actual_bp_percentage) && isFinite(actual_bp_percentage) ? actual_bp_percentage.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
} else if (field === 'bp_amt_for_calc') {
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
|
||||
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
|
||||
$('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
}
|
||||
if(actual_bp_per > 0){
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
|
||||
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
|
||||
$('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
|
||||
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
|
||||
// $('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
$('#actual_bp_brokerage_amt_' + input).val(!isNaN(actual_bp_brokerage_amount) && isFinite(actual_bp_brokerage_amount) ? actual_bp_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
}else if(actual_bp_brokerage_amt > 0){
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
|
||||
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
|
||||
// $('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
$('#actual_bp_per_' + input).val(!isNaN(actual_bp_percentage) && isFinite(actual_bp_percentage) ? actual_bp_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
|
||||
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
|
||||
// $('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
$('#actual_bp_brokerage_amt_' + input).val(!isNaN(actual_bp_brokerage_amount) && isFinite(actual_bp_brokerage_amount) ? actual_bp_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
|
||||
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
|
||||
// $('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
$('#actual_bp_per_' + input).val(!isNaN(actual_bp_percentage) && isFinite(actual_bp_percentage) ? actual_bp_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1033,24 +1075,48 @@ function actualAmountCalculation(input, field = null){
|
||||
if (field === 'tp_per') {
|
||||
if (actual_tp_amt > 0 && actual_tp_per >= 0) {
|
||||
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
|
||||
$('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
// $('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
$('#actual_tp_brokerage_amt_' + input).val(!isNaN(actual_tp_brokerage_amount) && isFinite(actual_tp_brokerage_amount) ? actual_tp_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
} else if (field === 'tp_broker_amt') {
|
||||
// If brokerage amount is changed, update percentage
|
||||
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
|
||||
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
|
||||
$('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
// $('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
$('#actual_tp_per_' + input).val(!isNaN(actual_tp_percentage) && isFinite(actual_tp_percentage) ? actual_tp_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
} else if (field === 'tp_amt_for_calc') {
|
||||
|
||||
if (actual_tp_amt > 0 && actual_tp_per >= 0) {
|
||||
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
|
||||
$('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
}
|
||||
if(actual_tp_amt > 0){
|
||||
|
||||
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
|
||||
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
|
||||
$('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
if (actual_tp_amt > 0 && actual_tp_per >= 0) {
|
||||
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
|
||||
// $('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
$('#actual_tp_brokerage_amt_' + input).val(!isNaN(actual_tp_brokerage_amount) && isFinite(actual_tp_brokerage_amount) ? actual_tp_brokerage_amount.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
|
||||
}else if(actual_tp_brokerage_amt > 0){
|
||||
|
||||
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
|
||||
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
|
||||
// $('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
$('#actual_tp_per_' + input).val(!isNaN(actual_tp_percentage) && isFinite(actual_tp_percentage) ? actual_tp_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
}else{
|
||||
if (actual_tp_amt > 0 && actual_tp_per >= 0) {
|
||||
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
|
||||
// $('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
$('#actual_tp_brokerage_amt_' + input).val(!isNaN(actual_tp_brokerage_amount) && isFinite(actual_tp_brokerage_amount) ? actual_tp_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
|
||||
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
|
||||
// $('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
$('#actual_tp_per_' + input).val(!isNaN(actual_tp_percentage) && isFinite(actual_tp_percentage) ? actual_tp_percentage.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1068,25 +1134,53 @@ function actualAmountCalculation(input, field = null){
|
||||
if (field === 'tep_per') {
|
||||
if (actual_tep_amt > 0 && actual_tep_per >= 0) {
|
||||
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
|
||||
$('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
// $('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
$('#actual_tep_brokerage_amt_' + input).val(!isNaN(actual_tep_brokerage_amount) && isFinite(actual_tep_brokerage_amount) ? actual_tep_brokerage_amount.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
} else if (field === 'tep_broker_amt') {
|
||||
// If brokerage amount is changed, update percentage
|
||||
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
|
||||
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
|
||||
$('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
// $('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
$('#actual_tep_per_' + input).val(!isNaN(actual_tep_percentage) && isFinite(actual_tep_percentage) ? actual_tep_percentage.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
} else if (field === 'tep_amt_for_calc') {
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_per >= 0) {
|
||||
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
|
||||
$('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
if(actual_tep_amt > 0){
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_per >= 0) {
|
||||
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
|
||||
// $('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
$('#actual_tep_brokerage_amt_' + input).val(!isNaN(actual_tep_brokerage_amount) && isFinite(actual_tep_brokerage_amount) ? actual_tep_brokerage_amount.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
|
||||
}else if(actual_tep_brokerage_amt > 0){
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
|
||||
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
|
||||
// $('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
$('#actual_tep_per_' + input).val(!isNaN(actual_tep_percentage) && isFinite(actual_tep_percentage) ? actual_tep_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_per >= 0) {
|
||||
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
|
||||
// $('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
$('#actual_tep_brokerage_amt_' + input).val(!isNaN(actual_tep_brokerage_amount) && isFinite(actual_tep_brokerage_amount) ? actual_tep_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
|
||||
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
|
||||
// $('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
$('#actual_tep_per_' + input).val(!isNaN(actual_tep_percentage) && isFinite(actual_tep_percentage) ? actual_tep_percentage.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
|
||||
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
|
||||
$('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
@ -1101,9 +1195,12 @@ function actualAmountCalculation(input, field = null){
|
||||
var actual_bp_brokerage_amount2 = parseFloat($('#actual_bp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tp_brokerage_amount2 = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tep_brokerage_amount2 = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
|
||||
let variance = expectedAmount - (actual_bp_brokerage_amount2 + actual_tp_brokerage_amount2 + actual_tep_brokerage_amount2)
|
||||
|
||||
$('#variance_' + input).val(variance.toFixed(2));
|
||||
// let variance = expectedAmount - (actual_bp_brokerage_amount2 + actual_tp_brokerage_amount2 + actual_tep_brokerage_amount2)
|
||||
let variance = (actual_bp_brokerage_amount2 + actual_tp_brokerage_amount2 + actual_tep_brokerage_amount2) - expectedAmount
|
||||
|
||||
// $('#variance_' + input).val(variance.toFixed(2));
|
||||
$('#variance_' + input).val(!isNaN(variance) && isFinite(variance) ? variance.toFixed(2) : '0.00');
|
||||
|
||||
// console.log('expectedAmount', expectedAmount);
|
||||
// console.log('variance', variance);
|
||||
@ -1308,13 +1405,13 @@ function addInsurerColumn() {
|
||||
newCell = `<td><input type="text" class="readonly-color right-align-input" id="total_amt_${insurerCount}" name="total[]" readonly onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 13: // Agreed BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_bp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_bp_${insurerCount}" name="agreed_bp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 14: // Agreed TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_tp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_tp_${insurerCount}" name="agreed_tp[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 15: // Agreed Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" name="agreed_ter[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="right-align-input" id="agreed_tep_${insurerCount}" name="agreed_ter[]" oninput="amountCalculation('${insurerCount}'); validateRange(this)" onkeypress="return onlyNumbers(event)" ></td>`;
|
||||
break;
|
||||
case 16: // Agreed Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="agreed_amount_${insurerCount}" name="agreed_amount[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
@ -1390,16 +1487,16 @@ function addInsurerColumn() {
|
||||
console.log('selcted client policy BAP', bap);
|
||||
|
||||
if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
|
||||
console.log('Fire, Marine Cargo, Marine Hull');
|
||||
// console.log('Fire, Marine Cargo, Marine Hull');
|
||||
$('.hideter').show();
|
||||
$('.hidetp').hide();
|
||||
}else{
|
||||
if(bap == 'Motor'){
|
||||
console.log('Motor');
|
||||
// console.log('Motor');
|
||||
$('.hidetp').show()
|
||||
$('.hideter').hide()
|
||||
}else{
|
||||
console.log('Not any thing');
|
||||
// console.log('Not any thing');
|
||||
$('.hideter').hide()
|
||||
$('.hidetp').hide()
|
||||
}
|
||||
@ -1423,7 +1520,7 @@ function addInsurerColumn() {
|
||||
const index = $(this).closest('th').index();
|
||||
removeInsurerColumn(index);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function removeInsurerColumn(index) {
|
||||
@ -1543,40 +1640,40 @@ function populateTable(dataArray, status = false) {
|
||||
cell.find('input').val(data.standerd_tep_per);
|
||||
break;
|
||||
case 20: // Actual BP Amount
|
||||
cell.find('input').val(data.actual_bp_amt);
|
||||
cell.find('input').val(status ? data.actual_bp_amt : '');
|
||||
break;
|
||||
case 21: // Actual TP Amount
|
||||
cell.find('input').val(data.actual_tp_amt);
|
||||
cell.find('input').val(status ? data.actual_tp_amt : '');
|
||||
break;
|
||||
case 22: // Actual Ter Amount
|
||||
cell.find('input').val(data.actual_tep_amt);
|
||||
cell.find('input').val(status ? data.actual_tep_amt : '');
|
||||
break;
|
||||
case 23: // Actual BP %
|
||||
cell.find('input').val(data.actual_bp_per);
|
||||
cell.find('input').val(status ? data.actual_bp_per : '');
|
||||
break;
|
||||
case 24: // Actual TP %
|
||||
cell.find('input').val(data.actual_tp_per);
|
||||
cell.find('input').val(status ? data.actual_tp_per : '');
|
||||
break;
|
||||
case 25: // Actual Ter %
|
||||
cell.find('input').val(data.actual_tep_per);
|
||||
cell.find('input').val(status ? data.actual_tep_per : '');
|
||||
break;
|
||||
case 26: // Actual BP Brokerage Amount
|
||||
cell.find('input').val(data.actual_bp_brokerage_amt);
|
||||
cell.find('input').val(status ? data.actual_bp_brokerage_amt : '');
|
||||
break;
|
||||
case 27: // Actual TP Brokerage Amount
|
||||
cell.find('input').val(data.actual_tp_brokerage_amt);
|
||||
cell.find('input').val(status ? data.actual_tp_brokerage_amt : '');
|
||||
break;
|
||||
case 28: // Actual Ter Brokerage Amount
|
||||
cell.find('input').val(data.actual_tep_brokerage_amt);
|
||||
cell.find('input').val(status ? data.actual_tep_brokerage_amt : '');
|
||||
break;
|
||||
case 29: // Expected Amount
|
||||
cell.find('input').val(data.exp_amt);
|
||||
cell.find('input').val(status ? data.exp_amt : '');
|
||||
break;
|
||||
case 30: // Variance
|
||||
cell.find('input').val(data.variance);
|
||||
cell.find('input').val(status ? data.variance : '');
|
||||
break;
|
||||
case 31: // Reward
|
||||
cell.find('input').val(data.reward);
|
||||
cell.find('input').val(status ? data.reward : '');
|
||||
break;
|
||||
case 32: // Co-share ID (hidden field)
|
||||
cell.find('input[type="hidden"]').val(status ? data.id : '');
|
||||
|
||||
@ -307,9 +307,21 @@ table.dataTable thead th {
|
||||
|
||||
var data_received_date = flatpickr("#data_received_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
allowInput: false,
|
||||
parseDate: (datestr, format) => {
|
||||
return new Date(datestr.replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3"));
|
||||
},
|
||||
onOpen: function(selectedDates, dateStr, instance) {
|
||||
instance.setDate(instance.input.value, false);
|
||||
},
|
||||
onInput: function(selectedDates, dateStr, instance) {
|
||||
let inputValue = instance.input.value;
|
||||
let formattedDate = inputValue.replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3");
|
||||
instance.input.value = formattedDate;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var closure_date = flatpickr("#closure_date", {
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
|
||||
@ -1644,6 +1644,8 @@ function amountCalculation(input) {
|
||||
let standard_tp_per = parseFloat($('#standard_tp_' + input).val()) || 0;
|
||||
let standard_tep_per = parseFloat($('#standard_tep_' + input).val()) || 0;
|
||||
|
||||
console.log(standard_bp_per, standard_tp_per, standard_tep_per);
|
||||
|
||||
// Calculate GST percentage
|
||||
let gst_per = igst;
|
||||
if (igst === 0) {
|
||||
@ -1654,39 +1656,61 @@ function amountCalculation(input) {
|
||||
let tpTotal = bp + tp + tep + cop;
|
||||
|
||||
let gst_per_amt = (tpTotal * gst_per) / 100;
|
||||
$('#gst_amount_' + input).val(gst_per_amt.toFixed(2));
|
||||
// $('#gst_amount_' + input).val(gst_per_amt.toFixed(2));
|
||||
$('#gst_amount_' + input).val(!isNaN(gst_per_amt) && isFinite(gst_per_amt) ? gst_per_amt.toFixed(2) : '0.00');
|
||||
|
||||
|
||||
let finalTotal = tpTotal + gst_per_amt + stamp_duty_amt;
|
||||
|
||||
// console.log('Summed Amount:', finalTotal);
|
||||
// $('#total_amt_' + input).val(finalTotal.toFixed(2));
|
||||
$('#total_amt_' + input).val(!isNaN(finalTotal) && isFinite(finalTotal) ? finalTotal.toFixed(2) : '0.00');
|
||||
|
||||
$('#total_amt_' + input).val(finalTotal.toFixed(2));
|
||||
|
||||
let sum_of_agreed_premium = agreed_bp_per + agreed_tp_per + agreed_tep_per;
|
||||
console.log('sum_of_agreed_precentage : ', sum_of_agreed_premium);
|
||||
|
||||
var expectedAmount = 0;
|
||||
|
||||
if(agreed_amount > 0 ){
|
||||
expectedAmount = agreed_amount;
|
||||
console.log('Formula 1 AGREED AMOUNT');
|
||||
}else if(sum_of_agreed_premium > 0){
|
||||
expectedAmount = ((bp + cop) * agreed_bp_per)+ ((tp + tep)*(agreed_tp_per + agreed_tep_per));
|
||||
expectedAmount = expectedAmount / 100;
|
||||
console.log('Formula 2 AGREED BP TP/TEP %');
|
||||
}else{
|
||||
expectedAmount = ((bp + cop) * standard_bp_per)+ ((tp + tep)*(standard_tp_per + standard_tep_per));
|
||||
console.log(expectedAmount)
|
||||
expectedAmount = expectedAmount / 100;
|
||||
console.log('Formula 3 STANDARD BP TP/TEP %');
|
||||
}
|
||||
|
||||
// console.log('expectedAmount', expectedAmount);
|
||||
console.log('expectedAmount', expectedAmount);
|
||||
|
||||
//Expected Amount
|
||||
$('#exp_amt_' + input).val(expectedAmount.toFixed(2));
|
||||
// $('#exp_amt_' + input).val(expectedAmount.toFixed(2));
|
||||
$('#exp_amt_' + input).val(!isNaN(expectedAmount) && isFinite(expectedAmount) ? expectedAmount.toFixed(2) : '0.00');
|
||||
|
||||
let actual_bp_brokerage_amount = $('#actual_bp_brokerage_amt_' + input).val();
|
||||
let actual_tp_brokerage_amount = $('#actual_tp_brokerage_amt_' + input).val();
|
||||
let actual_tep_brokerage_amount = $('#actual_tep_brokerage_amt_' + input).val();
|
||||
|
||||
let variance = expectedAmount - (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount)
|
||||
let actual_bp_brokerage_amount = parseFloat($('#actual_bp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tp_brokerage_amount = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tep_brokerage_amount = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
|
||||
|
||||
console.log('actual_bp_brokerage_amount', actual_bp_brokerage_amount);
|
||||
console.log('actual_tp_brokerage_amount', actual_tp_brokerage_amount);
|
||||
console.log('actual_tep_brokerage_amount', actual_tep_brokerage_amount);
|
||||
|
||||
|
||||
|
||||
// let variance = expectedAmount - (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount)
|
||||
let variance = (actual_bp_brokerage_amount + actual_tp_brokerage_amount + actual_tep_brokerage_amount) - expectedAmount;
|
||||
console.log('variance', variance);
|
||||
|
||||
|
||||
// $('#variance_' + input).val(variance.toFixed(2));
|
||||
$('#variance_' + input).val(!isNaN(variance) && isFinite(variance) ? variance.toFixed(2) : '0.00');
|
||||
|
||||
$('#variance_' + input).val(variance.toFixed(2));
|
||||
// console.log('variance', variance);
|
||||
}
|
||||
|
||||
@ -1696,16 +1720,19 @@ function actualAmountCalculation(input, field = null){
|
||||
console.log('actualAmountCalculation function input', input)
|
||||
console.log('actualAmountCalculation function field', field)
|
||||
|
||||
let selectedOption = $('#policy_type_id').find('option:selected');
|
||||
let selectedOption = $('#client_policy_id').find('option:selected');
|
||||
let bap = selectedOption.data('bap');
|
||||
|
||||
console.log('actualAmountCalculation function bap', bap)
|
||||
|
||||
let actual_bp_amt = parseFloat($('#actual_bp_amt_' + input).val()) || 0;
|
||||
let actual_tp_amt = parseFloat($('#actual_tp_amt_' + input).val()) || 0;
|
||||
let actual_tep_amt = parseFloat($('#actual_tep_amt_' + input).val()) || 0;
|
||||
|
||||
let actual_bp_per = parseFloat($('#actual_bp_per_' + input).val()) || 0;
|
||||
let actual_tp_per = parseFloat($('#actual_tp_per_' + input).val()) || 0;
|
||||
let actual_tep_per = parseFloat($('#actual_tep_per_' + input).val()) || 0;
|
||||
|
||||
let actual_bp_brokerage_amt = parseFloat($('#actual_bp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tp_brokerage_amt = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tep_brokerage_amt = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
|
||||
@ -1716,24 +1743,49 @@ function actualAmountCalculation(input, field = null){
|
||||
console.log()
|
||||
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
|
||||
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
|
||||
$('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
// $('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
$('#actual_bp_brokerage_amt_' + input).val(!isNaN(actual_bp_brokerage_amount) && isFinite(actual_bp_brokerage_amount) ? actual_bp_brokerage_amount.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
} else if (field === 'bp_broker_amt') {
|
||||
// If brokerage amount is changed, update percentage
|
||||
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
|
||||
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
|
||||
$('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
// $('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
$('#actual_bp_per_' + input).val(!isNaN(actual_bp_percentage) && isFinite(actual_bp_percentage) ? actual_bp_percentage.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
} else if (field === 'bp_amt_for_calc') {
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
|
||||
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
|
||||
$('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
}
|
||||
if(actual_bp_per > 0){
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
|
||||
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
|
||||
$('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
|
||||
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
|
||||
// $('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
$('#actual_bp_brokerage_amt_' + input).val(!isNaN(actual_bp_brokerage_amount) && isFinite(actual_bp_brokerage_amount) ? actual_bp_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
}else if(actual_bp_brokerage_amt > 0){
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
|
||||
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
|
||||
// $('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
$('#actual_bp_per_' + input).val(!isNaN(actual_bp_percentage) && isFinite(actual_bp_percentage) ? actual_bp_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_per >= 0) {
|
||||
let actual_bp_brokerage_amount = (actual_bp_amt * actual_bp_per) / 100;
|
||||
// $('#actual_bp_brokerage_amt_' + input).val(actual_bp_brokerage_amount.toFixed(2));
|
||||
$('#actual_bp_brokerage_amt_' + input).val(!isNaN(actual_bp_brokerage_amount) && isFinite(actual_bp_brokerage_amount) ? actual_bp_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
if (actual_bp_amt > 0 && actual_bp_brokerage_amt >= 0) {
|
||||
let actual_bp_percentage = (actual_bp_brokerage_amt / actual_bp_amt) * 100;
|
||||
// $('#actual_bp_per_' + input).val(actual_bp_percentage.toFixed(2));
|
||||
$('#actual_bp_per_' + input).val(!isNaN(actual_bp_percentage) && isFinite(actual_bp_percentage) ? actual_bp_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1744,24 +1796,48 @@ function actualAmountCalculation(input, field = null){
|
||||
if (field === 'tp_per') {
|
||||
if (actual_tp_amt > 0 && actual_tp_per >= 0) {
|
||||
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
|
||||
$('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
// $('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
$('#actual_tp_brokerage_amt_' + input).val(!isNaN(actual_tp_brokerage_amount) && isFinite(actual_tp_brokerage_amount) ? actual_tp_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
} else if (field === 'tp_broker_amt') {
|
||||
// If brokerage amount is changed, update percentage
|
||||
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
|
||||
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
|
||||
$('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
// $('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
$('#actual_tp_per_' + input).val(!isNaN(actual_tp_percentage) && isFinite(actual_tp_percentage) ? actual_tp_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
} else if (field === 'tp_amt_for_calc') {
|
||||
|
||||
if (actual_tp_amt > 0 && actual_tp_per >= 0) {
|
||||
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
|
||||
$('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
}
|
||||
if(actual_tp_amt > 0){
|
||||
|
||||
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
|
||||
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
|
||||
$('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
if (actual_tp_amt > 0 && actual_tp_per >= 0) {
|
||||
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
|
||||
// $('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
$('#actual_tp_brokerage_amt_' + input).val(!isNaN(actual_tp_brokerage_amount) && isFinite(actual_tp_brokerage_amount) ? actual_tp_brokerage_amount.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
|
||||
}else if(actual_tp_brokerage_amt > 0){
|
||||
|
||||
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
|
||||
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
|
||||
// $('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
$('#actual_tp_per_' + input).val(!isNaN(actual_tp_percentage) && isFinite(actual_tp_percentage) ? actual_tp_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
}else{
|
||||
if (actual_tp_amt > 0 && actual_tp_per >= 0) {
|
||||
let actual_tp_brokerage_amount = (actual_tp_amt * actual_tp_per) / 100;
|
||||
// $('#actual_tp_brokerage_amt_' + input).val(actual_tp_brokerage_amount.toFixed(2));
|
||||
$('#actual_tp_brokerage_amt_' + input).val(!isNaN(actual_tp_brokerage_amount) && isFinite(actual_tp_brokerage_amount) ? actual_tp_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
if (actual_tp_amt > 0 && actual_tp_brokerage_amt >= 0) {
|
||||
let actual_tp_percentage = (actual_tp_brokerage_amt / actual_tp_amt) * 100;
|
||||
// $('#actual_tp_per_' + input).val(actual_tp_percentage.toFixed(2));
|
||||
$('#actual_tp_per_' + input).val(!isNaN(actual_tp_percentage) && isFinite(actual_tp_percentage) ? actual_tp_percentage.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1779,25 +1855,53 @@ function actualAmountCalculation(input, field = null){
|
||||
if (field === 'tep_per') {
|
||||
if (actual_tep_amt > 0 && actual_tep_per >= 0) {
|
||||
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
|
||||
$('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
// $('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
$('#actual_tep_brokerage_amt_' + input).val(!isNaN(actual_tep_brokerage_amount) && isFinite(actual_tep_brokerage_amount) ? actual_tep_brokerage_amount.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
} else if (field === 'tep_broker_amt') {
|
||||
// If brokerage amount is changed, update percentage
|
||||
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
|
||||
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
|
||||
$('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
// $('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
$('#actual_tep_per_' + input).val(!isNaN(actual_tep_percentage) && isFinite(actual_tep_percentage) ? actual_tep_percentage.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
} else if (field === 'tep_amt_for_calc') {
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_per >= 0) {
|
||||
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
|
||||
$('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
if(actual_tep_amt > 0){
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_per >= 0) {
|
||||
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
|
||||
// $('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
$('#actual_tep_brokerage_amt_' + input).val(!isNaN(actual_tep_brokerage_amount) && isFinite(actual_tep_brokerage_amount) ? actual_tep_brokerage_amount.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
|
||||
}else if(actual_tep_brokerage_amt > 0){
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
|
||||
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
|
||||
// $('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
$('#actual_tep_per_' + input).val(!isNaN(actual_tep_percentage) && isFinite(actual_tep_percentage) ? actual_tep_percentage.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_per >= 0) {
|
||||
let actual_tep_brokerage_amount = (actual_tep_amt * actual_tep_per) / 100;
|
||||
// $('#actual_tep_brokerage_amt_' + input).val(actual_tep_brokerage_amount.toFixed(2));
|
||||
$('#actual_tep_brokerage_amt_' + input).val(!isNaN(actual_tep_brokerage_amount) && isFinite(actual_tep_brokerage_amount) ? actual_tep_brokerage_amount.toFixed(2) : '0.00');
|
||||
}
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
|
||||
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
|
||||
// $('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
$('#actual_tep_per_' + input).val(!isNaN(actual_tep_percentage) && isFinite(actual_tep_percentage) ? actual_tep_percentage.toFixed(2) : '0.00');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (actual_tep_amt > 0 && actual_tep_brokerage_amt >= 0) {
|
||||
let actual_tep_percentage = (actual_tep_brokerage_amt / actual_tep_amt) * 100;
|
||||
$('#actual_tep_per_' + input).val(actual_tep_percentage.toFixed(2));
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
@ -1812,12 +1916,15 @@ function actualAmountCalculation(input, field = null){
|
||||
var actual_bp_brokerage_amount2 = parseFloat($('#actual_bp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tp_brokerage_amount2 = parseFloat($('#actual_tp_brokerage_amt_' + input).val()) || 0;
|
||||
let actual_tep_brokerage_amount2 = parseFloat($('#actual_tep_brokerage_amt_' + input).val()) || 0;
|
||||
let variance = expectedAmount - (actual_bp_brokerage_amount2 + actual_tp_brokerage_amount2 + actual_tep_brokerage_amount2)
|
||||
|
||||
$('#variance_' + input).val(variance.toFixed(2));
|
||||
// let variance = expectedAmount - (actual_bp_brokerage_amount2 + actual_tp_brokerage_amount2 + actual_tep_brokerage_amount2)
|
||||
let variance = (actual_bp_brokerage_amount2 + actual_tp_brokerage_amount2 + actual_tep_brokerage_amount2) - expectedAmount
|
||||
|
||||
// $('#variance_' + input).val(variance.toFixed(2));
|
||||
$('#variance_' + input).val(!isNaN(variance) && isFinite(variance) ? variance.toFixed(2) : '0.00');
|
||||
|
||||
// console.log('expectedAmount', expectedAmount);
|
||||
// console.log('variance', variance);
|
||||
console.log('variance', variance);
|
||||
}
|
||||
|
||||
function validateRange(input) {
|
||||
@ -2946,13 +3053,13 @@ function addInsurerColumn() {
|
||||
newCell = `<td><input type="text" class="right-align-input" id="agreed_amount_${insurerCount}" name="agreed_amount[]" oninput="amountCalculation('${insurerCount}')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 18: // Standard BP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_bp[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_bp_${insurerCount}" name="standard_bp[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 19: // Standard TP %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_tp[]" onkeypress="return onlyNumbers(event)" readonly ></td>`;
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_tp_${insurerCount}" name="standard_tp[]" onkeypress="return onlyNumbers(event)" readonly ></td>`;
|
||||
break;
|
||||
case 20: // Standard Ter %
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" name="standard_ter[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
newCell = `<td class="input-with-percentage"><input type="text" class="readonly-color right-align-input" id="standard_tep_${insurerCount}" name="standard_ter[]" onkeypress="return onlyNumbers(event)" readonly></td>`;
|
||||
break;
|
||||
case 21: // Actual BP Amount
|
||||
newCell = `<td><input type="text" class="right-align-input" id="actual_bp_amt_${insurerCount}" name="actual_bp_amt[]" onchange="actualAmountCalculation('${insurerCount}', 'bp_amt_for_calc')" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user