@extends('layouts.master') @section('title') استلام فاتورة مشتريات {{ $purchase->orderId }} @endsection @section('page-header') @endsection @section('content') @include('financial_years.partials.alerts') @php $open = in_array($purchase->receipt_status, ['pending', 'partial'], true); $canPartial = auth()->user()->can('warehouse_receipts_partial') || auth()->user()->can('warehouse_receipts_manage'); $canPrint = auth()->user()->can('warehouse_receipts_print') || auth()->user()->can('warehouse_receipts_manage'); @endphp
@if (!$open)
{{ $purchase->receipt_status === 'received' ? 'تم استلام هذه الفاتورة بالكامل.' : 'هذه الفاتورة لا تنتظر استلاماً.' }}
@endif
@csrf
@foreach ($details as $i => $d) @php $ordered = \App\Services\Accounting\WarehouseReceiptService::ordered($d); $remaining = \App\Services\Accounting\WarehouseReceiptService::remaining($d); $fmt = fn ($v) => rtrim(rtrim(number_format($v, 4, '.', ''), '0'), '.'); @endphp @endforeach
# كود الصنف الصنف الكمية في الفاتورة المستلم سابقاً المتبقي الكمية المستلمة الآن
{{ $i + 1 }} {{ $productCodes[$d->product_id] ?? '-' }} {{ $d->product_name }} {{ $fmt($ordered) }} {{ $fmt($d->received_qty) }} {{ $fmt($remaining) }} @if ($open && $remaining > 0) @else ✓ @endif
@if ($open)
@if ($canPartial) @endif
@if ($canPartial) لاستلام جزئي: اكتب الكمية الموجودة فعلاً لكل صنف، واترك الباقي. المتبقي يظل في انتظار سند استلام لاحق. @else استلام كلي فقط (ليس لديك صلاحية الاستلام الجزئي) — لو الكمية ناقصة بلّغ المسؤول. @endif @endif
@if ($receipts->count())
سندات الاستلام السابقة لهذه الفاتورة
@foreach ($receipts as $r) @endforeach
رقم السندالنوعالتاريخبواسطةالكميةالقيمةرقم القيد
{{ $r->id }} {{ $r->type === 'full' ? 'كلي' : 'جزئي' }} {{ $r->created_at->format('Y-m-d H:i') }} {{ $r->receiver->name ?? '-' }} {{ rtrim(rtrim(number_format($r->total_qty, 4, '.', ''), '0'), '.') }} {{ number_format($r->total_value, 2) }} {{ $r->dely_record ?: '-' }} @if ($canPrint)طباعة@endif
@endif @endsection @section('js') @endsection