diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 08f9a9b6..961e5e66 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -119,6 +119,21 @@ class StockController extends BaseController $postData=$this->request->getPost(); + + $date = $postData['date']; + $shift = $postData['shift']; + + $sameShiftOnDateExists = $this->coatingMachineDetails_model + ->where('date',$date) + ->where('shift',$shift) + ->where('is_active',1) + ->first(); + + if(!empty($sameShiftOnDateExists)){ + + return redirect()->back()->with('error', 'Already same shift exists on the same date ..!!'); + } + $inserted= $this->coatingMachineDetails_model->insert($postData); @@ -496,15 +511,16 @@ class StockController extends BaseController foreach($updateDustAndRoughStockDetailsData as $data){ - $date = $data['date']; + $data['date'] = DateTime::createFromFormat('d-m-Y', $data['date'])->format('Y-m-d'); + + $date =$data['date']; $dbData= [ 'date' => $data['date'], 'finalRough' => $data['finalRough'], 'dust' => $data['dust'], 'total' => $data['total'] - - ]; + ]; $resultExists=$this->dustAndRoughStockDetails_model ->where('date',$date) diff --git a/app/Views/CoatingMachineDetail.php b/app/Views/CoatingMachineDetail.php index 931c0821..d49fb781 100644 --- a/app/Views/CoatingMachineDetail.php +++ b/app/Views/CoatingMachineDetail.php @@ -194,6 +194,11 @@ + getFlashdata('error')): ?> +