Skip to main content

Cost Tracking

Overview

The Costs API provides real-time cost calculations and rollup across all estimation modules. Costs flow from individual items → scopes → bids, with automatic application of multipliers, markups, overhead, and profit.

Get Bid Costs

GET /api/costs/bid/:bidId
Cookie: sAccessToken=...; sRefreshToken=...

Roles: ADMIN, ESTIMATOR, PM


Get Scope Costs

GET /api/costs/scope/:scopeId
Cookie: sAccessToken=...; sRefreshToken=...

Roles: ADMIN, ESTIMATOR, PM


Get Module Costs

GET /api/costs/module/:module/:scopeId
Cookie: sAccessToken=...; sRefreshToken=...

Roles: ADMIN, ESTIMATOR, PM

Module Values:

  • concrete
  • labor
  • equipment
  • materials
  • subcontractor
  • misc

Recalculate Bid Costs

POST /api/costs/recalculate/:bidId
Cookie: sAccessToken=...; sRefreshToken=...

Roles: ADMIN, ESTIMATOR

info

Cost recalculation is normally automatic when items are added/updated. Use this endpoint to force a full recalculation if costs appear out of sync.

Cost Rollup Flow

🔍 Click diagram to expand

Calculation Steps

  1. Item Costs - Individual item calculations (concrete CY _ price, labor hours _ rate, etc.)
  2. Scope Module Totals - Sum all items in each module within a scope
  3. Scope Multiplier - Apply scope multiplier (e.g., 2.0 for repeated scopes)
  4. Bid Module Totals - Sum all scope costs for each module
  5. Bid Subtotal - Sum all module costs
  6. Overhead - Apply overhead percentage to subtotal
  7. Profit - Apply profit percentage to (subtotal + overhead)
  8. Total - Final bid total

Example Calculation

// Scope 1: Foundation
const scope1 = {
concrete: 75000,
labor: 50000,
equipment: 12000,
materials: 8000,
subcontractor: 7000,
misc: 2000,
multiplier: 1.0
}
const scope1Total = (75000 + 50000 + 12000 + 8000 + 7000 + 2000) * 1.0 = 154000

// Scope 2: Grade Beams (repeated 2x)
const scope2 = {
concrete: 25000,
labor: 17500,
equipment: 5000,
materials: 3500,
subcontractor: 2500,
misc: 1500,
multiplier: 2.0
}
const scope2Total = (25000 + 17500 + 5000 + 3500 + 2500 + 1500) * 2.0 = 110000

// Bid totals
const bidSubtotal = 154000 + 110000 = 264000
const overhead = 264000 * 0.10 = 26400
const profit = (264000 + 26400) * 0.15 = 43560
const bidTotal = 264000 + 26400 + 43560 = 333960

Data Model

interface BidCosts {
bidId: string;
bidNumber: string;
jobName: string;
moduleCosts: ModuleCosts;
subtotal: number;
markups: Markups;
total: number;
scopes: ScopeCosts[];
}

interface ModuleCosts {
concrete: number;
labor: number;
equipment: number;
materials: number;
subcontractor: number;
misc: number;
}

interface Markups {
overhead: {
percentage: number;
amount: number;
};
profit: {
percentage: number;
amount: number;
};
}

interface ScopeCosts {
scopeId: string;
name: string;
multiplier: number;
moduleCosts: ModuleCosts;
subtotal: number;
}