Gas stock details changes-2 vadivel J 28-11-2024
This commit is contained in:
parent
1fb9adb241
commit
12463ca78b
@ -136,6 +136,7 @@ class StockController extends BaseController
|
||||
{
|
||||
$message1 = '';
|
||||
$message2 = '';
|
||||
$message3 = '';
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
$month = $this->request->getGet('month');
|
||||
@ -187,8 +188,11 @@ class StockController extends BaseController
|
||||
}
|
||||
$this->db->transCommit();
|
||||
|
||||
$message3 ="Kindly Update the next month Gas Stock If older month Gas Stock Updated..!!";
|
||||
|
||||
// Set flashdata for success message
|
||||
return redirect()->to("/coatingMachineDetails?month=$month")->with('success', $message1 . " " . $message2);
|
||||
return redirect()->to("/coatingMachineDetails?month=$month")
|
||||
->with('success', $message1 . " " . $message2 ." ".$message3);
|
||||
|
||||
} catch (\Exception $error) {
|
||||
$this->db->transRollback();
|
||||
@ -202,6 +206,7 @@ class StockController extends BaseController
|
||||
{
|
||||
$message1 = '';
|
||||
$message2 = '';
|
||||
$message3 = '';
|
||||
|
||||
$putData = $this->request->getPost();
|
||||
$month = $this->request->getGet('month');
|
||||
@ -232,6 +237,8 @@ class StockController extends BaseController
|
||||
}
|
||||
$message2 = 'And updated gas stock consumption.';
|
||||
|
||||
$message3 ="Kindly Update the next month Gas Stock If older month Gas Stock Updated..!!";
|
||||
|
||||
}
|
||||
// Commit the transaction if all queries succeed
|
||||
|
||||
@ -245,7 +252,8 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
// Set flashdata for success message
|
||||
return redirect()->to("/coatingMachineDetails?month=$month")->with('success', $message1 . " " . $message2);
|
||||
return redirect()->to("/coatingMachineDetails?month=$month")
|
||||
->with('success', $message1 . " " . $message2 ." " . $message3);
|
||||
|
||||
} else {
|
||||
throw new \Exception('Failed to update Coating machine details.');
|
||||
@ -988,8 +996,6 @@ class StockController extends BaseController
|
||||
|
||||
foreach ($resultExists as $index => $result) {
|
||||
|
||||
$count++;
|
||||
|
||||
if ($index == 0) {
|
||||
$result['consumption'] = $result['consumption'] + ($consumption);
|
||||
$result['total'] = $result['opening'] + $result['purchaseBharath'] + $result['purchaseIndian'];
|
||||
@ -1182,6 +1188,8 @@ class StockController extends BaseController
|
||||
return;
|
||||
}
|
||||
|
||||
$message1 = '';
|
||||
|
||||
$this->db->transBegin();
|
||||
|
||||
try {
|
||||
@ -1239,18 +1247,24 @@ class StockController extends BaseController
|
||||
|
||||
if (!empty($inserts)) {
|
||||
$this->drierMachineDetails_model->insertBatch($inserts);
|
||||
|
||||
$message3 ="Kindly Update the next month Gas Stock If older month Gas Stock Updated..!!";
|
||||
}
|
||||
|
||||
if (!empty($updates)) {
|
||||
$this->drierMachineDetails_model->updateBatch($updates, 'id');
|
||||
|
||||
$message3 ="Kindly Update the next month Gas Stock If older month Gas Stock Updated..!!";
|
||||
}
|
||||
|
||||
if ($this->db->transStatus() === false) {
|
||||
throw new \Exception('Transaction failed due to database error.');
|
||||
}
|
||||
$this->db->transCommit();
|
||||
echo "Data successfully saved.";
|
||||
|
||||
}
|
||||
|
||||
$this->db->transCommit();
|
||||
echo "Data successfully saved. $message1";
|
||||
} catch (\Exception $e) {
|
||||
// Rollback the transaction on any failure
|
||||
$this->db->transRollback();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user