@extends('layouts.master') @section('title', 'Profit and Lost') @section('content')

Profit and Loss


{{-- --}} @php $salesTotal = 0; $costofsalesTotal =0; $grossprofit = 0; $expenceTotal = 0; $otherIncomeTotal = 0; $profit = 0; $count = 1; @endphp @foreach ($sales as $value) @php $debit = $value->debit; $credit = $value->credit; if($value->trans == 1) { //$debit += $value->opening_balance; } if($value->trans == 2) { //$credit += $value->opening_balance; } @endphp @php $salesTotal+=$credit-$debit; @endphp @endforeach @foreach ($costofsales as $value) @php $debit = $value->debit; $credit = $value->credit; if($value->trans == 1) { //$debit += $value->opening_balance; } if($value->trans == 2) { //$credit += $value->opening_balance; } @endphp @php $costofsalesTotal+=$debit-$credit; @endphp @endforeach @php $grossprofit=($salesTotal)-($costofsalesTotal) @endphp @foreach ($expences as $value) @php $debit = $value->debit; $credit = $value->credit; if($value->trans == 1) { //$debit += $value->opening_balance; } if($value->trans == 2) { //$credit += $value->opening_balance; } @endphp @php $expenceTotal+=$debit-$credit; @endphp @endforeach @foreach ($otherIncome as $value) @php $debit = $value->debit; $credit = $value->credit; if($value->trans == 1) { //$debit += $value->opening_balance; } if($value->trans == 2) { //$credit += $value->opening_balance; } @endphp @php $otherIncomeTotal+=$credit-$debit; @endphp @endforeach @php $profit=($otherIncomeTotal+$grossprofit)-($expenceTotal) @endphp
#DateAccount Code Description Amount({{ $currencyCode }})
Sales
{{ $count++ }} {{ $value->acc_code }} {{ $value->acc_name }} {{ number_format($credit-$debit, 2, '.', ',') }}
Total Sales :{{ number_format($salesTotal, 2, '.', ',') }}
Cost of Sales
{{ $count++ }} {{ $value->acc_code }} {{ $value->acc_name }} {{ number_format($debit-$credit, 2, '.', ',') }}
Total Cost of Sales :{{ number_format($costofsalesTotal, 2, '.', ',') }}
Gross Profit : {{ number_format($grossprofit, 2, '.', ',') }}
Expences
{{ $count++ }} {{ $value->acc_code }} {{ $value->acc_name }} {{ number_format($debit-$credit, 2, '.', ',') }}
Total Expences :{{ number_format($expenceTotal, 2, '.', ',') }}
Other Income
{{ $count++ }} {{ $value->acc_code }} {{ $value->acc_name }} {{ number_format($credit-$debit, 2, '.', ',') }}
Total Other Income :{{ number_format($otherIncomeTotal, 2, '.', ',') }}
Net Profit : {{ number_format($profit, 2, '.', ',') }}
@endsection