From 283dc369dfb538fa152910da0c72689fbb434457 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 12 Mar 2026 11:42:29 +0530 Subject: [PATCH] FIX_ISSUES --- app/Controllers/EmployeeRestController.php | 6 ++--- app/Controllers/EmployeeServiceController.php | 25 +++++++++++++++++++ .../BaseTpaClaimImportService.php | 3 ++- app/Models/PolicyTransactionModel.php | 23 +++++++++++++---- app/Models/TpaApiDataModel.php | 4 ++- 5 files changed, 51 insertions(+), 10 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 8d160ef5..40bbb7f9 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2421,16 +2421,16 @@ class EmployeeRestController extends AdminController $client_id = $client_data['id'] ?? null; } - $client_data = $this->clientPolicyModel + $client_policy_data = $this->clientPolicyModel ->where('client_id', $client_id) ->where('is_active', 1) ->groupBy('policy_type_id') ->findAll(); - + $data['ticket_type'] = []; $addedTypes = []; - foreach ($client_data as $value) { + foreach ($client_policy_data as $value) { if (in_array($value['policy_type_id'], [2,3,4,5]) && !in_array('1', $addedTypes)) { $data['ticket_type'][] = ["ticket_type" => "1", "type_name" => "Claim-GMC"]; diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index bc4bfa7c..d6fa858f 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -2575,4 +2575,29 @@ class EmployeeServiceController extends AdminController return $result; } + + /** + * Returns the inception Excel column configuration used for + * validating and processing Employee Upload with Events files. + * This allows other controllers to generate compatible Excel files. + * + * @return array + */ + public function getInceptionExcelColumns(): array + { + return $this->inception_excel_columns; + } + + /** + * Returns the correction Excel column configuration used for + * validating and processing Employee correction files. + * This is reused by other controllers when they need to generate + * a correction-compatible Excel programmatically. + * + * @return array + */ + public function getCorrectionExcelColumns(): array + { + return $this->correction_excel_columns; + } } \ No newline at end of file diff --git a/app/Libraries/TPAClaimsImportServices/BaseTpaClaimImportService.php b/app/Libraries/TPAClaimsImportServices/BaseTpaClaimImportService.php index 3ccbcadd..566bb703 100644 --- a/app/Libraries/TPAClaimsImportServices/BaseTpaClaimImportService.php +++ b/app/Libraries/TPAClaimsImportServices/BaseTpaClaimImportService.php @@ -368,7 +368,8 @@ abstract class BaseTpaClaimImportService return $value; } } - return null; + + return 61; } /** diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 20da8dec..514b63d2 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -3785,7 +3785,7 @@ $totalBilled[$key] = ($totalBilled[$key] ?? 0) + (float) ($row['billed_amt'] ?? 0); // Store total_irda_amt once - if (!isset($totalIrdaMap[$key]) && ($row['total_irda_amt'] ?? 0) > 0) { + if (!isset($totalIrdaMap[$key])) { $totalIrdaMap[$key] = (float) $row['total_irda_amt']; } @@ -3802,11 +3802,24 @@ foreach ($result as $row) { $ptId = $row['pt_id'].'-'.$row['insurer_id']; if (!isset($ptSeen[$ptId])) { + + $totalIrdaVal = $totalIrdaMap[$ptId] ?? 0; + $totalBilledVal = $totalBilled[$ptId] ?? 0; + $addMinus = false; + + if($totalIrdaVal < 0){ + $totalIrdaVal = abs($totalIrdaVal); + $totalBilledVal = abs($totalBilledVal); + $addMinus = true; + } + // First entry → set unbilled amount - $row['unbilled_amount'] = round( - (float) (($totalIrdaMap[$ptId] ?? 0) - ($totalBilled[$ptId] ?? 0)), - 2 - ); + $row['unbilled_amount'] = round((float) ($totalIrdaVal - $totalBilledVal),2 ); + + if($addMinus){ + $row['unbilled_amount'] = ($row['unbilled_amount'] * -1); + } + $ptSeen[$ptId] = true; } else { // Other entries → zero diff --git a/app/Models/TpaApiDataModel.php b/app/Models/TpaApiDataModel.php index 50958fac..e63193b3 100644 --- a/app/Models/TpaApiDataModel.php +++ b/app/Models/TpaApiDataModel.php @@ -25,7 +25,9 @@ class TpaApiDataModel extends Model 'age', 'is_active', 'desc', - 'created_by' + 'created_by', + 'si', + 'doj' ]; // protected $useTimestamps = true;