@extends('backEnd.layouts.master') @section('title','Order Create') @section('css') @endsection @section('content')
@csrf

Order Create

@csrf
@php $product_discount = 0; @endphp @foreach($cartinfo as $key=>$value) @php $product_discount += $value->options->product_discount*$value->qty; Session::put('product_discount',$product_discount); @endphp @endforeach
Image Name Color Size Qty Sell Price Discount Sub Total Action
{{$value->name}} {{ $value->options->product_color_name ?? 'N/A' }} {{ $value->options->product_size_name ?? 'N/A' }}
{{$value->price}} {{($value->price - $value->options->product_discount)*$value->qty}}
@php // আগের মতই cart total হিসাব $subtotal = Cart::instance('pos_shopping')->subtotal(); $subtotal = str_replace([',','.00'], '', $subtotal); $shipping = Session::get('pos_shipping'); $total_discount = Session::get('pos_discount') + Session::get('product_discount'); $total = ($subtotal + $shipping) - $total_discount; // 💳 এই অর্ডারের পেমেন্ট থেকে কত টাকা নেয়া হয়েছে (advance / full) $paidAmount = \App\Models\Payment::where('order_id', $order->id)->sum('amount'); // ডিফল্ট: মনে করি advance নাই $advancePaid = 0; $dueAmount = $total; // যদি কিছু payment থাকে এবং সেটা total থেকে কম হয় = advance payment if ($paidAmount > 0 && $paidAmount < $total) { $advancePaid = $paidAmount; $dueAmount = $total - $advancePaid; } // যদি paidAmount == total হয় → ফুল পেমেন্ট, তখন advance দেখাব না, আগের মতই total থাকবে @endphp {{-- 🔥 যদি advance payment থাকে তখনই extra দুইটা রো দেখাব --}} @if($advancePaid > 0) @endif
Sub Total {{ $subtotal }}
Shipping Fee {{ $shipping }}
Discount {{ $total_discount }}
Total {{ $total }}
Advance Paid {{ number_format($advancePaid, 2) }}
Due Amount {{ number_format($dueAmount, 2) }}
Payment Info
@endsection @section('script') @endsection