@extends('layouts.master') @section('css') @section('title') {{ __('home.salesـreturned') }}@stop @endsection @section('page-header')
@endsection @section('content')
 

جارٍ إرسال الفاتورة، يرجى الانتظار
Invoice is being sent, please wait

@if (session()->has('foundinvoice')) @endif @if (session()->has('success')) @endif @if (session()->has('createnewproduct')) @endif @if ($errors->any())
@endif @if (session()->has('notfountreturnproduct')) @endif
{{ csrf_field() }}



@if (isset($data['product']))

{{ __('home.paymentmethod') }}

@foreach ($data['product'] as $product)
Warning: Undefined variable $product in /home/ebdea/public_html/sewing.ebdea.online/resources/views/products/salesreturned.blade.php on line 230

Warning: Attempt to read property "invoice_id" on null in /home/ebdea/public_html/sewing.ebdea.online/resources/views/products/salesreturned.blade.php on line 230
@if ($product->quantity > 0) @endif @endforeach
# {{ __('home.productNo') }} {{ __('home.product') }} {{ __('home.productprice') }} {{ __('home.quantity') }} {{ __('home.price') }} {{ __('home.discount') }} {{ __('home.total') }} {{ __('home.operations') }}
{{ $i }} {{ $product->productData->Product_Code }} {{ $product->productData->product_name }} {{ $product->Unit_Price }} {{ $product->quantity }} {{ $product->Unit_Price * $product->quantity }} {{ $product->Discount_Value }} {{ $product->Unit_Price * $product->quantity - $product->Discount_Value }}
{{__('home.the amount')}} {{ __('home.discount') }} {{ __('home.avt') }} {{ __('home.total') }}
@php // تحديد معرّف الفاتورة المتاح في المصفوفة $currentInvoiceId = $data['id'] ?? $data['invoice_id'] ?? $data['invoices_id'] ?? null; if ($currentInvoiceId) { // جلب مجموع (سعر الوحدة * الكمية) من جدول المبيعات مباشرة $rawUnitTotal = \App\Models\sales::where('invoice_id', $currentInvoiceId) ->sum(\DB::raw('Unit_Price * quantity')); } else { $rawUnitTotal = 0; } @endphp {{ number_format($rawUnitTotal, 2) }} {{ $data['invoicetotal_discount'] ?? 0 }} {{ round( $data['invoicetotal_addedvalue'] ?? 0,2) }} {{-- الإجمالي النهائي = (المبلغ الجديد - الخصم) + الضريبة --}} {{ round(($rawUnitTotal - ($data['invoicetotal_discount'] ?? 0)) + ($data['invoicetotal_addedvalue'] ?? 0), 2) }}


{{__('home.print')}}   {{ __('home.dwonloadpdf') }}   


   

@endif
@if (isset($data['product'])) @endif @endsection @section('js') @endsection