Depends on where you'd want to apply this, but it would be something like this:
inventBatch.inventBatchId = codeforyourspecificformat;
inventBatch.itemId = _itemId;
// since you create it manually through code, it could result in a duplicate, so check this:
if (InventBatch::exist(inventBatch.itemId, inventBatch.inventBatchId))
error("Batchnumber already exists");
else
inventBatch.insert();
You can of course extend the filling of the other variables on the batch as you wish.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,353 Super User 2024 Season 2
Martin Dráb 228,251 Most Valuable Professional
nmaenpaa 101,148