@extends('layouts.app') @section('title', $title) @section('content') @php($period = $type === 'stock' ? __('Current Stock') : trim(($from ?: __('Start')).' - '.($to ?: __('Today'))))
@include('reports.partials.header', ['title' => $title, 'period' => $period])
@if($type === 'stock')
@else
@endif
{{ __('Export CSV') }}
@if($type === 'sales') @foreach($rows as $row)@endforeach
{{ __('Date') }}{{ __('Invoice') }}{{ __('Customer') }}{{ __('Total') }}{{ __('Paid') }}{{ __('Due') }}
{{ \App\Support\DualDate::format($row->invoice_date, 'd M Y') }}{{ $row->invoice_number }}{{ $row->customer?->name ?? $row->walk_in_name ?? __('Walk-in Customer') }}{{ number_format($row->total, 2) }} {{ $row->currency_code }}{{ number_format($row->paid_amount, 2) }}{{ number_format($row->due_amount, 2) }}
{{ __('Total') }}{{ number_format($rows->sum('total'), 2) }} {{ $moneyCode }}{{ number_format($rows->sum('paid_amount'), 2) }}{{ number_format($rows->sum('due_amount'), 2) }}
@elseif($type === 'purchases') @foreach($rows as $row)@endforeach
{{ __('Date') }}{{ __('Purchase') }}{{ __('Supplier') }}{{ __('Total') }}{{ __('Paid') }}{{ __('Due') }}
{{ \App\Support\DualDate::format($row->purchase_date, 'd M Y') }}{{ $row->purchase_number }}{{ $row->supplier?->name }}{{ number_format($row->subtotal, 2) }} {{ $row->currency_code }}{{ number_format($row->paid_amount, 2) }}{{ number_format($row->due_amount, 2) }}
{{ __('Total') }}{{ number_format($rows->sum('subtotal'), 2) }} {{ $moneyCode }}{{ number_format($rows->sum('paid_amount'), 2) }}{{ number_format($rows->sum('due_amount'), 2) }}
@elseif($type === 'stock') @foreach($rows as $row)@endforeach
{{ __('Product') }}{{ __('Category') }}{{ __('Unit') }}{{ __('Stock') }}{{ __('Cost Value') }}
{{ $row->name }}{{ $row->category?->name }}{{ $row->unit }}{{ $row->stock_quantity }}{{ number_format($row->stock_quantity * $row->cost_price, 2) }} {{ $moneyCode }}
{{ __('Total') }}{{ number_format($rows->sum('stock_quantity'), 2) }}{{ number_format($rows->sum(fn ($row) => $row->stock_quantity * $row->cost_price), 2) }} {{ $moneyCode }}
@else @foreach($rows as $row)@endforeach
{{ __('Date') }}{{ __('Party') }}{{ __('Category') }}{{ __('Amount') }}
{{ \App\Support\DualDate::format($row['date'], 'd M Y') }}{{ $row['party'] ?: '-' }}{{ $row['category'] }}{{ number_format($row['amount'], 2) }} {{ $row['currency'] }}
{{ __('Total') }}{{ number_format($rows->sum('amount'), 2) }} {{ $moneyCode }}
@endif
@if(!empty($appSettings['report_footer']))

{{ $appSettings['report_footer'] }}

@endif @endsection