changes in stock module -vadivel j
This commit is contained in:
parent
6cd49c4142
commit
f5c899f29b
@ -387,6 +387,9 @@ class StockController extends BaseController
|
||||
|
||||
$updateBagStockDetailsData = json_decode($postData['updateBagStockDetails'], true);
|
||||
|
||||
$inserts = [];
|
||||
$updates = [];
|
||||
|
||||
foreach($updateBagStockDetailsData as $data){
|
||||
|
||||
$date = $data['date'];
|
||||
@ -409,20 +412,32 @@ class StockController extends BaseController
|
||||
->first();
|
||||
|
||||
|
||||
if(!empty($resultExists)){
|
||||
|
||||
$updated=$this->bagStockDetails_model
|
||||
->where('date',$date)
|
||||
->where('materialCode',$materialCode)
|
||||
->set($dbData)
|
||||
->update();
|
||||
|
||||
if(empty($resultExists)){
|
||||
$inserts [] = $dbData;
|
||||
|
||||
}else{
|
||||
$inserted = $this->bagStockDetails_model->insert($dbData);
|
||||
}
|
||||
|
||||
}
|
||||
$dbData['id']=$resultExists['id'];
|
||||
$updates [] = $dbData;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($inserts)){
|
||||
$inserted = $this->bagStockDetails_model->insertBatch($inserts);
|
||||
}
|
||||
if(!empty($updates)){
|
||||
|
||||
$updateResult = $this->bagStockDetails_model->updateBatch($updates,'id');
|
||||
|
||||
if ($updateResult === FALSE) {
|
||||
echo "Error during update";
|
||||
} else {
|
||||
echo "Data Updated Successfully";
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "Data Saved Successfully";
|
||||
|
||||
}
|
||||
@ -502,7 +517,7 @@ class StockController extends BaseController
|
||||
} else {
|
||||
$updates[] = $dbData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($inserts)) {
|
||||
$this->dustAndRoughStockDetails_model->insertBatch($inserts);
|
||||
@ -662,7 +677,8 @@ class StockController extends BaseController
|
||||
if(empty($resultExists)){
|
||||
$inserts[] = $dbData;
|
||||
}else{
|
||||
$updates[] = $dbData;
|
||||
$dbData['id']=$resultExists['id'];
|
||||
$updates[] = $dbData ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@
|
||||
|
||||
<!-- Add table-responsive for horizontal scroll -->
|
||||
<div class="table-responsive">
|
||||
<table id="incomingSilicaSandDetailsTable" class="fht-table " style="font-size: small;">
|
||||
<table id="incomingSilicaSandDetailsTable" class="fht-table table table-striped " >
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@ -266,7 +266,7 @@
|
||||
<tr id="<?php echo $row; ?>">
|
||||
|
||||
<!-- 'td:eq(0)' -->
|
||||
<td width="45" height="45" class="celda_normal"><?php echo $index; ?></td>
|
||||
<td class="celda_normal"><?php echo $index; ?></td>
|
||||
|
||||
<!-- 'td:eq(1)' -->
|
||||
<td class="celda_normal">
|
||||
|
||||
@ -261,7 +261,7 @@
|
||||
|
||||
<?php if(!empty($groupedResinStockDetails))
|
||||
{
|
||||
//dd($groupedBagStockDetails);
|
||||
//dd($groupedResinStockDetails);
|
||||
foreach($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails){
|
||||
?>
|
||||
<tr>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user