@foreach ($accountingVouchers as $accountingVoucher)
@if ($pageLogo != null) Logo @endif

{{ $company->name }}
{{ $company->address }},{{ $company->pin_code }}
PH: {{ $company->phone }}
Email: {{ $company->email }}

GSTIN: {{ $company->gst }}
@if ($company->fssai_number != null) FSSAI LICENSE NO : {{ $company->fssai_number }}
@endif Details of Reciever(Billed to)
Name: {{ $accountingVoucher->customer ? $accountingVoucher->customer->name : ($accountingVoucher->debitLedger->legal_name != null ? $accountingVoucher->debitLedger->legal_name : $accountingVoucher->debitLedger->name) }}
Address: {{ $accountingVoucher->customer ? $accountingVoucher->customer->address : $accountingVoucher->debitLedger->address }}
State: {{ $accountingVoucher->customer ? $accountingVoucher->customer->state : $accountingVoucher->debitLedger->state }}
Mobile: {{ $accountingVoucher->customer ? $accountingVoucher->customer->mobile : $accountingVoucher->debitLedger->mobile_no }}
GSTIN No :{{ $accountingVoucher->customer ? '' : $accountingVoucher->debitLedger->gst }}
TAX INVOICE
Invoice No : {{ $accountingVoucher->voucher_number }}
Invoice Date : {{ date('d-m-Y', strtotime($accountingVoucher->voucher_date)) }}
Invoice Type : {{ $accountingVoucher->voucherType->name }}
Sales Man : {{ $accountingVoucher->user ? $accountingVoucher->user->name : '' }}
Remarks : {{ $accountingVoucher->remarks }} @if ($accountingVoucher->ship_to_address != null)
Ship to Address : {{ $accountingVoucher->ship_to_address }} @endif @if ($accountingVoucher->vehicle_no != null)
Vehicle No : {{ $accountingVoucher->vehicle_no }}
@endif
@php $categoryGroupId = \App\Models\StockCategoryGroup::where('business_key', Auth::user()->business_key) ->where('name', 'Size') ->first()->id; $categories = \App\Models\StockCategory::where('business_key', Auth::user()->business_key) ->where('stock_category_group_id', $categoryGroupId) ->get(); $items = $accountingVoucher ->items() ->join('stock_items', 'accounting_voucher_items.stock_item_id', '=', 'stock_items.id') ->select('accounting_voucher_items.*', 'stock_items.item_collection_id as item_collection_id') ->get(); $itemGroups = $items->groupBy(function ($item) { return $item->item_collection_id . '-' . $item->price_inc_tax . '-' . $item->gst_per; }); @endphp @foreach ($categories as $category) @endforeach @foreach ($itemGroups as $key => $item) @foreach ($categories as $category) @php $itemIds = $item->pluck('stock_item_id'); $categoryExist = \App\Models\StockItemCategory::whereIn('stock_item_id', $itemIds) ->where('stock_category_id', $category->id) ->get(); @endphp @if ($categoryExist->isNotEmpty()) @else @endif @endforeach @endforeach @for ($k = $accountingVoucher->items()->count(); $k <= 17; $k++) @foreach ($categories as $category) @endforeach @endfor @foreach ($categories as $category) @endforeach
sno Items HSN MRP{{ $category->name }}Tot
Qty
Tax % Rate Amount
{{ $loop->iteration }} {{ $item[0]->stockItem->itemCollection ? $item[0]->stockItem->itemCollection->name : $item[0]->stockItem->name }} {{ $item[0]->stockItem->hsn_code }} {{ number_format($item[0]->stockItem->getMrp($accountingVoucher->voucher_date), 2) }}{{ $item->whereIn('stock_item_id', $categoryExist->pluck('stock_item_id'))->sum('quantity') }} {{ $item->sum('quantity') }} {{ $item[0]->gst_per }} {{ number_format($item[0]->price_inc_tax, 2) }} {{ number_format($item->sum('total'), 2) }}
Total {{ $accountingVoucher->items->sum('quantity') }} {{ number_format($accountingVoucher->items->sum('total'), 2) }}
@php $words = new \NumberFormatter('en', \NumberFormatter::SPELLOUT); $words = $words->format($accountingVoucher->amount); $additionalLedgers = \App\Models\AccountingVoucherLedger::where( 'accounting_voucher_id', $accountingVoucher->id, )->get(); $count = $additionalLedgers->count(); @endphp @if ($accountingVoucher->items()->sum('igst') > 0) @else @endif @foreach ($additionalLedgers as $additionalLedger) @endforeach @if ( $PrintSettings->show_outstanding == 1 && $accountingVoucher->debitLedger != null && !in_array($accountingVoucher->debitLedger->group->name, ['Cash in hand', 'Bank Accounts'])) @if ($accountingVoucher->todayVouchers != null) @foreach ($accountingVoucher->todayVouchers as $todayVoucher) @endforeach @endif @endif
show_outstanding == 1 && $accountingVoucher->debitLedger != null && !in_array($accountingVoucher->debitLedger->group->name, ['Cash in hand', 'Bank Accounts'])) rowspan="{{ 9 + $accountingVoucher->todayVouchers->count() + 1 + $count }}" @else rowspan= {{ 7 + $count }} @endif> Amount In Words
({{ $words }}) @if ($company->bankLedger != null)
Bank Details @if ($PrintSettings->upi_id != null) @endif
Bank Name : {{ $company->bankLedger->name }} @if ($qr_code != null)

@endif
Branch : {{ $company->bankLedger->branch }}
A/C No : {{ $company->bankLedger->account_number }}
IFSC : {{ $company->bankLedger->ifsc_code }}
UPI ID : {{ $PrintSettings->upi_id }}
@endif
Gross Value {{ number_format($accountingVoucher->items()->sum('gross_value'), 2) }}
Total IGST {{ number_format($accountingVoucher->items()->sum('igst'), 2) }}
Total CGST {{ number_format($accountingVoucher->items()->sum('cgst'), 2) }}
Total SGST {{ number_format($accountingVoucher->items()->sum('sgst'), 2) }}
Total GST {{ number_format($accountingVoucher->items()->sum('sgst') + $accountingVoucher->items()->sum('cgst') + $accountingVoucher->items()->sum('igst'), 2) }}
Bill Discount {{ number_format($accountingVoucher->discount, 2) }}
Freight {{ number_format($accountingVoucher->freight, 2) }}
{{ $additionalLedger->ledger->name }} @if ($additionalLedger->dr_or_cr == 'Dr') (-) @else (+) @endif ({{ $additionalLedger->dr_or_cr }}) {{ $additionalLedger->amount }}
Grand Total {{ $accountingVoucher->amount }}
Previous Day Balance {{ $accountingVoucher->previousBalance }}   {{ $accountingVoucher->previousBalanceDrCr }}
Today's Vouchers
{{ $todayVoucher->voucherType->name }} - {{ $todayVoucher->voucher_number }} {{ $todayVoucher->amount }}   {{ $todayVoucher->dr_or_cr }}
Net Amount {{ $accountingVoucher->totalOutstanding }} {{ $accountingVoucher->totalOutstandingDrCr }}

For, {{ $company->name }} @if ($seal_image != null) Logo
@else

@endif Authorized Signatory

Printed Date: {{ \Carbon\Carbon::now()->format('d M Y') }} Time: {{ \Carbon\Carbon::now('Asia/Kolkata')->format('h:i A') }} @if ($accountingVouchers->last() != $accountingVoucher)
@endif @endforeach