@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'); $gstPercentages = \App\Models\AccountingVoucherItem::where('accounting_voucher_id', $voucher->id) ->select('gst_per') ->groupBy('gst_per') ->get(); @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 @foreach ($gstPercentages as $gst) @php $acVoucher = \App\Models\AccountingVoucherItem::where('accounting_voucher_id', $voucher->id) ->where('gst_per', $gst->gst_per) ->get(); @endphp @if ($voucher->status != 0) @else @endif @endforeach @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'); $gstPercentages = \App\Models\AccountingVoucherItem::where('accounting_voucher_id', $voucher->id) ->select('gst_per') ->groupBy('gst_per') ->get(); @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 @foreach ($gstPercentages as $gst) @php $acVoucher = \App\Models\AccountingVoucherItem::where('accounting_voucher_id', $voucher->id) ->WhereHas('stockItem', function ($query) use ($gst) { $query->where('stock_items.gst', $gst->gst_per); }) ->get(); @endphp @if ($voucher->status != 0) @else @endif @endforeach @endif @endforeach
Voucher Number Voucher Date Voucher Type Party Name Party Address Party Pincode Party GSTIN Party Code Gst Percentage Taxable Value CGST SGST IGST CESS Total Business Type Status
B2B
{{ $voucher->voucher_number }} {{ Carbon::parse($voucher->voucher_date)->format('d-m-Y') }} {{ $voucher->voucherType->name }} {{ $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 }} {{ $gst->gst_per }} {{ $acVoucher->sum('taxable_value') }} {{ $acVoucher->sum('cgst') }} {{ $acVoucher->sum('sgst') }} {{ $acVoucher->sum('igst') }} {{ $acVoucher->sum('cess') }} {{ $acVoucher->sum('total') }} {{ $businessType }} {{ $voucher->status == 0 ? 'Cancelled' : '' }}
{{ $voucher->voucher_number }} {{ Carbon::parse($voucher->voucher_date)->format('d-m-Y') }} {{ $voucher->voucherType->name }} {{ $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 }} {{ $gst->gst_per }} {{ $businessType }} Cancelled
B2C
{{ $voucher->voucher_number }} {{ Carbon::parse($voucher->voucher_date)->format('d-m-Y') }} {{ $voucher->voucherType->name }} {{ $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 }} {{ $gst->gst_per }} {{ $acVoucher->sum('taxable_value') }} {{ $acVoucher->sum('cgst') }} {{ $acVoucher->sum('sgst') }} {{ $acVoucher->sum('igst') }} {{ $acVoucher->sum('cess') }} {{ $acVoucher->sum('total') }} {{ $businessType }} {{ $voucher->status == 0 ? 'Cancelled' : '' }}
{{ $voucher->voucher_number }} {{ Carbon::parse($voucher->voucher_date)->format('d-m-Y') }} {{ $voucher->voucherType->name }} {{ $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 }} {{ $gst->gst_per }} {{ $businessType }} Cancelled