@extends('layouts.mop_master') @section('css') @endsection @section('title') Sales Return Order @endsection @section('content')
@isset($order)
@method('put') @else @endisset @csrf
@isset($order) Edit Sales Return Order @else Add Sales Return Order @endisset
Report
Add Items
@isset($orderItems) @php $tabIndex = 0; @endphp @if (count($orderItems) > 0) @php $cloned = clone $orderItems; $grouped = $orderItems->groupBy([ 'stock_item_id', 'unit_id', ]); $key = 0; @endphp @foreach ($grouped as $units) @foreach ($units as $orderItem) @php $key = $key + 1; @endphp @php $price = $orderItem->sum('gross_value') / $orderItem->sum('quantity'); $gst = {{ $orderItem[0]->stockItem->getGst($order->order_date) }}; if ($gst != null && $gst != 0) { $price_incl_tax = $price + ($price * $gst) / 100; } else { $price_incl_tax = $price; } @endphp @php $tabIndex = $tabIndex + 8; @endphp @endforeach @endforeach @endif @endisset
Item MRP Unit Qty Price Price(Inc GST) Gross Value Disc% Taxable Value Tax Total Remarks
@if ($orderItem->count() == 1) @else @endif
{{-- @if (($orderItem->stock_availability != null && $orderItem->stock_availability != 0) || $orderItem->status_remarks != null) --}} {{-- @if ($orderItem->stock_availability == 'NS') --}} {{-- Stock Availability : {{ $orderItem->stock_availability }} @else --}} @if ($orderItem[0]->stock_availability != null && $orderItem[0]->stock_availability != 0) Stock Availability : {{ $orderItem[0]->stock_availability }}
@endif @if ($orderItem[0]->status_remarks != null) Stock Remarks : {{ $orderItem[0]->status_remarks }}

@endif {{-- @endif --}} {{-- @endif --}} @php $stockledger = \App\Models\StockLedger::select( 'stock_item_id', DB::raw( 'SUM(inwards) as total_inwards', ), DB::raw( 'SUM(outwards) as total_outwards', ), )->where( 'stock_item_id', $orderItem[0]->stock_item_id, ); $stockledger = $stockledger->where( 'stock_location_id', $order->stock_location_id, ); $stockledger = $stockledger ->groupBy('stock_item_id') ->first(); $inwards = 0; $outwards = 0; if ($stockledger) { $inwards = $stockledger->total_inwards; $outwards = $stockledger->total_outwards; } $stock_availability = $inwards - $outwards; $order_base_qty = \App\Models\OrderItem::select( DB::raw( 'SUM(base_qty) as base_qty', ), ) ->where( 'stock_item_id', $orderItem[0]->stock_item_id, ) ->groupBy('stock_item_id') ->whereHas('order', function ( $q, ) use ($order) { $q->where( 'business_key', Auth::user()->business_key, ) ->where( 'order_code', '<', $order->order_code, ) ->where( 'status', '!=', 'Cancelled', ) ->whereNull( 'accounting_voucher_id', ); }) ->first()->base_qty ?? 0; $stock_availability = $stock_availability - $order_base_qty; @endphp @if ($stock_availability < 0) Available Stock:{{ $stock_availability }} @endif
{{ isset($orderItems) ? $orderItems->sum('total') : '0.00' }}
Discount :
Freight/Etc :
Round Off :
{{ isset($order) ? $order->round_off : '0.00' }}
Grand Total :
{{ isset($order) ? $order->amount : '0.00' }}
* Stock is based on the base unit of the item
{{-- Print Modal --}} {{-- variant search modal --}} {{-- Price History Modal --}} {{-- NeW Variant Modal --}} {{-- Attribute Value Create Modal --}} @endsection @section('script') @endsection