diff --git a/web/src/pages/CheckIn.jsx b/web/src/pages/CheckIn.jsx index 633e048..4e88dcb 100644 --- a/web/src/pages/CheckIn.jsx +++ b/web/src/pages/CheckIn.jsx @@ -44,7 +44,8 @@ export default function CheckIn() { setResults([]); resetLookup(); const opts = buildUnitOptions(p, units); - setUnit(p.unit_name || (opts[0] && opts[0].value) || ""); + // Gibt es ein Gebinde (Glas, Packung, …), ist das die naheliegende Eingabe. + setUnit(p.package_size ? "package" : (p.unit_name || (opts[0] && opts[0].value) || "")); setLines([emptyLine()]); setLocationId(""); } diff --git a/web/src/pages/CheckOut.jsx b/web/src/pages/CheckOut.jsx index 4799ae0..13f2b26 100644 --- a/web/src/pages/CheckOut.jsx +++ b/web/src/pages/CheckOut.jsx @@ -29,7 +29,8 @@ export default function CheckOut() { setLotId(""); setQuantity(""); const opts = buildUnitOptions(p, units); - setUnit(p.unit_name || (opts[0] && opts[0].value) || ""); + // Gibt es ein Gebinde (Glas, Packung, …), ist das die naheliegende Eingabe. + setUnit(p.package_size ? "package" : (p.unit_name || (opts[0] && opts[0].value) || "")); try { setLots(await api.listLots(p.id)); } catch { setLots([]); } @@ -88,6 +89,14 @@ export default function CheckOut() { const unitOpts = product ? buildUnitOptions(product, units) : []; const selectedLot = lots.find((l) => String(l.id) === String(lotId)) || null; const baseShort = product ? unitShort(product.base_unit) : ""; + const pkgSize = product?.package_size || 0; + const pkgLabel = product?.package_label || "Packung"; + + // Chargenmenge in der Artikeleinheit (Gebinde), sonst in der Produkteinheit. + function lotAmount(q) { + if (pkgSize > 0) return `${fmt(q / pkgSize)} ${pkgLabel}`; + return `${fmt(q / (product?.unit_factor || 1))} ${product?.unit_name || baseShort}`; + } return (