{{-- Filters --}}
Date Range
Quick Select
Channel
Category
All time
Include only Shipped
No Negative margin orders
{{-- Summary Cards --}}
A
Discount A
Orders
{{ number_format($discountAStats['total_orders'] ?? 0) }}
Revenue
${{ number_format($discountAStats['total_revenue'] ?? 0) }}
Total Profit
${{ number_format($discountAStats['total_profit'] ?? 0) }}
Avg Margin %
{{ number_format($discountAStats['avg_margin_percent'] ?? 0, 1) }}%
Avg Order $
${{ number_format($discountAStats['avg_order_value'] ?? 0) }}
Loss Rate
{{ number_format($discountAStats['loss_rate'] ?? 0, 1) }}%
B
Discount B
Orders
{{ number_format($discountBStats['total_orders'] ?? 0) }}
Revenue
${{ number_format($discountBStats['total_revenue'] ?? 0) }}
Total Profit
${{ number_format($discountBStats['total_profit'] ?? 0) }}
Avg Margin %
{{ number_format($discountBStats['avg_margin_percent'] ?? 0, 1) }}%
Avg Order $
${{ number_format($discountBStats['avg_order_value'] ?? 0) }}
Loss Rate
{{ number_format($discountBStats['loss_rate'] ?? 0, 1) }}%
{{-- Monthly Profit Trend Line Chart --}}
Monthly Profit Trend
{{-- Line Series Toggles --}}
Show Lines:
{{-- Halo Effect Toggle - separate row for visibility --}}
@if($salesChannel === 'B2B') @if($lineChartIncludeHalo) ON - Discount A/B lines include cross-sell profit from orders containing discounted items @else OFF - Showing only direct profit from discounted items @endif @else Halo Effect Toggle Select B2B channel to enable Halo effect measures cross-sell profit from orders with discounted items @endif
{{-- Chart Container --}}
Loading chart...
{{-- Chart initialization script - always include to handle updates --}}
{{-- Chart Legend Info --}}
Monthly profit totals for selected date range @if($salesChannel === 'B2B') @if($lineChartIncludeHalo) Halo Effect ON: Discount A/B = discounted items profit + cross-sell profit @else Halo Effect OFF: Showing direct profit only @endif @endif
{{-- Risk & Quality Metrics --}}
Risk & Quality Metrics
Discount A
Loss Rate
{{ number_format($discountAStats['loss_rate'] ?? 0, 1) }}%
{{ $discountAStats['negative_margin_orders'] ?? 0 }} orders
Margin Volatility
{{ number_format($discountAStats['margin_std_dev'] ?? 0, 1) }}%
std deviation
Discount B
Loss Rate
{{ number_format($discountBStats['loss_rate'] ?? 0, 1) }}%
{{ $discountBStats['negative_margin_orders'] ?? 0 }} orders
Margin Volatility
{{ number_format($discountBStats['margin_std_dev'] ?? 0, 1) }}%
std deviation
{{-- Halo Effect / Cross-Sell Analysis (B2B Only) --}} @if($salesChannel === 'B2B' && !empty($haloEffectStats))
Halo Effect Analysis B2B Only
{{-- Collapsible Reference Guide --}}
{{-- What is Halo Effect --}}
What is the Halo Effect?

The Halo Effect (also known as "Loss Leader Analysis" or "Traffic Driver Effect") measures the additional sales generated when a customer comes in for a discounted item but ends up purchasing other non-discounted items as well.

Think of it like a shopping center offering a discount on one product - the customer walks in to buy that discounted item but purchases 5 more products while they're there. Those extra purchases are the "halo" around the discounted item.

This helps answer: "Is the discount bringing in enough additional business to justify the lower margin?"

