@php $acVoucherItems = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $saleVouchersLocalIds, )->get(); $returnAcVoucherItems = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $returnVouchersLocalIds, )->get(); @endphp @php $sumSales = $acVoucherItems->sum('igst') + $acVoucherItems->sum('cgst') + $acVoucherItems->sum('sgst') + $acVoucherItems->sum('cess'); $sumReturns = $returnAcVoucherItems->sum('igst') + $returnAcVoucherItems->sum('cgst') + $returnAcVoucherItems->sum('sgst') + $returnAcVoucherItems->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp @foreach ($gstPercentages as $gstPercentage) @php $gst = $gstPercentage->gst; $getacItemsLocal = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $saleVouchersLocalIds, ) ->where('gst_per', $gst) ->get(); $getReturnacItemsLocal = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $returnVouchersLocalIds, ) ->where('gst_per', $gst) ->get(); @endphp @endforeach @php $getacItemsLocal = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $saleVouchersLocalIds, )->where('gst_per', 0) ->get(); $getReturnacItemsLocal = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $returnVouchersLocalIds, ) ->where('gst_per', 0) ->get(); @endphp {{-- Inter --}} @php $acVoucherItems = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $saleVouchersInterIds, )->get(); $returnAcVoucherItems = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $returnVouchersInterIds, )->get(); @endphp @php $sumSales = $acVoucherItems->sum('igst') + $acVoucherItems->sum('cgst') + $acVoucherItems->sum('sgst') + $acVoucherItems->sum('cess'); $sumReturns = $returnAcVoucherItems->sum('igst') + $returnAcVoucherItems->sum('cgst') + $returnAcVoucherItems->sum('sgst') + $returnAcVoucherItems->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp @foreach ($gstPercentages as $gstPercentage) @php $gst = $gstPercentage->gst; $getacItemsInter = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $saleVouchersInterIds, ) ->where('gst_per', $gst) ->get(); $getReturnacItemsInter = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $returnVouchersInterIds, ) ->where('gst_per', $gst) ->get(); @endphp @endforeach @php $getacItemsInter = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $saleVouchersInterIds, ) ->where('gst_per', 0) ->get(); $getReturnacItemsInter = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $returnVouchersInterIds, ) ->where('gst_per', 0) ->get(); @endphp @php $salesVoucherIds = collect($saleVouchersLocalIds)->merge($saleVouchersInterIds); $returnVoucherIds = collect($returnVouchersLocalIds)->merge($returnVouchersInterIds); $totalSales = App\Models\AccountingVoucherItem::whereIn('accounting_voucher_id', $salesVoucherIds)->get(); $totalReturns = App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $returnVoucherIds, )->get(); @endphp {{-- Purchase Section Starts Here --}} {{-- local --}} @php $acVoucherItems = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseVouchersLocalIds, )->get(); $returnAcVoucherItems = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseReturnVouchersLocalIds, )->get(); @endphp @php $sumSales = $acVoucherItems->sum('igst') + $acVoucherItems->sum('cgst') + $acVoucherItems->sum('sgst') + $acVoucherItems->sum('cess'); $sumReturns = $returnAcVoucherItems->sum('igst') + $returnAcVoucherItems->sum('cgst') + $returnAcVoucherItems->sum('sgst') + $returnAcVoucherItems->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp @foreach ($gstPercentages as $gstPercentage) @php $gst = $gstPercentage->gst; $getacItemsLocal = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseVouchersLocalIds, ) ->where('gst_per', $gst) ->get(); $getReturnacItemsLocal = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseReturnVouchersLocalIds, ) ->where('gst_per', $gst) ->get(); @endphp @endforeach @php $getacItemsLocal = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseVouchersLocalIds, ) ->where('gst_per', 0) ->get(); $getReturnacItemsLocal = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseReturnVouchersLocalIds, ) ->where('gst_per', 0) ->get(); @endphp {{-- inter --}} @php $acVoucherItems = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseVouchersInterIds, )->get(); $returnAcVoucherItems = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseReturnVouchersInterIds, )->get(); @endphp @php $sumSales = $acVoucherItems->sum('igst') + $acVoucherItems->sum('cgst') + $acVoucherItems->sum('sgst') + $acVoucherItems->sum('cess'); $sumReturns = $returnAcVoucherItems->sum('igst') + $returnAcVoucherItems->sum('cgst') + $returnAcVoucherItems->sum('sgst') + $returnAcVoucherItems->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp @foreach ($gstPercentages as $gstPercentage) @php $gst = $gstPercentage->gst; $getacItemsInter = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseVouchersInterIds, ) ->where('gst_per', $gst) ->get(); $getReturnacItemsInter = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseReturnVouchersInterIds, ) ->where('gst_per', $gst) ->get(); @endphp @endforeach @php $getacItemsInter = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseVouchersInterIds, ) ->where('gst_per', 0) ->get(); $getReturnacItemsInter = \App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $purchaseReturnVouchersInterIds, ) ->where('gst_per', 0) ->get(); @endphp @php $salesVoucherIds = collect($purchaseVouchersLocalIds)->merge($purchaseVouchersInterIds); $returnVoucherIds = collect($purchaseReturnVouchersLocalIds)->merge($purchaseReturnVouchersInterIds); $totalSales = App\Models\AccountingVoucherItem::whereIn('accounting_voucher_id', $salesVoucherIds)->get(); $totalReturns = App\Models\AccountingVoucherItem::whereIn( 'accounting_voucher_id', $returnVoucherIds, )->get(); @endphp
{{ Auth::user()->company_profile->name }}
{{ Auth::user()->company_profile->address }}

