diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f397284f..634252a7 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -783,5 +783,6 @@ $routes->group('commission', function($routes) { $routes->get('sample_file',"RuleImportController::downloadSampleCommissionFileUploadExcel"); $routes->get('downloadErrorFile',"RuleImportController::downloadErrorFile"); $routes->get("deleteCommissionData/(:any)", "RuleImportController::deleteCommissionData/$1"); + $routes->get('checkSameEntry',"RuleImportController::checkSameEntry"); }); diff --git a/app/Controllers/RuleImportController.php b/app/Controllers/RuleImportController.php index d181284e..678e59c6 100644 --- a/app/Controllers/RuleImportController.php +++ b/app/Controllers/RuleImportController.php @@ -102,6 +102,7 @@ class RuleImportController extends AdminController $insurerId = $this->request->getPost('insurer_id'); $department = $this->request->getPost('department'); $commissionMonth = $this->request->getPost('commission_month'); + $overwrite = $this->request->getPost('overwrite') ?? 0; $createdBy = get_session_userid(); if (empty($insurerId) || empty($department) || empty($commissionMonth)) { @@ -424,5 +425,19 @@ class RuleImportController extends AdminController return $this->respond(['status' => true, 'code' => 200, 'message' => "File removed successfully"], 200); } + public function checkSameEntry() + { + $data = $this->request->getGet(); + $commissionMonth = $data['commission_month'] . '-01'; + $data['commission_month'] = change_date_format($commissionMonth, 'Y-M-d', 'Y-m-d'); + + $count = $this->commissionFilesModel->where($data)->where('is_active', 1)->countAllResults(); + if($count > 0){ + return $this->respond(['status' => true, 'code' => 200, 'data' => $count, 'message' => ""], 200); + }else{ + return $this->respond(['status' => false, 'code' => 404, 'data' => $count, 'message' => ""], 200); + } + } + } diff --git a/app/Views/commission_file_upload.php b/app/Views/commission_file_upload.php index 72fc1ca3..29961e3c 100644 --- a/app/Views/commission_file_upload.php +++ b/app/Views/commission_file_upload.php @@ -217,7 +217,7 @@