@extends('admin.layouts') @section('title', 'GSTR-1 (Sales)') @section('header') @endsection @section('content')

GSTR-2 (Purchase)

@foreach ($purchases as $purchase) @php $party = $purchase->purchaseParty; $gstin = $party->gstin ?? 'N/A'; $customerName = $party->customer_name ?? 'N/A'; $totalCgst = 0; $totalSgst = 0; $totalGstPercent = 0; foreach ($purchase->items as $item) { $totalSgst += $item->sgst * $item->quantity; $totalCgst += $item->cgst * $item->quantity; $totalGstPercent += $item->gst_percentage ?? 0; } $totalTax = $totalCgst + $totalSgst; $invoiceTotal = $purchase->total_amount ?? 0; $taxableValue = $invoiceTotal - $totalTax; @endphp @endforeach
S.N GSTIN Customer Name Invoice No Invoice Date Invoice Value Total Tax % Taxable Value SGST CGST Total Tax
{{ $loop->iteration }} {{ $gstin }} {{ $customerName }} {{ $purchase->invoice_number }} {{ \Carbon\Carbon::parse($purchase->purchase_date)->format('d-m-Y') }} ₹{{ number_format($taxableValue, 2) }} {{ number_format(count($purchase->items) > 0 ? $totalGstPercent / count($purchase->items) : 0, 2) }}% ₹{{ number_format($invoiceTotal, 2) }} ₹{{ number_format($totalSgst, 2) }} ₹{{ number_format($totalCgst, 2) }} ₹{{ number_format($totalTax, 2) }}
@endsection @section('footer') @endsection