Sl. No
|
Particulars
|
Packing
|
Qty
|
Free
|
PTR
|
Disc %
|
GST %
|
Taxable Value
|
@foreach ($orderDetails as $key => $orderItem)
@php
$freeProduct = \App\Models\Product::where('id', $orderItem->product_id)->first()->scheme;
if ($freeProduct != null) {
// Define a regex pattern for "10+5" format
$pattern1 = '/^\d+\+\d+$/';
// Define a regex pattern for "Neque quo amet ut v" format
$pattern2 = '/^[A-Za-z\s]+$/';
if (!preg_match($pattern1, $freeProduct) && !preg_match($pattern2, $freeProduct)) {
return;
}
$parts = explode('+', $freeProduct);
$baseQuantity = isset($parts[0]) ? (int) $parts[0] : 0;
$offerProductQuantity = isset($parts[1]) ? (int) $parts[1] : 0;
if ($orderItem->quantity < $baseQuantity) {
$offerProductQuantity = 0;
} elseif ($orderItem->quantity == $baseQuantity) {
$offerProductQuantity;
} else {
$cal1 = $orderItem->quantity / $baseQuantity;
$cal2 = floor($cal1);
$offerProductQuantity = intval(
$cal2 > 0 ? $cal2 * $offerProductQuantity : $cal1 * $offerProductQuantity,
);
}
}
@endphp
{{ ++$key }} |
{{ $orderItem->product?->name }} |
{{ $orderItem->product?->stripe }} |
@if ($orderItem->price != 0)
{{ $orderItem->quantity }}
@else
{{ 0 }}
@endif |
@if ($orderItem->price == 0)
{{ 0 }}
@elseif ($orderItem->price != 0)
{{ $offerProductQuantity }}
@endif |
{{ $orderItem->price }} |
@if ($orderItem->price != 0)
{{ $orderItem->product?->discount?->discount }}
@else
{{ 0 }}
@endif |
@if ($orderItem->price != 0)
{{ $orderItem->product?->gst_percentage }}
@else
{{ 0 }}
@endif |
{{ $orderItem->price * $orderItem->quantity }} |
@endforeach
Customer Order
Instruction |
Total PTR |
{{ $detail->total_price + $detail->points }} |
{{ $orderItem->order?->description ?? 'NA' }} |
Total GST |
{{ $detail->gst }} |
|
Credits Used |
{{ $detail->points }} |
|
Total Payable
|
{{ $detail->total_price + $detail->gst }} |