|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use App\Models\HierarchyFtth;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use App\Helpers\MasterFunctionsHelper;
|
|
|
|
use App\Models\Project;
|
|
|
|
|
|
|
|
class CalculateProgressGantt extends Command
|
|
|
|
{
|
|
|
|
protected $signature = 'calculate:progressgantt {hierarchy_id}';
|
|
|
|
|
|
|
|
protected $description = 'Calculate Progress Gantt';
|
|
|
|
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
$hierarchy_id = $this->argument('hierarchy_id');
|
|
|
|
$hierarchy = HierarchyFtth::findOrFail($hierarchy_id);
|
|
|
|
$project = Project::find($hierarchy->project_id);
|
|
|
|
|
|
|
|
$data = MasterFunctionsHelper::calculateSCurveForProgressTree($hierarchy_id);
|
|
|
|
|
|
|
|
$hierarchy->bobot_planning = 100;
|
|
|
|
$hierarchy->progress =round(((int) end($data[0]['data']['percentageReal']) / (int) end($data[0]['data']['percentagePlan'])) * 100, 2);
|
|
|
|
$hierarchy->save();
|
|
|
|
}
|
|
|
|
}
|