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);
|
$updateBagStockDetailsData = json_decode($postData['updateBagStockDetails'], true);
|
||||||
|
|
||||||
|
$inserts = [];
|
||||||
|
$updates = [];
|
||||||
|
|
||||||
foreach($updateBagStockDetailsData as $data){
|
foreach($updateBagStockDetailsData as $data){
|
||||||
|
|
||||||
$date = $data['date'];
|
$date = $data['date'];
|
||||||
@ -409,20 +412,32 @@ class StockController extends BaseController
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
if(!empty($resultExists)){
|
if(empty($resultExists)){
|
||||||
|
$inserts [] = $dbData;
|
||||||
$updated=$this->bagStockDetails_model
|
|
||||||
->where('date',$date)
|
|
||||||
->where('materialCode',$materialCode)
|
|
||||||
->set($dbData)
|
|
||||||
->update();
|
|
||||||
|
|
||||||
}else{
|
}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";
|
echo "Data Saved Successfully";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -502,7 +517,7 @@ class StockController extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
$updates[] = $dbData;
|
$updates[] = $dbData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($inserts)) {
|
if (!empty($inserts)) {
|
||||||
$this->dustAndRoughStockDetails_model->insertBatch($inserts);
|
$this->dustAndRoughStockDetails_model->insertBatch($inserts);
|
||||||
@ -662,7 +677,8 @@ class StockController extends BaseController
|
|||||||
if(empty($resultExists)){
|
if(empty($resultExists)){
|
||||||
$inserts[] = $dbData;
|
$inserts[] = $dbData;
|
||||||
}else{
|
}else{
|
||||||
$updates[] = $dbData;
|
$dbData['id']=$resultExists['id'];
|
||||||
|
$updates[] = $dbData ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -211,7 +211,7 @@
|
|||||||
|
|
||||||
<!-- Add table-responsive for horizontal scroll -->
|
<!-- Add table-responsive for horizontal scroll -->
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="incomingSilicaSandDetailsTable" class="fht-table " style="font-size: small;">
|
<table id="incomingSilicaSandDetailsTable" class="fht-table table table-striped " >
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
@ -266,7 +266,7 @@
|
|||||||
<tr id="<?php echo $row; ?>">
|
<tr id="<?php echo $row; ?>">
|
||||||
|
|
||||||
<!-- 'td:eq(0)' -->
|
<!-- '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:eq(1)' -->
|
||||||
<td class="celda_normal">
|
<td class="celda_normal">
|
||||||
|
|||||||
@ -261,7 +261,7 @@
|
|||||||
|
|
||||||
<?php if(!empty($groupedResinStockDetails))
|
<?php if(!empty($groupedResinStockDetails))
|
||||||
{
|
{
|
||||||
//dd($groupedBagStockDetails);
|
//dd($groupedResinStockDetails);
|
||||||
foreach($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails){
|
foreach($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails){
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user