Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme
This commit is contained in:
commit
1126731c5a
@ -470,6 +470,10 @@ class StockController extends BaseController
|
|||||||
|
|
||||||
$updateDustAndRoughStockDetailsData = json_decode($postData['updateDustAndRoughStockDetails'], true);
|
$updateDustAndRoughStockDetailsData = json_decode($postData['updateDustAndRoughStockDetails'], true);
|
||||||
|
|
||||||
|
$updates = [];
|
||||||
|
|
||||||
|
$inserts = [];
|
||||||
|
|
||||||
foreach($updateDustAndRoughStockDetailsData as $data){
|
foreach($updateDustAndRoughStockDetailsData as $data){
|
||||||
|
|
||||||
$date = $data['date'];
|
$date = $data['date'];
|
||||||
@ -485,18 +489,31 @@ class StockController extends BaseController
|
|||||||
$resultExists=$this->dustAndRoughStockDetails_model
|
$resultExists=$this->dustAndRoughStockDetails_model
|
||||||
->where('date',$date)
|
->where('date',$date)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
||||||
if(empty($resultExists)){
|
if (empty($resultExists)) {
|
||||||
$inserted = $this->dustAndRoughStockDetails_model->insert($dbData);
|
$inserts[] = $dbData;
|
||||||
}else{
|
|
||||||
$updated=$this->dustAndRoughStockDetails_model
|
} else {
|
||||||
->where('date',$date)
|
$updates[] = $dbData;
|
||||||
->set($dbData)
|
}
|
||||||
->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($inserts)) {
|
||||||
|
$this->dustAndRoughStockDetails_model->insertBatch($inserts);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($updates)) {
|
||||||
|
|
||||||
|
$updateResult = $this->dustAndRoughStockDetails_model->updateBatch($updates, 'date');
|
||||||
|
|
||||||
|
if ($updateResult === FALSE) {
|
||||||
|
echo "Error during update";
|
||||||
|
} else {
|
||||||
|
echo "Data Updated Successfully";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
echo "Data Saved Successfully";
|
echo "Data Saved Successfully";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user