Added hourly quantity logic in production target plan livewire table #413

Merged
jothi merged 1 commits from ranjith-dev into master 2026-02-26 11:51:12 +00:00
2 changed files with 8 additions and 7 deletions

View File

@@ -209,8 +209,9 @@ class ProductionTargetPlan extends Component
'items.code as item_code', 'items.code as item_code',
'items.category as category', 'items.category as category',
'items.description as item_description', 'items.description as item_description',
'items.hourly_quantity as hourly_quantity',
'lines.name as line_name', 'lines.name as line_name',
'lines.line_capacity as line_capacity', // 'lines.line_capacity as line_capacity',
'plants.name as plant_name' 'plants.name as plant_name'
) )
->get(); ->get();
@@ -257,10 +258,10 @@ class ProductionTargetPlan extends Component
$remainingDays = (int) ($row['working_days'] ?? 0); $remainingDays = (int) ($row['working_days'] ?? 0);
$lineCapacity = (float) ($row['line_capacity'] ?? 0); $lineCapacity = (float) ($row['line_capacity'] ?? 0);
$dailyLineCapacity = (float) ($row['line_capacity'] ?? 0); $dailyHourlyQuantity = (float) ($row['hourly_quantity'] ?? 0);
$row['category'] = $row['category'] ?? '-'; $row['category'] = $row['category'] ?? '-';
$row['daily_line_capacity'] = []; $row['daily_hourly_quantity'] = [];
$row['daily_target_dynamic'] = []; $row['daily_target_dynamic'] = [];
$row['produced_quantity'] = []; $row['produced_quantity'] = [];
@@ -270,7 +271,7 @@ class ProductionTargetPlan extends Component
// Skip leave dates fast // Skip leave dates fast
if (isset($leaveDates) && in_array($date, $leaveDates)) { if (isset($leaveDates) && in_array($date, $leaveDates)) {
$row['daily_line_capacity'][$date] = '-'; $row['daily_hourly_quantity'][$date] = '-';
$row['daily_target_dynamic'][$date] = '-'; $row['daily_target_dynamic'][$date] = '-';
$row['produced_quantity'][$date] = '-'; $row['produced_quantity'][$date] = '-';
continue; continue;
@@ -284,7 +285,7 @@ class ProductionTargetPlan extends Component
$row['daily_target_dynamic'][$date] = $todayTarget; $row['daily_target_dynamic'][$date] = $todayTarget;
$row['produced_quantity'][$date] = $producedQty; $row['produced_quantity'][$date] = $producedQty;
$row['daily_line_capacity'][$date] = $dailyLineCapacity; $row['daily_hourly_quantity'][$date] = $dailyHourlyQuantity * 22.5;
// Carry forward remaining qty // Carry forward remaining qty
$remainingQty = max(0, $remainingQty - $producedQty); $remainingQty = max(0, $remainingQty - $producedQty);

View File

@@ -28,7 +28,7 @@
</tr> </tr>
<tr> <tr>
@foreach($dates as $date) @foreach($dates as $date)
<th class="border px-4 py-2 whitespace-nowrap">Line Capacity</th> <th class="border px-4 py-2 whitespace-nowrap">Item Quantity</th>
<th class="border px-4 py-2 whitespace-nowrap">Target Plan</th> <th class="border px-4 py-2 whitespace-nowrap">Target Plan</th>
<th class="border px-4 py-2 whitespace-nowrap border-r-4 border-gray-400"> <th class="border px-4 py-2 whitespace-nowrap border-r-4 border-gray-400">
Produced Quantity Produced Quantity
@@ -61,7 +61,7 @@
@else @else
{{-- <td class="border px-4 py-2 whitespace-nowrap">{{ $record['daily_target'] ?? '-' }}</td> --}} {{-- <td class="border px-4 py-2 whitespace-nowrap">{{ $record['daily_target'] ?? '-' }}</td> --}}
<td class="border px-4 py-2 whitespace-nowrap"> <td class="border px-4 py-2 whitespace-nowrap">
{{ $record['daily_line_capacity'][$date] ?? '-' }} {{ $record['daily_hourly_quantity'][$date] ?? '-' }}
</td> </td>
<td class="border px-4 py-2 whitespace-nowrap"> <td class="border px-4 py-2 whitespace-nowrap">
{{ $record['daily_target_dynamic'][$date] ?? '-' }} {{ $record['daily_target_dynamic'][$date] ?? '-' }}