Added hourly quantity logic in production target plan livewire table
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Laravel Pint / pint (pull_request) Successful in 2m37s
Laravel Larastan / larastan (pull_request) Failing after 4m7s

This commit is contained in:
dhanabalan
2026-02-26 17:20:55 +05:30
parent 7be7d038da
commit 4d89c27a3b
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.category as category',
'items.description as item_description',
'items.hourly_quantity as hourly_quantity',
'lines.name as line_name',
'lines.line_capacity as line_capacity',
// 'lines.line_capacity as line_capacity',
'plants.name as plant_name'
)
->get();
@@ -257,10 +258,10 @@ class ProductionTargetPlan extends Component
$remainingDays = (int) ($row['working_days'] ?? 0);
$lineCapacity = (float) ($row['line_capacity'] ?? 0);
$dailyLineCapacity = (float) ($row['line_capacity'] ?? 0);
$dailyHourlyQuantity = (float) ($row['hourly_quantity'] ?? 0);
$row['category'] = $row['category'] ?? '-';
$row['daily_line_capacity'] = [];
$row['daily_hourly_quantity'] = [];
$row['daily_target_dynamic'] = [];
$row['produced_quantity'] = [];
@@ -270,7 +271,7 @@ class ProductionTargetPlan extends Component
// Skip leave dates fast
if (isset($leaveDates) && in_array($date, $leaveDates)) {
$row['daily_line_capacity'][$date] = '-';
$row['daily_hourly_quantity'][$date] = '-';
$row['daily_target_dynamic'][$date] = '-';
$row['produced_quantity'][$date] = '-';
continue;
@@ -284,7 +285,7 @@ class ProductionTargetPlan extends Component
$row['daily_target_dynamic'][$date] = $todayTarget;
$row['produced_quantity'][$date] = $producedQty;
$row['daily_line_capacity'][$date] = $dailyLineCapacity;
$row['daily_hourly_quantity'][$date] = $dailyHourlyQuantity * 22.5;
// Carry forward remaining qty
$remainingQty = max(0, $remainingQty - $producedQty);