@extends('backend.partials.master') @section('title') Sale Invoice @endsection @section('maincontent') Sale Invoice @csrf @if(!empty($invoices)) @method('PUT') @endif Bill Date * @error('date') {{ $message }} @enderror Invoice Number * @error('invoice_no') {{ $message }} @enderror Customer * Select Customer @foreach($customers as $customer) customer_id ?? '') == $customer->id ? 'selected' : '' }}> {{ $customer->fname }} @endforeach @error('customer_id') {{ $message }} @enderror Lot No * Product * HSN Stock * Quantity * {{-- Serial No(s) MAC Id(s) --}} GST (%) Rate Total * @php $i = 0; @endphp @if(!empty($invoicesdetails)) @foreach($invoicesdetails as $detail) @php $i++; @endphp @php // $productId = $detail->product_id; // $purchased = \App\Models\Backend\PurchaseDetail::where('product_id', $productId)->sum('quantity'); // $totalSold = \App\Models\Backend\SaleInvoieDetail::where('product_id', $productId)->sum('quantity'); // $currentInvoiceSold = \App\Models\Backend\SaleInvoieDetail::where('product_id', $productId) // ->where('parent_id', $invoices->id) // ->sum('quantity'); // $stockForEdit = $purchased - ($totalSold - $currentInvoiceSold); @endphp Select Lot @foreach($lots as $lot) lot_no ?? '') == $lot->lot_no ? 'selected' : '' }}> {{ $lot->lot_no }} @endforeach @error('lot_'.$i) {{ $message }} @enderror Select Product {{-- initial options will be loaded by loadProductsByLot --}} @if($errors->has('product_'.$i)) {{ $errors->first('lot_'.$i) }} @endif @error('quantity_'.$i) {{ $message }} @enderror @endforeach @endif + Add Row {{ !empty($saleinvoice) ? 'Update' : 'Create' }} Cancel @endsection {{---------------------------------------- my new code--------------------- --}}