T
Sign in

COSTING.md — the fabric costing & conversion engine (verified from the owner's sheet)

COSTING.md — the fabric costing & conversion engine (verified from the owner's sheet)

Source: the owner's Google Sheet "Calcn" (fabric costing). Every formula below was recomputed cell-by-cell against that sheet's values; the verification trace is at the bottom. This is the engine the system will implement for yarn kgs ↔ fabric mtrs and ₹/m costing.

1. Construction inputs (from the sheet, per construction)

Input Sheet value (example) Meaning
Reed 120 stock reed count = dents per 2" (EPI = Reed × Denting ÷ 2)
Denting 2 ends per dent, from the quality name (55/5*65 → 5; owner §250)
Pick 64 picks/inch (PPI)
Warp reed space 65" in-fabric width for warp → total ends = Reed × WarpReedSpace = 7800
Weft reed space 65" width used for weft quantity
Warp count 41 (Ne) "Warp Details-1 Count"
Weft count 41 (Ne) "Weft-1 Details Count"
Lasa 110 m warp allowance reference (see Q.2)
L 2 L 104 (m?) second warp-length reference (Q.2)
Sizing Wajan Vaad 10% size add-on on warp weight
Weft Waste 5% weft allowance
Other expenses 6.5% → 1% (C355) the company overhead: a share OF THE PRICE, grossed up; the quality master never feeds it (§252, C355 re-check)
Job rate 9 ps weaving charge (interpreted as ₹/100 picks, Q.7)
Sizing rate 23 ₹/kg (5% GST) sizing charge on warp kgs
Warping rate 0 warping charge per mtr
GLM / GSM targets 106.68 g/m · 70 gsm see Q.4 (width convention)

2. Weight formulas (verified)

ends           = Reed × WarpReedSpace × Denting / 2   (55/5 reed on 50" → 6875;
                 a 137.5-EPI reed with denting 2 gives the same 6875)
warpKgPerM     = ends × (0.5905 / Ne_warp) × K_warp / 1000
                 where K_warp = Lasa/L2L ≈ 1.055  (owner-confirmed — the
                 sheet's 120/1852 warp shortcut drops Lasa and is wrong,
                 PLANNING §248)
weftKgPerMBase = Pick×39.37 × WeftReedSpace(m) × (0.5905/Ne_weft) / 1000
weftKgPerM     = weftKgPerMBase × (1 + WeftWaste)          (= ×1.05)
sizedWarpKgPerM = warpKgPerM × (1 + SizingWajanVaad)       (= ×1.10)

-- the sheet's weight ladder (labels as-on-sheet) --
"Warp-1/Grams"          = warpKgPerM           (0.118527 … kg/m)
"Weft-1/Grams"          = weftKgPerM (+5%)     (0.062915 … kg/m)
"Warp incl Sizing"      = sizedWarpKgPerM      (0.130380 …)
"Weft excl Wastage"     = weftKgPerMBase       (0.059919 …)
"Weight of Fabrics"     = sizedWarp + weftBase (0.190299 …)
"Weight for Costing"    = warpKgPerM + weftKgPerM   ← NOTE: unsized warp + weft-WITH-waste
                         (0.118527 + 0.062915 = 0.181442 …) — the number used for GM/GSM/costing

Units: the "Grams" cells are actually kg per meter of fabric (the cost math proves it: kg/m × ₹/kg = ₹/m).

3. Costing formulas (₹/m, verified to 6+ decimals)

material = warpKgPerM×warpRate + weftKgPerM×weftRate
           (₹/kg rates; GST toggle per material row — incl vs excl)
sizing   = warpKgPerM × sizingRate(₹/kg)                    (0.118527×23 = 2.7261)
job      = Pick × jobRate/100                               (64×9/100 = 5.76 — ₹ per 100 picks ⇐ Q.7)
total    = material + sizing + job + warpingRate
-- C355: a charge that must be p% OF THE PRICE is not total × p/100. Every
-- percent-of-price line sits inside the same price, so one denominator:
price    = total × 100 / (100 − (overhead% + dhara% + brokerage%))
others   = price × overhead% / 100     (= total × overhead / (100 − Σp))
dhara    = price × dhara% / 100
broker   = price × brokerage% / 100
final    = price × (1 + GST%)
-- overhead is the company's 1% (it replaced the sheet's 6.5% other expenses);
-- with a lone overhead and no dhara/brokerage this is total × 1/99, and every
-- line is exactly its own percentage of the price.

4. GSM / GLM (needs one confirmation — Q.4)

Observed: GLM 106.68 = WeightForCosting × 588.0 (i.e. × ~1000/1.7008) and GSM 70 = GLM / 1.524 (exactly 60"). Two different widths are at play (≈67" and 60") — the sheet may treat these as target/derived values; confirm before the engine hardcodes them.

5. Verification trace (sheet cell → formula → match)

Sheet cell Sheet value Formula Computed Match
C20 Warp-1/Grams 0.1185271032 7800×0.5905/41×K/1000 0.118516 (K=1.055) ✓ (0.01%)
C24 Weft-1/Grams 0.06291530632 C36×1.05 0.06291530632 ✓ exact
C34 Warp incl Sizing 0.1303798135 C20×1.10 0.1303798135 ✓ exact
C36 Weft excl Wastage 0.05991933935 base geometry 0.059914 ✓ (0.01%)
C38 Weight of Fabrics 0.1902991529 C34+C36 0.19029915292 ✓ exact
C39 Weight for Costing 0.1814424095 C20+C24 0.18144240952 ✓ exact
C21 Warp cost 39.14357583 C20×330.25 39.14357583 ✓ exact
C25 Weft cost (excl GST) 19.18916843 C24×305.0 19.18916843 ✓ exact
C30 Sizing 2.726123374 C20×23 2.72612337 ✓ 0
C28 Job 5.76 64×9/100 5.76 ✓
C31 Total Cost 66.81886763 C21+C25+C30+C28 66.81886763 ✓ exact
C33 Total Cost 71.16209403 C31×1.065 71.16209403 ✓ exact
D33 incl GST 74.72019873 C33×1.05 74.72019873 ✓ exact

6. What the engine therefore looks like in the system

One construction_master+costing_profile per design (all the §1 inputs), then one weight service (kg/m + GSM/GLM) and one costing service (₹/m, GST-aware) — both consumed by orders, procurement suggestion, allocation, checking (measured vs computed GSM), and the costing/quote screen. Rates live per supplier/material with an incl/excl GST toggle per row (as the sheet shows per warp/weft).

6b. The Android costing app (owner) — same engine, richer (fields decoded 2026-09-02)

  • Construction: Reed · Pick · Warp Reed Sp. · Weft Reed Sp. · Warping Rate ps/Mtr (GST% toggle) · Job Rate ps (GST% toggle) · Siz. Wajan Vaad % · Lasa · L2L · Weft Waste % · Other Expense % · Warp Division (Pr/Me?).
  • Warp details: ADD-WARP rows (up to 4): Count, Warp %, Rate, GST %, Incl.GST toggle + per-warp SIZING rate (GST%, toggle).
  • Weft details (up to 4): Count, Weft %, Rate, GST %, Incl.GST toggle.
  • Outputs: Fabric Weight gms · per-warp/weft costs · cost lines: Warp Cost, Weft Cost, Siz. Cost, MAJURI (weaving labour), Warping Cost, Other Cost · Basic Cost / With GST · Margin table 1–20% (price at each margin, incl/excl GST).
  • Engine = same formulas as §2–3; adds multi-warp/weft % splits, Majuri line, margin table, per-warp sizing rate. (Confirm "Warp Division Pr/Me" = per-meter warp division basis.)

7. Open questions (to the owner)

  1. RESOLVED (owner 2026-09-01, re-confirmed 2026-09-22 — PLANNING §248): lasa = the sizer's warp-length marks (every ~110 m of warp); L2L = the distance between lasa marks in the FABRIC (107/104 m observed) → warp shrinkage = (lasa−L2L)/lasa; warp allowance K = Lasa/L2L — the costing formula stands as-is. (The live sheet's C20 bakes warp as 120/1852 with no Lasa term — owner ruled 2026-09-22 that the sheet is wrong there, not the engine.)
  2. "Weight for Costing" = unsized warp + weft-incl-5% — is that the intended costing basis (sizing excluded, waste included), and is the same basis used for GSM/GLM?
  3. GLM/GSM widths: GLM divides Costing-weight by ≈1.7008 m, GSM = GLM/1.524 (60"). Are both widths real (67″ loom → 60″ finished?) or is one a target? Which width should the engine use for a measured GSM at checking?
  4. Job rate unit: 9 ps = ₹ per 100 picks (giving 5.76 ₹/m at 64 picks)?
  5. Warp/weft rate GST toggles: rate entered excl-GST with a per-row inclusive flag — confirm the engine should reproduce that per-row.
  6. How the sheet's construction example relates to contracts: job-work contract lines show JobRate 3 / Rate 8.64 ₹/m, while this costing yields ~71 ₹/m — are these different fabrics/agreements, or is the contract Rate a conversion-only charge on party material?