Business Logic

3-Tier Pricing Model

The platform implements a cascading markup model that enables profitability tracking at every level of the reseller hierarchy. Each tier only sees their relevant costs and margins.

Pricing Cascade Flow
3-Tier Pricing Cascade

Rate Sources

Live Carrier Rate

The actual cost returned from the carrier's API in real-time. Used when no manual rate table exists for the given route and service.

Manual Rate Table

A rate defined by the Master Admin for specific zones, weights, or negotiated deals. Takes priority over live carrier rates when configured.

Interactive Calculator

Base Cost (Carrier)

$10.00

+20% markup

Sub-Admin Cost

$12.00

+15% markup

Customer Cost (Final)

$13.80

Master Admin Profit

$2.00per shipment

Sub-Admin Profit

$1.80per shipment

Reporting & Data Isolation

Each user role sees only the financial data relevant to their position in the hierarchy. This ensures business confidentiality while enabling accurate profitability tracking.

Shipment Pricing Fields

shipments table — pricing columns
base_cost         DECIMAL(12,4)  -- Actual carrier cost or manual rate
sub_admin_cost    DECIMAL(12,4)  -- Base + Master Admin markup
customer_cost     DECIMAL(12,4)  -- Sub-Admin Cost + Sub-Admin markup

-- Auto-calculated (stored)
master_admin_profit  GENERATED AS (sub_admin_cost - base_cost)
sub_admin_profit     GENERATED AS (customer_cost - sub_admin_cost)