GSTR 3B

From Date: {{ \Carbon\Carbon::parse($from_date)->format('d-m-Y') }}     To Date: {{ \Carbon\Carbon::parse($to_date)->format('d-m-Y') }}
GSTIN:{{ Auth::user()->company_profile->gst }}
------------------------------------------------------------------------------------------------
Particulars Vouchers Count
Total Vouchers {{ $allVoucherCount }}
Included in Return {{ $allVoucherCount - $cancelledVoucherCount }}
No direct implication in return tables {{$cancelledVoucherCount }}
------------------------------------------------------------------------------------------------
Particulars Taxable Amount Integrated Tax Amount Central Tax Amount State Tax Amount Cess Amount Total Tax Amount
OutWard Suppliers
Local Sales {{ $acVoucherItems->sum('taxable_value') - $returnAcVoucherItems->sum('taxable_value') }} {{ $acVoucherItems->sum('igst') - $returnAcVoucherItems->sum('igst') }} {{ $acVoucherItems->sum('cgst') - $returnAcVoucherItems->sum('cgst') }} {{ $acVoucherItems->sum('sgst') - $returnAcVoucherItems->sum('sgst') }} {{ $acVoucherItems->sum('cess') - $returnAcVoucherItems->sum('cess') }}{{ $lastSum }}
                Sales Taxable@ {{ $gstPercentage->gst }}% {{ $getacItemsLocal->sum('taxable_value') - $getReturnacItemsLocal->sum('taxable_value') }} {{ $getacItemsLocal->sum('igst') - $getReturnacItemsLocal->sum('igst') }} {{ $getacItemsLocal->sum('cgst') - $getReturnacItemsLocal->sum('cgst') }} {{ $getacItemsLocal->sum('sgst') - $getReturnacItemsLocal->sum('sgst') }} {{ $getacItemsLocal->sum('cess') - $getReturnacItemsLocal->sum('cess') }} @php $sumSales = $getacItemsLocal->sum('igst') + $getacItemsLocal->sum('cgst') + $getacItemsLocal->sum('sgst') + $getacItemsLocal->sum('cess'); $sumReturns = $getReturnacItemsLocal->sum('igst') + $getReturnacItemsLocal->sum('cgst') + $getReturnacItemsLocal->sum('sgst') + $getReturnacItemsLocal->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
                Sales Exempt {{ $getacItemsLocal->sum('taxable_value') - $getReturnacItemsLocal->sum('taxable_value') }} {{ $getacItemsLocal->sum('igst') - $getReturnacItemsLocal->sum('igst') }} {{ $getacItemsLocal->sum('cgst') - $getReturnacItemsLocal->sum('cgst') }} {{ $getacItemsLocal->sum('sgst') - $getReturnacItemsLocal->sum('sgst') }} {{ $getacItemsLocal->sum('cess') - $getReturnacItemsLocal->sum('cess') }} @php $sumSales = $getacItemsLocal->sum('igst') + $getacItemsLocal->sum('cgst') + $getacItemsLocal->sum('sgst') + $getacItemsLocal->sum('cess'); $sumReturns = $getReturnacItemsLocal->sum('igst') + $getReturnacItemsLocal->sum('cgst') + $getReturnacItemsLocal->sum('sgst') + $getReturnacItemsLocal->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
