@php
$debitTotal = $transactions->where('void', '0')->where('trans_type', 'd')->sum('amount');
$creditTotal = $transactions->where('void', '0')->where('trans_type', 'c')->sum('amount');
$ac_profit = $creditTotal - $debitTotal;
$ac_profit_percentage = $creditTotal>0 ? number_format(($ac_profit / $creditTotal) * 100, 2, '.', '') : 0;
@endphp
Profit
{{$ac_profit}}
{{$ac_profit_percentage}}%