E
Asked
Hello,
I noticed that the system did not revising the Quantity value when deleting a transaction ( check-in or check-out).
For example:- I have Item X123 and current Quantity in stock = 50
1) - Create a check-in with Quantity of 10, then the Quantity in stock updated to 60 which is correct.
2) - Delete the above check-in entry completely, then the Quantity in stock remains 60 which is wrong because it should be updated to be 50
The same above scenario is applied to check-out.
Kindly advise,
Ehab
I noticed that the system did not revising the Quantity value when deleting a transaction ( check-in or check-out).
For example:- I have Item X123 and current Quantity in stock = 50
1) - Create a check-in with Quantity of 10, then the Quantity in stock updated to 60 which is correct.
2) - Delete the above check-in entry completely, then the Quantity in stock remains 60 which is wrong because it should be updated to be 50
The same above scenario is applied to check-out.
Kindly advise,
Ehab
- MSAnsweredHello,
Yes, SSM don't sync the quantity on delete check in/out. You can edit the `app/models/Check_in_model.php` & `app/models/Check_out_model.php` models and replace the `deleteIn` & `deleteStockOut` respectively with
```php
public function deleteIn($id = null)
{
$oitems = $this->getAllInItems($id);
if ($this->db->delete('check_in', ['id' => $id])) {
foreach ($oitems as $oitem) {
$product = $this->getItemByID($oitem->item_id);
$this->db->update('items', ['quantity' => ($product->quantity - $oitem->quantity)], ['id' => $product->id]);
}
return true;
}
return false;
}
```
and
```php
public function deleteStockOut($id = null)
{
$oitems = $this->getAllOutItems($id);
if ($this->db->delete('check_out', ['id' => $id])) {
foreach ($oitems as $oitem) {
$product = $this->getItemByID($oitem->item_id);
$this->db->update('items', ['quantity' => ($product->quantity + $oitem->quantity)], ['id' => $product->id]);
}
return true;
}
return false;
}
```
Thank you - EAnsweredHello,
Thank you for your reply, the quantity value sync in the perfect way after we applied your answer .
Regards. - Login to Reply