{{$lang->data['print_sales_report'] ?? 'Print Sales Report'}} @php $no_of_invoices = \App\Models\Invoice::whereDate('date',$date)->latest(); $total_sales = \App\Models\Invoice::whereDate('date',$date)->latest(); $payment_received = \App\Models\InvoicePayment::whereDate('date',$date)->latest(); $total_expense = \App\Models\Expense::whereDate('date',$date)->latest(); $invoices = \App\Models\Invoice::whereDate('date',$date)->latest(); if($branch != '') { $no_of_invoices->where('created_by',$branch); $total_sales->where('created_by',$branch); $payment_received->where('created_by',$branch); $total_expense->where('created_by',$branch); $invoices->where('created_by',$branch); } $invoices = $invoices->get(); $no_of_invoices = $no_of_invoices->count(); $total_sales = $total_sales->sum('total'); $payment_received = $payment_received->sum('paid_amount'); $total_expense = $total_expense->sum('amount'); @endphp

Daily Sales Report

{{ \Carbon\Carbon::parse($date)->format('d/m/Y') }}

@if($branch != '') {{$lang->data['branch'] ?? 'Branch'}}: {{ \App\Models\User::find($branch)->name ?? '' }} @else {{$lang->data['branch'] ?? 'Branch'}}: All Branches @endif

Daily Sales

@php $total_balance = 0; $total_payment = 0; @endphp @foreach ($invoices as $item) @endforeach
Invoice No File No. Qty Amount Payment Balance
#{{$item->invoice_number}}
{{$item->customer_file_number}}
@php $localquantity = \App\Models\InvoiceDetail::where('invoice_id',$item->id)->sum('quantity'); @endphp
{{$localquantity}}
{{getFormattedCurrency($item->total)}}
@php $payment = \App\Models\InvoicePayment::where('invoice_id',$item->id)->sum('paid_amount'); $total_balance+= $item->total - $payment; $total_payment+= $payment; @endphp
{{getFormattedCurrency($payment)}}
{{getFormattedCurrency($item->total - $payment)}}
Total Amount:
{{getFormattedCurrency($invoices->sum('total'))}}
Total Payment :
{{getFormattedCurrency($total_payment)}}
Total Balance:
{{getFormattedCurrency($total_balance)}}

Other Daily Data

@php if($branch== '') { $opening_balance = \App\Models\InvoicePayment::whereDate('date',$date)->where('payment_type',2)->sum('paid_amount'); $all_payment = \App\Models\InvoicePayment::whereDate('date',$date)->where('payment_type',1)->sum('paid_amount'); $max_payment = \App\Models\InvoicePayment::whereDate('date',$date)->sum('paid_amount'); } else{ $opening_balance = \App\Models\InvoicePayment::whereCreatedBy($branch)->whereDate('date',$date)->where('payment_type',2)->sum('paid_amount'); $all_payment = \App\Models\InvoicePayment::whereCreatedBy($branch)->whereDate('date',$date)->where('payment_type',1)->sum('paid_amount'); $max_payment = \App\Models\InvoicePayment::whereCreatedBy($branch)->whereDate('date',$date)->sum('paid_amount'); } @endphp
Particulars Value ... ...
Number of Invoices
{{$no_of_invoices}}
Opening Balance Received
{{getFormattedCurrency($opening_balance)}}
Total Sales
{{getFormattedCurrency($total_sales)}}
Old Invoice Balance Received
{{getFormattedCurrency($all_payment - $total_payment)}}
Total Expense
{{getFormattedCurrency($total_expense)}}
Total Payment Received
{{getFormattedCurrency($max_payment)}}