CHANGE_BDS_NEW_CHANGES
This commit is contained in:
parent
847719fd92
commit
247d072e97
@ -669,14 +669,43 @@
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// // Fetch Sales Team
|
||||
// $data['salse_team'] = $this->userModel
|
||||
// ->select('user_profiles.*,nhance_branch.id as nhance_branch_id, nhance_branch.branch_name as nhance_branch_name')
|
||||
// ->join('user_teams', 'user_profiles.id = user_teams.user_id')
|
||||
// ->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id','left')
|
||||
// ->where('user_teams.team_id', 5)
|
||||
// ->where('user_teams.is_active', 1)
|
||||
// ->where('user_profiles.is_active', 1)
|
||||
// ->findAll();
|
||||
|
||||
// // Fetch Partner Agent
|
||||
// $data['partner_agent'] = db_connect()->table('partner_agent')
|
||||
// ->where('is_active', 1)
|
||||
// ->get()
|
||||
// ->getResultArray();
|
||||
|
||||
// // Fetch ACM
|
||||
// $data['ACM'] = $this->userModel
|
||||
// ->where('role', 3) // Assuming `role` is in `user_profiles`
|
||||
// ->where('is_active', 1)
|
||||
// ->findAll();
|
||||
|
||||
// Fetch Sales Team
|
||||
$data['salse_team'] = $this->userModel
|
||||
->select('user_profiles.*,nhance_branch.id as nhance_branch_id, nhance_branch.branch_name as nhance_branch_name')
|
||||
->select('
|
||||
user_profiles.*,
|
||||
nhance_branch.id as nhance_branch_id,
|
||||
nhance_branch.branch_name as nhance_branch_name,
|
||||
rm.first_name AS rm_name
|
||||
')
|
||||
->join('user_teams', 'user_profiles.id = user_teams.user_id')
|
||||
->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id','left')
|
||||
->join('user_profiles AS rm', 'user_profiles.rm_id = rm.id', 'left')
|
||||
->where('user_teams.team_id', 5)
|
||||
->where('user_teams.is_active', 1)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->groupBy('user_profiles.id', 'asc')
|
||||
->findAll();
|
||||
|
||||
// Fetch Partner Agent
|
||||
@ -687,12 +716,20 @@
|
||||
|
||||
// Fetch ACM
|
||||
$data['ACM'] = $this->userModel
|
||||
->where('role', 3) // Assuming `role` is in `user_profiles`
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
// echo '<pre>';
|
||||
->select('
|
||||
user_profiles.*,
|
||||
nhance_branch.id AS nhance_branch_id,
|
||||
nhance_branch.branch_name AS nhance_branch_name,
|
||||
rm.first_name AS rm_name
|
||||
')
|
||||
->join('user_teams', 'user_profiles.id = user_teams.user_id')
|
||||
->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id', 'left')
|
||||
->join('user_profiles AS rm', 'user_profiles.rm_id = rm.id', 'left')
|
||||
->where('user_profiles.role', 3)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->groupBy('user_profiles.id', 'asc')
|
||||
->findAll();
|
||||
|
||||
// print_r($data['ppTeamsData']); die;
|
||||
|
||||
// dd($data);
|
||||
|
||||
|
||||
@ -2572,6 +2572,7 @@
|
||||
cb.address1 AS client_address,
|
||||
ptype.policy_type,
|
||||
ptype.bap,
|
||||
ins.id AS insurer_id,
|
||||
ins.name AS insurer_name,
|
||||
ins.short_name AS insurer_short_name,
|
||||
ib.branch_name AS insurer_branch_name,
|
||||
@ -2596,7 +2597,6 @@
|
||||
ROUND(pcsd.cotp_amt + pcsd.cotep_amt, 2) AS tp_or_ter,
|
||||
DATEDIFF(pt.policy_end_date, CURDATE()) AS days,
|
||||
(pcsd.agreed_tp_per + pcsd.agreed_tep_per) AS agreed_tp_or_ter_per,
|
||||
pcsd.agreed_bp_per,
|
||||
|
||||
ROUND(pcsd.exp_amt, 2) AS total_irda_amt,
|
||||
0.00 AS reward,
|
||||
@ -2607,7 +2607,55 @@
|
||||
WHEN pcsd.co_share_type > 1 THEN
|
||||
IFNULL(NULLIF(pcsd.follower_policy_no,''), pt.policy_no)
|
||||
ELSE pt.policy_no
|
||||
END AS policy_no
|
||||
END AS policy_no,
|
||||
|
||||
CASE
|
||||
WHEN pt.co_share = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS co_share,
|
||||
|
||||
CASE
|
||||
WHEN pt.bro_payable_by = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS bro_payable_by,
|
||||
|
||||
pcsd.non_comm_per_amt,
|
||||
|
||||
pcsd.bp_igst,
|
||||
pcsd.bp_sgst,
|
||||
pcsd.bp_cgst,
|
||||
|
||||
pcsd.agreed_bp_per,
|
||||
ROUND(pcsd.agreed_tp_per + pcsd.agreed_tep_per,2) AS agreed_tp_per,
|
||||
|
||||
pcsd.standerd_bp_per,
|
||||
ROUND(pcsd.standerd_tp_per + pcsd.standerd_tep_per,2) AS standerd_tp_per,
|
||||
|
||||
0 AS actual_bp_amt,
|
||||
ROUND(0, 2) AS actual_tp_amt,
|
||||
|
||||
0 AS actual_bp_per,
|
||||
ROUND(0, 2) AS actual_tp_per,
|
||||
|
||||
0 AS actual_tep_brokerage_amt,
|
||||
ROUND(0, 2) AS actual_tp_brokerage_amt,
|
||||
|
||||
service_branch.branch_name as service_branch,
|
||||
|
||||
salse_manager.first_name as salse_manager_name,
|
||||
service_manager.first_name as service_manager_name,
|
||||
cd_master.cd_ac_no,
|
||||
pt.rollover_date,
|
||||
pt.policy_holder_name,
|
||||
|
||||
CASE
|
||||
WHEN pt.same_as_proposer = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS same_as_proposer,
|
||||
|
||||
pcsd.follower_policy_no,
|
||||
pcsd.co_share_per,
|
||||
pcsd.stamp_duty
|
||||
|
||||
FROM policy_transaction pt
|
||||
LEFT JOIN pt_co_share_details pcsd ON pt.id = pcsd.pt_id
|
||||
@ -2626,6 +2674,11 @@
|
||||
LEFT JOIN user_profiles created_user ON pt.created_by = created_user.id
|
||||
LEFT JOIN nhance_branch ON pt.issuer_branch = nhance_branch.id
|
||||
|
||||
LEFT JOIN nhance_branch service_branch ON pt.service_person_branch_id = service_branch.id
|
||||
LEFT JOIN user_profiles salse_manager ON pt.salse_person_manager_id = salse_manager.id
|
||||
LEFT JOIN user_profiles service_manager ON pt.service_person_manager_id = service_manager.id
|
||||
LEFT JOIN cd_master ON pt.cd_ac_pk = cd_master.id
|
||||
|
||||
WHERE pt.is_active = 1
|
||||
AND pcsd.is_active = 1
|
||||
$default_date_filter
|
||||
@ -2663,10 +2716,20 @@
|
||||
END AS revenue_type,
|
||||
|
||||
CASE
|
||||
WHEN pt.action_type = 'inception' THEN 'Policy'
|
||||
WHEN
|
||||
IFNULL(cssd.actual_tep_brokerage_amt, 0) = 0
|
||||
AND IFNULL(cssd.actual_tp_brokerage_amt, 0) = 0
|
||||
AND IFNULL(cssd.actual_bp_brokerage_amt, 0) = 0
|
||||
AND IFNULL(cssd.reward, 0) != 0
|
||||
THEN 'Rewards'
|
||||
|
||||
WHEN pt.action_type = 'inception'
|
||||
THEN 'Policy'
|
||||
|
||||
ELSE 'Endorsement'
|
||||
END AS action_type,
|
||||
|
||||
|
||||
pt.action_type as action_type_string,
|
||||
|
||||
c.client_name,
|
||||
@ -2675,20 +2738,13 @@
|
||||
cb.address1 AS client_address,
|
||||
ptype.policy_type,
|
||||
ptype.bap,
|
||||
ins.id AS insurer_id,
|
||||
ins.name AS insurer_name,
|
||||
ins.short_name AS insurer_short_name,
|
||||
ib.branch_name AS insurer_branch_name,
|
||||
ib.branch_code AS insurer_branch_code,
|
||||
|
||||
CASE
|
||||
WHEN
|
||||
IFNULL(cssd.actual_tep_brokerage_amt,0) = 0 AND
|
||||
IFNULL(cssd.actual_tp_brokerage_amt,0) = 0 AND
|
||||
IFNULL(cssd.actual_bp_brokerage_amt,0) = 0 AND
|
||||
IFNULL(cssd.reward,0) != 0
|
||||
THEN 'Rewards'
|
||||
ELSE created_user.first_name
|
||||
END AS user_name,
|
||||
created_user.first_name as user_name,
|
||||
|
||||
v.vehicle_no,
|
||||
tpa.name AS tpa_name,
|
||||
@ -2708,7 +2764,6 @@
|
||||
ROUND(pcsd.cotp_amt + pcsd.cotep_amt,2) AS tp_or_ter,
|
||||
DATEDIFF(pt.policy_end_date, CURDATE()) AS days,
|
||||
(pcsd.agreed_tp_per + pcsd.agreed_tep_per) AS agreed_tp_or_ter_per,
|
||||
pcsd.agreed_bp_per,
|
||||
|
||||
CASE
|
||||
WHEN insq.month = pt.month THEN pcsd.exp_amt
|
||||
@ -2747,7 +2802,55 @@
|
||||
WHEN pcsd.co_share_type > 1
|
||||
THEN IFNULL(NULLIF(pcsd.follower_policy_no,''), pt.policy_no)
|
||||
ELSE pt.policy_no
|
||||
END AS policy_no
|
||||
END AS policy_no,
|
||||
|
||||
CASE
|
||||
WHEN pt.co_share = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS co_share,
|
||||
|
||||
CASE
|
||||
WHEN pt.bro_payable_by = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS bro_payable_by,
|
||||
|
||||
pcsd.non_comm_per_amt,
|
||||
|
||||
pcsd.bp_igst,
|
||||
pcsd.bp_sgst,
|
||||
pcsd.bp_cgst,
|
||||
|
||||
pcsd.agreed_bp_per,
|
||||
ROUND(pcsd.agreed_tp_per + pcsd.agreed_tep_per,2) AS agreed_tp_per,
|
||||
|
||||
pcsd.standerd_bp_per,
|
||||
ROUND(pcsd.standerd_tp_per + pcsd.standerd_tep_per,2) AS standerd_tp_per,
|
||||
|
||||
cssd.actual_bp_amt,
|
||||
ROUND(cssd.actual_tp_amt + cssd.actual_tep_amt,2) AS actual_tp_amt,
|
||||
|
||||
cssd.actual_bp_per,
|
||||
ROUND(cssd.actual_tp_per + cssd.actual_tep_per,2) AS actual_tp_per,
|
||||
|
||||
cssd.actual_tep_brokerage_amt,
|
||||
ROUND(cssd.actual_tp_brokerage_amt + cssd.actual_bp_brokerage_amt,2) AS actual_tp_brokerage_amt,
|
||||
|
||||
service_branch.branch_name as service_branch,
|
||||
|
||||
salse_manager.first_name as salse_manager_name,
|
||||
service_manager.first_name as service_manager_name,
|
||||
cd_master.cd_ac_no,
|
||||
pt.rollover_date,
|
||||
pt.policy_holder_name,
|
||||
|
||||
CASE
|
||||
WHEN pt.same_as_proposer = 1 THEN 'Yes'
|
||||
ELSE 'No'
|
||||
END AS same_as_proposer,
|
||||
|
||||
pcsd.follower_policy_no,
|
||||
pcsd.co_share_per,
|
||||
pcsd.stamp_duty
|
||||
|
||||
FROM policy_transaction pt
|
||||
LEFT JOIN pt_co_share_details pcsd ON pt.id = pcsd.pt_id
|
||||
@ -2768,6 +2871,12 @@
|
||||
LEFT JOIN user_profiles created_user ON pt.created_by = created_user.id
|
||||
LEFT JOIN nhance_branch ON pt.issuer_branch = nhance_branch.id
|
||||
|
||||
LEFT JOIN nhance_branch service_branch ON pt.service_person_branch_id = service_branch.id
|
||||
LEFT JOIN user_profiles salse_manager ON pt.salse_person_manager_id = salse_manager.id
|
||||
LEFT JOIN user_profiles service_manager ON pt.service_person_manager_id = service_manager.id
|
||||
LEFT JOIN cd_master ON pt.cd_ac_pk = cd_master.id
|
||||
|
||||
|
||||
WHERE pt.is_active = 1
|
||||
AND pcsd.is_active = 1
|
||||
AND cssd.is_active = 1
|
||||
@ -2823,29 +2932,64 @@
|
||||
$result = array_values($filtered);
|
||||
// dd($result);
|
||||
|
||||
$runningBilled = [];
|
||||
// $runningBilled = [];
|
||||
// $totalIrdaMap = [];
|
||||
// $final = [];
|
||||
|
||||
// foreach ($result as $row) {
|
||||
// $ptId = $row['pt_id'];
|
||||
|
||||
// // Store total_irda_amt only once (first non-zero value)
|
||||
// if (!isset($totalIrdaMap[$ptId]) && $row['total_irda_amt'] > 0) {
|
||||
// $totalIrdaMap[$ptId] = $row['total_irda_amt'];
|
||||
// }
|
||||
|
||||
// // Initialize running sum
|
||||
// if (!isset($runningBilled[$ptId])) {
|
||||
// $runningBilled[$ptId] = 0;
|
||||
// }
|
||||
|
||||
// // Add billed amount to running total
|
||||
// $runningBilled[$ptId] += (float)$row['billed_amt'];
|
||||
|
||||
// // Calculate unbilled amount
|
||||
// $row['unbilled_amount'] = ($totalIrdaMap[$ptId] ?? 0) - $runningBilled[$ptId];
|
||||
|
||||
// $final[] = $row;
|
||||
// }
|
||||
|
||||
$totalBilled = [];
|
||||
$totalIrdaMap = [];
|
||||
$final = [];
|
||||
|
||||
foreach ($result as $row) {
|
||||
$ptId = $row['pt_id'];
|
||||
$key = $row['pt_id'].'-'.$row['insurer_id'];
|
||||
|
||||
// Store total_irda_amt only once (first non-zero value)
|
||||
if (!isset($totalIrdaMap[$ptId]) && $row['total_irda_amt'] > 0) {
|
||||
$totalIrdaMap[$ptId] = $row['total_irda_amt'];
|
||||
// Sum billed amount
|
||||
$totalBilled[$key] = ($totalBilled[$key] ?? 0)
|
||||
+ (float) ($row['billed_amt'] ?? 0);
|
||||
|
||||
// Store total_irda_amt once
|
||||
if (!isset($totalIrdaMap[$key]) && ($row['total_irda_amt'] ?? 0) > 0) {
|
||||
$totalIrdaMap[$key] = (float) $row['total_irda_amt'];
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize running sum
|
||||
if (!isset($runningBilled[$ptId])) {
|
||||
$runningBilled[$ptId] = 0;
|
||||
|
||||
$ptSeen = [];
|
||||
$final = [];
|
||||
|
||||
foreach ($result as $row) {
|
||||
$ptId = $row['pt_id'].'-'.$row['insurer_id'];
|
||||
if (!isset($ptSeen[$ptId])) {
|
||||
// First entry → set unbilled amount
|
||||
$row['unbilled_amount'] = ($totalIrdaMap[$ptId] ?? 0) - ($totalBilled[$ptId] ?? 0);
|
||||
|
||||
$ptSeen[$ptId] = true;
|
||||
} else {
|
||||
// Other entries → zero
|
||||
$row['unbilled_amount'] = 0;
|
||||
}
|
||||
|
||||
// Add billed amount to running total
|
||||
$runningBilled[$ptId] += (float)$row['billed_amt'];
|
||||
|
||||
// Calculate unbilled amount
|
||||
$row['unbilled_amount'] = ($totalIrdaMap[$ptId] ?? 0) - $runningBilled[$ptId] ;
|
||||
|
||||
$final[] = $row;
|
||||
}
|
||||
|
||||
|
||||
@ -325,6 +325,10 @@
|
||||
<input type="hidden" name="issuer" id="issuer" value="2">
|
||||
<input type="hidden" name="base_cd_amount" id="base_cd_amount">
|
||||
<input type="hidden" name="cd_amt_changed" id="cd_amt_changed" disabled>
|
||||
<input type="hidden" name="salse_person_manager_id" id="salse_person_manager_id">
|
||||
<input type="hidden" name="service_person_manager_id" id="service_person_manager_id">
|
||||
<input type="hidden" name="service_person_branch_id" id="service_person_branch_id">
|
||||
<input type="hidden" name="issuer_branch" id="issuer_branch">
|
||||
|
||||
<!-- <input type="hidden" id="cd_ac_no_for_edit"> -->
|
||||
<input type="hidden" id="premium_details_unique_id">
|
||||
@ -420,7 +424,7 @@
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="client_branch">Nhance Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="issuer_branch" name="issuer_branch" required>
|
||||
<option value="">Select Nhance Branch</option>
|
||||
@ -432,7 +436,8 @@
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -779,7 +784,7 @@
|
||||
name="renewal_date" placeholder="DD/MM/YYYY">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="sales_generated_by">Sales Generated By</label>
|
||||
<select class="form-control" id="sales_generated_by" name="sales_generated_by">
|
||||
<option value="" selected>Select Sales Person</option>
|
||||
@ -805,6 +810,65 @@
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="sales_generated_by" class="d-flex align-items-center">
|
||||
<span class="flex-grow-1">Sales Generated By</span>
|
||||
<small id="nhance_branch_info"
|
||||
class="text-right"
|
||||
style="font-size: x-small;">
|
||||
</small>
|
||||
<small id="salse_rm_info"
|
||||
class="text-right"
|
||||
style="font-size: x-small;">
|
||||
</small>
|
||||
</label>
|
||||
<select class="form-control" id="sales_generated_by" name="sales_generated_by" onchange="setNhanceBranch(this, 'nhance_branch_info'); setRM(this, 'salse_rm_info')" autocomplete="off">
|
||||
<option value="" selected>Select Sales Person</option>
|
||||
<?php if (isset($salse_team)) { ?>
|
||||
<?php foreach ($salse_team as $value) { ?>
|
||||
<option value="<?= $value['id'];?>"
|
||||
data-nbid="<?= $value['nhance_branch_id'];?>"
|
||||
data-nbname="<?= $value['nhance_branch_name'];?>"
|
||||
data-rmid="<?= $value['rm_id'];?>"
|
||||
data-rmname="<?= $value['rm_name'];?>"
|
||||
>
|
||||
<?= $value['first_name'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="serviced_by" class="d-flex align-items-center" >
|
||||
<span class="flex-grow-1">Serviced By</span>
|
||||
<small id="service_nhance_branch_info"
|
||||
class="text-right"
|
||||
style="font-size: x-small;">
|
||||
</small>
|
||||
<small id="service_rm_info"
|
||||
class="text-right"
|
||||
style="font-size: x-small;">
|
||||
</small>
|
||||
</label>
|
||||
<select class="form-control" id="serviced_by" name="serviced_by" onchange="setNhanceBranch(this, 'service_nhance_branch_info'); setRM(this, 'service_rm_info')">
|
||||
<option value="" selected>Select Service Person</option>
|
||||
<?php if (isset($ACM)) { ?>
|
||||
<?php foreach ($ACM as $value) { ?>
|
||||
<option value="<?= $value['id'];?>"
|
||||
data-nbid="<?= $value['nhance_branch_id'];?>"
|
||||
data-nbname="<?= $value['nhance_branch_name'];?>"
|
||||
data-rmid="<?= $value['rm_id'];?>"
|
||||
data-rmname="<?= $value['rm_name'];?>"
|
||||
>
|
||||
<?= $value['first_name'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -6422,8 +6486,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function generateShortName() {
|
||||
let clientInput = $("#client_name");
|
||||
let shortInput = $("#short_name");
|
||||
@ -6593,4 +6655,76 @@
|
||||
}
|
||||
}
|
||||
|
||||
function setNhanceBranch(select, show_id) {
|
||||
|
||||
if (!select || !select.options || select.selectedIndex < 0) {
|
||||
console.warn('No option selected yet');
|
||||
return;
|
||||
}
|
||||
|
||||
let selectedOption = select.options[select.selectedIndex];
|
||||
|
||||
let nbID = selectedOption.getAttribute('data-nbid');
|
||||
let nbName = selectedOption.getAttribute('data-nbname');
|
||||
|
||||
console.log('NB ID:', nbID);
|
||||
console.log('NB Name:', nbName);
|
||||
|
||||
if(show_id == "nhance_branch_info"){
|
||||
$('#issuer_branch').val(nbID ? nbID : '');
|
||||
}else{
|
||||
$('#service_person_branch_id').val(nbID ? nbID : '');
|
||||
}
|
||||
|
||||
let nbDiv = document.getElementById(show_id);
|
||||
|
||||
if (!nbID || !nbName) {
|
||||
nbDiv.innerHTML = '';
|
||||
nbDiv.classList.remove('show');
|
||||
return;
|
||||
}
|
||||
|
||||
nbDiv.innerHTML =
|
||||
'<span class="text-success">' + nbName + '</span>' +
|
||||
' <span class="vehicle-badge success">✓ Nhance Branch</span>';
|
||||
|
||||
nbDiv.classList.add('show');
|
||||
}
|
||||
|
||||
function setRM(select, show_id) {
|
||||
|
||||
if (!select || !select.options || select.selectedIndex < 0) {
|
||||
console.warn('No option selected yet');
|
||||
return;
|
||||
}
|
||||
|
||||
let selectedOption = select.options[select.selectedIndex];
|
||||
|
||||
let rmid = selectedOption.getAttribute('data-rmid');
|
||||
let rmname = selectedOption.getAttribute('data-rmname');
|
||||
|
||||
console.log('RM ID:', rmid);
|
||||
console.log('RM Name:', rmname);
|
||||
|
||||
if(show_id == "salse_rm_info"){
|
||||
$('#salse_person_manager_id').val(rmid ? rmid : '');
|
||||
}else{
|
||||
$('#service_person_manager_id').val(rmid ? rmid : '');
|
||||
}
|
||||
|
||||
let rmDiv = document.getElementById(show_id);
|
||||
|
||||
if (!rmid || !rmname) {
|
||||
rmDiv.innerHTML = '';
|
||||
rmDiv.classList.remove('show');
|
||||
return;
|
||||
}
|
||||
|
||||
rmDiv.innerHTML =
|
||||
'<span class="text-success">' + rmname + '</span>' +
|
||||
' <span class="vehicle-badge success">✓ RM</span>';
|
||||
|
||||
rmDiv.classList.add('show');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -54,11 +54,15 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
Total Rewards: <span class="text-primary" id="total_rewards">0.00</span>
|
||||
IRDA Amount : <span class="text-primary" id="total_irda">0.00</span>
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
Total IRDA Revenue INR: <span class="text-primary" id="total_irda">0.00</span>
|
||||
Rewards: <span class="text-primary" id="total_rewards">0.00</span>
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
Revenue: <span class="text-primary" id="total_revenue">0.00</span>
|
||||
</div>
|
||||
|
||||
<div class="badge-container">
|
||||
@ -84,7 +88,7 @@ table.dataTable tbody td {
|
||||
<th style="display: none;">Business Type</th>
|
||||
<th style="display: none;">Client Type</th>
|
||||
<th>Insured Name</th>
|
||||
<th style="text-align:center;">Policy /<br>Endorsement</th>
|
||||
<th style="text-align:center;">Transaction Type</th>
|
||||
<th>Policy Type</th>
|
||||
<th style="display: none;">BAP Group</th>
|
||||
<th style="display: none;">Vehicle Number</th>
|
||||
@ -99,23 +103,60 @@ table.dataTable tbody td {
|
||||
<th style="display: none;">Reference</th>
|
||||
<th style="display: none;">Remarks</th>
|
||||
<th>BP Premium</th>
|
||||
<th>TP/Ter Premium</th>
|
||||
<th>TP Premium</th>
|
||||
<th style="text-align:center;">Premium <br>(without GST)</th>
|
||||
<!-- <th style="display: none;">GST @ 18%</th> -->
|
||||
<th style="display: none;">Total Premium</th>
|
||||
<th>BP%</th>
|
||||
<th>TP/Ter%</th>
|
||||
<th>Agreed BP %</th>
|
||||
<th>Agreed TP %</th>
|
||||
<th style="display: none;">Rewards</th>
|
||||
<th>Agreed Amount</th>
|
||||
<th>Invoiced Amount</th>
|
||||
<th>Outstanding Amount</th>
|
||||
|
||||
<th style="display: none;">Salse Person</th>
|
||||
<th style="display: none;">Service Person</th>
|
||||
<th style="display: none;">Nhance Branch</th>
|
||||
<th style="display: none;">Salse Person Branch</th>
|
||||
<th style="display: none;">Installment</th>
|
||||
<th style="display: none;">Data Received Date</th>
|
||||
<th style="display: none;">Renewal Date</th>
|
||||
|
||||
|
||||
<th style="display: none;">Co-Premium</th>
|
||||
<th style="display: none;">Remuneration Pay By Leader</th>
|
||||
|
||||
<th style="display: none;">Salse Person Manager</th>
|
||||
<th style="display: none;">Service Person Manager</th>
|
||||
<th style="display: none;">Service Person Branch</th>
|
||||
|
||||
<th style="display: none;">Rollover Date</th>
|
||||
|
||||
<th style="display: none;">Policyholder Name</th>
|
||||
<th style="display: none;">Insured (Same as Proposer)</th>
|
||||
|
||||
<th style="display: none;">Follower Policy No</th>
|
||||
|
||||
<th style="display: none;">Co-Share %</th>
|
||||
<th style="display: none;">Non Commissional <br> Premium Amount</th>
|
||||
|
||||
<th style="display: none;">CGST</th>
|
||||
<th style="display: none;">SGST</th>
|
||||
<th style="display: none;">IGST</th>
|
||||
|
||||
<th style="display: none;">Stamp Duty</th>
|
||||
|
||||
<th style="display: none;">Standard BP %</th>
|
||||
<th style="display: none;">Standard TP %</th>
|
||||
|
||||
<th style="display: none;">Actual BP Amount</th>
|
||||
<th style="display: none;">Actual TP Amount</th>
|
||||
|
||||
<th style="display: none;">Actual BP %</th>
|
||||
<th style="display: none;">Actual TP %</th>
|
||||
|
||||
<th style="display: none;">Actual BP Remuneration Amount</th>
|
||||
<th style="display: none;">Actual TP Remuneration Amount</th>
|
||||
|
||||
<th style="display: none;">CD Account No</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -148,13 +189,14 @@ table.dataTable tbody td {
|
||||
<td style="display: none;"><?php echo empty($row['policy_end_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||
<td style="display: none;"><?php echo $row['ref'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['remarks'] ?: 'N/A'; ?></td>
|
||||
|
||||
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['bp_amt'] ?: '0.00') : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['tp_or_ter'] ?: '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['tp_or_ter'] ?: '0.00') : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['premium_wo_gst'] ?: '0.00') : '0.00'; ?></td>
|
||||
<!-- <td class="right-align-input" style="display: none;"><?php echo $row['gst_amount']; ?></td> -->
|
||||
<td class="right-align-input" style="display: none;"><?php echo $row['total_premium'] ?: '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per'] ?: '0.00'; ?>%</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'] ?: '0.00';?>%</td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['total_premium'] ?: '0.00') : '0.00'; ?></td>
|
||||
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['agreed_bp_per'] ?: '0.00') : '0.00'; ?>%</td>
|
||||
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['agreed_tp_or_ter_per'] ?: '0.00') : '0.00'; ?>%</td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
|
||||
<?php
|
||||
@ -189,7 +231,9 @@ table.dataTable tbody td {
|
||||
<td class="right-align-input">
|
||||
<?php echo
|
||||
// number_format((float)$unbilled_amt,2, '.', '')
|
||||
number_format((float)$row['unbilled_amount'],2, '.', '');
|
||||
// number_format((float) ($row['unbilled_amount'] ?: 0), 2, '.', '');
|
||||
$unbilled = isset($row['unbilled_amount']) ? (float)$row['unbilled_amount'] : 0;
|
||||
number_format($unbilled, 2, '.', '');
|
||||
?>
|
||||
</td>
|
||||
<td style="display: none;"><?php echo $row['salse_person_name'] ?: 'N/A'; ?></td>
|
||||
@ -198,6 +242,44 @@ table.dataTable tbody td {
|
||||
<td style="display: none;"><?php echo $row['installment'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo empty($row['data_received_date']) ? 'N/A' : date('d/m/Y', strtotime($row['data_received_date'])) ?></td>
|
||||
<td style="display: none;"><?php echo empty($row['renewal_date']) ? 'N/A' : date('d/m/Y', strtotime($row['renewal_date'])) ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo $row['co_share'] ?? 'No'; ?></td>
|
||||
<td style="display:none;"><?php echo $row['bro_payable_by'] ?? 'No'; ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo $row['salse_manager_name'] ?: 'N/A'; ?></td>
|
||||
<td style="display:none;"><?php echo $row['service_manager_name'] ?: 'N/A'; ?></td>
|
||||
<td style="display:none;"><?php echo $row['service_branch'] ?: 'N/A'; ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo empty($row['rollover_date']) ? 'N/A' : change_date_format($row['rollover_date'], 'Y-m-d', 'd/m/Y') ?? 'N/A'; ?> </td>
|
||||
|
||||
<td style="display:none;"><?php echo $row['policy_holder_name'] ?: 'N/A'; ?></td>
|
||||
<td style="display:none;"><?php echo $row['same_as_proposer'] ?? 'No'; ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo $row['follower_policy_no'] ?: 'N/A'; ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo number_format((float)($row['co_share_per'] ?? 0), 2); ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo number_format((float)($row['non_comm_per_amt'] ?? 0), 2); ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo number_format((float)($row['bp_igst'] ?? 0), 2); ?></td>
|
||||
<td style="display:none;"><?php echo number_format((float)($row['bp_sgst'] ?? 0), 2); ?></td>
|
||||
<td style="display:none;"><?php echo number_format((float)($row['bp_cgst'] ?? 0), 2); ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo number_format((float)($row['stamp_duty'] ?? 0), 2); ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo number_format((float)($row['standerd_bp_per'] ?? 0), 2); ?></td>
|
||||
<td style="display:none;"><?php echo number_format((float)($row['standerd_tp_per'] ?? 0), 2); ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo number_format((float)($row['actual_bp_amt'] ?? 0), 2); ?></td>
|
||||
<td style="display:none;"><?php echo number_format((float)($row['actual_tp_amt'] ?? 0), 2); ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo number_format((float)($row['actual_bp_per'] ?? 0), 2); ?></td>
|
||||
<td style="display:none;"><?php echo number_format((float)($row['actual_tp_per'] ?? 0), 2); ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo number_format((float)($row['actual_tep_brokerage_amt'] ?? 0), 2); ?></td>
|
||||
<td style="display:none;"><?php echo number_format((float)($row['actual_tp_brokerage_amt'] ?? 0), 2); ?></td>
|
||||
|
||||
<td style="display:none;"><?php echo $row['cd_ac_no'] ?: 'N/A'; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
@ -602,12 +684,14 @@ $(document).ready(function() {
|
||||
var totalRewards = getTotal(24);
|
||||
var totalIrda = getTotal(25);
|
||||
var totalBilled = getTotal(26);
|
||||
var totalRevenue = parseFloat(totalIrda) + parseFloat(totalRewards);
|
||||
// var totalUnbilled = getTotal(27);
|
||||
|
||||
// Update the totals section above the table
|
||||
$('#total_premium').text(totalPremium.toFixed(2));
|
||||
$('#total_rewards').text(totalRewards.toFixed(2));
|
||||
$('#total_irda').text(totalIrda.toFixed(2));
|
||||
$('#total_revenue').text(totalRevenue.toFixed(2));
|
||||
$('#total_billed').text(totalBilled.toFixed(2));
|
||||
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||
var totalUnbilled = getUniqueUnbilled(27);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user