@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->created_at ? $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 $invoice = $sale->amount_payable ?? 0; // Invoice Value $cgst = $sale->cgst ?? 0; $sgst = $sale->sgst ?? 0; $taxable = $invoice - ($cgst + $sgst); // Taxable Value like Screenshot $totalTax = $cgst + $sgst; // Only CGST + SGST $taxPercent = $taxable > 0 ? round(($totalTax / $taxable) * 100) : 0; @endphp {{-- Taxable Value like Screenshot --}} {{-- Tally style Total Tax % --}} @endforeach
# Invoice Number Invoice Date Invoice Value Total Tax(%) Taxable Value CGST SGST Total Tax Action
{{ $loop->iteration }} {{ $sale->order_id }} {{ $sale->created_at?->format('d-m-Y') }} ₹{{ number_format($taxable,2) }}{{ $taxPercent }}%₹{{ number_format($invoice,2) }} ₹{{ number_format($cgst,2) }} ₹{{ number_format($sgst,2) }} ₹{{ number_format($totalTax,2) }} View Invoice
@endsection @section('footer') @endsection