30 lines
1.5 KiB
Plaintext
30 lines
1.5 KiB
Plaintext
The Qty Req. (Units) for each packing/component row is auto-calculated in recalcMaterials() (work-order.html:369-371) whenever Total Units, Std Qty/Unit, or Ovg% changes:
|
||
|
||
|
||
total = Std Qty/Unit × Total Units × (1 + Ovg% / 100)
|
||
|
||
if the item is a ROLL item (name contains "<number> MTR", e.g. "PRINTED FILM 50 MTR"):
|
||
Qty Req. (Units) = ceil(total / roll length) ← total metres needed ÷ metres per roll, rounded UP
|
||
else (a discrete-count item — caps, boxes, labels, etc.):
|
||
Qty Req. (Units) = round(total) ← rounded to nearest whole unit
|
||
Details on the inputs:
|
||
|
||
Std Qty/Unit (work-order.html:204) accepts a plain number or a fraction like 1/2 (parsed as n/d).
|
||
Roll length (work-order.html:207) is pulled straight out of the component's name — it regex-matches \d+ MTR (case-insensitive), so an item named e.g. LDPE FILM 100 MTR is treated as a 100-metre roll; if no MTR pattern is found, rl=0 and it falls to the plain rounding path.
|
||
If you manually type directly into the Qty Req. field, that row gets flagged _manual=true and the auto-calc skips it from then on — it only resumes auto-computing once you edit Std Qty/Unit, Ovg%, or UOM again.
|
||
This is the same for both the separate "Packing Materials" table and the simplified single "Components" table (singleTableMode, when no raw material was found) — they share the same _pack array and formula.
|
||
|
||
now Qty Req. (Units) = round(Std Qty/Unit × Total Units × (1 + Ovg%/100))
|
||
|
||
|
||
log1
|
||
prod1
|
||
prod2 - manager
|
||
store1
|
||
qa1
|
||
qa2 - manager
|
||
qc - manager
|
||
|
||
123456
|
||
|