Inter State Sales {{ $acVoucherItems->sum('taxable_value') - $returnAcVoucherItems->sum('taxable_value') }} {{ $acVoucherItems->sum('igst') - $returnAcVoucherItems->sum('igst') }} {{ $acVoucherItems->sum('cgst') - $returnAcVoucherItems->sum('cgst') }} {{ $acVoucherItems->sum('sgst') - $returnAcVoucherItems->sum('sgst') }} {{ $acVoucherItems->sum('cess') - $returnAcVoucherItems->sum('cess') }}{{ $lastSum }}
                Sales Taxable@ {{ $gstPercentage->gst }}% {{ $getacItemsInter->sum('taxable_value') - $getReturnacItemsInter->sum('taxable_value') }} {{ $getacItemsInter->sum('igst') - $getReturnacItemsInter->sum('igst') }} {{ $getacItemsInter->sum('cgst') - $getReturnacItemsInter->sum('cgst') }} {{ $getacItemsInter->sum('sgst') - $getReturnacItemsInter->sum('sgst') }} {{ $getacItemsInter->sum('cess') - $getReturnacItemsInter->sum('cess') }} @php $sumSales = $getacItemsInter->sum('igst') + $getacItemsInter->sum('cgst') + $getacItemsInter->sum('sgst') + $getacItemsInter->sum('cess'); $sumReturns = $getReturnacItemsInter->sum('igst') + $getReturnacItemsInter->sum('cgst') + $getReturnacItemsInter->sum('sgst') + $getReturnacItemsInter->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
                Sales Exempt {{ $getacItemsInter->sum('taxable_value') - $getReturnacItemsInter->sum('taxable_value') }} {{ $getacItemsInter->sum('igst') - $getReturnacItemsInter->sum('igst') }} {{ $getacItemsInter->sum('cgst') - $getReturnacItemsInter->sum('cgst') }} {{ $getacItemsInter->sum('sgst') - $getReturnacItemsInter->sum('sgst') }} {{ $getacItemsInter->sum('cess') - $getReturnacItemsInter->sum('cess') }} @php $sumSales = $getacItemsInter->sum('igst') + $getacItemsInter->sum('cgst') + $getacItemsInter->sum('sgst') + $getacItemsInter->sum('cess'); $sumReturns = $getReturnacItemsInter->sum('igst') + $getReturnacItemsInter->sum('cgst') + $getReturnacItemsInter->sum('sgst') + $getReturnacItemsInter->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
                              Total Outward Supplies {{ $totalSales->sum('taxable_value') - $totalReturns->sum('taxable_value') }} {{ $totalSales->sum('igst') - $totalReturns->sum('igst') }} {{ $totalSales->sum('cgst') - $totalReturns->sum('cgst') }} {{ $totalSales->sum('cgst') - $totalReturns->sum('cgst') }} {{ $totalSales->sum('cess') - $totalReturns->sum('cess') }} @php $sumSales = $totalSales->sum('igst') + $totalSales->sum('cgst') + $totalSales->sum('sgst') + $totalSales->sum('cess'); $sumReturns = $totalReturns->sum('igst') + $totalReturns->sum('cgst') + $totalReturns->sum('sgst') + $totalReturns->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
                              Total Liability {{ $totalSales->sum('taxable_value') - $totalReturns->sum('taxable_value') }} {{ $totalSales->sum('igst') - $totalReturns->sum('igst') }} {{ $totalSales->sum('cgst') - $totalReturns->sum('cgst') }} {{ $totalSales->sum('cgst') - $totalReturns->sum('cgst') }} {{ $totalSales->sum('cess') - $totalReturns->sum('cess') }} @php $sumSales = $totalSales->sum('igst') + $totalSales->sum('cgst') + $totalSales->sum('sgst') + $totalSales->sum('cess'); $sumReturns = $totalReturns->sum('igst') + $totalReturns->sum('cgst') + $totalReturns->sum('sgst') + $totalReturns->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
