Browse Source

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

Reviewed-on: ordo/adw-backend#276
pull/1/head
ibnu 1 year ago
parent
commit
fa2a8f92f5
  1. 2
      app/Http/Controllers/ProjectController.php
  2. 10
      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) if($result['type_proyek_id'] === 9)
{ {
// $actualEndExist = Activity::where('proyek_id', $id)->exists(); // $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') $maxEndDate = Activity::where('proyek_id', $id)->select('end_date')
->orderBy('end_date', 'desc') ->orderBy('end_date', 'desc')
->first(); ->first();

10
app/Http/Controllers/ReportActivityMaterialController.php

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

Loading…
Cancel
Save