Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
2094e680d7
@ -223,6 +223,10 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$data = $this->request->getJSON();
|
$data = $this->request->getJSON();
|
||||||
|
|
||||||
|
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id);
|
||||||
|
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
|
||||||
|
|
||||||
if ($data) {
|
if ($data) {
|
||||||
|
|
||||||
$Count = 0;
|
$Count = 0;
|
||||||
@ -505,6 +509,10 @@ class EmployeeRestController extends AdminController
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$requestData = $this->request->getJSON();
|
$requestData = $this->request->getJSON();
|
||||||
|
|
||||||
|
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($requestData[0]->client_policy_id);
|
||||||
|
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
|
||||||
|
|
||||||
foreach ($requestData as $key => $value)
|
foreach ($requestData as $key => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1996,6 +2004,7 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
|
|
||||||
$postData = json_decode($this->request->getBody(), true);
|
$postData = json_decode($this->request->getBody(), true);
|
||||||
|
$this->myLogger->logme("error", $this->request->getBody());
|
||||||
$client_policy_id = $postData['client_policy_id'];
|
$client_policy_id = $postData['client_policy_id'];
|
||||||
sort($client_policy_id);
|
sort($client_policy_id);
|
||||||
|
|
||||||
@ -2003,7 +2012,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$client_id = $postData['client_id'];
|
$client_id = $postData['client_id'];
|
||||||
|
|
||||||
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
|
$empData = $this->employeeModel->where('emp_code', $emp_code )->where('client_id', $client_id ) ->where('is_active', 1 )->findAll();
|
||||||
|
$employeeIds = array_column($empData, 'id');
|
||||||
//for mail common parameter
|
//for mail common parameter
|
||||||
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
|
$filteredEmpData = array_filter($empData, fn($item) => $item['relationship'] === 'Self');
|
||||||
|
|
||||||
@ -2015,39 +2024,56 @@ class EmployeeRestController extends AdminController
|
|||||||
$policy = $this->clientPolicyModel->where('id',$value)->where('open_for_enrollment',1)->find();
|
$policy = $this->clientPolicyModel->where('id',$value)->where('open_for_enrollment',1)->find();
|
||||||
if($policy)
|
if($policy)
|
||||||
{
|
{
|
||||||
foreach ($empData as $empDataKey => $empDataValue)
|
$this->myLogger->logme("error", 'client policy id = '.$value.' is open for enrollment');
|
||||||
|
|
||||||
|
$empPolicyData = $this->employeePolicyModel->where('client_policy_id', $value )
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->whereIn('employee_id',$employeeIds)
|
||||||
|
->findAll();
|
||||||
|
if(count($empPolicyData))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$empIdsFromPolicyData = array_column($empPolicyData, 'employee_id');
|
||||||
|
//update emp polict table
|
||||||
$this->employeePolicyModel->where('client_policy_id', $value )
|
$this->employeePolicyModel->where('client_policy_id', $value )
|
||||||
->where('is_active', 1 )
|
->where('is_active', 1 )
|
||||||
->where('employee_id', $empDataValue['id'] )
|
->whereIn('employee_id', $empIdsFromPolicyData )
|
||||||
->where('status', 'draft' )
|
->groupStart()
|
||||||
|
->where('status', 'draft')
|
||||||
|
->orWhere('status', 'enrolled')
|
||||||
|
->groupEnd()
|
||||||
->set(array('status'=>'enrolled'))
|
->set(array('status'=>'enrolled'))
|
||||||
->update();
|
->update();
|
||||||
|
//update Employee table
|
||||||
|
$this->employeeModel->where('emp_code', $emp_code)
|
||||||
|
->whereIn('id', $empIdsFromPolicyData)
|
||||||
|
->where('client_id', $client_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->groupStart()
|
||||||
|
->where('emp_status', 'draft')
|
||||||
|
->orWhere('emp_status', 'enrolled')
|
||||||
|
->groupEnd()
|
||||||
|
->set(['emp_status' => 'enrolled'])
|
||||||
|
->update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
|
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value,emp_code: $emp_code,client_id: $client_id,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
|
||||||
if(count($find) > 0){
|
if(count($find) > 0){
|
||||||
$array_list[] = $find;
|
$array_list[] = $find;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}else { $this->myLogger->logme("error", 'client policy id = '.$value.' is not open for enrollment');}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//update Employee table
|
|
||||||
$this->employeeModel->where('emp_code', $emp_code)->where('client_id', $client_id)->where('is_active', 1)
|
|
||||||
->groupStart()
|
|
||||||
->where('emp_status', 'draft')
|
|
||||||
->orWhere('emp_status', 'enrolled')
|
|
||||||
->groupEnd()
|
|
||||||
->set(['emp_status' => 'enrolled'])
|
|
||||||
->update();
|
|
||||||
|
|
||||||
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
|
$notification = $this->notificationModel->where('client_id' ,$client_id)->where('template_name', 'member_review_and_summary_mail')->first();
|
||||||
|
|
||||||
|
|
||||||
if (isset($notification) && $notification['enabled'] == 1) {
|
if (isset($notification) && $notification['enabled'] == 1 && count($array_list)) {
|
||||||
$params ['array_list'] = $array_list;
|
$params ['array_list'] = $array_list;
|
||||||
$params ['client_policy_id'] = $client_policy_id;
|
$params ['client_policy_id'] = $client_policy_id;
|
||||||
$params ['emp_code'] = $emp_code;
|
$params ['emp_code'] = $emp_code;
|
||||||
@ -2328,7 +2354,8 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$clientPolicy = $this->clientPolicyModel->where('id',$this->request->getGet('client_policy_id'))->findAll();
|
$clientPolicy = $this->clientPolicyModel->where('id',$this->request->getGet('client_policy_id'))
|
||||||
|
->where('open_for_enrollment',1)->findAll();
|
||||||
|
|
||||||
if(count($clientPolicy))
|
if(count($clientPolicy))
|
||||||
{
|
{
|
||||||
@ -2990,6 +3017,19 @@ class EmployeeRestController extends AdminController
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function findThePolicyIsOpenForEnrollment($plicy_id)
|
||||||
|
{
|
||||||
|
|
||||||
|
$policy = $this->clientPolicyModel->where('id',$plicy_id)->where('open_for_enrollment',1)->find();
|
||||||
|
|
||||||
|
if($policy)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,11 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
public function viewLeadsList()
|
public function viewLeadsList()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// $d = $this->constructExcelToSaveTemp(24, 1, $propsal_and_insurer = null);
|
||||||
|
// $d = $this->calculateMembersDemography(['lead_id' => 34]);
|
||||||
|
//$this->mergeQuoteExcelFileWithMembersListExcelFile(24, 1, $propsal_and_insurer = null);
|
||||||
|
// dd($d);
|
||||||
$data['page_name'] = 'Leads';
|
$data['page_name'] = 'Leads';
|
||||||
|
|
||||||
// Set basic data
|
// Set basic data
|
||||||
@ -431,7 +436,7 @@ class LeadsController extends BaseController
|
|||||||
//FOR EXCEL
|
//FOR EXCEL
|
||||||
public function exportExcelForQCRandRFQ($lead_id, $type)
|
public function exportExcelForQCRandRFQ($lead_id, $type)
|
||||||
{
|
{
|
||||||
$filepath = $this->constructExcelToSaveTemp($lead_id, $type);
|
//$filepath = $this->constructExcelToSaveTemp($lead_id, $type);
|
||||||
$filepath = $filepath['filePath'];
|
$filepath = $filepath['filePath'];
|
||||||
|
|
||||||
if (file_exists($filepath)) {
|
if (file_exists($filepath)) {
|
||||||
@ -662,6 +667,85 @@ class LeadsController extends BaseController
|
|||||||
'fileName' => $filename,
|
'fileName' => $filename,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Merge RFQ/QCR file with lead members file
|
||||||
|
public function mergeQuoteExcelFileWithMembersListExcelFile($lead_id, $type, $source_file_path)
|
||||||
|
{
|
||||||
|
$rfq_data = $this->RFQModel->getRFQTableDataWithLeadIDAndType($lead_id, $type);
|
||||||
|
|
||||||
|
if($source_file_path && $rfq_data['file_name'])
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function calculateMembersDemography($params)
|
||||||
|
{
|
||||||
|
$lead_id = $params['lead_id'];
|
||||||
|
$lead_data = $this->leadsModel->find($lead_id);
|
||||||
|
// print_rr($lead_data);
|
||||||
|
if($lead_data['file_name'])
|
||||||
|
{
|
||||||
|
$file_name_with_path = WRITEPATH."/uploads/lead_files/".$lead_data['file_name'];
|
||||||
|
|
||||||
|
//check physical file
|
||||||
|
if(!file_exists($file_name_with_path))
|
||||||
|
{
|
||||||
|
//file not found update status and reason
|
||||||
|
$message = "Lead Physcial file not found";
|
||||||
|
// echo $message;
|
||||||
|
$this->myLogger->logme('error',($message . ' for file ' . $file_name_with_path));
|
||||||
|
return ['status' => 'failed','message' => 'no physcial file'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||||
|
|
||||||
|
//get members data
|
||||||
|
$members_sheet = $spreadsheet->getSheet(0);
|
||||||
|
$highestRowAndColumn = $members_sheet->getHighestRowAndColumn();
|
||||||
|
// dd($highestRowAndColumn);
|
||||||
|
$members = $members_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||||
|
// dd($members);
|
||||||
|
|
||||||
|
//get age band data
|
||||||
|
$age_band_sheet = $spreadsheet->getSheet(1);
|
||||||
|
$highestRowAndColumn = $age_band_sheet->getHighestRowAndColumn();
|
||||||
|
$age_band_data = $age_band_sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||||
|
print_r($age_band_data);
|
||||||
|
|
||||||
|
//check age or dob column
|
||||||
|
$members_heading = $members[0];
|
||||||
|
Kint::dump($members_heading);
|
||||||
|
$available_col = null;
|
||||||
|
$col_index = null;
|
||||||
|
|
||||||
|
if (in_array('age', array_map('strtolower',$members_heading))) {
|
||||||
|
$available_col = 'age';
|
||||||
|
$col_index = array_search('age',array_map('strtolower',$members_heading));
|
||||||
|
} elseif (in_array('dob', array_map('strtolower', $members_heading))) {
|
||||||
|
$available_col = 'dob';
|
||||||
|
$col_index = array_search('dob', array_map('strtolower', $members_heading));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($available_col == null) {
|
||||||
|
$message = 'No DOB or Age column ';
|
||||||
|
$this->myLogger->logme('error',($message . $file_name_with_path));
|
||||||
|
return ['status' => 'failed','message' => $message];
|
||||||
|
}
|
||||||
|
|
||||||
|
//convert age slab data into array
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->myLogger->logme('error',(' no file found ' . $file_name_with_path));
|
||||||
|
return ['status' => 'failed','message' => 'no file found'];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//this funciton for send mail to insurer and client with either RFQ/QCR
|
//this funciton for send mail to insurer and client with either RFQ/QCR
|
||||||
public function sendMailWithAttachement()
|
public function sendMailWithAttachement()
|
||||||
|
|||||||
@ -327,7 +327,7 @@ class sendMailNotification
|
|||||||
// dd($payable_employee_array);
|
// dd($payable_employee_array);
|
||||||
// dd(count($payable_employee_array['emp_data']));
|
// dd(count($payable_employee_array['emp_data']));
|
||||||
|
|
||||||
if(count($payable_employee_array['emp_data']) > 0){
|
if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0){
|
||||||
|
|
||||||
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
|
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Type :';
|
||||||
$temp_data = '';
|
$temp_data = '';
|
||||||
|
|||||||
@ -67,7 +67,8 @@ class RFQModel extends Model
|
|||||||
tpa.name as tpa_name,
|
tpa.name as tpa_name,
|
||||||
tpa_branch.branch_name as tpa_branch_name,
|
tpa_branch.branch_name as tpa_branch_name,
|
||||||
policy_type.policy_type,
|
policy_type.policy_type,
|
||||||
rfq.json
|
rfq.json,
|
||||||
|
file_name
|
||||||
')
|
')
|
||||||
->join('leads', 'rfq.lead_id = leads.id')
|
->join('leads', 'rfq.lead_id = leads.id')
|
||||||
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
->join('policy_type', 'leads.policy_type_id = policy_type.id')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user