{{-- Metric Definitions --}}
Metric Definitions
Cross-Sell Rate
Percentage of orders with discounted items that ALSO contain non-discounted items. Higher = discounts are bringing in more basket expansion.
Attachment Rate
Number of cross-sell items per discounted item. A rate of 2.0 means for every 1 discounted item, 2 non-discounted items were also purchased.
Lift Factor
How much larger orders with cross-sells are vs. orders without. A lift of 1.5x means orders with cross-sells are 50% larger in value.
Cross-Sell Revenue
Total dollar revenue from non-discounted items that were purchased alongside discounted items.
Cross-Sell Profit
Gross profit from non-discounted items. This is the "bonus profit" generated by the halo effect.
Discount ROI
Return on investment for the discount. Formula: (Cross-sell profit ÷ Discount given) × 100. An ROI of 200% means you earned $2 in cross-sell profit for every $1 discounted.
$ Return per $1 Discount
Cross-sell profit generated for every $1 of discount given. A value of $1.50 means every dollar you discount brings back $1.50 in cross-sell profit.
Est. Discount Given
Estimated total dollar amount discounted to customers, calculated from the discount percentage applied to items.
Discounted Items Profit
Gross profit from the discounted items themselves (often lower due to the discount).
Total Profit (with Halo)
Combined profit from discounted items + cross-sell items. This is the true profitability picture including the halo effect.
{{-- A/B Test Explanation --}}
Understanding the A/B Test

Discount A and Discount B represent a random split test. The comparison shows which discount type is more effective at:

  • Driving additional purchases (higher attachment rate)
  • Generating cross-sell profit relative to discount given (better ROI)
  • Increasing overall order value (higher lift factor)
  • Maximizing total profit including the halo effect

The winner is determined by which discount wins on more of the 4 key metrics: ROI, Total Profit, Lift Factor, and $/Discount.

