@foreach($gstPercentages as $gstPercentage) @endforeach @foreach ($accountingVouchers as $accountingVoucher ) @php $totalGroupedAmount = 0; $firstVoucher = \App\Models\AccountingVoucher::where('voucher_type_id', $accountingVoucher->voucher_type_id)->where('voucher_date', $accountingVoucher->voucher_date)->where('status', 1)->orderBy('id', 'asc')->first(); $lastVoucher = \App\Models\AccountingVoucher::where('voucher_type_id', $accountingVoucher->voucher_type_id)->where('voucher_date', $accountingVoucher->voucher_date)->where('status', 1)->orderBy('id', 'desc')->first(); $totalTax = 0; $nonTaxable = \App\Models\AccountingVoucherItem::whereHas('accountingVoucher', function ($query) use ($accountingVoucher,$cashAndBankLedgerId) { $query->where('accounting_vouchers.voucher_type_id', $accountingVoucher->voucher_type_id)->where('accounting_vouchers.voucher_date', $accountingVoucher->voucher_date)->where('status', 1) ->whereHas('debitLedger',function ($q) use ($cashAndBankLedgerId) { $q->whereIn('group_id', $cashAndBankLedgerId); }); })->where(function ($query) { $query->where('gst_per', 0)->orWhere('gst_per', null); })->sum('taxable_value'); $nonTaxable = round($nonTaxable, 2); $totalGroupedAmount += $nonTaxable; $totalQty = \App\Models\AccountingVoucherItem::whereHas('accountingVoucher', function ($query) use ($accountingVoucher,$cashAndBankLedgerId) { $query->where('accounting_vouchers.voucher_type_id', $accountingVoucher->voucher_type_id)->where('accounting_vouchers.voucher_date', $accountingVoucher->voucher_date)->where('status', 1) ->whereHas('debitLedger',function ($q) use ($cashAndBankLedgerId) { $q->whereIn('group_id', $cashAndBankLedgerId); }); })->sum('base_qty'); @endphp @foreach ($gstPercentages as $gstPercentage) @php $gst = $gstPercentage->gst; $acVoucherItems = \App\Models\AccountingVoucherItem::whereHas('accountingVoucher', function ($query) use ($accountingVoucher,$cashAndBankLedgerId) { $query->where('voucher_type_id', $accountingVoucher->voucher_type_id)->where('voucher_date', $accountingVoucher->voucher_date)->where('status', 1) ->whereHas('debitLedger',function ($q) use ($cashAndBankLedgerId) { $q->whereIn('group_id', $cashAndBankLedgerId); }); })->where('gst_per', $gst)->get(); $igst = round($acVoucherItems->sum('igst'),2); $cgst = round($acVoucherItems->sum('cgst'),2); $sgst = round($acVoucherItems->sum('sgst'),2); $totalTax += $igst + $cgst + $sgst; $taxableValue = round($acVoucherItems->sum('taxable_value'),2); $totalGroupedAmount += $taxableValue; @endphp @endforeach @php $cess = \App\Models\AccountingVoucherItem::whereHas('accountingVoucher', function ($query) use ($accountingVoucher,$cashAndBankLedgerId) { $query->where('voucher_type_id', $accountingVoucher->voucher_type_id)->where('voucher_date', $accountingVoucher->voucher_date)->where('status', 1) ->whereHas('debitLedger',function ($q) use ($cashAndBankLedgerId) { $q->whereIn('group_id', $cashAndBankLedgerId); }); })->sum('cess'); $cess = round($cess,2); $totalGroupedAmount += $cess; $totalGroupedAmount += $totalTax; @endphp @php $round_off = round($totalGroupedAmount) - $totalGroupedAmount; $amount = $totalGroupedAmount + $round_off; @endphp @endforeach
SL No Inv Date Inv No Party Name GSTR No Total Qty None Taxable{{$gstPercentage->gst}}% Sales IGST Amt CGST Amt SGST AmtTotal Tax Cess Amt Round Off Bill Amt
{{$loop->iteration}} {{date('d/m/Y', strtotime($accountingVoucher->voucher_date))}}{{ $firstVoucher->voucher_number }} - {{ $lastVoucher->voucher_number }} Cash {{ $totalQty }} {{ $nonTaxable }}{{ $taxableValue }} {{ $igst }} {{ $cgst }} {{ $sgst }}{{ round($totalTax ,2)}}{{ $cess }}{{ $round_off }} {{ round($amount) }}