@extends('layouts.app') @section('title', 'Compute Profits') @section('content')

Profit Computation

Calculate accrued profits based on profit rules

{{-- Trigger --}}
@csrf
{{-- Results --}} @if (!empty($results))
Computation Results ({{ count($results) }} rules processed)
@foreach ($results as $r) @if (isset($r['error'])) @else @endif @endforeach
Investor Project Rule Type Value Project Profit Accrued Distributed Pending
Rule #{{ $r['profit_rule_id'] ?? '?' }}: {{ $r['error'] }}
{{ $r['investor_name'] }} {{ $r['project_name'] }} {{ ucfirst($r['profit_type']) }} @if ($r['profit_type'] === 'percentage') {{ number_format($r['profit_value'], 2) }}% @else {{ number_format($r['profit_value'], 2) }} @endif {{ number_format($r['project_profit'], 2) }} {{ number_format($r['accrued_profit'], 2) }} {{ number_format($r['distributed'], 2) }} {{ number_format($r['pending'], 2) }}
Totals: {{ number_format(collect($results)->where('accrued_profit', '!=', null)->sum('accrued_profit'), 2) }} {{ number_format(collect($results)->where('distributed', '!=', null)->sum('distributed'), 2) }} {{ number_format(collect($results)->where('pending', '!=', null)->sum('pending'), 2) }}
@elseif (request()->isMethod('get') && !$results)

Select a project (or all) and click Compute Profits to see results.

@endif
@endsection