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

GSTR-1 (Sales)

{{-- @foreach ($sales as $sale) @php $customer = is_string($sale->customer_details) ? json_decode($sale->customer_details, true) ?? [] : $sale->customer_details ?? []; $totalCgst = 0; $totalSgst = 0; $totalGstPercent = 0; $totalTaxable = 0; foreach ($sale->sale_items as $item) { $productId = $item['item_identifier'] ?? null; $product = \App\Models\Product::where( 'product_id', $productId, )->first(); $sellPrice = $item['sell_price'] ?? 0; $quantity = $item['quantity'] ?? 0; $taxableValue = $sellPrice * $quantity; $totalTaxable += $taxableValue; $cgst = $product->cgst ?? 0; $sgst = $product->sgst ?? 0; $totalGstPercent += $cgst + $sgst; $totalCgst += $cgst; $totalSgst += $sgst; } @endphp @endforeach
# Customer Name Invoice Number Invoice Date Invoice Value Total Tax (%) Taxable Value CGST SGST Action
{{ $loop->iteration }} {{ $customer['name'] ?? 'N/A' }} {{ $sale->order_id ?? '-' }} {{ $sale->changed_date ? $sale->created_at->format('d-m-Y') : '-' }} ₹{{ number_format($sale->amount_payable ?? 0, 2) }} {{ $totalGstPercent }}% ₹{{ number_format($totalTaxable, 2) }} ₹{{ number_format($totalCgst, 2) }} ₹{{ number_format($totalSgst, 2) }} View Invoice
--}} {{-- ///////////////////////////// --}} {{-- @foreach ($sales as $sale) @php $customer = is_array($sale->customer_details) ? $sale->customer_details : (json_decode($sale->customer_details, true) ?? []); @endphp @endforeach
# Customer Name Invoice Number Invoice Date Invoice Value Taxable Value CGST SGST Total Tax Action
{{ $loop->iteration }} {{ $customer['name'] ?? 'N/A' }} {{ $sale->order_id ?? '-' }} {{ $sale->created_at?->format('d-m-Y') ?? '-' }} ₹{{ number_format($sale->amount_payable ?? 0, 2) }} ₹{{ number_format(($sale->amount_payable ?? 0) - ($sale->cgst ?? 0) - ($sale->sgst ?? 0), 2) }} ₹{{ number_format($sale->tax_value ?? 0, 2) }} ₹{{ number_format($sale->cgst ?? 0, 2) }} ₹{{ number_format($sale->sgst ?? 0, 2) }} View Invoice
--}} {{-- ///////////////////////////// --}} {{-- --}} @foreach ($sales as $sale) @php $items = is_array($sale->sale_items) ? $sale->sale_items : json_decode($sale->sale_items, true); $items = is_array($items) ? $items : []; $gstItems = collect($items)->filter(function ($item) { return (($item['cgst'] ?? 0) + ($item['sgst'] ?? 0)) > 0; }); $invoice = $gstItems->sum(fn($i) => ($i['sell_price'] ?? 0) * ($i['quantity'] ?? 1)); $cgst = $gstItems->sum('cgst'); $sgst = $gstItems->sum('sgst'); $totalTax = $cgst + $sgst; $taxable = $invoice - $totalTax; @endphp @if($gstItems->count() > 0) @endif @endforeach
# Invoice Number Invoice Date Invoice ValueTotal Tax(%)Taxable Value CGST SGST Total Tax Value Action
{{ $loop->iteration }} {{ $sale->order_id }} {{ $sale->created_at?->format('d-m-Y') }} ₹{{ number_format($invoice, 2) }} ₹{{ number_format($taxable, 2) }} ₹{{ number_format($cgst, 2) }} ₹{{ number_format($sgst, 2) }} ₹{{ number_format($totalTax, 2) }} View Invoice
@endsection @section('footer') @endsection