diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 69f19725..9ece093c 100644
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -578,6 +578,7 @@ class EmpDataServiceController extends BaseController
$file = $this->batchFileModel->where('id', $file_id)->first();
$client_id = $file['client_id'];
$client_policy_id = $file['client_policy_id'];
+ $client_branch_id = $file['client_branch_id'];
$batch_code = $file['batch_code'];
@@ -626,6 +627,7 @@ class EmpDataServiceController extends BaseController
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
->findAll();
@@ -976,6 +978,7 @@ class EmpDataServiceController extends BaseController
$client_id = $file['client_id'];
$client_policy_id = $file['client_policy_id'];
+ $client_branch_id = $file['client_branch_id'];
$insurer_or_tpa = $file['insurer_or_tpa'];
$status = $file['status'];
$batch_code = $file['batch_code'];
@@ -1031,6 +1034,7 @@ class EmpDataServiceController extends BaseController
$query->join('employees', 'employees.id = employee_polices.employee_id');
$query->where('employee_polices.client_policy_id', $client_policy_id);
$query->where('employees.client_id', $client_id);
+ $query->where('employees.client_branch_id', $client_branch_id);
$query->where('employees.name', $name);
$query->where('employees.emp_code', $emp_code);
if ($file['insurer_or_tpa'] == 'tpa') {
@@ -1103,6 +1107,7 @@ class EmpDataServiceController extends BaseController
'employeeIds' => $emp_policy_ids,
'client_id' => $client_id,
'client_policy_id' => $client_policy_id,
+ 'client_branch_id' => $client_branch_id,
'count' => $emp_count,
'event' => $file['event_type'],
'policy_name' => $policy_name['policy_name'],
@@ -1116,6 +1121,7 @@ class EmpDataServiceController extends BaseController
'employeeIds' => $emp_policy_ids,
'client_id' => $client_id,
'client_policy_id' => $client_policy_id,
+ 'client_branch_id' => $client_branch_id,
'count' => $emp_count,
'event' => $file['event_type'],
'policy_name' => $policy_name['policy_name'],
@@ -1152,6 +1158,7 @@ class EmpDataServiceController extends BaseController
$client_id = $import_data['client_id'];
$client_policy_id = $import_data['client_policy_id'];
+ $client_branch_id = $import_data['client_branch_id'];
$file = $import_data['file'];
$data = $this->readExcelToArray($file);
@@ -1181,6 +1188,7 @@ class EmpDataServiceController extends BaseController
->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('employee_polices.uhid', $uhid)
->where('employees.emp_code', $emp_code)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
@@ -1211,10 +1219,6 @@ class EmpDataServiceController extends BaseController
return 2;
}
- // if($empty_emp_tpa_uh_ids != $count){
-
- // return 3;
- // }
if ($empty_id_count == 0) {
@@ -1265,6 +1269,7 @@ class EmpDataServiceController extends BaseController
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('employee_polices.uhid', $uhid)
->where('employees.emp_code', $emp_code)
->where('employees.is_active', 1)
@@ -1280,6 +1285,7 @@ class EmpDataServiceController extends BaseController
->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('employees.emp_code', $emp_code)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.uhid', $uhid)
->get()
@@ -1319,6 +1325,7 @@ class EmpDataServiceController extends BaseController
$client_id = $import_data['client_id'];
$client_policy_id = $import_data['client_policy_id'];
+ $client_branch_id = $import_data['client_branch_id'];
$file = $import_data['file'];
$data = $this->readExcelToArray($file);
@@ -1352,6 +1359,7 @@ class EmpDataServiceController extends BaseController
->where('employees.emp_code', $emp_code)
->where('employees.name', $emp_name)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('emp_endorsement.actions', 'si')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
@@ -1449,6 +1457,7 @@ class EmpDataServiceController extends BaseController
->where('employees.emp_code', $emp_code)
->where('employees.name', $emp_name)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.is_active', 1)
->first();
@@ -1478,6 +1487,7 @@ class EmpDataServiceController extends BaseController
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('employees.name', $emp_name)
->where('employees.emp_code', $emp_code)
->where('employee_polices.is_active', 1)
@@ -1500,6 +1510,7 @@ class EmpDataServiceController extends BaseController
'employeeIds' => $employeeIds,
'client_id' => $client_id,
'client_policy_id' => $client_policy_id,
+ 'client_branch_id' => $client_branch_id,
'count' => $count,
'event' => $import_data['event_type'],
'policy_name' => $policy_name['policy_name'],
@@ -1517,6 +1528,7 @@ class EmpDataServiceController extends BaseController
$client_id = $import_data['client_id'];
$client_policy_id = $import_data['client_policy_id'];
+ $client_branch_id = $import_data['client_branch_id'];
$file = $import_data['file'];
@@ -1554,6 +1566,7 @@ class EmpDataServiceController extends BaseController
->where('employees.emp_code', $emp_code)
->where('employees.name', $emp_name)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('emp_endorsement.actions', 'd')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
@@ -1644,6 +1657,7 @@ class EmpDataServiceController extends BaseController
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('employees.name', $emp_name)
->where('employees.emp_code', $emp_code)
->where('employee_polices.is_active', 1)
@@ -1674,6 +1688,7 @@ class EmpDataServiceController extends BaseController
->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('emp_endorsement.emp_code', $emp_code)
->where('employees.client_id', $client_id)
+ ->where('employees.client_branch_id', $client_branch_id)
->where('employee_polices.client_policy_id', $client_policy_id)
->where('emp_endorsement.name', $emp_name)
->where('emp_endorsement.field_name', 'emp_status')
@@ -1712,6 +1727,7 @@ class EmpDataServiceController extends BaseController
$depositeData = [
'employeeIds' => $employeeIds,
'client_id' => $client_id,
+ 'client_branch_id' => $client_branch_id,
'client_policy_id' => $client_policy_id,
'count' => $count,
'event' => $import_data['event_type'],
@@ -2239,9 +2255,10 @@ class EmpDataServiceController extends BaseController
public function getDataByFileId($file_id, $status = 'success'){
$data = $this->batchFileModel
- ->select('batch_files.*, clients.client_name, clients.short_name, policies.name as policy_name')
+ ->select('batch_files.*, clients.client_name, clients.short_name, policies.name as policy_name, client_branch.branch_name')
->join('clients', 'clients.id = batch_files.client_id')
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
+ ->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
->join('policies', 'policies.id = client_policy.policy_id')
->where('batch_files.id', $file_id)
->first();
@@ -2249,12 +2266,12 @@ class EmpDataServiceController extends BaseController
if($status == 'success'){
- $msg_txt = $data['short_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
+ $msg_txt = $data['short_name'] . ' - ' . $data['branch_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
$msg_title = 'File Upload Success';
}else if ($status == 'failure'){
- $msg_txt = $data['short_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
+ $msg_txt = $data['short_name'] . ' - ' . $data['branch_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
$msg_title = 'File Upload Failure';
}
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 9e495ea9..51a5ef50 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -369,8 +369,12 @@ class EmployeeController extends AdminController
$actions = $this->request->getPost('action_type');
$client_data = $this->clientModel->where('id', $client_id)->first();
- $policy_name = $this->clientPolicyModel->select('policies.name')->join('policies', 'policies.id = client_policy.policy_id')->where('client_policy.id', $client_policy_id)->first();
- $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']);
+ $policy_name_and_branch_name = $this->clientPolicyModel->select('policies.name, client_branch.branch_code')
+ ->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
+ ->join('policies', 'policies.id = client_policy.policy_id')
+ ->where('client_policy.id', $client_policy_id)
+ ->first();
+ $file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name_and_branch_name['name'], $policy_name_and_branch_name['branch_code']);
$batch_data = [
'client_id' => $client_id,
diff --git a/app/Controllers/PendingActionsController.php b/app/Controllers/PendingActionsController.php
index 2e4bb8e8..c7764902 100644
--- a/app/Controllers/PendingActionsController.php
+++ b/app/Controllers/PendingActionsController.php
@@ -95,17 +95,20 @@ class PendingActionsController extends AdminController
cp.policy_status,
cp.open_for_enrollment,
cp.inception_type,
+ cb.id as branch_id,
+ cb.branch_name,
COUNT(ep.id) AS employee_policy_count
');
$builder->join('employee_polices ep', 'cp.id = ep.client_policy_id AND ep.is_active = 1', 'left');
$builder->join('clients', 'cp.client_id = clients.id');
+ $builder->join('client_branch cb', 'cb.id = cp.client_branch_id');
$builder->join('policies', 'cp.policy_id = policies.id');
$builder->where('cp.is_active', 1);
$builder->where('cp.open_for_enrollment', 1);
$builder->where('cp.is_addon', 1);
$builder->where('cp.policy_status', 1);
$builder->where('cp.inception_type', 1);
- $builder->whereIn('cp.policy_type_id', [1, 2, 30]);
+ $builder->whereIn('cp.policy_type_id', [1, 2, 3]);
$builder->groupBy('cp.id, cp.client_id, cp.policy_id, cp.policy_type_id, cp.is_addon, cp.policy_status, cp.open_for_enrollment');
$builder->having('employee_policy_count = 0 OR employee_policy_count IS NULL');
@@ -147,6 +150,8 @@ class PendingActionsController extends AdminController
clients.client_name as client_name,
clients.id as client_id,
+ client_branch.id as branch_id,
+ client_branch.branch_name,
emp_endorsement.id,
emp_endorsement.pk,
emp_endorsement.endorsement_id,
@@ -159,20 +164,23 @@ class PendingActionsController extends AdminController
employees.name as ename
')
->join('employees', 'emp_endorsement.pk = employees.id AND employees.is_active = 1 AND employees.emp_status = \'active\'')
- ->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left')
- ->where([
+ ->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left')
+ ->join('client_branch', 'client_branch.id = employees.client_branch_id', 'left')
+ ->where([
'emp_endorsement.actions' => 'c',
'emp_endorsement.is_active' => 1,
'emp_endorsement.status' => 'pending',
'emp_endorsement.endorsement_id' => null
])
- ->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.table_name, emp_endorsement.actions, emp_endorsement.name');
+ ->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.table_name, emp_endorsement.actions, emp_endorsement.name');
// Main query builder
$builder = $this->db->table('clients');
$builder->select("
subquery.client_name,
subquery.client_id,
+ subquery.branch_name,
+ subquery.branch_id,
COUNT(subquery.id) AS subquery_count,
($subQueryExport) AS batch_export_count,
($subQueryImport) AS batch_import_count
@@ -223,6 +231,8 @@ class PendingActionsController extends AdminController
->select('
clients.client_name as client_name,
clients.id as client_id,
+ client_branch.id as branch_id,
+ client_branch.branch_name,
client_policy.id as client_policy_id,
policies.name as policy_name,
policies.id as pid,
@@ -239,6 +249,7 @@ class PendingActionsController extends AdminController
->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\'')
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1')
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1')
+ ->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1')
->where([
'emp_endorsement.actions' => 'si',
@@ -256,6 +267,8 @@ class PendingActionsController extends AdminController
subquery.client_id,
subquery.client_policy_id,
subquery.policy_name,
+ subquery.branch_name,
+ subquery.branch_id,
COUNT(subquery.id) AS subquery_count,
($subQueryExport) AS batch_export_count,
($subQueryImport) AS batch_import_count
@@ -304,8 +317,10 @@ class PendingActionsController extends AdminController
// Build the subquery
$subqueryBuilder = $this->db->table('emp_endorsement')
->select('
- clients.client_name as client_name,
clients.id as client_id,
+ clients.client_name as client_name,
+ client_branch.id as branch_id,
+ client_branch.branch_name,
client_policy.id as client_policy_id,
policies.name as policy_name,
policies.id as pid,
@@ -317,10 +332,12 @@ class PendingActionsController extends AdminController
emp_endorsement.actions,
emp_endorsement.name,
emp_endorsement.status
+
')
->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\' AND emp_endorsement.table_name = \'employee_polices\'', 'left')
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1', 'left')
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1', 'left')
+ ->join('client_branch', 'client_branch.id = client_policy.client_branch_id', 'left')
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1', 'left')
->where([
'emp_endorsement.actions' => 'd',
@@ -339,6 +356,8 @@ class PendingActionsController extends AdminController
subquery.client_id,
subquery.client_policy_id,
subquery.policy_name,
+ subquery.branch_name,
+ subquery.branch_id,
COUNT(subquery.id) AS subquery_count,
($subQueryExport) AS batch_export_count,
($subQueryImport) AS batch_import_count
@@ -389,10 +408,12 @@ class PendingActionsController extends AdminController
->select('c.short_name')
->select('p.name as policy_name')
->select('ep.uhid')
+ ->select('cb.branch_name, cb.id as branch_id')
->select("($subQueryExport) AS batch_export_count", false)
->select("($subQueryImport) AS batch_import_count", false)
->join('client_policy cp', 'ep.client_policy_id = cp.id AND cp.is_active = 1 AND cp.policy_status = 1')
->join('clients c', 'c.id = cp.client_id')
+ ->join('client_branch cb', 'cb.id = cp.client_branch_id')
->join('policies p', 'p.id = cp.policy_id')
->where('ep.uhid IS NULL')
->where('ep.status', 'active')
@@ -439,13 +460,16 @@ class PendingActionsController extends AdminController
clients.short_name,
clients.client_name,
policies.name as policy_name,
- clients.id as client_id
+ clients.id as client_id,
+ client_branch.id as branch_id,
+ client_branch.branch_name
');
$builder->select("($subQueryExport) AS batch_export_count", false);
$builder->select("($subQueryImport) AS batch_import_count", false);
$builder->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1');
$builder->join('clients', 'clients.id = client_policy.client_id');
+ $builder->join('client_branch', 'client_branch.id = client_policy.client_branch_id');
$builder->join('policies', 'policies.id = client_policy.policy_id');
$builder->where('employee_polices.tpa_id', null);
$builder->where('employee_polices.uhid IS NOT NULL');
diff --git a/app/Helpers/excel_import_export_helper.php b/app/Helpers/excel_import_export_helper.php
index 5c29ce41..c7cec62d 100644
--- a/app/Helpers/excel_import_export_helper.php
+++ b/app/Helpers/excel_import_export_helper.php
@@ -359,7 +359,7 @@ if (!function_exists('read_excel_file_to_array')) {
if (! function_exists('generate_filename')) {
- function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name) {
+ function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name, $branch_code) {
$evenTypeLabel = '';
if($event_type == 'inception'){
@@ -387,9 +387,10 @@ if (! function_exists('generate_filename')) {
$currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s');
$policy_name = str_replace(' ', '_', $policy_name);
+ $branch_code = isset($branch_code) ? str_replace(' ', '_', $branch_code) : '_';
// Generate file name
- $file_name = $client_short_name. '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx';
+ $file_name = $client_short_name. '_' . $branch_code . '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx';
return $file_name;
}
}
diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index b422ccfe..bccd442b 100644
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -120,6 +120,7 @@ class EmployeePolicyModel extends Model
public function getInceptionEmployeeDataForExportExcel($ref_data)
{
$client_policy_id = $ref_data['client_policy_id'];
+ $client_branch_id = $ref_data['client_branch_id'];
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
$event = $ref_data['event_type'];
@@ -174,7 +175,8 @@ class EmployeePolicyModel extends Model
) as batch_data ON employee_polices.id = batch_data.emp_policy_id
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '')
- AND employee_polices.is_active = 1";
+ AND employee_polices.is_active = 1
+ AND employees.client_branch_id = '{$client_branch_id}'";
// Get the result set
$query = $this->db->query($sql);
@@ -188,6 +190,7 @@ class EmployeePolicyModel extends Model
$client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_id'];
+ $client_branch_id = $ref_data['client_branch_id'];
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
$sql = "
@@ -236,6 +239,7 @@ class EmployeePolicyModel extends Model
AND batch_data.bl IS NULL
AND employees.client_id = '{$client_id}'
AND employee_polices.client_policy_id = '{$client_policy_id}'
+ AND employees.client_branch_id = '{$client_branch_id}'
AND emp_endorsement.actions = 'c'
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
@@ -255,6 +259,7 @@ class EmployeePolicyModel extends Model
$client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_id'];
+ $client_branch_id = $ref_data['client_branch_id'];
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
$query = $this->db->query("
@@ -345,6 +350,7 @@ class EmployeePolicyModel extends Model
batch_data.bf IS NULL
AND batch_data.bl IS NULL
AND employee_polices.client_policy_id = '{$client_policy_id}'
+ AND employees.client_branch_id = '{$client_policy_id}'
AND employee_polices.is_active = '1'
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
AND a.field_name = 'si_enhancement_date'
@@ -362,10 +368,11 @@ class EmployeePolicyModel extends Model
$client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_id'];
+ $client_branch_id = $ref_data['client_branch_id'];
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
$query = $this->db->query("
- SELECT
+ SELECT DISTINCT
a.id as endorsement_primarykey,
employee_polices.id as primaryKey,
employees.name AS emp_name,
@@ -436,6 +443,7 @@ class EmployeePolicyModel extends Model
batch_data.bf IS NULL
AND batch_data.bl IS NULL
AND employee_polices.client_policy_id = {$client_policy_id}
+ AND employees.client_branch_id = {$client_branch_id}
AND employee_polices.is_active = 1
AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status'
");
@@ -613,6 +621,7 @@ class EmployeePolicyModel extends Model
$query1->join('employee_polices ep', 'ep.id = e.pk');
$query1->join('employees', 'employees.id = ep.employee_id');
$query1->join('client_policy', 'client_policy.id = ep.client_policy_id');
+ $query1->join('client_branch', 'client_branch.id = employees.client_branch_id');
$query1->join('policies', 'policies.id = client_policy.policy_id');
$query1->join('insurers', 'insurers.id = policies.insurer_id');
$query1->whereIn('e.actions', ['c']);
@@ -645,6 +654,7 @@ class EmployeePolicyModel extends Model
$query2->join('employee_polices ep', 'ep.id = e.pk');
$query2->join('employees', 'employees.id = ep.employee_id');
$query2->join('client_policy', 'client_policy.id = ep.client_policy_id');
+ $query2->join('client_branch', 'client_branch.id = employees.client_branch_id');
$query2->join('policies', 'policies.id = client_policy.policy_id');
$query2->join('insurers', 'insurers.id = policies.insurer_id');
$query2->whereIn('e.actions', ['si', 'd']);
diff --git a/app/Views/client_deposit_list.php b/app/Views/client_deposit_list.php
index fb1adc40..bb261f17 100644
--- a/app/Views/client_deposit_list.php
+++ b/app/Views/client_deposit_list.php
@@ -5,7 +5,7 @@
-
diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php
index f53b7c16..6893b31c 100644
--- a/app/Views/client_kyc.php
+++ b/app/Views/client_kyc.php
@@ -51,7 +51,7 @@
-
+
@@ -100,6 +100,7 @@
$(document).ready(function(){
kycPrimaryKey = $('#kyc_PrimaryKey').val();
+
$('#others').hide()
$('#other_docs_table').hide();
@@ -176,10 +177,10 @@
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
$('#form_'+item.kyc_doc_type_id).hide();
- console.log('step 1')
+ // console.log('step 1')
if(item.file_name != null && item.file_name != ""){
- console.log('step 2')
+ // console.log('step 2')
$('#download_'+item.kyc_doc_type_id).show();
$('#download_' + item.kyc_doc_type_id).attr('href', '= base_url('download-kyc-docs/') ?>' + item.file_name);
@@ -187,14 +188,14 @@
}
else{
- console.log('step 3')
+ // console.log('step 3')
$('#download_'+item.kyc_doc_type_id).hide();
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
$('#delete_'+item.kyc_doc_type_id).hide();
}
- console.log('step 4')
+ // console.log('step 4')
});
@@ -217,6 +218,9 @@
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
+
+
+
$.ajax({
url: '= base_url("client/kyc/list/"); ?>' + '= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
type: "GET",
@@ -224,6 +228,7 @@
processData: false,
contentType: false,
success: function (res) {
+
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
@@ -270,9 +275,20 @@
var table = '';
var data = = isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
- console.log(data)
+ // console.log('other documents data', data)
+
+
$('#other_docs tr').remove();
+
+ var other_docs_count = 0;
+
$.each(data, function(index, item) {
+
+ if(item.other_docs_name != ""){
+
+ other_docs_count++;
+ }
+
if(item.kyc_doc_type_id == '0'){
table += `
@@ -288,6 +304,11 @@
}
});
$('#other_docs').append(table);
+
+ if(other_docs_count > 0){
+ $('#others').show()
+ $('#other_docs_table').show();
+ }
$.each(data, function(index, item) {
@@ -299,19 +320,17 @@
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
$('#form_'+item.kyc_doc_type_id).hide();
- console.log('step 1')
+ // console.log('step 1')
if(item.file_name != null && item.file_name != ""){
- console.log('step 2')
+ // console.log('step 2')
$('#download_'+item.kyc_doc_type_id).show();
$('#download_' + item.kyc_doc_type_id).attr('href', '= base_url('download-kyc-docs/') ?>' + item.file_name);
$('#delete_'+item.kyc_doc_type_id).show();
-
-
}
else{
- console.log('step 3')
+ // console.log('step 3')
$('#download_'+item.kyc_doc_type_id).hide();
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
@@ -319,7 +338,7 @@
}
- console.log('step 4')
+ // console.log('step 4')
}, 1000);
@@ -369,7 +388,7 @@
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
- console.log(res);
+ // console.log(res);
$('#kyc_form').trigger('reset');
if(res){
setTimeout(function() {
@@ -380,23 +399,36 @@
}, 500);
}
+ var other_docs_count = 0;
+
$('#other_docs tr').remove();
$.each(res.data, function(index, item) {
- console.log("Current item:", item);
+
+ if(item.other_docs_name != ""){
+
+ other_docs_count++;
+ }
+
+ // console.log("Current item:", item);
if (item.kyc_doc_type_id == '0') {
- console.log("Appending item:", item);
+ // console.log("Appending item:", item);
var rowHtml = `
| ${item.other_docs_name} |
${item.file_name} |
-
+
|
`;
}
$('#other_docs').append(rowHtml);
+
+ if(other_docs_count > 0){
+ $('#others').show()
+ $('#other_docs_table').show();
+ }
});
},
error: function(xhr, status, error) {
@@ -431,8 +463,8 @@
var kyc_id = $(this).attr('data-id');
$.get(''+kyc_id, function (data) {
- console.log('kyc-'+ kyc_id)
- console.log(data)
+ // console.log('kyc-'+ kyc_id)
+ // console.log(data)
if(data){
$('#form_'+kyc_id).show();
$('#name_'+kyc_id).hide();
@@ -458,7 +490,7 @@
var kyc_id = $(this).attr('data-id');
$.get(''+kyc_id, function (data) {
- console.log('kyc-'+ kyc_id)
+ // console.log('kyc-'+ kyc_id)
if(data){
$('#kyc-'+ kyc_id).remove();
}
@@ -468,30 +500,4 @@
});
- function validateForm() {
- var isValid = true;
-
-
- $('#kyc_form input, #kyc_form select').each(function() {
- if ($(this).is('input[type="text"]') || $(this).is('select')) {
- if ($.trim($(this).val()) == '') {
- console.log('Please fill in all fields');
- isValid = false;
- return false;
- }
- }
-
- if ($(this).is('input[type="file"]')) {
- var fileInput = $(this)[0];
- if (fileInput.files.length === 0) {
- console.log('Please select an image file');
- isValid = false;
- return false;
- }
- }
- });
-
- return isValid;
- }
-
\ No newline at end of file
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index bb6e8294..bb844432 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -2,8 +2,7 @@
-
+
@@ -30,9 +29,7 @@
-
+
@@ -42,34 +39,31 @@
-
+
-
-
+
+
@@ -163,104 +150,104 @@
\ No newline at end of file
diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php
index a9148742..479260a6 100644
--- a/app/Views/employee_list.php
+++ b/app/Views/employee_list.php
@@ -122,7 +122,7 @@ function fetchClientPolicies() {
$('#loader').show();
var apiURL = '' + 'util/clients-with-policies';
console.log('fetchClientPolicies');
- console.log(apiURL);
+ // console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
@@ -139,20 +139,20 @@ function fetchClientPolicies() {
clientPolicies = (response.data);
response.data.forEach(policy => {
- console.log('policies', policy.policies);
+ // console.log('policies', policy.policies);
policy.policies.forEach(p => {
clientPoliciesWithBranch.policies.push(p);
});
});
- console.log('1',clientPolicies);
+ // console.log('1',clientPolicies);
appendClients(clientPolicies);
//this function for reselect the policy
setTimeout(function() {
if (client_id != 0 ) {
var foundPolicies = clientPolicies.find(function(item) {
- console.log(typeof item.id)
+ // console.log(typeof item.id)
return item.id == client_id;
});
appendBranch(foundPolicies.branchs);
@@ -163,12 +163,12 @@ function fetchClientPolicies() {
if (client_branch_id != 0 ) {
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
- console.log('item', item);
+ // console.log('item', item);
return item.branch_id === client_branch_id;
});
if (foundPolicies) {
- console.log('foundPolicies', foundPolicies);
+ // console.log('foundPolicies', foundPolicies);
appendPolicies(foundPolicies);
} else {
console.log('No policies found for the selected client');
@@ -239,7 +239,7 @@ function appendPolicies(data) {
}));
var PolicyID = = isset($getData) ? $getData['policy_id'] : '0'?>;
- console.log(PolicyID)
+ // console.log(PolicyID)
$.each(data, function(index, item) {
var option = $('
', {
value: item.client_policy_id,
@@ -346,14 +346,14 @@
}));
var selectedClient = $(this).val();
- console.log(selectedClient);
+ // console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
});
- console.log(foundPolicies.branchs);
+ // console.log(foundPolicies.branchs);
appendBranch(foundPolicies.branchs);
});
@@ -365,20 +365,24 @@
var selectedClient = $(this).val();
- console.log('selectedBranch', selectedClient);
- console.log('clientPolicies', clientPoliciesWithBranch);
+ // console.log('selectedBranch', selectedClient);
+ // console.log('clientPolicies', clientPoliciesWithBranch);
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
- console.log('item', item);
+ // console.log('item', item);
return item.branch_id === selectedClient;
});
- if (foundPolicies) {
- console.log('foundPolicies', foundPolicies);
+ if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
+
appendPolicies(foundPolicies);
+ toastr.warning('No policies found for the selected client branch.');
+
} else {
- console.log('No policies found for the selected client');
+
+ // console.log('foundPolicies', foundPolicies);
+ appendPolicies(foundPolicies);
}
});
@@ -396,7 +400,7 @@
var policy_id = $('#policies').val();
var status = $('#status1').val();
var branch_id = $('#branch_id').val();
- console.log(client_id + '-' + policy_id);
+ // console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') {
alert('Please select values in both dropdowns.');
return;
@@ -411,7 +415,7 @@
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
- console.log(apiURL);
+ // console.log(apiURL);
window.location.href = apiURL;
}
@@ -425,7 +429,7 @@
$('.emp_data_model').click(function() {
var myVal = $(this).data('id');
- console.log(myVal);
+ // console.log(myVal);
fetchEmpEndorsementData(myVal)
});
@@ -438,7 +442,7 @@
var apiURL = '' + 'util/get-emp-endorsement/' + id;
console.log('fetchEmpEndorsementData');
- console.log(apiURL);
+ // console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
@@ -447,7 +451,7 @@
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
- console.log(response);
+ // console.log(response);
if (response.code === 200 && response.dataStatus === true) {
try {
endorsementData = (response.data);
diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php
index 623e4676..48cc73a1 100644
--- a/app/Views/insurer_or_tpa_data.php
+++ b/app/Views/insurer_or_tpa_data.php
@@ -25,14 +25,14 @@
-
-
+
Select
@@ -140,6 +140,7 @@
};
var client_id_param2 = 0;
+ var client_branch_id_param2 = 0;
var client_policy_param2 = 0;
$(document).ready(function() {
@@ -173,7 +174,7 @@
// Create FormData object
var formData = new FormData($(this)[0]);
for (var pair of formData.entries()) {
- console.log(pair[0] + ', ' + pair[1]);
+ // console.log(pair[0] + ', ' + pair[1]);
}
$('.loader').fadeIn();
@@ -187,7 +188,7 @@
contentType: false, // Let jQuery handle the content type
success: function(response) {
- console.log(response);
+ // console.log(response);
if (response.code === 200 && response.status === true) {
$('.loader').fadeOut();
@@ -205,7 +206,7 @@
} else {
console.error('Something went wrong!');
- toastr.error('Something went wrong! Try later', 'Error');
+ // toastr.error('Something went wrong! Try later', 'Error');
// window.location.reload(true);
}
},
@@ -215,7 +216,7 @@
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$("#import_export_excel_form")[0].reset()
- toastr.error('Something went wrong! Try later', 'Error');
+ // toastr.error('Something went wrong! Try later', 'Error');
// window.location.reload(true);
}
});
@@ -243,17 +244,18 @@
// Get the value of 'client_id' and 'client_policy_id'
client_id_param2 = params.get('client_id');
client_policy_param2 = params.get('client_policy_id');
+ client_branch_id_param2 = params.get('client_branch_id');
actions = params.get('actions');
insurer_or_tpa = params.get('insurer_or_tpa');
event = params.get('event');
- console.log('client_id2:', client_id_param2);
- console.log('client_policy_id2:', client_policy_param2);
- console.log('actions:', actions);
- console.log('insurer_or_tpa:', insurer_or_tpa);
- console.log('event:', event);
+ // console.log('client_id2:', client_id_param2);
+ // console.log('client_policy_id2:', client_policy_param2);
+ // console.log('actions:', actions);
+ // console.log('insurer_or_tpa:', insurer_or_tpa);
+ // console.log('event:', event);
@@ -264,7 +266,7 @@
$('#insurer_or_tpa').val(insurer_or_tpa).change()
var selectedValue = actions;
- console.log(selectedValue);
+ // console.log(selectedValue);
if (selectedValue == '') {
$('#import_excel_btn').hide();
@@ -304,11 +306,11 @@
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
try {
clientPolicies = (response.data);
- console.log(clientPolicies);
+ // console.log(clientPolicies);
response.data.forEach(policy => {
- console.log('policies', policy.policies);
+ // console.log('policies', policy.policies);
policy.policies.forEach(p => {
clientPoliciesWithBranch2.policies.push(p);
});
@@ -317,17 +319,33 @@
appendClients2(clientPolicies);
- //this function for reselect the policy
setTimeout(function() {
- if (client_id_param2 != null) {
+ if (client_branch_id_param2 != null) {
var foundPolicies = clientPolicies.find(function(item) {
- console.log(typeof item.id)
+ // console.log(typeof item.id)
return item.id == client_id_param2;
});
- appendPolicies2(foundPolicies.policies);
+ appendBranch2(foundPolicies.branchs);
+ }
+ }, 500);
+
+ setTimeout(function() {
+ if (client_id_param2 != null) {
+
+ var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
+ // console.log('item', item);
+ return item.branch_id === client_branch_id_param2;
+ });
+
+
+ if (foundPolicies) {
+ // console.log('foundPolicies', foundPolicies);
+ appendPolicies2(foundPolicies);
+ } else {
+ console.log('No policies found for the selected client');
+ }
}
}, 500);
- //end
} catch (error) {
console.error('Error parsing API response data:', error);
@@ -335,7 +353,7 @@
} else if (response.code === 404 && response.dataStatus === false) {
console.error('no data found', response);
} else {
- console.error('Something went wrong!');
+ // console.error('Something went wrong!');
}
},
error: function(xhr, status, error) {
@@ -349,7 +367,7 @@
function appendClients2(data) {
- console.log('client_id_param2', client_id_param2)
+ // console.log('client_id_param2', client_id_param2)
$.each(data, function(index, item) {
var option = $('', {
@@ -366,7 +384,7 @@
function appendBranch2(data) {
- console.log(data)
+ // console.log(data)
$('#client_branch_id').empty();
$('#client_branch_id').append($('', {
@@ -378,7 +396,7 @@
value: item.id,
text: item.branch_name
});
- if (client_policy_param == item.id) {
+ if (client_branch_id_param2 == item.id) {
option.attr('selected', true);
}
$('#client_branch_id').append(option);
@@ -417,14 +435,14 @@
}));
var selectedClient = $(this).val();
- console.log(selectedClient);
+ // console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
});
- console.log(foundPolicies.branchs);
+ // console.log(foundPolicies.branchs);
appendBranch2(foundPolicies.branchs);
});
@@ -437,20 +455,25 @@
var selectedClient = $(this).val();
- console.log('selectedBranch', selectedClient);
- console.log('clientPolicies', clientPoliciesWithBranch2);
+ // console.log('selectedBranch', selectedClient);
+ // console.log('clientPolicies', clientPoliciesWithBranch2);
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
- console.log('item', item);
return item.branch_id === selectedClient;
});
+
+
+
+ if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
- if (foundPolicies) {
- console.log('foundPolicies', foundPolicies);
appendPolicies2(foundPolicies);
+ toastr.warning('No policies found for the selected client branch.');
+
} else {
- console.log('No policies found for the selected client');
+
+ // console.log('foundPolicies', foundPolicies);
+ appendPolicies2(foundPolicies);
}
});
@@ -466,7 +489,7 @@
var client_id = $('#client').val();
var policy_id = $('#policy').val();
- console.log(client_id + '-' + policy_id);
+ // console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') {
alert('Please select values in both dropdowns.');
return;
@@ -479,7 +502,7 @@
const queryString = objectToQueryString2(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
- console.log(apiURL);
+ // console.log(apiURL);
window.location.href = apiURL;
@@ -491,7 +514,7 @@
$('#action_type').change(function() {
var selectedValue = $(this).val();
- console.log(selectedValue);
+ // console.log(selectedValue);
if (selectedValue == '') {
$('#import_excel_btn').hide();
@@ -521,7 +544,7 @@
$('#event_type').change(function() {
var selectedVal = $(this).val();
- console.log(selectedVal);
+ // console.log(selectedVal);
if (selectedVal === 'correction') {
$('#policy').prop('required', false);
diff --git a/app/Views/layout/footer.php b/app/Views/layout/footer.php
index 962befdb..bb051d4e 100644
--- a/app/Views/layout/footer.php
+++ b/app/Views/layout/footer.php
@@ -291,7 +291,7 @@
fetchMessages();
- setInterval(fetchMessages, 10000); // Fetch messages every minute
+ setInterval(fetchMessages, 10000); // Fetch messages every ten seconds
});
$(document).ready(function() {
@@ -325,6 +325,7 @@
var queryParams = {
client_id: item.client_id,
client_policy_id: item.client_policy_id,
+ client_branch_id: item.branch_id,
actions: 'inception'
};
@@ -339,7 +340,7 @@
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Info';
- var toast_body_data = item.client_name + ' - ' + item.policy_name;
+ var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data);
@@ -376,6 +377,7 @@
var queryParams = {
client_id: item.client_id,
+ client_branch_id: item.branch_id,
event: 'correction',
actions: 'export',
insurer_or_tpa: 'tpa',
@@ -399,7 +401,7 @@
title = 'Correction Import Pending';
}
- var toast_body_data = item.client_name;
+ var toast_body_data = item.client_name + ' - ' + item.branch_name;
//console.log(toast_body_data);
var html = `
@@ -439,6 +441,7 @@
client_id: item.client_id,
client_policy_id: item.client_policy_id,
+ client_branch_id: item.branch_id,
event: 'deletion',
actions: 'export',
insurer_or_tpa: 'tpa',
@@ -462,7 +465,7 @@
title = 'Deletion Import Pending';
}
- var toast_body_data = item.client_name + ' - ' + item.policy_name;
+ var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data);
var html = `
@@ -501,6 +504,7 @@
var queryParams = {
client_id: item.client_id,
client_policy_id: item.client_policy_id,
+ client_branch_id: item.branch_id,
event: 'si_enhancement',
actions: 'export',
insurer_or_tpa: 'tpa',
@@ -523,7 +527,7 @@
title = 'SI Enhancement Import Pending';
}
- var toast_body_data = item.client_name + ' - ' + item.policy_name;
+ var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data);
var html = `
@@ -562,6 +566,7 @@
var queryParams = {
client_id: item.client_id,
client_policy_id: item.client_policy_id,
+ client_branch_id: item.branch_id,
event: 'inception',
insurer_or_tpa: 'tpa',
actions: 'export',
@@ -584,7 +589,7 @@
title = 'TPA Import Pending';
}
- var toast_body_data = item.client_name + ' - ' + item.policy_name;
+ var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data);
var html = `
@@ -623,6 +628,7 @@
client_id: item.client_id,
client_policy_id: item.client_policy_id,
+ client_branch_id: item.branch_id,
event: 'inception',
insurer_or_tpa: 'insurer',
actions: 'export',
@@ -644,7 +650,7 @@
title = 'Insurer Import Pending';
}
- var toast_body_data = item.client_name + ' - ' + item.policy_name;
+ var toast_body_data = item.client_name + ' - ' + item.branch_name + ' - ' + item.policy_name;
//console.log(toast_body_data);
var html = `
diff --git a/app/Views/view_deposit.php b/app/Views/view_deposit.php
index e004bb33..0e2c6854 100644
--- a/app/Views/view_deposit.php
+++ b/app/Views/view_deposit.php
@@ -84,7 +84,7 @@