@extends('layouts.app') @section('title', __('lang_v1.expiry_disposal')) @section('content')

@lang('lang_v1.expiry_disposal') @lang('lang_v1.expiry_disposal_store_desc')

@include('layouts.partials.error') {{-- Headline numbers. Expired is money already lost; the pipeline is still recoverable, so the two are never shown as one figure. --}}
@lang('lang_v1.expired_value_at_cost') @format_currency($totals['value_at_cost']) {{ @num_format($totals['units']) }} @lang('lang_v1.units'), {{ $totals['batches'] }} @lang('lang_v1.batches')
@foreach([30 => 'bg-red', 90 => 'bg-orange'] as $days => $class)
@lang('lang_v1.expiring_in_days', ['days' => $days]) @format_currency($upcoming[$days]['value_at_cost']) {{ @num_format($upcoming[$days]['units']) }} @lang('lang_v1.units') — @lang('lang_v1.still_recoverable')
@endforeach
@lang('lang_v1.sends_expired_stock_to') {{ $warehouse ? $warehouse->name : __('lang_v1.not_linked') }} @if($warehouse) @lang('lang_v1.warehouse_disposes_centrally') @else @lang('lang_v1.egr_no_linked_warehouse') @endif
{{-- Despatch form: only expired batches with stock, minus anything already on an open return, so the same physical stock can never be sent twice. --}} @if($can_send && $warehouse && $batches->count()) @component('components.widget', ['class' => 'box-primary', 'title' => __('lang_v1.send_expired_to_warehouse')]) {!! Form::open(['route' => 'expiry.store.send', 'method' => 'post', 'id' => 'egr_form']) !!}
@foreach($batches as $b) @endforeach
@lang('business.product') @lang('lang_v1.lot_number') @lang('product.exp_date') @lang('lang_v1.days_expired') @lang('lang_v1.manufacturer') @lang('lang_v1.available_qty') @lang('lang_v1.unit_cost') @lang('lang_v1.value_at_cost') @lang('lang_v1.qty_to_send')
{{ $b->product_name }} @if($b->variation_name && $b->variation_name !== 'DUMMY') ({{ $b->variation_name }}) @endif @if(in_array($b->drug_schedule, ['H','H1','X'])) {{-- Controlled drugs need a witnessed destruction at the warehouse, so they are flagged from the outset. --}} @lang('lang_v1.schedule') {{ $b->drug_schedule }} @endif {{ $b->lot_number ?: '--' }} {{ \Carbon::parse($b->exp_date)->format('d-m-Y') }} {{ (int) $b->days_expired }} {{ $b->batch_manufacturer ?: ($b->product_manufacturer ?: '--') }} {{ @num_format($b->available_qty) }} @format_currency($b->unit_cost) @format_currency($b->available_qty * $b->unit_cost)
{!! Form::label('notes', __('lang_v1.notes') . ':') !!} {!! Form::textarea('notes', null, ['class' => 'form-control', 'rows' => 2, 'maxlength' => 1000]) !!}

@lang('lang_v1.egr_despatch_help', ['warehouse' => $warehouse->name])

{!! Form::close() !!} @endcomponent @elseif($can_send && $warehouse)
@lang('lang_v1.no_expired_stock_here')
@endif @component('components.widget', ['class' => 'box-solid', 'title' => __('lang_v1.expired_goods_returns')])
@foreach($returns as $r) @endforeach
@lang('purchase.ref_no') @lang('messages.date') @lang('lang_v1.warehouse') @lang('sale.quantity') @lang('lang_v1.value_at_cost') @lang('lang_v1.status') @lang('messages.action')
{{ $r->ref_no }} {{ @format_datetime($r->created_at) }} {{ optional($r->warehouse_business)->name ?: '--' }} {{ @num_format($r->total_quantity) }} @format_currency($r->total_value) {{ $r->statusLabel() }} @if($r->status === \App\ExpiredGoodsReturn::STATUS_REJECTED && $r->rejection_reason)
{{ \Illuminate\Support\Str::limit($r->rejection_reason, 60) }} @endif
@lang('messages.view')
@endcomponent
@endsection @section('javascript') @endsection