Documentation Index
Fetch the complete documentation index at: https://mintlify.com/shubhamsingh-pg/rto-profit-simulator/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The RTO Profit Simulator uses two primary calculation functions to analyze financial impact and simulate savings scenarios. All calculations are implemented insrc/utils/calculations.js.
calculateMetrics()
Calculates comprehensive financial metrics based on business inputs.Function Signature
Business input data containing:
monthlyOrders(number): Total orders per monthaverageOrderValue(number): Average order value in INRcodPercentage(number): Percentage of COD orders (0-100)rtoPercentage(number): Percentage of RTO orders (0-100)forwardShippingCost(number): Forward shipping cost per orderreturnShippingCost(number): Return shipping cost per RTOproductCost(number): Product cost per order
Whether to calculate annual projections (multiplies monthly values by 12)
Return Values
Total revenue if all orders were successfulFormula:
monthlyOrders × averageOrderValue × multiplierWhere multiplier is 12 for annual view, 1 for monthly view.Number of Cash on Delivery ordersFormula:
Math.round(monthlyOrders × (codPercentage / 100)) × multiplierNumber of Return to Origin ordersFormula:
Math.round(codOrders × (rtoPercentage / 100)) × multiplierTotal financial loss due to RTO ordersFormula:
rtoOrders × (forwardShippingCost + returnShippingCost + productCost) × multiplierThis represents the complete loss per RTO order including:- Forward shipping costs (already spent)
- Return shipping costs (recovery expense)
- Product cost (inventory blocked or lost)
Actual revenue realized from delivered ordersFormula:
(prepaidOrders + deliveredCodOrders) × averageOrderValue × multiplierWhere:prepaidOrders = monthlyOrders - codOrdersdeliveredCodOrders = codOrders - rtoOrders
Net profit after accounting for RTO lossesFormula:
netRealizedRevenue - totalRtoLossMaximum sustainable RTO percentage before losses exceed profitsFormula:
(profitPerSuccessfulOrder / (profitPerSuccessfulOrder + lossPerRtoOrder)) × 100Where:profitPerSuccessfulOrder = averageOrderValue - productCost - forwardShippingCostlossPerRtoOrder = productCost + forwardShippingCost + returnShippingCost
Calculation Steps
The function performs calculations in the following order:-
Order Distribution
-
RTO Impact
-
Loss Calculation
-
Revenue Realization
-
Profit Calculation
-
Break-Even Analysis
Example Calculation
Given the default business inputs:- Total Revenue:
10,000 × 1,500 = ₹15,000,000 - COD Orders:
10,000 × 0.60 = 6,000 - Prepaid Orders:
10,000 - 6,000 = 4,000 - RTO Orders:
6,000 × 0.30 = 1,800 - Delivered COD Orders:
6,000 - 1,800 = 4,200 - RTO Loss per Order:
60 + 60 + 500 = ₹620 - Total RTO Loss:
1,800 × 620 = ₹1,116,000 - Net Realized Revenue:
(4,000 + 4,200) × 1,500 = ₹12,300,000 - Net Profit:
12,300,000 - 1,116,000 = ₹11,184,000 - Profit per Success:
1,500 - 500 - 60 = ₹940 - Loss per RTO:
500 + 60 + 60 = ₹620 - Break-Even RTO%:
(940 / (940 + 620)) × 100 = 60.3%
calculateSavings()
Calculates potential savings from reducing RTO percentage.Function Signature
Same business input data structure as
calculateMetrics()Absolute percentage points to reduce RTO by (e.g., 5 reduces 30% to 25%)
Whether to calculate annual projections
Return Values
Number of orders saved from RTOFormula:
originalRtoOrders - newRtoOrdersAdditional profit gained from RTO reductionFormula:
newNetProfit - originalNetProfitImplementation Logic
The function uses absolute reduction (not relative):Example Usage
Scenario: Reduce RTO from 30% to 25% (5% reduction)- Original RTO orders: 1,800
- New RTO orders (25%): 1,500
- Orders saved: 300
- Each saved order prevents ₹620 loss
- Profit improvement:
300 × 620 = ₹186,000
Break-Even RTO Formula Explained
The break-even RTO percentage is the critical threshold where your business neither makes nor loses money.Mathematical Derivation
Let:- P = Profit per successful delivery
- L = Loss per RTO order
- R = RTO percentage (break-even point)
- C = Number of COD orders
Practical Interpretation
If your current RTO% > Break-Even RTO%:- You’re losing more money on RTOs than making on deliveries
- Every additional RTO pushes you into net loss
- Immediate intervention required
- Your business is still profitable despite RTOs
- You have buffer room for growth
- Focus on optimization to increase margins
Example
With default values:- Profit per delivery: ₹940
- Loss per RTO: ₹620
- Break-even:
940 / (940 + 620) = 0.603 = 60.3%
- At 60.3% RTO rate, you break even
- At 30% RTO (current), you’re still profitable
- You have ~30% buffer before critical losses
Usage in Application
The calculations are used throughout the application: In App.jsx:data (user inputs) or metrics (calculated outputs) as props to display financial insights.