Merge pull request 'Added monthly plan in production target plan' (#1151) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s

Reviewed-on: #1151
This commit was merged in pull request #1151.
This commit is contained in:
2026-10-01 12:33:10 +00:00
2 changed files with 21 additions and 18 deletions

View File

@@ -23,6 +23,8 @@ class ProductionTargetPlan extends Component
public $monthlyRecords = []; public $monthlyRecords = [];
public $monthlyActualQuantity = [];
public $leaveDates = []; public $leaveDates = [];
public $productionPlanDates = ''; public $productionPlanDates = '';
@@ -635,22 +637,23 @@ class ProductionTargetPlan extends Component
$this->records = $records; $this->records = $records;
// $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId) $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId)
// ->where('line_id', $lineId) ->where('line_id', $lineId)
// ->whereYear('created_at', $year) ->whereYear('created_at', $year)
// ->whereMonth('created_at', $month) ->whereMonth('created_at', $month)
// ->sum('plan_quantity'); ->sum('plan_quantity');
// $this->monthlyRecords = $plans->sum('plan_quantity'); $this->monthlyActualQuantity = ProductionPlan::where('plant_id', $plantId)
->where('line_id', $lineId)
->whereBetween('created_at', [
Carbon::create($year, $month, 1)->startOfMonth(),
now(),
])
->count();
//$this->monthlyRecords = $plans->sum('plan_quantity');
} }
// public function loadMonthlyPlan($year, $month, $plantId, $lineId){
// $this->monthlyRecords = ProductionPlan::where('plant_id', $plantId)
// ->where('line_id', $lineId)
// ->whereYear('created_at', $year)
// ->whereMonth('created_at', $month)
// ->sum('plan_quantity');
// }
public function exportProductionData() public function exportProductionData()
{ {
return Excel::download( return Excel::download(
@@ -664,9 +667,9 @@ class ProductionTargetPlan extends Component
// return view('livewire.production-target-plan'); // return view('livewire.production-target-plan');
return view('livewire.production-target-plan', [ return view('livewire.production-target-plan', [
'records' => $this->records, 'records' => $this->records,
// 'monthlyRecords' => $this->monthlyRecords, 'monthlyRecords' => $this->monthlyRecords,
'monthlyActualRecords' => $this->monthlyActualQuantity,
'dates' => $this->dates, 'dates' => $this->dates,
]); ]);
} }
} }

View File

@@ -1,6 +1,6 @@
<div class="p-4"> <div class="p-4">
{{-- <div class="p-4 mt-6"> <div class="p-4 mt-6">
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider"> <h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">
MONTHLY PRODUCTION PLAN: MONTHLY PRODUCTION PLAN:
</h2> </h2>
@@ -45,7 +45,7 @@
{{ $monthlyRecords ?? 0 }} {{ $monthlyRecords ?? 0 }}
</td> </td>
<td class="border px-4 py-2 whitespace-nowrap font-semibold"> <td class="border px-4 py-2 whitespace-nowrap font-semibold">
{{ $monthlyRecords ?? 0 }} {{ $monthlyActualQuantity ?? 0 }}
</td> </td>
<td class="border px-4 py-2 whitespace-nowrap font-semibold"> <td class="border px-4 py-2 whitespace-nowrap font-semibold">
{{ $monthlyRecords ?? 0 }} {{ $monthlyRecords ?? 0 }}
@@ -63,7 +63,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> --}} </div>
{{-- //.. --}} {{-- //.. --}}
<h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider"> <h2 class="text-lg font-bold mb-4 text-gray-700 uppercase tracking-wider">