{{-- Summary Stats --}}
Cross-Sell Rate
{{ number_format($haloEffectStats['cross_sell_rate'] ?? 0, 1) }}%
{{ $haloEffectStats['orders_with_cross_sell'] ?? 0 }} of {{ $haloEffectStats['total_orders_with_discounts'] ?? 0 }} orders
Attachment Rate
{{ number_format($haloEffectStats['attachment_rate'] ?? 0, 2) }}
cross-sell items per discounted item
Cross-Sell Revenue
${{ number_format($haloEffectStats['cross_sell_revenue'] ?? 0) }}
{{ $haloEffectStats['total_cross_sell_items'] ?? 0 }} items
Cross-Sell Profit
${{ number_format($haloEffectStats['cross_sell_profit'] ?? 0) }}
${{ number_format($haloEffectStats['avg_cross_sell_per_order'] ?? 0, 2) }} avg per order
{{-- A/B Test Comparison Table --}}
A/B Split Test Comparison
@php $aHalo = $haloEffectStats['discount_a_halo'] ?? []; $bHalo = $haloEffectStats['discount_b_halo'] ?? []; $haloMetrics = [ ['label' => 'Total Orders', 'key' => 'total_orders', 'format' => 'number', 'higher_better' => true, 'description' => 'Orders with this discount type'], ['label' => 'Cross-Sell Rate', 'key' => 'cross_sell_rate', 'format' => 'percent', 'higher_better' => true, 'description' => '% of orders that had cross-sells'], ['label' => 'Attachment Rate', 'key' => 'attachment_rate', 'format' => 'decimal', 'higher_better' => true, 'description' => 'Cross-sell items per discounted item'], ['label' => 'Lift Factor', 'key' => 'lift_factor', 'format' => 'decimal_x', 'higher_better' => true, 'description' => 'Order value multiplier from cross-sells'], ['label' => 'Cross-Sell Revenue', 'key' => 'cross_sell_revenue', 'format' => 'dollar', 'higher_better' => true, 'description' => 'Revenue from non-discounted items'], ['label' => 'Cross-Sell Profit', 'key' => 'cross_sell_profit', 'format' => 'dollar', 'higher_better' => true, 'description' => 'Profit from non-discounted items'], ['label' => 'Discount ROI', 'key' => 'discount_roi', 'format' => 'percent', 'higher_better' => true, 'description' => '(Cross-sell profit / Discount given) x 100'], ['label' => '$ Return per $1 Discount', 'key' => 'net_contribution_per_discount_dollar', 'format' => 'dollar_per', 'higher_better' => true, 'description' => 'Cross-sell profit for every $1 discounted'], ['label' => 'Est. Discount Given', 'key' => 'estimated_discount_given', 'format' => 'dollar', 'higher_better' => false, 'description' => 'Total discount $ given to customers'], ['label' => 'Discounted Items Profit', 'key' => 'discounted_profit', 'format' => 'dollar', 'higher_better' => true, 'description' => 'Profit from discounted items only'], ['label' => 'Total Profit (with Halo)', 'key' => 'total_profit_with_halo', 'format' => 'dollar', 'higher_better' => true, 'description' => 'Combined: discounted + cross-sell profit'], ['label' => 'Avg Order Value (w/ Cross-Sell)', 'key' => 'avg_order_value_with_cross_sell', 'format' => 'dollar', 'higher_better' => true, 'description' => 'Avg order $ when cross-sells present'], ['label' => 'Avg Order Value (no Cross-Sell)', 'key' => 'avg_order_value_without_cross_sell', 'format' => 'dollar', 'higher_better' => true, 'description' => 'Avg order $ when no cross-sells'], ]; @endphp @foreach($haloMetrics as $metric) @php $a = $aHalo[$metric['key']] ?? 0; $b = $bHalo[$metric['key']] ?? 0; $winner = $a == $b ? null : ($metric['higher_better'] ? ($a > $b ? 'A' : 'B') : ($a < $b ? 'A' : 'B')); @endphp @endforeach
Metric Discount A Discount B Winner
{{ $metric['label'] }} @if($metric['format'] === 'dollar') ${{ number_format($a, 0) }} @elseif($metric['format'] === 'dollar_per') ${{ number_format($a, 2) }} @elseif($metric['format'] === 'percent') {{ number_format($a, 1) }}% @elseif($metric['format'] === 'decimal') {{ number_format($a, 2) }} @elseif($metric['format'] === 'decimal_x') {{ number_format($a, 2) }}x @else {{ number_format($a) }} @endif @if($metric['format'] === 'dollar') ${{ number_format($b, 0) }} @elseif($metric['format'] === 'dollar_per') ${{ number_format($b, 2) }} @elseif($metric['format'] === 'percent') {{ number_format($b, 1) }}% @elseif($metric['format'] === 'decimal') {{ number_format($b, 2) }} @elseif($metric['format'] === 'decimal_x') {{ number_format($b, 2) }}x @else {{ number_format($b) }} @endif @if($winner === 'A') A @elseif($winner === 'B') B @else - @endif
@endif {{-- Margin Comparison --}}
Margin Comparison
@php $aVal = $discountAStats[$chartMetric] ?? 0; $bVal = $discountBStats[$chartMetric] ?? 0; $maxVal = max($aVal, $bVal, 1); $isDollar = in_array($chartMetric, ['avg_margin_dollar', 'total_profit']); @endphp
Disc A
{{ $isDollar ? '$' . number_format($aVal, $chartMetric === 'avg_margin_dollar' ? 2 : 0) : number_format($aVal, 1) . '%' }}
Disc B
{{ $isDollar ? '$' . number_format($bVal, $chartMetric === 'avg_margin_dollar' ? 2 : 0) : number_format($bVal, 1) . '%' }}
@if($aVal != $bVal)
{{ $aVal > $bVal ? 'A' : 'B' }} wins by {{ $isDollar ? '$' . number_format(abs($aVal - $bVal), $chartMetric === 'avg_margin_dollar' ? 2 : 0) : number_format(abs($aVal - $bVal), 1) . '%' }}
@endif
{{-- Detailed Comparison Table --}}
Detailed Comparison
@php $metrics = [ ['label' => 'Total Orders', 'key' => 'total_orders', 'format' => 'number', 'higher_better' => true], ['label' => 'Total Revenue', 'key' => 'total_revenue', 'format' => 'dollar_large', 'higher_better' => true], ['label' => 'Total Profit', 'key' => 'total_profit', 'format' => 'dollar_large', 'higher_better' => true], ['label' => 'Avg Order Value', 'key' => 'avg_order_value', 'format' => 'dollar', 'higher_better' => true], ['label' => 'Avg Margin %', 'key' => 'avg_margin_percent', 'format' => 'percent', 'higher_better' => true], ['label' => 'Avg Margin $', 'key' => 'avg_margin_dollar', 'format' => 'dollar', 'higher_better' => true], ['label' => 'Profit per Revenue', 'key' => 'profit_per_revenue', 'format' => 'percent', 'higher_better' => true], ['label' => 'Loss Rate', 'key' => 'loss_rate', 'format' => 'percent', 'higher_better' => false], ['label' => 'Margin Volatility', 'key' => 'margin_std_dev', 'format' => 'percent', 'higher_better' => false], ]; @endphp @foreach($metrics as $metric) @php $a = $discountAStats[$metric['key']] ?? 0; $b = $discountBStats[$metric['key']] ?? 0; $winner = $a == $b ? null : ($metric['higher_better'] ? ($a > $b ? 'A' : 'B') : ($a < $b ? 'A' : 'B')); @endphp @endforeach
Metric Discount A Discount B Winner
{{ $metric['label'] }} @if($metric['format'] === 'dollar') ${{ number_format($a, 2) }} @elseif($metric['format'] === 'dollar_large') ${{ number_format($a, 0) }} @elseif($metric['format'] === 'percent') {{ number_format($a, 1) }}% @else {{ number_format($a) }} @endif @if($metric['format'] === 'dollar') ${{ number_format($b, 2) }} @elseif($metric['format'] === 'dollar_large') ${{ number_format($b, 0) }} @elseif($metric['format'] === 'percent') {{ number_format($b, 1) }}% @else {{ number_format($b) }} @endif @if($winner === 'A') A @elseif($winner === 'B') B @else - @endif
{{-- Category Breakdown --}} @if(count($this->categoryBreakdown) > 0)
By Category ({{ count($this->categoryBreakdown) }})
@foreach($this->categoryBreakdown as $cat) @endforeach
Category A Qty A Margin B Qty B Margin Best
{{ $cat['name'] }} {{ number_format($cat['discount_a']['orders']) }} {{ number_format($cat['discount_a']['avg_margin_percent'], 1) }}% {{ number_format($cat['discount_b']['orders']) }} {{ number_format($cat['discount_b']['avg_margin_percent'], 1) }}% @if($cat['discount_a']['avg_margin_percent'] > $cat['discount_b']['avg_margin_percent']) A @elseif($cat['discount_b']['avg_margin_percent'] > $cat['discount_a']['avg_margin_percent']) B @else - @endif
@endif {{-- Channel Breakdown --}} @if(count($this->channelBreakdown) > 0)
By Channel ({{ count($this->channelBreakdown) }})
@foreach($this->channelBreakdown as $ch) @endforeach
Channel A Qty A Margin B Qty B Margin Best
{{ $ch['name'] }} {{ number_format($ch['discount_a']['orders']) }} {{ number_format($ch['discount_a']['avg_margin_percent'], 1) }}% {{ number_format($ch['discount_b']['orders']) }} {{ number_format($ch['discount_b']['avg_margin_percent'], 1) }}% @if($ch['discount_a']['avg_margin_percent'] > $ch['discount_b']['avg_margin_percent']) A @elseif($ch['discount_b']['avg_margin_percent'] > $ch['discount_a']['avg_margin_percent']) B @else - @endif
@endif {{-- Export Section --}}
Export Raw Data
A
Discount A Data
{{ number_format($discountAStats['total_orders'] ?? 0) }} orders matching current filters
B
Discount B Data
{{ number_format($discountBStats['total_orders'] ?? 0) }} orders matching current filters
Exports include: Order ID, Date, Channel, Category, Partslink, Sale Price, Buy Price, Gross Margin, Gross Profit %