@php $scopeOfWorks = \App\Models\ScopeOfWork::all(); $areas = \App\Models\Area::all(); $setting = \App\Models\Setting::where('name', 'IfAddTierManually')->first(); $uoms = \App\Models\Uom::select('id', 'name')->get(); $scopeOfWorkItems = ''; $areaItems = ''; foreach ($scopeOfWorks as $item){ $scopeOfWorkItems .= ''; } foreach ($areas as $item){ $areaItems .= ''; } $variation_order = \App\Models\VariationOrder::find(request()->route('id')); $variation_orderItem = \App\Models\VariationOrderItem::where('variation_order_id', $variation_order->id) ->where('revision', 'like', '%REV%') ->orderBy('created_at', 'desc')->first(); $variation_orderItemList = \App\Models\VariationOrderItemList::where('variation_order_id', $variation_order->id)->where('variation_order_item_id', $variation_orderItem->id)->orderBy('id', 'asc')->get(); $totalCur = $variation_orderItemList->count(); $curItems = ''; $rowRT1IdxTemp = 0; $rowRT2IdxTemp = 0; $rowRT1Idx = 1; $rowRT2Idx = 1; $rowRT3Idx = 1; $rowRT4Idx = 1; $rowStepNum = 1; $itTier1 = 0; $itTier2 = 0; $itTier3 = 0; $endOfTier3 = 0; $marginIndex = 0; $amountTotal = 0; function mapItemMargin($margins, $rowRT3Idx, $sales_item_children_id, $marginIndex, $quantity, $isAmount=false){ $total = 0; $getTotalSum = 0; $getTotalSumWithMargin = 0; $marginChillIndex = 0; $html = null; $iMargin = 1; $html .= '
'; if ($margins->count() > 0) { foreach ($margins as $margin) { $getTotalSum += $margin->price * $margin->quantity; $getTotalSumWithMargin += ($margin->price / ( 1 - $margin->margin_percentage / 100 )) * $margin->quantity; $html .= '
is_from_system ? 'readonly': '').'/>
'; $marginChillIndex++; $iMargin++; } } else { if ($isAmount) { $getTotalSum = $isAmount; $getTotalSumWithMargin = $isAmount; } $html .= '

Item not found, please add material first.

'; } $getTotalSum = $quantity * round($getTotalSum); $getTotalSumWithMargin = $quantity * round($getTotalSumWithMargin); $html .= '
'; return $html; } function mapUomFunc($uoms, $selected=false) { $htmlUom = ''; if ($uoms && $uoms->count() > 0){ foreach ($uoms as $uom) { $htmlUom .= ''; } } return $htmlUom; } if($variation_orderItemList->count()>0){ $i = 0; foreach ($variation_orderItemList as $key => $current){ if ($current->tier_level==1 && $current->is_area != true) { $rowStepNum++; if ($rowRT1IdxTemp > 0) { $curItems .= ''; $curItems .= ''; $rowRT1IdxTemp = 0; } if ($rowRT2IdxTemp > 0) { $curItems .= ''; $curItems .= ''; $rowRT2IdxTemp = 0; } } if ($current->tier_level==1 && $current->is_area != true) { $amountTotal += $current->amount; $curItems .= '
'; $curItems .= '
Amount ($)
Total Cost : Total Profit : Total Margin % :
'; $curItems .= '
'; $curItems .= '
'; $rowRT1IdxTemp++; $rowRT1Idx++; } if ($current->tier_level==2 && $current->is_area != true) { if ($rowRT2IdxTemp > 0) { $curItems .= '
'; $curItems .= ''; $rowRT2IdxTemp = 0; } } if ($current->tier_level==2 && $current->is_area != true) { $curItems .= '
'; $curItems .= '
Amount ($)
Total Cost : Total Profit : Total Margin % :
is_modified? 'checked' : '').'>
'.mapItemMargin(\App\Models\VariationOrderItemMargin::where('variation_order_item_list_id', $current->id)->get(), $rowRT2Idx, $current->variation_order_item_id, $marginIndex, $current->quantity, $current->amount).'
'; $curItems .= '
'; $curItems .= '
'; $rowRT2IdxTemp++; $rowRT2Idx++; } if ($current->tier_level==3 && $current->is_area != true) { $curItems .= '
UOM
QTY
Amount ($)
'.mapItemMargin(\App\Models\VariationOrderItemMargin::where('variation_order_item_list_id', $current->id)->get(), $rowRT3Idx, $current->variation_order_item_id, $marginIndex, $current->quantity, $current->amount).'
'; $rowRT3Idx++; } if ($current->is_area && empty($current->title)) { $attrIdArea = ($current->tier_level == 1 ? 'areaT1' : ($current->tier_level == 2 ? 'areaT2' : 'areaT3')); $curItems .= '
'; $curItems .= '
THIS IS BLANK SPACE SECTION
'; $curItems .= '
'; } if ($current->is_area && !empty($current->title)) { $attrIdArea = ($current->tier_level == 1 ? 'areaT1' : ($current->tier_level == 2 ? 'areaT2' : 'areaT3')); $curItems .= '
'; $curItems .= '
THIS IS NOTE SECTION
'; $curItems .= '
'; } if(++$i === $variation_orderItemList->count()) { $curItems .= '
'; $curItems .= '
'; $rowRT2IdxTemp = 0; $curItems .= ''; $curItems .= '
'; $rowRT1IdxTemp = 0; $rowStepNum++; } $marginIndex++; } } else { $curItems .= '

Item Not Found

click add new item button below to add new requirement field
'; } @endphp

Requirement

{{$variation_order->status != 'draft' ? 'Current Version: '.$variation_orderItem->revision : ''}}
{{-- Items --}}