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("sentTestMail/(:any)", "NotificationController::sentTestMail/$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_branch_data/(:any)", "ClientController::get_client_branch_data/$1");
|
||||
$routes->get("getLevelContects", "LeadsController::getLevelContects");
|
||||
|
||||
@ -20,6 +20,7 @@ use App\Models\ClientPolicyModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Controllers\PendingActionsContrller;
|
||||
use App\Controllers\EmpDataServiceController;
|
||||
|
||||
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){
|
||||
|
||||
$groupedData = [
|
||||
|
||||
@ -168,19 +168,23 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
}
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($objects as $item) {
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
|
||||
$totals = round($totals, 2);
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
return 0;
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($objects as $item) {
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
|
||||
$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 ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,7 +412,7 @@ class EmpDataServiceController extends BaseController
|
||||
],
|
||||
[
|
||||
'column_index' => 18,
|
||||
'column_name' => 'PR0 RATA PREMIUM',
|
||||
'column_name' => 'PRO RATA PREMIUM',
|
||||
'db_column_name' => 'pro_rata_premium'
|
||||
],
|
||||
[
|
||||
@ -921,18 +925,23 @@ class EmpDataServiceController extends BaseController
|
||||
$cash_balance['balance'] = $balance['opening_bal'];
|
||||
}
|
||||
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($inceptionData as $item) {
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
|
||||
|
||||
$totals = round($totals, 2);
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
return 0;
|
||||
// Calculate the total amount from the objects
|
||||
$totals = 0;
|
||||
foreach ($inceptionData as $item) {
|
||||
$totals = $totals + $item->total;
|
||||
}
|
||||
$totals = round($totals, 2);
|
||||
|
||||
if($export_data['insurer_or_tpa'] != 'tpa')// check overal emp premium amt with cd balance only for insurer export, not tpa export
|
||||
{
|
||||
if (!empty($cash_balance)) {
|
||||
if ((int) $cash_balance['balance'] < (int) $totals) {
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount.');
|
||||
$this->myLogger->logme('error', 'Inception export failed due to insufficient deposit amount. CASH BALANCE : {balance} and TOTAL AMOUNT : {total}', ['balance' => $cash_balance['balance'], 'total' => $totals]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,28 +445,25 @@ class EmployeeController extends AdminController
|
||||
'actions' => $actions,
|
||||
'file_name' => $file_name,
|
||||
];
|
||||
|
||||
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);
|
||||
if ($return === 0) {
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
if ($return === 0) {
|
||||
}else if($return === 5){
|
||||
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
else if($return === 6){
|
||||
|
||||
}else if($return === 5){
|
||||
|
||||
session()->setFlashdata('error', "The policy does not have a CD account number.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
else if($return === 6){
|
||||
|
||||
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
session()->setFlashdata('error', "The Insurer does not have an Excel export template format.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
|
||||
@ -1111,6 +1108,7 @@ class EmployeeController extends AdminController
|
||||
$htmlContent = $tmplt_data;
|
||||
|
||||
$placeholders = [
|
||||
'{CLIENT_NAME}' => $value['client_name'],
|
||||
'{TPA_ID}' => $value['tpa_id'],
|
||||
'{NAME}' => $value['name'],
|
||||
'{UHID}' => $value['uhid'],
|
||||
|
||||
@ -49,7 +49,7 @@ class Jobs extends AdminController
|
||||
}
|
||||
|
||||
$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;
|
||||
$myLogger->logme('error','new job {jobid} added to queue',['jobid' => $jobid]);
|
||||
return ['id' => $jobid,'uuid' => $uuid,'job_name' => $payload['job_name']];
|
||||
|
||||
@ -157,6 +157,27 @@ class EmployeePolicyModel extends Model
|
||||
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
|
||||
public function checkExistingEmpPolicy($arr)
|
||||
{
|
||||
@ -845,7 +866,7 @@ class EmployeePolicyModel extends Model
|
||||
e.doj,
|
||||
e.band,
|
||||
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,
|
||||
@ -910,7 +931,7 @@ class EmployeePolicyModel extends Model
|
||||
e.doj,
|
||||
e.band,
|
||||
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,
|
||||
|
||||
@ -70,8 +70,13 @@ table.dataTable tbody td {
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<div class="row justify-content-end">
|
||||
<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"); ?>"
|
||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
@ -371,4 +376,69 @@ document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
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>
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<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 class="col-2">
|
||||
@ -74,17 +74,22 @@
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="col-1">
|
||||
<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 class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
|
||||
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div class="row" style="margin-bottom: 44px;"> -->
|
||||
<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;">
|
||||
Status <i id="toggleIcon" class="fas fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card-body status-option" id="statusContent" style="padding: 1.5rem !important;background-color: darkgrey;">
|
||||
|
||||
@ -713,31 +718,44 @@
|
||||
return false
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
Swal.fire({
|
||||
title: "Do you want to send reminder mail?",
|
||||
showDenyButton: true,
|
||||
showCancelButton: false,
|
||||
confirmButtonText: "Yes,Send",
|
||||
denyButtonText: "Don't Send"
|
||||
}).then((result) => {
|
||||
|
||||
console.log('send_manual_reminder', res)
|
||||
if (result.isConfirmed) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
if(res.status == false){
|
||||
toastr.info(res.message, 'INFO');
|
||||
}else{
|
||||
toastr.success(res.message, 'SUCCESS');
|
||||
console.log('send_manual_reminder', 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');
|
||||
}
|
||||
|
||||
},
|
||||
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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user