FIX_STMT_UPLOAD_INT_ISSUE

This commit is contained in:
VENKATESHWARAN 2025-11-11 18:38:57 +05:30
parent 0682a4ed70
commit 1dc56c325b
2 changed files with 84 additions and 68 deletions

View File

@ -5702,8 +5702,8 @@ class ClientController extends AdminController
// ---------- POLICY TRANSACTION CONTROLLER --------------------------------------------------------------------------------
$policyTransactionController = new PolicyTransactionController();
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '60']);
// $res = $policyTransactionController->updateInsurerStatement(['file_id' => '22']);
// $res = $policyTransactionController->validateInsurerStatement(['file_id' => '62']);
// $res = $policyTransactionController->updateInsurerStatement(['file_id' => '62']);
// dd('-----', $res);
// ----------EMP DATA SERVICE CONTROLLER--------------------------------------------------------------------------------

View File

@ -2510,6 +2510,7 @@
// check policy no,insurer and etc in DB for this month
// if all good return true, otherwise return false with messssage
$data_to_update = [];
try{
foreach ($excel_data as $excel_key => $excel_row) {
$is_row_empty = check_row_is_empty_or_null($excel_row);
if (!$is_row_empty) {
@ -2534,14 +2535,14 @@
// $actual_bp_per = trim($excel_row[9]); //commented becoz this filed removed tfrom excel file
$actual_bp_per = 0; //set default value 0 for maintaining existing code flow
$actual_bp_brokerage = trim($excel_row[5]);
$actual_bp_amt = trim($excel_row[3]);
$actual_bp_brokerage = (int) trim($excel_row[5]);
$actual_bp_amt = (int) trim($excel_row[3]);
if (($actual_bp_brokerage && $actual_bp_brokerage != 0 && $actual_bp_brokerage != "")) {
$total_amt += $actual_bp_brokerage;
//percentage reverse calculation
if (($actual_bp_per == 0 || $actual_bp_per == 0) && !empty($actual_bp_amt)) {
$actual_bp_per = round(($actual_bp_brokerage / $actual_bp_amt) * 100, 2);
$actual_bp_per = (int) round(($actual_bp_brokerage / $actual_bp_amt) * 100, 2);
}
} else {
$actual_bp_brokerage = $actual_bp_amt * ($actual_bp_per / 100);
@ -2550,14 +2551,14 @@
// $actual_tp_per = trim($excel_row[10]);//commented becoz this filed removed tfrom excel file
$actual_tp_per = 0;//set default value 0 for maintaining existing code flow
$actual_tp_brokerage = trim($excel_row[6]);
$actual_tp_amt = trim($excel_row[4]);
$actual_tp_brokerage = (int) trim($excel_row[6]);
$actual_tp_amt = (int) trim($excel_row[4]);
if ($actual_tp_brokerage && $actual_tp_brokerage != 0 && $actual_tp_brokerage != "") {
$total_amt += $actual_tp_brokerage;
//percentage reverse calculation
if (($actual_tp_per == 0 || $actual_tp_per == "") && !empty($actual_tp_amt)) {
$actual_tp_per = ($actual_tp_brokerage / $actual_tp_amt) * 100;
$actual_tp_per = (int) round(($actual_tp_brokerage / $actual_tp_amt) * 100, 2);
}
} else {
$actual_tp_brokerage = $actual_tp_amt * ($actual_tp_per / 100);
@ -2594,6 +2595,21 @@
}
}
}
}catch (\Throwable $th) {
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - updateInsurerStatement: Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
$errorData = [
'message' => $th->getMessage(),
'file' => $th->getFile(),
'line' => $th->getLine(),
'code' => $th->getCode(),
'trace' => $th->getTraceAsString(),
'trace_array' => $th->getTrace(), // full array version (optional)
'function' => $th->getTrace()[0]['function'] ?? null,
'class' => $th->getTrace()[0]['class'] ?? null,
];
return ['status' => 'failed', 'code' => 500, 'message' => $th->getMessage(), 'error_data' => $errorData];
}
// dd($data_to_update);
$this->coShareStmtDetailsModel->insertBatch($data_to_update, 'id');
// dd($data_to_update);