@extends('layouts.app') @section('title', __('Analysis pricing')) @section('page-title', __('Analysis pricing')) @section('page-subtitle', __('Flat per-analysis price + automatic volume discount + monthly floor.')) @section('content') @if(session('status'))
{{ session('status') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif {{-- Explainer --}}

{{ __('How billing works') }}

{{ __('Each completed analysis is billed at the standard rate for the first :n of the calendar month, then at the volume rate from the :n2-th onward. Every tenant pays at least the monthly minimum, even if they ran no analyses that month.', ['n' => $config['bulk_threshold'], 'n2' => $config['bulk_threshold'] + 1]) }}

{{-- Global pricing form --}}
@csrf

{{ __('Global pricing') }}

{{ $config['currency'] }}

{{ __('Charged for the first analyses of the month.') }}

{{ $config['currency'] }}

{{ __('Discounted rate from analysis #(threshold + 1) onward.') }}

{{ __('Number of analyses charged at the standard rate.') }}

{{ $config['currency'] }}

{{ __('Guaranteed billed every month (set 0 to disable).') }}

{{ __('ISO-4217 (EUR, USD, …).') }}

%

{{ __('Override per tenant for reverse-charge cases.') }}

{{-- Live preview --}} @php $up = (float) $config['unit_price']; $bp = (float) $config['bulk_unit_price']; $th = (int) $config['bulk_threshold']; $fl = (float) $config['monthly_minimum']; $vatPct = (float) $config['vat_rate']; $cur = $config['currency']; $scenarios = [0, 1, 5, 10, 50, 100]; $rows = []; foreach ($scenarios as $n) { $std = min($n, $th) * $up; $vol = max(0, $n - $th) * $bp; $sub = $std + $vol; $floor = max(0, $fl - $sub); $final = $sub + $floor; $vat = round($final * $vatPct / 100, 2); $rows[] = compact('n', 'std', 'vol', 'sub', 'floor', 'final', 'vat'); } @endphp

{{ __('Live billing preview') }}

@foreach($rows as $r) @endforeach
{{ __('Analyses') }} {{ __('Standard') }} {{ __('Volume') }} {{ __('Floor') }} {{ __('Subtotal') }} {{ __('VAT') }} {{ __('Total') }}
{{ $r['n'] }} {{ number_format($r['std'], 2) }} {{ number_format($r['vol'], 2) }} {{ $r['floor'] > 0 ? '+'.number_format($r['floor'], 2) : '—' }} {{ number_format($r['final'], 2) }} {{ number_format($r['vat'], 2) }} {{ number_format($r['final'] + $r['vat'], 2) }} {{ $cur }}

{{ __('Save the form to update the preview.') }}

{{ __('Defaults: :u standard, :b volume, threshold :t, floor :f.', [ 'u' => number_format($defaults['unit_price'], 2).' '.$defaults['currency'], 'b' => number_format($defaults['bulk_unit_price'], 2).' '.$defaults['currency'], 't' => $defaults['bulk_threshold'], 'f' => number_format($defaults['monthly_minimum'], 2).' '.$defaults['currency'], ]) }}

{{-- Per-tenant overrides --}}

{{ __('Per-tenant overrides') }}

{{ __('Empty fields inherit the global value above. Use for enterprise contracts.') }}

@forelse($tenants as $t) @csrf @empty @endforelse
{{ __('Tenant') }} {{ __('Standard') }} {{ __('Volume') }} {{ __('Threshold') }} {{ __('Floor') }} {{ __('VAT %') }} {{ __('Actions') }}
{{ $t->name }}
{{ $t->slug }}
@if($t->unit_price_override !== null || $t->bulk_unit_price_override !== null || $t->bulk_threshold_override !== null || $t->monthly_minimum_override !== null || $t->vat_rate_override !== null)
@csrf @method('DELETE')
@endif
{{ __('No tenants yet.') }}
@endsection