Browse Source

Merge pull request 'dev-ibnu' (#276) from dev-ibnu into staging

Reviewed-on: ordo/adw-backend#276
pull/1/head
ibnu 11 months ago
parent
commit
fa2a8f92f5
  1. 2
      app/Http/Controllers/ProjectController.php
  2. 12
      app/Http/Controllers/ReportActivityMaterialController.php

2
app/Http/Controllers/ProjectController.php

@ -539,7 +539,7 @@ class ProjectController extends Controller
if($result['type_proyek_id'] === 9)
{
// $actualEndExist = Activity::where('proyek_id', $id)->exists();
// $query = Activity::where('proyek_id', $id);
$query = Activity::where('proyek_id', $id);
$maxEndDate = Activity::where('proyek_id', $id)->select('end_date')
->orderBy('end_date', 'desc')
->first();

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

Loading…
Cancel
Save