diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c26c0863..4f395843 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -232,6 +232,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("id-card", "EmployeeController::viewECard/$1"); $routes->get("preview-card/(:any)", "EmployeeController::previewTemplate/$1"); $routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1"); + $routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1"); }); $routes->cli('cli/processjob', 'JobWorker::processJob'); @@ -288,6 +289,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->post("calculatePremium", "EmployeeRestController::calculatePremium"); $routes->get("getEmployeeOldPolicy", "EmployeeRestController::getEmployeeOldPolicy"); + $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); }); $routes->post("sendEmail", "EmployeeRestController::send_email"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index a6cd25ce..1984e5dc 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -168,6 +168,8 @@ class ClientController extends AdminController // echo "
";
// print_r($data); die;
+ $data['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
+
echo view('layout/header', $headerData);
echo view('client_onboarding', $data);
@@ -651,6 +653,7 @@ class ClientController extends AdminController
}
+ $data['policy_no'] = $this->request->getPost('policy_no');
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
$data['created_by'] = get_session_userid();
@@ -694,6 +697,7 @@ class ClientController extends AdminController
$data['tpa_id'] = $tpaId;
$data['policy_id'] = $this->request->getPost('policy_id');
$data['policy_type_id'] = $this->request->getPost('policy_type_id');
+ $data['policy_no'] = $this->request->getPost('policy_no');
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
@@ -739,6 +743,7 @@ class ClientController extends AdminController
// dd($data);
$data['updated_by'] = get_session_userid();
+ // print_r($data);die;
$insert = $this->clientPolicyModel->update($id,$data);
$lastQuery = $this->clientPolicyModel->getLastQuery();
@@ -1241,19 +1246,19 @@ class ClientController extends AdminController
$client_policy_id = $this->request->getPost("client_policy_id");
$data['sum_insured'] =str_replace(',', '',$this->request->getPost("sum_insured"));
- $data['family_floater'] =$this->request->getPost("family_floater");
- $data['corporatebuffer'] = $this->request->getPost("corporatebuffer");
+ $data['family_floater'] =$this->request->getPost("family_floater") ? $this->request->getPost("family_floater") : 0;
+ $data['corporatebuffer'] = $this->request->getPost("corporatebuffer") ? $this->request->getPost("corporatebuffer") : 0;
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
// print_r($this->request->getPost());die;
- $data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age");
- $data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
- $data['age_ratio']['spouse']['min'] = $this->request->getPost("spouse_min_age");
- $data['age_ratio']['spouse']['max'] = $this->request->getPost("spouse_max_age");
- $data['age_ratio']['child']['min'] = $this->request->getPost("child_min_age");
- $data['age_ratio']['child']['max'] = $this->request->getPost("child_max_age");
- $data['age_ratio']['elders']['min'] = $this->request->getPost("other_member_min_age");
- $data['age_ratio']['elders']['max'] = $this->request->getPost("other_member_max_age");
+ $data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age") ? $this->request->getPost("self_min_age") :0;
+ $data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age") ? $this->request->getPost("self_max_age") : 0;
+ $data['age_ratio']['spouse']['min'] = $this->request->getPost("spouse_min_age") ? $this->request->getPost("spouse_min_age") : 0;
+ $data['age_ratio']['spouse']['max'] = $this->request->getPost("spouse_max_age") ? $this->request->getPost("spouse_max_age") : 0;
+ $data['age_ratio']['child']['min'] = $this->request->getPost("child_min_age") ? $this->request->getPost("child_min_age") : 0;
+ $data['age_ratio']['child']['max'] = $this->request->getPost("child_max_age") ? $this->request->getPost("child_max_age") : 0;
+ $data['age_ratio']['elders']['min'] = $this->request->getPost("other_member_min_age") ? $this->request->getPost("other_member_min_age") :0;
+ $data['age_ratio']['elders']['max'] = $this->request->getPost("other_member_min_age") ? $this->request->getPost("other_member_min_age") : 0;
@@ -1327,7 +1332,7 @@ class ClientController extends AdminController
}
}
- $data['family_floaters']['elders_count'] =$this->request->getPost("member_count");
+ $data['family_floaters']['elders_count'] =$this->request->getPost("member_count") ? $this->request->getPost("member_count") : 0;
$data['waiverofpreexistingdiseases'] =$this->request->getPost("waiverofpreexistingdiseases");
if ($data['waiverofpreexistingdiseases'] == 1) {
diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php
index 220f6cde..d1e9ebda 100644
--- a/app/Controllers/EmpDataServiceController.php
+++ b/app/Controllers/EmpDataServiceController.php
@@ -2091,10 +2091,12 @@ class EmpDataServiceController extends BaseController
$this->myLogger->logme('error', 'sendMailForDownloadingECard - inside try');
$count = 0;
+ $counts = 0;
+
foreach ($ids as $key => $id) {
$get_emp_email_and_other_details = $this->employeePolicyModel
- ->select('employee_polices.client_policy_id, employees.emp_code, employees.email_corporate,employees.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id')
+ ->select('employee_polices.client_policy_id, employees.relationship, employees.emp_code, employees.email_corporate,employees.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id')
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employees.emp_status', 'active')
->where('employees.is_active', '1')
@@ -2119,19 +2121,28 @@ class EmpDataServiceController extends BaseController
$params['notification'] = $notification;
$params['notification'] = $notification;
$params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details;
- $wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
+ // $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',);
- $count++;
+ if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] === 'Self') {
+ $wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params);
+ $count++;
+ }
+ $counts++;
+
- if ($count == 20 || $count == count($ids) - 1) {
+ if ($count == 20 || $counts == count($ids) - 1) {
+ if(count($wholeData) > 0){
- $this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',);
+ $this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',);
+
+ $job_details = new Jobs();
+ $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]);
+ $wholeData = [];
+ $count = 0;
+
+ }
- $job_details = new Jobs();
- $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]);
- $wholeData = [];
- $count = 0;
}
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',);
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 5e531472..3fd972b8 100644
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -11,6 +11,7 @@ use Psr\Log\LoggerInterface;
use App\Models\EmployeeModel;
use App\Models\EmployeePolicyModel;
use App\Models\ClientModel;
+use App\Models\PolicesModel;
use App\Models\FileModel;
use App\Models\BatchListModel;
use App\Models\BatchFileModel;
@@ -49,6 +50,7 @@ class EmployeeController extends AdminController
protected $empEndorsementModel;
protected $clientPolicyModel;
protected $TPAModel;
+ protected $policiesModel;
public function __construct()
{
@@ -64,6 +66,7 @@ class EmployeeController extends AdminController
$this->empEndorsementModel = new EmpEndorsementModel();
$this->clientPolicyModel = new ClientPolicyModel();
$this->TPAModel = new TPAModel();
+ $this->policiesModel = new PolicesModel();
}
public function list()
@@ -1148,4 +1151,29 @@ class EmployeeController extends AdminController
echo view('export_import_error_list', $excelErrorData);
}
+ public function hasPolicyConfigCompleted()
+ {
+ $client_policy_id = $this->request->uri->getSegment(3);
+ $policy_details = $this->clientPolicyModel->find($client_policy_id);
+ // print_r($policy_details);die();
+ $policy_terms = isset($policy_details['policy_terms']) ? true : false;
+
+ $slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']);
+
+ $message = null;
+
+ if (!isset($policy_terms)) {
+ $message .= 'Policy terms';
+ }
+
+ if($slab_details['slab_rates'] == null && $slab_details['grid_master'] == null)
+ {
+ $message = isset($message) ? ($message . ' and rack rates ') : ($message . ' Rack rates');
+ }
+ $message = isset($message) ? ($message . ' not defined for choosed policy') : null;
+
+ return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message], 200);
+
+ }
+
}
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index b49b37d6..91c4b6b6 100644
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -618,7 +618,6 @@ class EmployeeRestController extends AdminController
$client_data = $this->clientModel->where('id', $client_id)->first();
- $notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first();
$jwt = $this->request->getHeader('Authorization');
$jwtParts = explode(' ', $jwt);
@@ -874,10 +873,11 @@ class EmployeeRestController extends AdminController
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
}
+ $notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first();
- if ($notification['enabled'] == 1) {
+ if (isset($notification) && $notification['enabled'] == 1) {
//trigger
- if ($dataToInsert[$a]['relationship'] == 'Self') {
+ if ($dataToInsert[$a]['relationship'] == 'Self' && isset($dataToInsert[$a]['email_corporate']) && !empty($dataToInsert[$a]['email_corporate'])) {
$params['dataToInsert'] = $dataToInsert[$a];
$params['notification'] = $notification;
@@ -887,20 +887,18 @@ class EmployeeRestController extends AdminController
$count++;
}
if($count == 20 || $a == count($dataToInsert)-1){
- $job_details = new Jobs();
- $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
- // $wholeData[]= $r;
-
- // Mailhelper::bulk_mail($wholeData);
- $wholeData = [];
- $count = 0;
+ if (count($wholeData) > 0) {
+ $job_details = new Jobs();
+ $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
+ $wholeData = [];
+ $count = 0;
+ }
}
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
}
-
}
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 200);
}else{
@@ -917,7 +915,19 @@ class EmployeeRestController extends AdminController
//-------------------------------------
+public function getAgeRange($terms,$familyFloatesValue)
+{
+ $ageRangeArray = ['self' => ['min' => 18, 'max' => 60] , 'spouse' => ['min' => 18, 'max' => 60] , 'child' => ['min' => 0, 'max' => 25] , 'elders' => ['min' => 18, 'max' => 60] ];
+ $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue);
+ if(isset($terms->age_ratio)){
+ return $terms->age_ratio->$ageKey;
+ }else{
+ return $ageRangeArray[$ageKey];
+ }
+
+
+}
public function getEmployeePolicy()
{
try {
@@ -1022,10 +1032,10 @@ public function getEmployeePolicy()
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
$temp['data']['form_type'] = $dependent;
- $temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
- $ageKey = ($dependent == 'parent' || $dependent == 'parent_in_law') ? 'elders' : $dependent;
-
- $temp['data']['age_validation'] = $decodedArray->age_ratio->$ageKey;
+ $temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
+
+
+ $temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
array_push($data,$temp);
unset($empData[$key]);
@@ -1064,9 +1074,9 @@ public function getEmployeePolicy()
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
- $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue);
-
- $temp2['data']['age_validation'] = $decodedArray->age_ratio->$ageKey;
+
+
+ $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
array_push($data,$temp2);
@@ -1194,8 +1204,8 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
$temp['data']['form_type'] = $dependent;
$temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
- $ageKey = ($dependent == 'parent' || $dependent == 'parent_in_law') ? 'elders' : $dependent;
- $temp['data']['age_validation'] = $array->Policy_Terms->age_ratio->$ageKey;
+ $temp['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue);
+
array_push($data,$temp);
unset($empData[$key]);
@@ -1232,9 +1242,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
- $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue);
-
- $temp2['data']['age_validation'] = $array->Policy_Terms->age_ratio->$ageKey;
+ $temp2['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue);
array_push($data,$temp2);
}
@@ -1435,7 +1443,9 @@ public function getAddOnPolicy()
$temp['data']['client_policy_id'] = $array['id'];
$temp['data']['form_type'] = $dependent;
$temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
- $temp['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
+ $temp['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
+ $temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
+
array_push($data,$temp);
unset($addOnEmployeeData[$key]);
$floters = array_diff($floters, [$familyFloatesValue]);
@@ -1492,9 +1502,8 @@ public function getAddOnPolicy()
$temp2['data']['client_policy_id'] = $array['id'];
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
- $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue);
-
- $temp2['data']['age_validation'] = $decodedArray->age_ratio->$ageKey;
+
+ $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
array_push($data,$temp2);
@@ -1658,26 +1667,33 @@ public function iAgreeForAddOn()
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
$array_list[] = $find;
}
- $params ['array_list'] = $array_list;
- $params ['client_policy_id'] = $client_policy_id;
- $params ['emp_code'] = $emp_code;
- $params ['client_id'] = $client_id;
- $wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
- MailHelper::send_email($wholeData[0]);
+ $notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
- if (isset($wholeData[0])) {
-
- $account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
- foreach ($account_manager_wholeData as $key => $value) {
- MailHelper::send_email($value);
- }
+ if (isset($notification) && $notification['enabled'] == 1) {
+ $params ['array_list'] = $array_list;
+ $params ['client_policy_id'] = $client_policy_id;
+ $params ['emp_code'] = $emp_code;
+ $params ['client_id'] = $client_id;
+ $params ['notification'] = $notification;
- $client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
+ $wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
+ MailHelper::send_email($wholeData[0]);
- foreach ($client_hr_wholeData as $key => $value) {
- MailHelper::send_email($value);
+ if (isset($wholeData[0])) {
+
+ $account_manager_wholeData =sendMailNotification::sendMailNotification('account_maneger_summary_mail', $params);
+
+ foreach ($account_manager_wholeData as $key => $value) {
+ MailHelper::send_email($value);
+ }
+
+ $client_hr_wholeData =sendMailNotification::sendMailNotification('client_hr_summary_mail', $params);
+
+ foreach ($client_hr_wholeData as $key => $value) {
+ MailHelper::send_email($value);
+ }
}
}
@@ -2031,6 +2047,83 @@ function getEmployeeOldPolicy()
}
+function getEmployeeActiveOrInactivePolicy()
+{
+
+ if($this->request->getGet('type') == 'Active'){ $value = 1; }else{ $value = 0; }
+ $ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
+ ->join('policies', 'client_policy.policy_id = policies.id', 'left')
+ ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
+ ->where('client_policy.client_id', $this->request->getGet('client_id') )
+ ->where('client_policy.is_active', 1 )
+ ->where('client_policy.policy_status', $value)
+ ->orderby('client_policy.id' , 'ASC')
+ ->findAll();
+
+ // Retrieve employee and dependents data by passing the employee code
+ $employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
+ ->where('client_id',$this->request->getGet('client_id'))
+ ->where('is_active', 1 )->findAll();
+ $whereArrayForId = [];
+ foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
+
+ if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
+ {
+ $result = [];
+ foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
+
+ $terms = json_decode($ClientPolicyValue['policy_terms']);
+ // dd($terms);
+ $data['client_id'] = $ClientPolicyValue['client_id'];
+ $data['client_policy_id'] = $ClientPolicyValue['id'];
+ $data['policy_name'] = $ClientPolicyValue['policy_name'];
+ $data['policy_type'] = $ClientPolicyValue['policy_type'];
+ $data['policy_type'] = $ClientPolicyValue['policy_type'];
+ $data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
+ $data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
+
+ if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
+ if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
+ if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
+ if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
+ if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
+
+ if($ClientPolicyValue['policy_type_id'] == 1){ $data['floter_text_heading'] = 'Sum Insured'; }
+ else
+ {
+ if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
+ }
+
+ $employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string')
+ ->join('employees', 'employee_polices.employee_id = employees.id', 'left')
+ ->whereIn('employee_polices.employee_id',$whereArrayForId)
+ ->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
+ ->where('employee_polices.is_active', 1 )->findAll();
+ $si_value = 0;
+ $si_premium_value = 0;
+ $si_gst_value = 0;
+ foreach ($employee_policy as $key => $value) {
+ if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
+ if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
+ if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
+ }
+
+ $data['si_value'] = $si_value;
+ $data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
+ $data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
+
+ $data['EmployeePolicy'] = $employee_policy;
+ array_push($result, $data);
+ }
+
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result ], 200);
+
+ }else{
+ return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
+ }
+
+}
+
private function convertDateFormatDisplay($dateString)
{
diff --git a/app/Controllers/Jobs/SubJob.php b/app/Controllers/Jobs/SubJob.php
index be74f0b8..35d9f8fd 100644
--- a/app/Controllers/Jobs/SubJob.php
+++ b/app/Controllers/Jobs/SubJob.php
@@ -8,6 +8,8 @@ class SubJob extends PublicController
{
public function handle($payload)
{
+ $log = \Config\Services::mylogger();
+ $log->logme('error', 'handle called');
return $payload['a'] - $payload['b'];
}
diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php
index a2c011a2..b652d3eb 100644
--- a/app/Controllers/MasterController.php
+++ b/app/Controllers/MasterController.php
@@ -427,6 +427,7 @@ class MasterController extends AdminController
$data['tpa_logo'] = $file_name;
$data['front_card'] = $front_card_file_name;
$data['back_card'] = $back_card_file_name;
+ $data['network_hospitals'] = $this->request->getPost('network_hospitals');
$insert = $this->tpaModel->insert($data);
@@ -566,6 +567,7 @@ class MasterController extends AdminController
$data['back_card'] = $back_card_file_name;
}
+ $data['network_hospitals'] = $this->request->getPost('network_hospitals');
$update = $this->tpaModel->update($id,$data);
diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php
index e0a6280c..2c050523 100644
--- a/app/Controllers/NotificationController.php
+++ b/app/Controllers/NotificationController.php
@@ -147,11 +147,14 @@ class NotificationController extends AdminController
$count++;
$temp_whole_data[] = $value;
if($count == 20 || $whole_index == count($wholeData)-1 && $index == count($values)-1){
- $job_details = new Jobs();
- $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]);
+ if (count($temp_whole_data) > 0) {
+ $job_details = new Jobs();
+ $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]);
- $temp_whole_data = [];
- $count = 0;
+ $temp_whole_data = [];
+ $count = 0;
+ }
+
}
}
}
diff --git a/app/Helpers/MailHelper.php b/app/Helpers/MailHelper.php
index 55d17264..da8d2624 100644
--- a/app/Helpers/MailHelper.php
+++ b/app/Helpers/MailHelper.php
@@ -58,7 +58,6 @@ class MailHelper
}
}
-
public static function bulk_mail(array $mails = [])
{
// print_r();die;
@@ -78,6 +77,5 @@ class MailHelper
}
}
-
}
?>
\ No newline at end of file
diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php
index f93e79f6..cfc96b17 100644
--- a/app/Helpers/sendMailNotification.php
+++ b/app/Helpers/sendMailNotification.php
@@ -57,21 +57,32 @@ class sendMailNotification
if ($value['relationship'] != 'Self') {
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
-
- foreach ($emp_data as $key => $value) {
- if ($value['relationship'] == 'Self') {
- $employee_name =$value['name'];
- $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
- $mail = $value['email_corporate'];
+ if(count($emp_data) > 1){
+ $mail ='';
+ foreach ($emp_data as $key => $values) {
+ if ($value['relationship'] == 'Self') {
+ $employee_name =$values['name'];
+ $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
+
+ $mail = $values['email_corporate'];
+ }
}
+ }else{
+ $mail ='';
}
+
}else{
$employee_name =$value['name'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail = $value['email_corporate'];
}
+ if (isset($mail) && !empty($mail)) {
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
+ }
+ }
+ if (count($wholeData) < 1) {
+ $wholeData = [];
}
return $wholeData;
}else{
@@ -194,8 +205,9 @@ class sendMailNotification
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
// $mail = "aadhavanvalli@gmail.com";
-
- $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
+ // if (isset($mail) && !empty($mail)) {
+ $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
+ // }
return $wholeData;
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index 291b13f9..4cdd36b5 100644
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -40,7 +40,8 @@ class ClientPolicyModel extends Model
"updated_by",
"Is_active",
"date_of_exit",
- "reason_for_exit"
+ "reason_for_exit",
+ "policy_no"
];
public function getClientPolicyById($id){
diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php
index d6a8182e..a56af6bc 100644
--- a/app/Models/PolicesModel.php
+++ b/app/Models/PolicesModel.php
@@ -39,6 +39,7 @@ class PolicesModel extends Model
{
$premium_slab_data = null;
+ $grid_type = null;
$policyPremium1Model = new PolicyPremium1Model();
$premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
@@ -50,9 +51,13 @@ class PolicesModel extends Model
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
}
- $grid_id = $premium_slab_data[0]['policy_grid_id'];
- $policyGridModel = new PolicyGridModel();
- $results = $policyGridModel->find($grid_id);
- return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
+ if(isset($premium_slab_data[0]['policy_grid_id']))
+ {
+ $grid_id = $premium_slab_data[0]['policy_grid_id'];
+ $policyGridModel = new PolicyGridModel();
+ $grid_type = $policyGridModel->find($grid_id);
+ }
+
+ return ['slab_rates' => $premium_slab_data,'grid_master' => $grid_type];
}
}
diff --git a/app/Models/TPAModel.php b/app/Models/TPAModel.php
index 215c734d..fe3f30cd 100644
--- a/app/Models/TPAModel.php
+++ b/app/Models/TPAModel.php
@@ -15,6 +15,7 @@ class TPAModel extends Model
"front_card",
"back_card",
"tpa_logo",
+ "network_hospitals",
"created_by",
"updated_by",
"is_active",
diff --git a/app/Views/client_onboarding.php b/app/Views/client_onboarding.php
index 5ae22d1a..9ff286b9 100644
--- a/app/Views/client_onboarding.php
+++ b/app/Views/client_onboarding.php
@@ -201,11 +201,11 @@ body {
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
- $('#btnBranchAdd').hide();
+ $('#notification-tab').hide();
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
}else{
- if ($('#btnBranchBack')[0].style.display == 'none') {
- $('#btnBranchAdd').show();
+ if ($('#notification-tab')[0].style.display == 'none') {
+ $('#notification-tab').show();
}
}
@@ -236,10 +236,10 @@ body {
client_branch_contact();
});
- // document.getElementById("notification_tab").addEventListener("click", function(event) {
- // event.preventDefault();
- // client_notification();
- // });
+ document.getElementById("notification_tab").addEventListener("click", function(event) {
+ event.preventDefault();
+ client_notification();
+ });
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 8ee76ec5..d26b3f20 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -92,15 +92,19 @@