Lot, Serial, ExpiryDate

This commit is contained in:
Thanakorn S
2026-04-25 14:37:00 +07:00
parent 92d116fd21
commit 3cc5baba3f
35 changed files with 3518 additions and 1890 deletions
@@ -6,6 +6,27 @@
$id = (int)$data['id'];
// ── Business rule: min_stock < reorder_point ──────────────────────────
// The warning tier (balance between min_stock and reorder_point) only
// exists when min_stock is strictly less than reorder_point. Enforcing
// this invariant keeps the low-stock report meaningful.
$min_stock = (float) ($data['min_stock'] ?? 0);
$reorder_point = (float) ($data['reorder_point'] ?? 0);
if ($min_stock < 0 || $reorder_point < 0) {
$answer["success"] = 0;
$answer["message"] = "Min stock and reorder point cannot be negative.";
http_response_code(400);
exit(json_encode($answer));
}
if ($min_stock >= $reorder_point) {
$answer["success"] = 0;
$answer["message"] = "Min stock ({$min_stock}) must be less than reorder point ({$reorder_point}).";
http_response_code(400);
exit(json_encode($answer));
}
try {
/** 1. FILE HANDLING **/