Custom Backend OSPRO Surveyor Indonesia
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
829 B

<?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();
}
}