Browse Source

update for logic update status report on-progress, actual >= plan is 95, actual < plan is calculate

pull/1/head
ibnu 1 year ago
parent
commit
aded36c0ae
  1. 10
      app/Http/Controllers/ReportActivityMaterialController.php

10
app/Http/Controllers/ReportActivityMaterialController.php

@ -64,10 +64,18 @@ class ReportActivityMaterialController extends Controller
} else {
$sumAssignMaterial = AssignMaterial::where('activity_id', $request->activity_id)->sum('qty_planning');
$sumReportActivityMaterial = ReportActivityMaterial::where('activity_id', $request->activity_id)->sum('qty');
// if actual >= plan
if ($sumReportActivityMaterial >= $sumAssignMaterial){
$persentaseProgress = 95;
}else{
// actual < plan
$persentaseProgress = $sumReportActivityMaterial/$sumAssignMaterial*100;
}
$dataUpdate = array(
"actual_start" => null,
"actual_end" => null,
"persentase_progress" => $sumReportActivityMaterial/$sumAssignMaterial*100,
"persentase_progress" => $persentaseProgress,
"updated_by" => $this->currentName
);
if ($sumReportActivityMaterial > 0) {

Loading…
Cancel
Save