|
|
|
@ -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, |
|
|
|
|
"actual_end" => null, |
|
|
|
|
"persentase_progress" => $persentaseProgress, |
|
|
|
|
"updated_by" => $this->currentName |
|
|
|
|
); |
|
|
|
|
if ($sumReportActivityMaterial > 0) { |
|
|
|
|