diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index db8be45b..39b4bdea 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -2102,7 +2102,7 @@ class PolicyTransactionController extends BaseController //insurer statement list page public function statementList() { - // dd($this->validateInsurerStatement(['file_id' => 49])); // for check validateInsurerStatementfunction with hard coded file id always un command + // dd($this->updateInsurerStatement(['file_id' => 133])); // for check validateInsurerStatementfunction with hard coded file id always un command $data['insurers'] = $this->insurerModel->where('is_active',1)->findAll(); $today = date('Y-m-d'); $fromday = $from_date = date('Y-m-d', strtotime('-180 days', strtotime($today))); @@ -2347,13 +2347,13 @@ class PolicyTransactionController extends BaseController // $excel_row = ExcelSanitizeHelper::sanitizeArrayData($excel_row); $is_source_found = 0; // Kint::dump($excel_key,$excel_row[1],$excel_row[2]); - $policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]); //policy_start_date from excel - $policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]); //policy_end_date from excel + // $policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]); //policy_start_date from excel + // $policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]); //policy_end_date from excel $policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]); //policy_end_date from excel $policy_no = preg_replace( '/[\x{200B}\x{200C}\x{200D}\x{FEFF}\x{00A0}\x{200E}\x{200F}\x{202A}-\x{202E}]/u', '', $excel_row[1]); //policy_end_date from excel - $client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]); //clientname from excel + // $client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]); //clientname from excel $endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]); //policy_end_date from excel $endorsement_no = preg_replace( '/[\x{200B}\x{200C}\x{200D}\x{FEFF}\x{00A0}\x{200E}\x{200F}\x{202A}-\x{202E}]/u', '', $excel_row[2]); //policy_end_date from excel @@ -2459,11 +2459,11 @@ class PolicyTransactionController extends BaseController if (!$is_row_empty) { $is_source_found = 0; - $policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]); //policy_start_date from excel - $policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]); //policy_end_date from excel + // $policy_start_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[4]); //policy_start_date from excel + // $policy_end_date = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[5]); //policy_end_date from excel $policy_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[1]); //policy_end_date from excel $policy_no = preg_replace('/[\x{200C}\x{200B}]/u', '', $excel_row[1]); // - $client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]); //clientname from excel + // $client_name = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[3]); //clientname from excel $endorsement_no = preg_replace('/^\p{Z}+|\p{Z}+$/u', '', $excel_row[2]); //policy_end_date from excel foreach ($source_data as $source_key => $source_row) { @@ -2476,9 +2476,10 @@ class PolicyTransactionController extends BaseController //calculate percentage first $total_amt = 0; - $actual_bp_per = trim($excel_row[9]); - $actual_bp_brokerage = trim($excel_row[12]); - $actual_bp_amt = trim($excel_row[6]); + // $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]); if (($actual_bp_brokerage && $actual_bp_brokerage != 0 && $actual_bp_brokerage != "")) { $total_amt += $actual_bp_brokerage; @@ -2491,9 +2492,10 @@ class PolicyTransactionController extends BaseController $total_amt += $actual_bp_brokerage; } - $actual_tp_per = trim($excel_row[10]); - $actual_tp_brokerage = trim($excel_row[13]); - $actual_tp_amt = trim($excel_row[7]); + // $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]); if ($actual_tp_brokerage && $actual_tp_brokerage != 0 && $actual_tp_brokerage != "") { $total_amt += $actual_tp_brokerage; @@ -2506,9 +2508,13 @@ class PolicyTransactionController extends BaseController $total_amt += $actual_tp_brokerage; } - $actual_tep_per = trim($excel_row[11]); - $actual_tep_brokerage = trim($excel_row[14]); - $actual_tep_amt = trim($excel_row[8]); + // $actual_tep_per = trim($excel_row[11]); + // $actual_tep_brokerage = trim($excel_row[14]); + // $actual_tep_amt = trim($excel_row[8]); + + $actual_tep_per = 0; + $actual_tep_brokerage = 0; + $actual_tep_amt = 0; if ($actual_tep_brokerage && $actual_tep_brokerage != 0 && $actual_tep_brokerage != "") { $total_amt += $actual_tep_brokerage; @@ -2524,7 +2530,7 @@ class PolicyTransactionController extends BaseController //find variance $variance_amt = $source_row['exp_amt'] - $total_amt; - $data_to_update[] = ['co_share_id' => $source_row['id'], 'actual_bp_amt' => $actual_bp_amt, 'actual_tp_amt' => $actual_tp_amt, 'actual_tep_amt' => $actual_tep_amt, 'actual_bp_per' => $actual_bp_per, 'actual_tp_per' => $actual_tp_per, 'actual_tep_per' => $actual_tep_per, 'variance' => $variance_amt, 'actual_tep_brokerage_amt' => $actual_tep_brokerage, 'actual_tp_brokerage_amt' => $actual_tp_brokerage, 'actual_bp_brokerage_amt' => $actual_bp_brokerage, 'reward' => trim($excel_row[15]), 'statement_id' => $file_id]; + $data_to_update[] = ['co_share_id' => $source_row['id'], 'actual_bp_amt' => $actual_bp_amt, 'actual_tp_amt' => $actual_tp_amt, 'actual_tep_amt' => $actual_tep_amt, 'actual_bp_per' => $actual_bp_per, 'actual_tp_per' => $actual_tp_per, 'actual_tep_per' => $actual_tep_per, 'variance' => $variance_amt, 'actual_tep_brokerage_amt' => $actual_tep_brokerage, 'actual_tp_brokerage_amt' => $actual_tp_brokerage, 'actual_bp_brokerage_amt' => $actual_bp_brokerage, 'reward' => trim($excel_row[7]), 'statement_id' => $file_id]; unset($source_data[$source_key]); continue 2; diff --git a/public/sample_excel/insurer_stament_sample.xlsx b/public/sample_excel/insurer_stament_sample.xlsx index 0cdabdf1..2c01d7fe 100644 Binary files a/public/sample_excel/insurer_stament_sample.xlsx and b/public/sample_excel/insurer_stament_sample.xlsx differ diff --git a/public/sample_excel/insurer_stament_sample_old.xlsx b/public/sample_excel/insurer_stament_sample_old.xlsx new file mode 100644 index 00000000..0cdabdf1 Binary files /dev/null and b/public/sample_excel/insurer_stament_sample_old.xlsx differ