Browse Source

Merge pull request 'staging' (#277) from staging into master

Reviewed-on: ordo/adw-backend#277
pull/1/head
ibnu 11 months ago
parent
commit
b4b9b1ecbe
  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) 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();

12
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