@php use Carbon\Carbon; $party = 'Dr'; switch ($name) { case 'Purchase': $party = 'Cr'; break; case 'Sales': $party = 'Dr'; break; case 'Purchase Return': $party = 'Dr'; break; case 'Sales Return': $party = 'Cr'; break; default: $party = 'Dr'; break; } @endphp @foreach ($vouchers as $voucher) @php $businessType = $party == 'Cr' ? ($voucher->creditLedger != null && $voucher->creditLedger->gst != null && $voucher->creditLedger->gst != 0 ? 'B2B' : 'B2C') : ($voucher->debitLedger != null && $voucher->debitLedger->gst != null && $voucher->debitLedger->gst != 0 ? 'B2B' : 'B2C'); @endphp @if ($businessType == 'B2B') @if (($party == 'Cr' && $voucher->creditLedger == null) || ($party == 'Dr' && $voucher->debitLedger == null)) @php $ledgerName = ''; @endphp @foreach ($paymentLedgers as $paymentLedger) @php $ledger = App\Models\AccountingVoucherDetails::where('accounting_voucher_id', $voucher->id) ->where('ledger_id', $paymentLedger->id) ->first(); if ($ledger) { $ledgerName .= $paymentLedger->name . ', '; } @endphp @endforeach @endif @if ($voucher->status == 1) @foreach ($voucher->items as $item) @endforeach @else {{-- @dd($voucher) --}} {{-- @dd('cancelled') --}} @endif @endif @endforeach @foreach ($vouchers as $voucher) @php $businessType = $party == 'Cr' ? ($voucher->creditLedger != null && $voucher->creditLedger->gst != null && $voucher->creditLedger->gst != 0 ? 'B2B' : 'B2C') : ($voucher->debitLedger != null && $voucher->debitLedger->gst != null && $voucher->debitLedger->gst != 0 ? 'B2B' : 'B2C'); @endphp @if ($businessType == 'B2C') @if (($party == 'Cr' && $voucher->creditLedger == null) || ($party == 'Dr' && $voucher->debitLedger == null)) @php $ledgerName = ''; @endphp @foreach ($paymentLedgers as $paymentLedger) @php $ledger = App\Models\AccountingVoucherDetails::where('accounting_voucher_id', $voucher->id) ->where('ledger_id', $paymentLedger->id) ->first(); if ($ledger) { $ledgerName .= $paymentLedger->name . ', '; } @endphp @endforeach @endif @if ($voucher->status == 1) @foreach ($voucher->items as $item) @endforeach @else @endif @endif @endforeach
Voucher Number Voucher Type Voucher Date Party Name Party Address Party Pincode Party GSTIN Party Code Product Name Product Code Product HSN Product GST Product Unit Product Quantity Product Price Gross Value Discount Percentage Discount Amount Taxable Value CGST SGST IGST CESS Total Business Type Supplier Inv No Supplier Inv Date Status
B2B
{{ $voucher->voucher_number }} {{ $voucher->voucherType->name }} {{ Carbon::parse($voucher->voucher_date)->format('d-m-Y') }} {{ $party == 'Cr' ? ($voucher->creditLedger != null ? $voucher->creditLedger->name : $ledgerName) : ($voucher->debitLedger != null ? $voucher->debitLedger->name : $ledgerName) }} {{ $party == 'Cr' ? $voucher->creditLedger?->address : $voucher->debitLedger?->address }} {{ $party == 'Cr' ? $voucher->creditLedger?->pin_code : $voucher->debitLedger?->pin_code }} {{ $party == 'Cr' ? $voucher->creditLedger?->gst : $voucher->debitLedger?->gst }} {{ $party == 'Cr' ? $voucher->creditLedger?->ledger_code : $voucher->debitLedger?->ledger_code }} {{ $item->stockItem->name }} {{ $item->stockItem->item_code }} {{ $item->stockItem->hsn_code }} {{ $item->gst_per }} {{ $item->unit->name }} {{ $item->quantity }} {{ $item->price }} {{ $item->gross_value }} {{ $item->disc_percentage }} {{ $item->disc_amount }} {{ $item->taxable_value }} {{ $item->cgst }} {{ $item->sgst }} {{ $item->igst }} {{ $item->cess }} {{ $item->total }} {{ $businessType }} {{ $voucher->supplier_invoice_no }} {{ $voucher->supplier_invoice_date != null ? Carbon::parse($voucher->supplier_invoice_date)->format('d-m-Y') : '' }} {{ $voucher->status == 0 ? 'Cancelled' : '' }}
{{ $voucher->voucher_number }} {{ $voucher->voucherType->name }} {{ Carbon::parse($voucher->voucher_date)->format('d-m-Y') }} {{ $party == 'Cr' ? ($voucher->creditLedger != null ? $voucher->creditLedger->name : $ledgerName) : ($voucher->debitLedger != null ? $voucher->debitLedger->name : $ledgerName) }} {{ $party == 'Cr' ? $voucher->creditLedger?->address : $voucher->debitLedger?->address }} {{ $party == 'Cr' ? $voucher->creditLedger?->pin_code : $voucher->debitLedger?->pin_code }} {{ $party == 'Cr' ? $voucher->creditLedger?->gst : $voucher->debitLedger?->gst }} {{ $party == 'Cr' ? $voucher->creditLedger?->ledger_code : $voucher->debitLedger?->ledger_code }} {{ $businessType }} {{ $voucher->supplier_invoice_no }} {{ $voucher->supplier_invoice_date != null ? Carbon::parse($voucher->supplier_invoice_date)->format('d-m-Y') : '' }} Cancelled
B2C
{{ $voucher->voucher_number }} {{ $voucher->voucherType->name }} {{ Carbon::parse($voucher->voucher_date)->format('d-m-Y') }} {{ $party == 'Cr' ? ($voucher->creditLedger != null ? $voucher->creditLedger->name : $ledgerName) : ($voucher->debitLedger != null ? $voucher->debitLedger->name : $ledgerName) }} {{ $party == 'Cr' ? $voucher->creditLedger?->address : $voucher->debitLedger?->address }} {{ $party == 'Cr' ? $voucher->creditLedger?->pin_code : $voucher->debitLedger?->pin_code }} {{ $party == 'Cr' ? $voucher->creditLedger?->gst : $voucher->debitLedger?->gst }} {{ $party == 'Cr' ? $voucher->creditLedger?->ledger_code : $voucher->debitLedger?->ledger_code }} {{ $item->stockItem->name }} {{ $item->stockItem->item_code }} {{ $item->stockItem->hsn_code }} {{ $item->gst_per }} {{ $item->unit->name }} {{ $item->quantity }} {{ $item->price }} {{ $item->gross_value }} {{ $item->disc_percentage }} {{ $item->disc_amount }} {{ $item->taxable_value }} {{ $item->cgst }} {{ $item->sgst }} {{ $item->igst }} {{ $item->cess }} {{ $item->total }} {{ $businessType }} {{ $voucher->supplier_invoice_no }} {{ $voucher->supplier_invoice_date != null ? Carbon::parse($voucher->supplier_invoice_date)->format('d-m-Y') : '' }} {{ $voucher->status == 0 ? 'Cancelled' : '' }}
{{ $voucher->voucher_number }} {{ $voucher->voucherType->name }} {{ Carbon::parse($voucher->voucher_date)->format('d-m-Y') }} {{ $party == 'Cr' ? ($voucher->creditLedger != null ? $voucher->creditLedger->name : $ledgerName) : ($voucher->debitLedger != null ? $voucher->debitLedger->name : $ledgerName) }} {{ $party == 'Cr' ? $voucher->creditLedger?->address : $voucher->debitLedger?->address }} {{ $party == 'Cr' ? $voucher->creditLedger?->pin_code : $voucher->debitLedger?->pin_code }} {{ $party == 'Cr' ? $voucher->creditLedger?->gst : $voucher->debitLedger?->gst }} {{ $party == 'Cr' ? $voucher->creditLedger?->ledger_code : $voucher->debitLedger?->ledger_code }} {{ $businessType }} {{ $voucher->supplier_invoice_no }} {{ $voucher->supplier_invoice_date != null ? Carbon::parse($voucher->supplier_invoice_date)->format('d-m-Y') : '' }} Cancelled