{{ __('Income Statement') }}

{{ __('From Date') }}: {{ $start_date }}

{{ __('To Date') }}: {{ $end_date }}

{{ Auth::user()->id ?? __('Guest') }}


@php $salesAmount = $sales * -1; $formattedSales = number_format($salesAmount, 3); $TotalCredit = 0; $TotalDebit = 0; $TotalCreditCheckSalary = 0; $TotalDebitSalary = 0; // Convert the formatted sales back to a numeric value for arithmetic operations $numericSalesAmount = (float) $salesAmount; if ($numericSalesAmount > 0) { $TotalCredit += $numericSalesAmount; } else { $TotalDebit += abs($numericSalesAmount); } @endphp @if ($returns_on_sales_allowances != 0) @php $returnsAmount = $returns_on_sales_allowances * -1; $formattedReturns = number_format($returnsAmount, 3); $numericAmount = (float) $returnsAmount; if ($numericAmount > 0) { $TotalCredit += $numericAmount; } else { $TotalDebit += abs($numericAmount); } @endphp @endif @if ($discount_allowed != 0) @php $discountAmount = $discount_allowed * -1; $formattedDiscount = number_format($discountAmount, 3); $numericAmount = (float) $discountAmount; if ($numericAmount > 0) { $TotalCredit += $numericAmount; } else { $TotalDebit += abs($numericAmount); } @endphp @endif @php $costofgoodssold = $cost_of_goods_sold; $formattedcostofgoodssold = number_format($costofgoodssold, 3); $numericAmount = (float) $costofgoodssold; if ($numericAmount > 0) { $TotalCredit += $numericAmount; } else { $TotalDebit += abs($numericAmount); } @endphp @foreach ($administrative_and_general_expenses as $item) @php // Check if amount is numeric and if it's less than 0.1 in absolute value if (is_numeric($item['amount']) && abs($item['amount']) < 0.1) { $item['amount'] = 0; // Set amount to 0 if less than 0.1 } // If the amount is not 0 if ($item['amount'] != 0) { // Invert the amount for administrative expenses $adminAmount = $item['amount'] * -1; // Format the amount to 3 decimal places $formattedAdmin = number_format($adminAmount, 3); $numericAmount = (float) $adminAmount; // Check if the amount is positive (credit) or negative (debit) if ($numericAmount > 0) { $TotalCredit += $numericAmount; } else { $TotalDebit += abs($numericAmount); // Use absolute value for debit } } @endphp @if ($item['amount'] != 0) @endif @endforeach @foreach ($detailed_salary_accounts as $item) @if ($item['amount'] != 0) @php $adminAmount = $item['amount'] * -1; $formattedAdmin = number_format($adminAmount, 3); $numericAmount = (float) $adminAmount; if ($numericAmount > 0) { $TotalCreditCheckSalary += $numericAmount; } else { $TotalDebitSalary += abs($numericAmount); } @endphp @endif @endforeach @if ($TotalCreditCheckSalary != 0 || $TotalDebitSalary != 0) @endif @foreach ($detailed_salary_accounts as $item) @if ($item['amount'] != 0) @php $adminAmount = $item['amount'] * -1; $formattedAdmin = number_format($adminAmount, 3); $numericAmount = (float) $adminAmount; if ($numericAmount > 0) { $TotalCredit += $numericAmount; } else { $TotalDebit += abs($numericAmount); } @endphp @endif @endforeach @foreach ($other_incomes as $item) @if ($item['amount'] != 0) @php // Calculate the absolute value for formatting $amount = $item['amount'] * -1; $formattedAmount = number_format(abs($amount), 3); $numericAmount = (float) $amount; if ($numericAmount > 0) { $TotalCredit += $numericAmount; } else { $TotalDebit += abs($numericAmount); } @endphp @endif @endforeach @if ($sum_of_other_incomes * -1 != 0) @endif @foreach ($other_expenses as $item) @if ($item['amount'] != 0) @php // Convert the amount to a positive value for display in the Debit column $amount = $item['amount'] * -1; $formattedAmount = number_format(abs($amount), 3); $numericAmount = (float) $amount; if ($numericAmount > 0) { $TotalCredit += $numericAmount; } else { $TotalDebit += abs($numericAmount); } @endphp @endif @endforeach @if ($sum_of_other_expenses != 0) @endif
{{ __('Statement') }} {{ __('Credit') }} {{ __('Debit') }} {{ __('Total') }}
{{ __('Sales') }}{{ $sales > 0 ? number_format(abs($sales), 3) : '---' }} {{ $sales < 0 ? number_format(abs($sales), 3) : '---' }}
{{ __('Returns on sales allowances') }} {{ $returnsAmount > 0 ? number_format(abs($returns_on_sales_allowances)) : '---' }} {{ $returnsAmount < 0 ? number_format(abs($returns_on_sales_allowances), 3) : '---' }}
{{ __('Discount allowed') }} {{ $discountAmount > 0 ? number_format(abs($discountAmount), 3) : '---' }} {{ $discountAmount < 0 ? number_format(abs($discountAmount), 3) : '---' }}
{{ __('Net sales') }} {{ number_format(abs($net_sales), 3) }}
       
{{ __('Cost of goods sold') }} {{ $costofgoodssold > 0 ? number_format(abs($costofgoodssold), 3) : '---' }} {{ $costofgoodssold < 0 ? number_format(abs($costofgoodssold), 3) : '---' }}
{{ __('Gross profit') }} --- --- {{ number_format(abs($gross_profit), 3) }}
{{ __('Administrative and general expenses') }}  
{{ $item['name'] }} {{ $adminAmount > 0 ? number_format(abs($adminAmount), 3) : '---' }} {{ $adminAmount < 0 ? number_format(abs($adminAmount), 3) : '---' }}
{{ __('Salary Expanse') }}  
{{ $item['name'] }} {{ $adminAmount > 0 ? number_format(abs($adminAmount), 3) : '---' }} {{ $adminAmount < 0 ? number_format(abs($adminAmount), 3) : '---' }}
{{ __('Total expenses') }}     {{ number_format(abs($sum_of_administrative_and_general_expenses + $sum_of_employee_salaries), 3) }}
{{ __('Other income') }}
{{ $item['name'] }} {{ $amount > 0 ? number_format(abs($numericAmount), 3) : '---' }} {{ $amount < 0 ? number_format(abs($numericAmount), 3) : '---' }}
{{ __('Total Other income') }} --- --- {{ number_format(abs($sum_of_other_incomes), 3) }}
{{ __('Other expenses') }}
{{ $item['name'] }} {{ $amount > 0 ? number_format(abs($numericAmount), 3) : '---' }} {{ $amount <= 0 ? number_format(abs($numericAmount), 3) : '---' }}
{{ __('Total Other expenses') }} --- --- {{ number_format(abs($sum_of_other_expenses), 3) }}
{{ __('Net profit') }} --- --- {{ number_format(abs($total), 3) }}
{{ __('Total') }} {{ number_format(abs($TotalCredit), 3) }} {{ number_format(abs($TotalDebit), 3) }} {{ number_format(abs($total), 3) }}