----------------------------------------------------------------------------------------------------------------
Local Purchases {{ $acVoucherItems->sum('taxable_value') - $returnAcVoucherItems->sum('taxable_value') }} {{ $acVoucherItems->sum('igst') - $returnAcVoucherItems->sum('igst') }} {{ $acVoucherItems->sum('cgst') - $returnAcVoucherItems->sum('cgst') }} {{ $acVoucherItems->sum('sgst') - $returnAcVoucherItems->sum('sgst') }} {{ $acVoucherItems->sum('cess') - $returnAcVoucherItems->sum('cess') }}{{ $lastSum }}
                Purchase Taxable@ {{ $gstPercentage->gst }}% {{ $getacItemsLocal->sum('taxable_value') - $getReturnacItemsLocal->sum('taxable_value') }} {{ $getacItemsLocal->sum('igst') - $getReturnacItemsLocal->sum('igst') }} {{ $getacItemsLocal->sum('cgst') - $getReturnacItemsLocal->sum('cgst') }} {{ $getacItemsLocal->sum('sgst') - $getReturnacItemsLocal->sum('sgst') }} {{ $getacItemsLocal->sum('cess') - $getReturnacItemsLocal->sum('cess') }} @php $sumSales = $getacItemsLocal->sum('igst') + $getacItemsLocal->sum('cgst') + $getacItemsLocal->sum('sgst') + $getacItemsLocal->sum('cess'); $sumReturns = $getReturnacItemsLocal->sum('igst') + $getReturnacItemsLocal->sum('cgst') + $getReturnacItemsLocal->sum('sgst') + $getReturnacItemsLocal->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
                Purchase Exempt {{ $getacItemsLocal->sum('taxable_value') - $getReturnacItemsLocal->sum('taxable_value') }} {{ $getacItemsLocal->sum('igst') - $getReturnacItemsLocal->sum('igst') }} {{ $getacItemsLocal->sum('cgst') - $getReturnacItemsLocal->sum('cgst') }} {{ $getacItemsLocal->sum('sgst') - $getReturnacItemsLocal->sum('sgst') }} {{ $getacItemsLocal->sum('cess') - $getReturnacItemsLocal->sum('cess') }} @php $sumSales = $getacItemsLocal->sum('igst') + $getacItemsLocal->sum('cgst') + $getacItemsLocal->sum('sgst') + $getacItemsLocal->sum('cess'); $sumReturns = $getReturnacItemsLocal->sum('igst') + $getReturnacItemsLocal->sum('cgst') + $getReturnacItemsLocal->sum('sgst') + $getReturnacItemsLocal->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
