diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index 39a0285e..bff1d34f 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -2557,6 +2557,7 @@ class ClientController extends AdminController
// $data['special_condition_label'] = str_replace(',', '', $this->request->getPost("special_condition_label")) ?? [];
// $data['special_condition_input'] = str_replace(',', '', $this->request->getPost("special_condition_input")) ?? [];
// $data['multiple_sum_insured'] = str_replace(',', '', $this->request->getPost("multiple_sum_insured")) ?? [];
+
$fields = [
'waiverofpreexistingdiseases' => false,
'waiverof1,2,3&4thyearexclusions' => false,
@@ -2611,6 +2612,8 @@ class ClientController extends AdminController
if ($value !== null && $value !== '') {
$data[$field] = $needsCleanup ? str_replace(',', '', $value) : $value;
+ }else{
+ $data[$field] = $value;
}
}
@@ -2877,6 +2880,8 @@ class ClientController extends AdminController
try {
$this->myLogger->logme('error', 'Policy GPA Terms CREATE function called');
+ // print_r($this->request->getPost()); die;
+
/*** Client Policy Table Primary Key(ID) ***/
$client_policy_id = $this->request->getPost("client_policy_id");
@@ -2948,6 +2953,8 @@ class ClientController extends AdminController
$value = $this->request->getPost($field);
if ($value !== null) {
$data[$field] = str_replace(',', '', $value);
+ }else{
+ $data[$field] = $value;
}
}
@@ -2956,6 +2963,8 @@ class ClientController extends AdminController
$value = $this->request->getPost($field);
if ($value !== null) {
$data[$field] = $value;
+ }else{
+ $data[$field] = $value;
}
}
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 9d3eeecf..6da138fd 100755
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -199,13 +199,21 @@ class EmpDataServiceController extends BaseController
$totals = round($totals, 2);
- if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
+ //check CD amt insufficient only insurer, not tpa // DO NOT REMOVE THIS
+ if($export_data['insurer_or_tpa'] == 'insurer')
{
if (!empty($cash_balance)) {
if ((int) $cash_balance['balance'] < (int) $totals) {
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
- return 0;
+ session()->set('cd_balance', false);
+ session()->set('cd_amount', $cash_balance['balance']);
+ session()->set('excel_file_amt', $totals);
+ }else{
+ session()->set('cd_balance', true);
+ session()->set('cd_amount', $cash_balance['balance']);
+ session()->set('excel_file_amt', $totals);
+
}
}
}
@@ -700,13 +708,21 @@ class EmpDataServiceController extends BaseController
// echo '
';
// print_r($ids); die;
- if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
+ //check CD amt insufficiend for only insurer, not tpa // DO NOT REMOVE THIS
+ if($export_data['insurer_or_tpa'] == 'insurer')
{
if (!empty($cash_balance)) {
if ((int) $cash_balance['balance'] < (int) $rounded_totals) {
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
- return 0;
+ session()->set('cd_balance', false);
+ session()->set('cd_amount', $cash_balance['balance']);
+ session()->set('excel_file_amt', $rounded_totals);
+ }else{
+ session()->set('cd_balance', true);
+ session()->set('cd_amount', $cash_balance['balance']);
+ session()->set('excel_file_amt', $rounded_totals);
+
}
}
}
@@ -1003,22 +1019,29 @@ class EmpDataServiceController extends BaseController
$cash_balance['balance'] = $balance['opening_bal'];
}
+ // Calculate the total amount from the objects
+ $totals = 0;
+ foreach ($inceptionData as $item) {
+ $totals = $totals + $item->total;
+ }
-
- // Calculate the total amount from the objects
- $totals = 0;
- foreach ($inceptionData as $item) {
- $totals = $totals + $item->total;
- }
$totals = round($totals, 2);
- if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
+
+ if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
{
if (!empty($cash_balance)) {
if ((int) $cash_balance['balance'] < (int) $totals) {
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
- return 0;
+ session()->set('cd_balance', false);
+ session()->set('cd_amount', $cash_balance['balance']);
+ session()->set('excel_file_amt', $totals);
+ }else{
+ session()->set('cd_balance', true);
+ session()->set('cd_amount', $cash_balance['balance']);
+ session()->set('excel_file_amt', $totals);
+
}
}
}
@@ -1359,6 +1382,8 @@ class EmpDataServiceController extends BaseController
$batch_code = $file['batch_code'];
$user_id = $file['created_by'];
+ $client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+
$insurer_or_tpa = $file['insurer_or_tpa'];
if ($insurer_or_tpa == 'tpa') {
$id = 'tpa_id';
@@ -1516,37 +1541,40 @@ class EmpDataServiceController extends BaseController
//--- TPA ID Duplicate check start ---
- $current_tpa_id = $excel_data[$key][13];
+ // Duplicate checking for only GMC's and GPA
+ if(in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])){
+ $current_tpa_id = $excel_data[$key][13];
- if (isset($tpa_id_all[$current_tpa_id])) {
+ if (isset($tpa_id_all[$current_tpa_id])) {
- // Add the current row to errors
- $errors[$key][] = [
- 'row' => $key,
- 'column' => 13,
- 'db_data' => "Duplicate TPA ID Found",
- 'excel_data' => $current_tpa_id
- ];
-
- // Add all existing rows with the same TPA ID to errors
- foreach ($tpa_id_all[$current_tpa_id] as $existing_row) {
- $errors[$existing_row][] = [
- 'row' => $existing_row,
+ // Add the current row to errors
+ $errors[$key][] = [
+ 'row' => $key,
'column' => 13,
'db_data' => "Duplicate TPA ID Found",
'excel_data' => $current_tpa_id
];
- }
+
+ // Add all existing rows with the same TPA ID to errors
+ foreach ($tpa_id_all[$current_tpa_id] as $existing_row) {
+ $errors[$existing_row][] = [
+ 'row' => $existing_row,
+ 'column' => 13,
+ 'db_data' => "Duplicate TPA ID Found",
+ 'excel_data' => $current_tpa_id
+ ];
+ }
- } else {
- if($current_tpa_id != "" && $current_tpa_id != null){
- $tpa_id_all[$current_tpa_id][] = $key;
- }
+ } else {
+ if($current_tpa_id != "" && $current_tpa_id != null){
+ $tpa_id_all[$current_tpa_id][] = $key;
+ }
+ }
}
//--- TPA ID Duplicate check end ---
- if ($insurer_or_tpa == 'tpa') {
+ if ($insurer_or_tpa == 'tpa' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
if ($excel_data[$key][13] === null) {
$missing_id[$key][] = [
@@ -1688,7 +1716,7 @@ class EmpDataServiceController extends BaseController
];
}
- if ($insurer_or_tpa == 'tpa') {
+ if ($insurer_or_tpa == 'tpa' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
if ($emp_value['uhid'] != $excel_data[$key][14]) {
$errors[$key][] = [
@@ -1699,7 +1727,7 @@ class EmpDataServiceController extends BaseController
];
}
- } else if ($insurer_or_tpa == 'insurer') {
+ } else if ($insurer_or_tpa == 'insurer' && in_array($client_policy_data['policy_type_id'], [1,2,3,4,5])) {
if ($emp_value['tpa_id'] != $excel_data[$key][13]) {
$errors[$key][] = [
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 97a71e4c..dd80cd05 100755
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -305,7 +305,8 @@ class EmployeeController extends AdminController
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
// $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
- $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
+ // $data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
+ $data['import_or_export'] = ['import' => 'Upload', 'export' => 'Download'];
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
// $data['fileList'] = $this->fileModel
diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php
index 5eabf684..ba9b2fcd 100644
--- a/app/Models/PolicyTransactionModel.php
+++ b/app/Models/PolicyTransactionModel.php
@@ -765,7 +765,12 @@ class PolicyTransactionModel extends Model
),
2
) AS unbilled_amt,
- created_user.first_name as user_name
+ created_user.first_name as user_name,
+ CASE
+ WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
+ WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
+ ELSE `policy_transaction`.`policy_no` -- Default fallback
+ END AS `policy_no`
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
@@ -986,7 +991,12 @@ class PolicyTransactionModel extends Model
pt_co_share_details.tp_amt AS tp,
clients.pan,
DATE_FORMAT(policy_transaction.created_at, '%d %b %Y %h:%i %p') AS created_at,
- user_profiles.first_name as user_name
+ user_profiles.first_name as user_name,
+ CASE
+ WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
+ WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
+ ELSE `policy_transaction`.`policy_no` -- Default fallback
+ END AS `policy_no`
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
@@ -1049,8 +1059,8 @@ class PolicyTransactionModel extends Model
// Optimize Query Execution
$builder->orderBy('policy_transaction.id', 'desc');
-
- return $builder->get()->getResultArray();
+ $data = $builder->get()->getResultArray();
+ return $data;
}
@@ -1065,7 +1075,12 @@ class PolicyTransactionModel extends Model
client_branch.branch_name as client_branch_name,
insurers.name AS insurer_name,
insurers.short_name AS insurer_short_name,
- policy_type.policy_type
+ policy_type.policy_type ,
+ CASE
+ WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
+ WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
+ ELSE `policy_transaction`.`policy_no` -- Default fallback
+ END AS `policy_no`
')
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
@@ -1228,7 +1243,12 @@ class PolicyTransactionModel extends Model
AND co_share_stmt_details.is_active = 1
),
2
- ) AS variance_amt
+ ) AS variance_amt,
+ CASE
+ WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
+ WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
+ ELSE `policy_transaction`.`policy_no` -- Default fallback
+ END AS `policy_no`
")
@@ -1317,7 +1337,6 @@ class PolicyTransactionModel extends Model
'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'
@@ -1327,7 +1346,12 @@ class PolicyTransactionModel extends Model
'pt_co_share_details.bp_amt',
'pt_co_share_details.tp_amt',
'pt_co_share_details.tep_amt',
- 'policy_transaction.status'
+ 'policy_transaction.status',
+ 'CASE
+ WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
+ WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
+ ELSE `policy_transaction`.`policy_no` -- Default fallback
+ END AS `policy_no`'
])
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
@@ -1417,7 +1441,12 @@ class PolicyTransactionModel extends Model
policy_transaction.action_type AS action_type_full,
pt_co_share_details.exp_amt,
pt_co_share_details.variance,
- policy_transaction.status
+ policy_transaction.status,
+ CASE
+ WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
+ WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
+ ELSE `policy_transaction`.`policy_no` -- Default fallback
+ END AS `policy_no`
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
@@ -1490,7 +1519,6 @@ class PolicyTransactionModel extends Model
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'
@@ -1525,7 +1553,12 @@ class PolicyTransactionModel extends Model
inv_payment_details.statement_id = insurer_statements.id
AND inv_payment_details.is_active = 1
),
- 2) AS outstanding_amount
+ 2) AS outstanding_amount,
+ CASE
+ WHEN `pt_co_share_details`.`co_share_type` IN (0, 1) THEN `policy_transaction`.`policy_no`
+ WHEN `pt_co_share_details`.`co_share_type` > 1 THEN `pt_co_share_details`.`follower_policy_no`
+ ELSE `policy_transaction`.`policy_no` -- Default fallback
+ END AS `policy_no`
")
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('insurer_statements', 'pt_co_share_details.statement_id = insurer_statements.id', 'left')
diff --git a/app/Views/batch_list.php b/app/Views/batch_list.php
index f1a623fe..c754ecc0 100755
--- a/app/Views/batch_list.php
+++ b/app/Views/batch_list.php
@@ -62,8 +62,8 @@
| - |
|
- |
- |
+ |
+ |
|
|
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index f218a241..e59e467d 100755
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -1,5 +1,26 @@
-
+
+
+
Saved
+
@@ -7,9 +28,8 @@
-
-
-
+
+
| Insurer |
Policy |
@@ -198,6 +218,7 @@
+
@@ -237,8 +258,7 @@
-
\ No newline at end of file
diff --git a/app/Views/insurer_basic_info.php b/app/Views/insurer_basic_info.php
index 524f2604..88628771 100755
--- a/app/Views/insurer_basic_info.php
+++ b/app/Views/insurer_basic_info.php
@@ -89,7 +89,7 @@ input:checked + .slider:before {
>
-
+
diff --git a/app/Views/insurer_export_templete.php b/app/Views/insurer_export_templete.php
index 1ef280c2..5a1b93ce 100755
--- a/app/Views/insurer_export_templete.php
+++ b/app/Views/insurer_export_templete.php
@@ -80,7 +80,7 @@
S.NO |
Policy Type |
Event Type |
- Import/Export |
+ Upload/Download |
Template |
Action |
@@ -92,7 +92,7 @@
= $key+1; ?> |
= $value['policy_type']; ?> |
= $events[$value['event_name']]; ?> |
- = $value['type_name']; ?> |
+ = $value['type_name'] == 'import' ? 'Upload' : 'Download'; ?> |
= $value['jsoncolumns']; ?> |
diff --git a/app/Views/insurer_onboarding.php b/app/Views/insurer_onboarding.php
index 03e9598c..bdc3fd71 100755
--- a/app/Views/insurer_onboarding.php
+++ b/app/Views/insurer_onboarding.php
@@ -33,7 +33,7 @@
- Insurer Export Templete
+ Insurer Download Templete
diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php
index 84b41062..0f05c651 100755
--- a/app/Views/insurer_or_tpa_data.php
+++ b/app/Views/insurer_or_tpa_data.php
@@ -653,10 +653,8 @@
});
-
//------------------------------------------------------------------------------------------------------
-
$('#import_excel_download').click(function() {
// Check if the element with ID "import_excel_download" has the href attribute set
@@ -682,4 +680,87 @@
}
});
+ //------------- CHECK CD BALANCE in SESSION -----------------------------------------------------------------------------------------
+
+ // Global variables
+ var submitInterval = null;
+ var messageShown = false; // Flag to prevent duplicate messages
+
+ //function for checking the session
+ function checkCDBalance() {
+
+ has('cd_balance')): ?>
+ var cdBalance = get('cd_balance')); ?>;
+ var cdAmount = get('cd_amount')); ?>;
+ var excel_file_amt = get('excel_file_amt')); ?>;
+
+ console.log("cdBalance : ", cdBalance);
+ console.log("cdAmount : ", cdAmount);
+ console.log("excel_file_amt : ", excel_file_amt);
+
+ // Only show message once and if status is false
+ if (cdBalance === false && !messageShown) {
+ // toastr.warning('Insufficient CD Balance deducated. Please wait the file will be downloaded', 'WARNING');
+ var message1 = 'Insufficient CD Balance deducted. Please wait the file will be downloaded ' +
+ ' CD Amount: ₹' + (cdAmount || 0) + ' ' +
+ ' Total Amount: ₹' + (excel_file_amt || 0);
+
+ toastr.warning(message1, 'WARNING', {
+ allowHtml: true,
+ timeOut: 10000,
+ extendedTimeOut: 3000
+ });
+ messageShown = true; // Prevent showing message again
+ stopInterval();
+ } else if (cdBalance === true) {
+ console.log("CD Balance is sufficient");
+ stopInterval();
+ }
+
+ remove('cd_balance');
+ session()->remove('cd_amount');
+ session()->remove('excel_file_amt');
+ ?>
+
+
+ console.log("No cd_balance session found");
+
+ }
+
+ // Start the interval
+ function startInterval() {
+ if (!submitInterval) {
+ messageShown = false; // Reset message flag
+ submitInterval = setInterval(function() {
+ checkCDBalance();
+ }, 2000);
+ console.log("Checking CD balance started...");
+ }
+ }
+
+ // Stop the interval
+ function stopInterval() {
+ if (submitInterval) {
+ clearInterval(submitInterval);
+ submitInterval = null;
+ remove('cd_balance');
+ session()->remove('cd_amount');
+ session()->remove('excel_file_amt');
+ ?>
+ console.log("Interval stopped.");
+ }
+ }
+
+ // When click the button to start the interval
+ $(document).ready(function() {
+ $('#emp_form_submit_button_2').on('click', function() {
+ console.log("Submit button clicked, starting interval...");
+ startInterval();
+ });
+ });
+
+ //------------------------------------------------------------------------------------------------------
+
\ No newline at end of file
diff --git a/app/Views/other_policy_terms.php b/app/Views/other_policy_terms.php
index b3caf451..9cdf9887 100755
--- a/app/Views/other_policy_terms.php
+++ b/app/Views/other_policy_terms.php
@@ -1,92 +1,94 @@
-
+
+
-
-
-
\ No newline at end of file
diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php
index e5f19539..5358566c 100755
--- a/app/Views/policy_gmc_terms.php
+++ b/app/Views/policy_gmc_terms.php
@@ -97,8 +97,6 @@
}
-
-
x
@@ -878,7 +876,6 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php
index 3dee9703..513ee345 100755
--- a/app/Views/policy_gpa_terms.php
+++ b/app/Views/policy_gpa_terms.php
@@ -1,90 +1,97 @@
-
-
-
\ No newline at end of file
diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php
index 6626d85e..53c61966 100755
--- a/app/Views/policy_grid.php
+++ b/app/Views/policy_grid.php
@@ -189,6 +189,7 @@ $(document).on('click', '.close', function() {
var rarc_rate_json_array = [];
+//Submit function
$(document).on('submit', 'form[id^="GridForm_"]', function(event) {
console.log('submitted function called')
event.preventDefault(); // Prevent the default form submission
@@ -619,8 +620,6 @@ $('body').on('click', '.btnPolicyModel', function()
$('#no_data').html('The policy has no Policy Rack Rate');
toastr.warning("The policy has no Policy Rack Rate", "Warning")
}
-
-
});
$(document).on('change', 'select[id^="grid_"]', function(event)
diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php
index 74cdf5a5..2d15e411 100644
--- a/app/Views/policy_transaction_inception_form.php
+++ b/app/Views/policy_transaction_inception_form.php
@@ -421,15 +421,15 @@
- |