That “brain” is the core calculation engine, This is where every input — area, type, labor rate, add-ons, phases, etc. — is unified into a single pricing output.
Here’s a complete breakdown of what it does, step-by-step 👇
🧠 1. Calculates Base Hours
“Calculates base hours using area, productivity, and passes”
The calculator first determines how many labor hours are needed before any money is calculated.
const roughHrsBase = (areaM2 * wR) / effProd.rough_m2_hr;
const finalHrsBase = (areaM2 * wF) / effProd.final_m2_hr;
const fluffHrsBase = (areaM2 * wFl) / effProd.fluff_m2_hr;
Then it scales each phase (rough, final, fluff) by the number of passes entered:
const roughHrs = roughHrsBase * phasePasses.rough;
const finalHrs = finalHrsBase * phasePasses.final;
const fluffHrs = fluffHrsBase * phasePasses.fluff;
Finally, it totals everything:
const laborHours = roughHrs + finalHrs + fluffHrs;
✅ Result: the raw cleaning time for the building based on its size and how many passes each phase needs.
⚙️ 2. Applies All Multipliers
“Applies all multipliers”
Before turning hours into money, the calculator modifies productivity and rates using several real-world factors:
- Location factor (e.g., California = +15%, Alabama = -11%)
- Building type factor (e.g., Healthcare slower, Warehouse faster)
- Size factor (smaller buildings take proportionally more time)
- Level penalty (+3% per floor)
- Phase premium (+15% for each additional active phase)
Example:
const phaseFactor = 1 + (enabledPhasesCount - 1) * 0.15;
const lvlMult = 1 + (levels - 1) * 0.03;
These ensure the calculator adjusts pricing for complexity, logistics, and access.
✅ Result: realistic scaling for building difficulty, height, and region.
💰 3. Computes Labor-Based and Area-Based Pricing
“Computes both labor-based and area-based pricing”
The system runs two parallel pricing models and then uses whichever yields the higher result:
- Labor-based pricing
const laborCost = laborHours * labor.rate_per_hour; const basePreMargin = laborCost * phaseFactor + allAddOns; - Area-based pricing
const effectiveSqftRate = nationalBaseSqft × locRateMult × typeRateMult; const minByArea = areaFt2 × effectiveSqftRate;
It then takes the larger:
const adjustedBaseCost = Math.max(basePreMargin, minByArea);
Then applies profit margins:
totals = {
market_win: adjustedBaseCost * 1.07,
lean: adjustedBaseCost * 1.15,
profit_heavy: adjustedBaseCost * 1.28,
};
✅ Result: ensures pricing never drops below a fair per-ft² minimum, even if labor math produces a lower figure.
🔌 4. Integrates All Add-Ons
“Integrates all add-ons”
Each optional add-on (Windows, Pressure Wash, Flooring, Units, etc.) is calculated separately and added into the total.
Add-on examples:
pressureCost = pressure.enabled ? pressure.area × pressure.rate_per_unit : 0;
flooringCost = flooring.enabled ? flooring.area × coats × price_per_coat : 0;
windowCost = windows.enabled ? panes × price_per_pane × levelFactor : 0;
All of them feed back into the main total:
basePreMargin = (laborCost * phaseFactor) + pressureCost + flooringCost + unitsBathsCost + windowCost;
✅ Result: You get one unified total that accounts for every enabled option in the UI.
🧩 5. Produces the Final “Selected Bid”
Finally, the “brain” decides what number to display as your Selected Bid, based on what’s active:
- If T&M Override is on → uses man-hour total
- Else if Janitorial Mode is on → uses recurring pricing
- Else → uses the selected margin model (Market-Win, Lean, or Profit-Heavy)
let selectedBid = totals[selectedModel];
if (janitorial.enabled && janitorial.apply_to_selected) { selectedBid = janTotal; }
if (manHour.enabled && manHour.apply_to_selected) { selectedBid = manHourTotal; }
✅ Result: the final number you’d use for your proposal — whether it’s hourly, recurring, or construction-based.
🧾 Summary
| Step | Function | Output |
|---|---|---|
| 1️⃣ | Calculate base labor hours | How long the clean takes |
| 2️⃣ | Apply multipliers | Adjust for region, size, and complexity |
| 3️⃣ | Compute labor & area rates | Build the raw cost floor |
| 4️⃣ | Add all add-ons | Include pressure wash, windows, flooring, etc. |
| 5️⃣ | Select final bid type | Chooses between construction, T&M, or janitorial totals |
In short —
💥 “The brain that processes everything” is the calculator’s master engine that unifies every input, applies smart scaling, and produces a realistic final bid across any cleaning scenario.