@extends('layouts.app') @section('title', 'Create Credit Note') @section('content')

Create Credit Note

Sale Information

@lang('sale.invoice_no'): {{ $transaction->invoice_no ?? 'N/A' }}
@lang('contact.customer'): @if(!empty($transaction->contact)) {{ $transaction->contact->name }} @if(!empty($transaction->contact->supplier_business_name)) ({{ $transaction->contact->supplier_business_name }}) @endif @else N/A @endif
@lang('messages.date'): {{ \Carbon\Carbon::parse($transaction->transaction_date)->format('d/m/Y H:i') }}
Total Amount: {{ number_format($transaction->final_total, 2) }}
Location: {{ $transaction->location->name ?? 'N/A' }}
Payment Status: {{ ucfirst($transaction->payment_status ?? 'N/A') }}
@if(!empty($saleData))

Tax Sale Information

Sale ID: {{ $saleData['id'] ?? 'N/A' }}
Status: {{ $saleData['status'] ?? 'N/A' }}
eTims No.: {{ $saleData['invoice_number'] ?? 'N/A' }}
@if(!empty($saleData['etims_url'])) @endif
@endif

Credit Note Details

@csrf

Select Items for Credit Note

Select items and adjust quantities/amounts/discounts for the credit note.

@if(!empty($saleItems) && count($saleItems) > 0) @foreach($saleItems as $index => $item) @php $product = App\Product::where('item_id', $item['item_id'] ?? '')->first(); $quantity = $item['quantity'] ?? 1; $unitPrice = $item['unit_price'] ?? 0; $totalAmount = $item['total_amount'] ?? ($quantity * $unitPrice); $productFound = !empty($product); $discountRate = $item['discount_rate'] ?? 0; $discountAmount = $item['discount_amount'] ?? 0; // Check if this item has credit data from existing credit note $creditQty = $item['credit_quantity'] ?? $quantity; $creditAmt = $item['credit_amount'] ?? $totalAmount; $creditDiscRate = $item['credit_discount_rate'] ?? $discountRate; $creditDiscAmt = $item['credit_discount_amount'] ?? $discountAmount; @endphp @endforeach @else @endif
# Product Item ID Original Qty Unit Price Original Total Quantity Amount Disc % Disc Amount
{{ $index + 1 }} {{ $item['item_description'] ?? $product->name ?? 'Unknown' }} @if($product)
SKU: {{ $product->sku ?? 'N/A' }} @endif @if(!$productFound)
Product not found in system @endif
{{ $item['item_id'] ?? 'N/A' }} {{ number_format($quantity, 2) }} {{ number_format($unitPrice, 2) }} {{ number_format($totalAmount, 2) }} %
No items found. Please ensure the sale has been synced with Digitax.
Totals: 0 0.00 0 0.00
Credit Note Summary
Total Items Selected: 0
Total Quantity: 0
Total Amount: 0.00
Total Discount: 0.00
Net Amount: 0.00
Credit Note Information
Credit Note Number: CN-{{ $transaction->invoice_no ?? time() }}
Date: {{ \Carbon\Carbon::now()->format('d/m/Y H:i') }}
@if(!empty($creditNoteData) && !empty($creditNoteData['etims_url'])) @endif @if(!empty($creditNoteData) && !empty($creditNoteData['receipt_signature']))
Receipt Signature: {{ substr($creditNoteData['receipt_signature'], 0, 20) }}...
@endif
Cancel
Loading...
Processing Credit Note...

Please wait while we submit to Digitax

Credit Note Created
@endsection @section('javascript') @endsection