{{ $branchInfo['name'] ?? 'Branch Name' }}

{{ $branchInfo['address'] ?? '' }}
Phone: {{ $branchInfo['phone'] ?? '' }}
Email: {{ $branchInfo['email'] ?? '' }}

Tax Invoice

Invoice No: {{ $offlineSale->order_id }}
Date: {{ \Carbon\Carbon::parse($offlineSale->created_at)->format('d-M-Y H:i') }}
Customer: {{ $offlineSale->customer_details['name'] ?? 'Walk-in Customer' }}
@if (isset($offlineSale->customer_details['phone_number'])) Phone: {{ $offlineSale->customer_details['phone_number'] }}
@endif @if (isset($offlineSale->customer_details['address'])) Address: {{ $offlineSale->customer_details['address'] }} @endif
@php use App\Models\Product; $totalProfit = 0; $netprofit = 0; @endphp @foreach ($offlineSale->sale_items as $index => $item) @php $product = Product::where('item_code', $item['item_code'])->first(); $purchasePrice = $item['purchase_price'] ?? 0; $qty = $item['quantity']; $gstRate = $item['gst'] ?? 0; $priceInclGst = $item['sell_price']; $totalInclGst = $priceInclGst * $qty; // Profit calculation for the item $profit = ($priceInclGst - $purchasePrice) * $qty; $totalProfit += $profit; @endphp @endforeach @if ($offlineSale->discount > 0) @endif @if ($offlineSale->additional_charge > 0) @endif @if ($offlineSale->cash_wallet_deduction > 0) @endif @if ($offlineSale->shopping_wallet_deduction > 0) @endif @php $netprofit = $totalProfit; if ($offlineSale->discount > 0) $netprofit -= $offlineSale->discount; if ($offlineSale->additional_charge > 0) $netprofit += $offlineSale->additional_charge; if ($offlineSale->cash_wallet_deduction > 0) $netprofit -= $offlineSale->cash_wallet_deduction; if ($offlineSale->shopping_wallet_deduction > 0) $netprofit -= $offlineSale->shopping_wallet_deduction; @endphp
# Item Item Code Purchase Price N. Rate Qty Rate (Incl. GST) GST % Total Profit
{{ $index + 1 }} {{ $item['name'] }} {{ $item['item_code'] }} ₹{{ number_format($purchasePrice, 2) }} ₹{{ number_format($item['sell_price'], 2) }} {{ $qty }} ₹{{ number_format($item['sell_price'], 2) }} {{ number_format($gstRate, 2) }}% ₹{{ number_format($totalInclGst, 2) }} ₹{{ number_format($profit, 2) }}
Total Profit: ₹{{ number_format($totalProfit, 2) }}
Discount: -₹{{ number_format($offlineSale->discount, 2) }}
Additional Charges: +₹{{ number_format($offlineSale->additional_charge, 2) }}
Cash Wallet Deduction: -₹{{ number_format($offlineSale->cash_wallet_deduction, 2) }}
Shopping Wallet Deduction: -₹{{ number_format($offlineSale->shopping_wallet_deduction, 2) }}
Net Profit: ₹{{ number_format($netprofit, 2) }}

Thank you for your purchase!

Subtotal (Incl. GST): ₹{{ number_format($offlineSale->sub_total, 2) }}

@if ($offlineSale->discount > 0)

Discount: -₹{{ number_format($offlineSale->discount, 2) }}

@endif @if ($offlineSale->additional_charge > 0)

Additional Charges: +₹{{ number_format($offlineSale->additional_charge, 2) }}

@endif @if ($offlineSale->cash_wallet_deduction > 0)

Cash Wallet Deduction: -₹{{ number_format($offlineSale->cash_wallet_deduction, 2) }}

@endif @if ($offlineSale->shopping_wallet_deduction > 0)

Shopping Wallet Deduction: -₹{{ number_format($offlineSale->shopping_wallet_deduction, 2) }}

@endif

Subtotal (Excl. Tax): ₹{{ number_format(($offlineSale->amount_payable ?? 0) - ($offlineSale->cgst ?? 0) - ($offlineSale->sgst ?? 0), 2) }}

CGST: ₹{{ number_format($offlineSale->cgst, 2) }}

SGST: ₹{{ number_format($offlineSale->sgst, 2) }}


Total Payable: ₹{{ number_format($offlineSale->amount_payable, 2) }}

Payment Mode: {{ ucfirst($offlineSale->payment_mode) }}