Inter State Purchase {{ $acVoucherItems->sum('taxable_value') - $returnAcVoucherItems->sum('taxable_value') }} {{ $acVoucherItems->sum('igst') - $returnAcVoucherItems->sum('igst') }} {{ $acVoucherItems->sum('cgst') - $returnAcVoucherItems->sum('cgst') }} {{ $acVoucherItems->sum('sgst') - $returnAcVoucherItems->sum('sgst') }} {{ $acVoucherItems->sum('cess') - $returnAcVoucherItems->sum('cess') }}{{ $lastSum }}
                purchase Taxable@ {{ $gstPercentage->gst }}% {{ $getacItemsInter->sum('taxable_value') - $getReturnacItemsInter->sum('taxable_value') }} {{ $getacItemsInter->sum('igst') - $getReturnacItemsInter->sum('igst') }} {{ $getacItemsInter->sum('cgst') - $getReturnacItemsInter->sum('cgst') }} {{ $getacItemsInter->sum('sgst') - $getReturnacItemsInter->sum('sgst') }} {{ $getacItemsInter->sum('cess') - $getReturnacItemsInter->sum('cess') }} @php $sumSales = $getacItemsInter->sum('igst') + $getacItemsInter->sum('cgst') + $getacItemsInter->sum('sgst') + $getacItemsInter->sum('cess'); $sumReturns = $getReturnacItemsInter->sum('igst') + $getReturnacItemsInter->sum('cgst') + $getReturnacItemsInter->sum('sgst') + $getReturnacItemsInter->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
                purchase Exempt {{ $getacItemsInter->sum('taxable_value') - $getReturnacItemsInter->sum('taxable_value') }} {{ $getacItemsInter->sum('igst') - $getReturnacItemsInter->sum('igst') }} {{ $getacItemsInter->sum('cgst') - $getReturnacItemsInter->sum('cgst') }} {{ $getacItemsInter->sum('sgst') - $getReturnacItemsInter->sum('sgst') }} {{ $getacItemsInter->sum('cess') - $getReturnacItemsInter->sum('cess') }} @php $sumSales = $getacItemsInter->sum('igst') + $getacItemsInter->sum('cgst') + $getacItemsInter->sum('sgst') + $getacItemsInter->sum('cess'); $sumReturns = $getReturnacItemsInter->sum('igst') + $getReturnacItemsInter->sum('cgst') + $getReturnacItemsInter->sum('sgst') + $getReturnacItemsInter->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
                              Total Inward Supplies {{ $totalSales->sum('taxable_value') - $totalReturns->sum('taxable_value') }} {{ $totalSales->sum('igst') - $totalReturns->sum('igst') }} {{ $totalSales->sum('cgst') - $totalReturns->sum('cgst') }} {{ $totalSales->sum('cgst') - $totalReturns->sum('cgst') }} {{ $totalSales->sum('cess') - $totalReturns->sum('cess') }} @php $sumSales = $totalSales->sum('igst') + $totalSales->sum('cgst') + $totalSales->sum('sgst') + $totalSales->sum('cess'); $sumReturns = $totalReturns->sum('igst') + $totalReturns->sum('cgst') + $totalReturns->sum('sgst') + $totalReturns->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}
                              Total Input Tax Credit {{ $totalSales->sum('taxable_value') - $totalReturns->sum('taxable_value') }} {{ $totalSales->sum('igst') - $totalReturns->sum('igst') }} {{ $totalSales->sum('cgst') - $totalReturns->sum('cgst') }} {{ $totalSales->sum('cgst') - $totalReturns->sum('cgst') }} {{ $totalSales->sum('cess') - $totalReturns->sum('cess') }} @php $sumSales = $totalSales->sum('igst') + $totalSales->sum('cgst') + $totalSales->sum('sgst') + $totalSales->sum('cess'); $sumReturns = $totalReturns->sum('igst') + $totalReturns->sum('cgst') + $totalReturns->sum('sgst') + $totalReturns->sum('cess'); $lastSum = $sumSales - $sumReturns; @endphp {{ $lastSum }}