changes in stock controller
This commit is contained in:
parent
f5c899f29b
commit
864a6f62ac
@ -120,6 +120,21 @@ class StockController extends BaseController
|
|||||||
$postData=$this->request->getPost();
|
$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);
|
$inserted= $this->coatingMachineDetails_model->insert($postData);
|
||||||
|
|
||||||
if ($inserted) {
|
if ($inserted) {
|
||||||
@ -496,15 +511,16 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
foreach($updateDustAndRoughStockDetailsData as $data){
|
foreach($updateDustAndRoughStockDetailsData as $data){
|
||||||
|
|
||||||
$date = $data['date'];
|
$data['date'] = DateTime::createFromFormat('d-m-Y', $data['date'])->format('Y-m-d');
|
||||||
|
|
||||||
|
$date =$data['date'];
|
||||||
|
|
||||||
$dbData= [
|
$dbData= [
|
||||||
'date' => $data['date'],
|
'date' => $data['date'],
|
||||||
'finalRough' => $data['finalRough'],
|
'finalRough' => $data['finalRough'],
|
||||||
'dust' => $data['dust'],
|
'dust' => $data['dust'],
|
||||||
'total' => $data['total']
|
'total' => $data['total']
|
||||||
|
];
|
||||||
];
|
|
||||||
|
|
||||||
$resultExists=$this->dustAndRoughStockDetails_model
|
$resultExists=$this->dustAndRoughStockDetails_model
|
||||||
->where('date',$date)
|
->where('date',$date)
|
||||||
|
|||||||
@ -194,6 +194,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (session()->getFlashdata('error')): ?>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<?= session()->getFlashdata('error'); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@ -250,7 +255,11 @@
|
|||||||
?>
|
?>
|
||||||
<tr data-id="<?php echo $record['id']; ?>">
|
<tr data-id="<?php echo $record['id']; ?>">
|
||||||
|
|
||||||
<td class="celda_normal"><?php echo $record['date'] ?></td>
|
<?php
|
||||||
|
$date = DateTime::createFromFormat('Y-m-d', $record['date'])->format('d-m-Y');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<td class="celda_normal"><?php echo $date ?></td>
|
||||||
<td class="celda_normal"><?php echo $record['shift'] ?></td>
|
<td class="celda_normal"><?php echo $record['shift'] ?></td>
|
||||||
<td class="celda_normal"><?php echo $record['machineOnTime'] ?></td>
|
<td class="celda_normal"><?php echo $record['machineOnTime'] ?></td>
|
||||||
<td class="celda_normal"><?php echo $record['machineOffTime'] ?></td>
|
<td class="celda_normal"><?php echo $record['machineOffTime'] ?></td>
|
||||||
@ -708,7 +717,8 @@
|
|||||||
|
|
||||||
// Get values from the row
|
// Get values from the row
|
||||||
|
|
||||||
var date = row.find('td:eq(0)').text();
|
var date = row.find('td:eq(0)').text().split('-');
|
||||||
|
date=`${date[2]}-${date[1]}-${date[0]}`;
|
||||||
var shift = row.find('td:eq(1)').text();
|
var shift = row.find('td:eq(1)').text();
|
||||||
var machineOnTimeHr = row.find('td:eq(2)').text();
|
var machineOnTimeHr = row.find('td:eq(2)').text();
|
||||||
var machineOffTimeHr = row.find('td:eq(3)').text();
|
var machineOffTimeHr = row.find('td:eq(3)').text();
|
||||||
@ -723,9 +733,10 @@
|
|||||||
|
|
||||||
// Fill the modal fields with the values
|
// Fill the modal fields with the values
|
||||||
|
|
||||||
|
|
||||||
$('#editCoatingMachineDetailId').val(row.data('id'));
|
$('#editCoatingMachineDetailId').val(row.data('id'));
|
||||||
$('#editCustomerNameId').val(customerName);
|
$('#editCustomerNameId').val(customerName);
|
||||||
$('#editDateId').val(date);
|
$('#editDateId').val(date);//convert this from d-m-y to Y-m-d in javascript
|
||||||
$('#editShiftId').val(shift);
|
$('#editShiftId').val(shift);
|
||||||
$('#editMachineOnTimeHrId').val(machineOnTimeHr).change();
|
$('#editMachineOnTimeHrId').val(machineOnTimeHr).change();
|
||||||
$('#editMachineOffTimeHrId').val(machineOffTimeHr).change();
|
$('#editMachineOffTimeHrId').val(machineOffTimeHr).change();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user