@php use App\Models\Item; @endphp @extends('layouts.backend.index') @section('title', $label) @section('content')
@csrf @method('PUT')
@php $old = old('items', []); $old_item = json_decode($purchase->items, true); $total = 0; @endphp @if (empty($old)) @foreach ($old_item as $index => $i) @php $goods = Item::select('id', 'name', 'id_category','uom') ->with([ 'uomData' => function ($query) { $query->select('id', 'name'); }, 'category' => function ($query) { $query->select('id', 'name'); } ]) ->whereId($i['id']) ->withTrashed() ->first(); $price = $i['price']; $qty = $i['qty']; $total_item = $price * $qty; $total += $total_item; @endphp @endforeach @else @foreach ($old['id'] as $index => $i) @php $qty = (empty($old['qty'][$index])) ? 0 : str_replace('.', '', $old['qty'][$index]); $price = (empty($old['price'][$index])) ? 0 : str_replace('.', '', $old['price'][$index]); $total_item = $qty * $price; $total += $total_item @endphp @endforeach @endif
Nama Item Jenis Jumlah Harga Satuan Total #
@if ($index > 0) @endif
@if ($index > 0) @endif
ADD

Total : Rp {{ number_format($total, 0, '', '.') }}
@endsection @push('styles') @endpush @push('scripts') @endpush