@extends('backend.invoice.master') @php($title= 'Invoice') @if($payment->row_id!=null) @php($title='Sale Invoice') @else @php($title='Cash Received Memo') @endif @section('title') {{ $title }} @endsection @section('body')

@php($client = $payment->client)
Name:{{ $client->name }} Mobile:{{ $client->mobile }} Address:{{ $client->address }}
Date:{{ dateFormat($payment->created_at,'d-m-Y') }} Time:{{ dateFormat($payment->created_at,'h:m:i') }} Invoice No: @if($payment->row_id != null) {{ memoNo($payment->sale->id) }} @endif
{{-- --}} @if($payment->row_id!=null) @foreach($payment->sale->details as $detail) {{-- @php($factor = unitConversionFactor($detail->unit_id,$detail->secondary_unit_id))--}} {{-- --}} @endforeach @endif @php($total = 0) @if($payment->row_id!=null) {{-- @if($payment->sale->vat>0)--}} {{-- @endif--}} {{-- @if($payment->sale->discount>0)--}} {{-- @endif--}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- --}} {{-- @php($total = $payment->sale->total)--}} @php($total = $payment->sale->product_cost+$payment->sale->vat-$payment->sale->discount) @endif @php($received = $payment->amount) @php($due = ($total - $received)) @if($payment->row_id!=null) @endif @php($oldBalance = clientLastBalance($payment->client_id,$payment->id)) @php($oldBal = $oldBalance['balance']) @php($presentBalance = customerNewBalance($due,$oldBalance))
Sl Product CompanyQuantityQuantity Rate(Taka) Cost(Taka)
{{ numberFormat($loop->iteration) }} {{ $detail->product->name }} {{ $detail->product->brand->name }}{{ numberFormat($detail->quantity*$factor) }} {{ $detail->secondaryUnit->code }}{{ numberFormat($detail->quantity,dp($detail->quantity)) }} {{ $detail->unit->code }} {{ numberFormat($detail->rate,2) }} {{ numberFormat($detail->rate*$detail->quantity,2) }}
Total Cost: {{ numberFormat($payment->sale->product_cost,2) }}/-
Vat(+): {{ numberFormat($payment->sale->vat,2) }}/-
Discount(-): {{ numberFormat($payment->sale->discount,2) }}/-
Transport Cost(-):{{ numberFormat($payment->sale->transport_cost,2) }}/-
Labour Cost(-):{{ numberFormat($payment->sale->labour_cost,2) }}/-
Total:{{ numberFormat($total,2) }}/-
Received:{{ numberFormat($received,2) }}/-
{{ $due<0 ? 'Payable':'Receivable' }}: {{ numberFormat(abs($due),2) }}/-
Past {{ $oldBalance['title'] == 'Credit' ? 'Receivable' : 'Payable' }}:{{ numberFormat($oldBal,2) }}/-
Present {{ $presentBalance['title'] == 'Credit' ? 'Receivable' : 'Payable' }}: {{ numberFormat($presentBalance['balance'],2) }}/-
@endsection