@php /* |-------------------------------------------------------------------------- | CUSTOMER DETAILS |-------------------------------------------------------------------------- */ $customer = $offlineSale->customer_details; if (is_string($customer)) { $decodedCustomer = json_decode( $customer, true ); $customer = is_array($decodedCustomer) ? $decodedCustomer : []; } if (!is_array($customer)) { $customer = []; } $customerName = $customer['name'] ?? $customer['customer_name'] ?? 'Walk-in Customer'; $customerPhone = $customer['phone'] ?? $customer['mobile'] ?? $customer['phone_number'] ?? '-'; $customerEmail = $customer['email'] ?? '-'; $customerAddress = $customer['address'] ?? $customer['full_address'] ?? '-'; $customerGstin = $customer['gst_number'] ?? $customer['gstin'] ?? $customer['gst_no'] ?? '-'; /* |-------------------------------------------------------------------------- | SELECTED INVOICE TOTALS |-------------------------------------------------------------------------- | | IMPORTANT: | These totals are calculated ONLY from $processedItems. | | So if invoice contains only dfvd: | | Taxable = dfvd taxable | CGST = dfvd CGST | SGST = dfvd SGST | Total = dfvd total | |-------------------------------------------------------------------------- */ $invoiceTaxable = 0; $invoiceCgst = 0; $invoiceSgst = 0; $invoiceIgst = 0; $invoiceTotal = 0; $invoiceQty = 0; foreach ($processedItems as $processedItem) { $invoiceTaxable += (float) ( $processedItem['taxable_value'] ?? 0 ); $invoiceCgst += (float) ( $processedItem['cgst'] ?? 0 ); $invoiceSgst += (float) ( $processedItem['sgst'] ?? 0 ); $invoiceIgst += (float) ( $processedItem['igst'] ?? 0 ); $invoiceTotal += (float) ( $processedItem['total'] ?? 0 ); $invoiceQty += (float) ( $processedItem['quantity'] ?? 0 ); } @endphp {{-- ========================================================= --}} {{-- INVOICE --}} {{-- ========================================================= --}}
{{-- ===================================================== --}} {{-- HEADER --}} {{-- ===================================================== --}}
{{ $branchInfo['name'] ?? 'Sakthi Super Mart' }}
@if(!empty($branchInfo['address']))
{{ $branchInfo['address'] }}
@endif @if(!empty($branchInfo['phone']))
Phone: {{ $branchInfo['phone'] }}
@endif @if(!empty($branchInfo['email']))
Email: {{ $branchInfo['email'] }}
@endif @if(!empty($branchInfo['gstin']))
GSTIN: {{ $branchInfo['gstin'] }}
@endif
Tax Invoice
Invoice No : {{ $offlineSale->order_id ?? '-' }}
Date : @if(!empty($offlineSale->changed_date)) {{ \Carbon\Carbon::parse($offlineSale->changed_date)->format('d/m/Y') }} @elseif($offlineSale->created_at) {{ \Carbon\Carbon::parse($offlineSale->created_at)->format('d/m/Y') }} @else - @endif
{{-- ===================================================== --}} {{-- CUSTOMER INFORMATION --}} {{-- ===================================================== --}}
{{-- CUSTOMER --}}
Customer Information
Name
:
{{ $customerName }}
Phone
:
{{ $customerPhone }}
Email
:
{{ $customerEmail }}
@if($customerGstin !== '-')
GSTIN
:
{{ $customerGstin }}
@endif
{{-- SHIPPING --}}
Shipping Address
Name
:
{{ $customerName }}
Phone
:
{{ $customerPhone }}
Email
:
{{ $customerEmail }}
Address
:
{{ $customerAddress }}
{{-- ===================================================== --}} {{-- ORDER SUMMARY --}} {{-- ===================================================== --}}
Order Summary
{{-- --}} @forelse($processedItems as $index => $item) {{-- S.NO --}} {{-- ITEM --}} {{-- HSN --}} {{-- RATE --}} {{-- QTY --}} {{-- GST RATE --}} {{-- --}} {{-- TAXABLE --}} {{-- --}} {{-- CGST --}} {{-- --}} {{-- SGST --}} {{-- --}} {{-- TOTAL --}} @empty @endforelse
S.NO ITEM HSN CODE RATE QTY GST % TAXABLE CGST SGST TOTAL
{{ $index + 1 }}
{{ $item['name'] ?? 'Product' }}
@if(!empty($item['item_code']))
Code: {{ $item['item_code'] }}
@endif
{{ $item['hsn_code'] ?? '-' }} ₹{{ number_format( (float)($item['rate'] ?? 0), 2 ) }} {{ number_format( (float)($item['quantity'] ?? 0), 2 ) }} {{ number_format( (float)($item['gst_rate'] ?? 0), 2 ) }}% ₹{{ number_format( (float)($item['taxable_value'] ?? 0), 2 ) }} ₹{{ number_format( (float)($item['cgst'] ?? 0), 2 ) }} ₹{{ number_format( (float)($item['sgst'] ?? 0), 2 ) }} ₹{{ number_format( (float)($item['total'] ?? 0), 2 ) }}
No items available
{{-- ===================================================== --}} {{-- PAYMENT / TERMS --}} {{-- ===================================================== --}}
{{-- TERMS --}}
TERMS AND CONDITIONS
1. Price is inclusive of applicable taxes.
2. Payment as per agreed terms.
3. Manufacturer warranty applicable where provided.
4. Goods once sold cannot be returned unless applicable.
5. Subject to applicable terms and conditions.
Payment Details
{{-- TOTAL AMOUNT --}}
Total Amount ₹{{ number_format((float) $invoiceTotal, 2) }}
{{-- ===================================================== --}} {{-- AMOUNT --}} {{-- ===================================================== --}}
Invoice Amount: ₹{{ number_format( $invoiceTotal, 2 ) }}
{{-- ===================================================== --}} {{-- FOOTER --}} {{-- ===================================================== --}}