CHANGE_MANUAL_ECARD_MAIL&FIX_EXPORT&IMPORT_OF_TPA
This commit is contained in:
parent
bce0ef1440
commit
81957e5151
@ -298,6 +298,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->get("base_policy_for_policy_inception/(:any)", "PolicyTransactionController::getBasePolicy/$1");
|
$routes->get("base_policy_for_policy_inception/(:any)", "PolicyTransactionController::getBasePolicy/$1");
|
||||||
$routes->get("sentTestMail/(:any)", "NotificationController::sentTestMail/$1");
|
$routes->get("sentTestMail/(:any)", "NotificationController::sentTestMail/$1");
|
||||||
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
$routes->get("send_manual_reminder/(:any)", "DashboardController::sendManualReminder/$1");
|
||||||
|
$routes->get("send_manual_ecard/(:any)", "DashboardController::sendManualEcard/$1");
|
||||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||||
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
$routes->get("get_client_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
||||||
$routes->get("getLevelContects", "LeadsController::getLevelContects");
|
$routes->get("getLevelContects", "LeadsController::getLevelContects");
|
||||||
|
|||||||
@ -20,6 +20,7 @@ use App\Models\ClientPolicyModel;
|
|||||||
use App\Models\NotificationModel;
|
use App\Models\NotificationModel;
|
||||||
use App\Models\EmployeePolicyModel;
|
use App\Models\EmployeePolicyModel;
|
||||||
use App\Controllers\PendingActionsContrller;
|
use App\Controllers\PendingActionsContrller;
|
||||||
|
use App\Controllers\EmpDataServiceController;
|
||||||
|
|
||||||
class DashboardController extends AdminController
|
class DashboardController extends AdminController
|
||||||
{
|
{
|
||||||
@ -544,6 +545,35 @@ class DashboardController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendManualEcard($client_id, $client_branch_id, $policy_id)
|
||||||
|
{
|
||||||
|
$this->myLogger->logme('error', "sendManualEcard called with client_id: {$client_id}, client_branch_id: {$client_branch_id}, policy id : {$policy_id}");
|
||||||
|
|
||||||
|
$notification = $this->notificationModel->where('client_id', $client_id)->where('template_name', 'member_ecard_mail')->first();
|
||||||
|
// print_r(($notification)); die;
|
||||||
|
if($notification && $notification['enabled'] == 0 && $notification['mail_content'] == '')
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No template found','message2' => 'Failed' ], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
$emp_data = $this->employeePolicyModel->getEmployeePolicyForEcard($policy_id);
|
||||||
|
if(count($emp_data) == 0)
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'No employees found','message2' => 'Failed' ], 200);
|
||||||
|
}
|
||||||
|
$ids = array_column($emp_data, 'id');
|
||||||
|
// print_r(($ids)); die;
|
||||||
|
// print_r($this->clientPolicyModel->getLastQuery()); die;
|
||||||
|
// $this->myLogger->logme('error', "Policy details fetched: " . json_encode($client_policy_data));
|
||||||
|
Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => $ids]);
|
||||||
|
// $empEmpDataServiceController = new EmpDataServiceController();
|
||||||
|
// $empEmpDataServiceController->sendMailForDownloadingECard($ids);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail Queued'], 200);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function data_construct_for_bds($data){
|
public function data_construct_for_bds($data){
|
||||||
|
|
||||||
$groupedData = [
|
$groupedData = [
|
||||||
|
|||||||
@ -176,6 +176,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$totals = round($totals, 2);
|
$totals = round($totals, 2);
|
||||||
|
|
||||||
|
if($export_data['insurer_or_tpa'] == 'insurer') //check CD amt related issue for only insurer, not tpa
|
||||||
|
{
|
||||||
if (!empty($cash_balance)) {
|
if (!empty($cash_balance)) {
|
||||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
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.');
|
||||||
@ -183,6 +186,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Log the count of exported data
|
// Log the count of exported data
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
@ -408,7 +412,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'column_index' => 18,
|
'column_index' => 18,
|
||||||
'column_name' => 'PR0 RATA PREMIUM',
|
'column_name' => 'PRO RATA PREMIUM',
|
||||||
'db_column_name' => 'pro_rata_premium'
|
'db_column_name' => 'pro_rata_premium'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@ -921,13 +925,17 @@ class EmpDataServiceController extends BaseController
|
|||||||
$cash_balance['balance'] = $balance['opening_bal'];
|
$cash_balance['balance'] = $balance['opening_bal'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Calculate the total amount from the objects
|
// Calculate the total amount from the objects
|
||||||
$totals = 0;
|
$totals = 0;
|
||||||
foreach ($inceptionData as $item) {
|
foreach ($inceptionData as $item) {
|
||||||
$totals = $totals + $item->total;
|
$totals = $totals + $item->total;
|
||||||
}
|
}
|
||||||
|
|
||||||
$totals = round($totals, 2);
|
$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 (!empty($cash_balance)) {
|
if (!empty($cash_balance)) {
|
||||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
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.');
|
||||||
@ -936,6 +944,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->removeOldExportInfoFromBatchFile($export_data);
|
$this->removeOldExportInfoFromBatchFile($export_data);
|
||||||
|
|
||||||
|
|||||||
@ -445,15 +445,12 @@ class EmployeeController extends AdminController
|
|||||||
'actions' => $actions,
|
'actions' => $actions,
|
||||||
'file_name' => $file_name,
|
'file_name' => $file_name,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($actions == 'export') {
|
if ($actions == 'export') {
|
||||||
|
|
||||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception') {
|
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' || $event_type == 'missed_inception' || ($event_type == 'MultipleEvents' && $insurer_or_tpa == 'tpa')) {
|
||||||
|
|
||||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||||
|
|
||||||
if ($return === 0) {
|
if ($return === 0) {
|
||||||
|
|
||||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||||
return redirect()->to(base_url('employee/upload'));
|
return redirect()->to(base_url('employee/upload'));
|
||||||
|
|
||||||
@ -1111,6 +1108,7 @@ class EmployeeController extends AdminController
|
|||||||
$htmlContent = $tmplt_data;
|
$htmlContent = $tmplt_data;
|
||||||
|
|
||||||
$placeholders = [
|
$placeholders = [
|
||||||
|
'{CLIENT_NAME}' => $value['client_name'],
|
||||||
'{TPA_ID}' => $value['tpa_id'],
|
'{TPA_ID}' => $value['tpa_id'],
|
||||||
'{NAME}' => $value['name'],
|
'{NAME}' => $value['name'],
|
||||||
'{UHID}' => $value['uhid'],
|
'{UHID}' => $value['uhid'],
|
||||||
|
|||||||
@ -49,7 +49,7 @@ class Jobs extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$uuid = generate_uuid();
|
$uuid = generate_uuid();
|
||||||
$jobid = $jobModel->insert(['name' => $payload['job_name'],'uuid' => $uuid,'payload' => json_encode($payload['payload'])]);
|
$jobid = $jobModel->insert(['name' => $payload['job_name'],'uuid' => $uuid,'payload' => json_encode($payload['payload']), 'status' => isset($payload['status']) ? $payload['status'] : 'queued']);
|
||||||
// echo $jobid;
|
// echo $jobid;
|
||||||
$myLogger->logme('error','new job {jobid} added to queue',['jobid' => $jobid]);
|
$myLogger->logme('error','new job {jobid} added to queue',['jobid' => $jobid]);
|
||||||
return ['id' => $jobid,'uuid' => $uuid,'job_name' => $payload['job_name']];
|
return ['id' => $jobid,'uuid' => $uuid,'job_name' => $payload['job_name']];
|
||||||
|
|||||||
@ -157,6 +157,27 @@ class EmployeePolicyModel extends Model
|
|||||||
return $result->findAll();
|
return $result->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEmployeePolicyForEcard($policy_id = 0)
|
||||||
|
{
|
||||||
|
$result = $this->select([
|
||||||
|
'employee_polices.id'
|
||||||
|
])
|
||||||
|
->join('employees emp', 'employee_polices.employee_id = emp.id AND emp.relationship = "Self" ');
|
||||||
|
if ($policy_id !=0 && !empty($policy_id)) {
|
||||||
|
$result->where('employee_polices.client_policy_id', $policy_id);
|
||||||
|
}
|
||||||
|
// Always check these conditions
|
||||||
|
$result->where('employee_polices.is_active', 1)
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employee_polices.tpa_id is not null')
|
||||||
|
->where('emp.relationship','Self');
|
||||||
|
|
||||||
|
return $result->findAll();
|
||||||
|
// $result->findAll();
|
||||||
|
// print_r($this->db->getLastQuery());die();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//for emp onboard do not change
|
//for emp onboard do not change
|
||||||
public function checkExistingEmpPolicy($arr)
|
public function checkExistingEmpPolicy($arr)
|
||||||
{
|
{
|
||||||
@ -845,7 +866,7 @@ class EmployeePolicyModel extends Model
|
|||||||
e.doj,
|
e.doj,
|
||||||
e.band,
|
e.band,
|
||||||
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
||||||
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.') AS self,
|
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.' LIMIT 1) AS self,
|
||||||
|
|
||||||
|
|
||||||
ep.tpa_id,
|
ep.tpa_id,
|
||||||
@ -910,7 +931,7 @@ class EmployeePolicyModel extends Model
|
|||||||
e.doj,
|
e.doj,
|
||||||
e.band,
|
e.band,
|
||||||
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
||||||
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.') AS self,
|
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ' and client_id = '.$client_id.' LIMIT 1) AS self,
|
||||||
|
|
||||||
|
|
||||||
ep.tpa_id,
|
ep.tpa_id,
|
||||||
|
|||||||
@ -70,8 +70,13 @@ table.dataTable tbody td {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row justify-content-end">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-auto">
|
||||||
|
<!-- <div id="categoryFilter_12"> -->
|
||||||
|
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualEcard(this)">Send Ecard</a>
|
||||||
|
<!-- </div> -->
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
<a href="<?= base_url("employee/list"); ?>"
|
<a href="<?= base_url("employee/list"); ?>"
|
||||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||||
@ -371,4 +376,69 @@ document.getElementById('toggleIcon').addEventListener('click', function() {
|
|||||||
icon.classList.toggle('mdi-chevron-up');
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function sendManualEcard(input)
|
||||||
|
{
|
||||||
|
console.log('sendManualEcard function called');
|
||||||
|
|
||||||
|
var client_id = $('#clients').val()
|
||||||
|
var client_branch_id = $('#branch_id').val()
|
||||||
|
var policy_id = $('#policies').val()
|
||||||
|
|
||||||
|
console.log('input', input);
|
||||||
|
console.log('client_id', client_id);
|
||||||
|
console.log('client_branch_id', client_branch_id);
|
||||||
|
|
||||||
|
if(client_id == 0 || client_branch_id == 0 || policy_id == 0)
|
||||||
|
{
|
||||||
|
Swal.fire({
|
||||||
|
title: "warning!",
|
||||||
|
text: 'Please select the Client, Client Branch and Policy.',
|
||||||
|
icon: "warning"
|
||||||
|
});
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Do you want to send Ecard Mail?",
|
||||||
|
showDenyButton: true,
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonText: "Yes,Send",
|
||||||
|
denyButtonText: "Don't Send"
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: '<?= base_url("util/send_manual_ecard/") ?>' + client_id + '/' + client_branch_id+'/'+policy_id,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
console.log('send_manual_ecard', res)
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(res.status == false){
|
||||||
|
toastr.info(res.message, 'INFO');
|
||||||
|
}else{
|
||||||
|
toastr.success(res.message, 'SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Swal.fire("Saved!", "", "success");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -66,7 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-1">
|
<div class="col-1">
|
||||||
<div id="categoryFilter_11">
|
<div id="categoryFilter_11">
|
||||||
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Search</a>
|
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);"><i class="fa fa-search" aria-hidden="true"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
@ -74,17 +74,22 @@
|
|||||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
|
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-1">
|
||||||
<div id="categoryFilter_13">
|
<div id="categoryFilter_13">
|
||||||
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" >Upload File</a>
|
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" ><i class="fas fa-file-upload" ></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
|
<!-- <div class="row" style="margin-bottom: 44px;"> -->
|
||||||
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
|
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
|
||||||
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;">
|
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;">
|
||||||
Status <i id="toggleIcon" class="fas fa-minus"></i>
|
Status <i id="toggleIcon" class="fas fa-minus"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body status-option" id="statusContent" style="padding: 1.5rem !important;background-color: darkgrey;">
|
<div class="card-body status-option" id="statusContent" style="padding: 1.5rem !important;background-color: darkgrey;">
|
||||||
|
|
||||||
@ -713,6 +718,16 @@
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Do you want to send reminder mail?",
|
||||||
|
showDenyButton: true,
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonText: "Yes,Send",
|
||||||
|
denyButtonText: "Don't Send"
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id,
|
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@ -738,6 +753,9 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Swal.fire("Saved!", "", "success");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user