From 8d3ba5376cae360fb58b6f1dcc544b6fae7d4593 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 9 May 2024 12:12:01 +0530 Subject: [PATCH] FIX_INCEPTION_TYPE_CHANGE_1_SWITCH_OFF_2_SWITCH_ON : RV --- app/Controllers/EmpDataServiceController.php | 18 +++++++++++++++--- app/Views/client_policy.php | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 5e1a1adb..123e741f 100644 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -27,6 +27,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Reader\Exception as SpreadsheetReaderException; +use PhpParser\Node\Expr\Cast\Double; use function PHPUnit\Framework\returnSelf; @@ -108,16 +109,27 @@ class EmpDataServiceController extends BaseController { // Fetch employee data for export from the database $objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data); + + $insurer_id = $this->clientPolicyModel->where('id', $export_data['client_policy_id'])->first(); - // dd($objects); - + $cash_balance = $this->clientDepositModel->where('client_id',$export_data['client_id'] )->where('insurer_id', $insurer_id['insurer_id'])->orderBy('id', 'DESC')->first(); + + $totals = 0; foreach ($objects as $key => $value) { $totals += $value->total; } - + // dd((Double) $totals, $insurer_id['insurer_id'], (Double) $cash_balance['balance']); + + if((int) $totals < (int) $cash_balance['balance']){ + + dd($totals, $insurer_id['insurer_id'], $cash_balance['balance']); + } + + dd($totals); + // Log the count of exported data $count = count($objects); $export_data['count'] = $count; diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index ff519275..e9174cf8 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -634,7 +634,7 @@ $('#policy_status').val(checkDateStatus(res.data.policy_end_date)); $('#policy_status_field').show(); - if (res.data.inception_type == 1) { + if (res.data.inception_type == 2) { $('#inception_type').prop('checked', true); } else { $('#inception_type').prop('checked', false);