Browse Source

Merge pull request 'staging upload 23-05-17' (#54) from staging into master

Reviewed-on: ordo/adw-backend#54
pull/3/head
ibnu 2 years ago
parent
commit
9f1beafbf0
  1. 34
      app/Helpers/MasterFunctionsHelper.php
  2. 2
      app/Http/Controllers/AssignMaterialController.php
  3. 4
      app/Http/Controllers/ProjectController.php

34
app/Helpers/MasterFunctionsHelper.php

@ -71,12 +71,14 @@ class MasterFunctionsHelper {
// foreach ($gantt as $key => $value) { // foreach ($gantt as $key => $value) {
// Log::info('gantt '.$value.' index '.$key); // Log::info('gantt '.$value.' index '.$key);
// } // }
if($gantt['calculation_type'] == 'simple') { if (isset($gantt['calculation_type'])) {
// to do if($gantt['calculation_type'] == 'simple') {
return MasterFunctionsHelper::calculateProgressBasedOnSimple($gantt); // to do
} else { return MasterFunctionsHelper::calculateProgressBasedOnSimple($gantt);
return MasterFunctionsHelper::calculateProgressBasedOnReportMaterial($gantt); } else {
} return MasterFunctionsHelper::calculateProgressBasedOnReportMaterial($gantt);
}
}
} }
} }
@ -213,8 +215,26 @@ class MasterFunctionsHelper {
$dataTempReport [$w]['duration'] = $keyActualM->duration; $dataTempReport [$w]['duration'] = $keyActualM->duration;
$dataTempReport [$w]['persentase_progress'] = $keyActualM->persentase_progress; $dataTempReport [$w]['persentase_progress'] = $keyActualM->persentase_progress;
try { try {
// assign_material_to_activity
$checkStatusActivity = DB::table('assign_material_to_activity')
->select('activity_id', 'status_activity')
->where('activity_id', '=', $keyActualM->activity_id)
->orderBy('status_activity', 'ASC')
->first();
$dataTempReport [$w]['percentage'] = ($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; $dataTempReport [$w]['percentage'] = ($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning;
$sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; // $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning;
if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){
if($checkStatusActivity->status_activity == 'done'){
$sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning;
}else{
$sumPercentageActual+=(($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning)*(95/100);
}
// }else if($checkStatusActivity->status_activity == 'done'){
// $sumPercentageActual+=0;
}else{
$sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning;
}
$totalACWP += $keyActualM->biaya_actual/$keyActualM->duration; $totalACWP += $keyActualM->biaya_actual/$keyActualM->duration;
} catch (\DivisionByZeroError $e) { } catch (\DivisionByZeroError $e) {
return response()->json(['message' => $e->getMessage()]); return response()->json(['message' => $e->getMessage()]);

2
app/Http/Controllers/AssignMaterialController.php

@ -42,7 +42,7 @@ class AssignMaterialController extends Controller
$data['budget'] = $checkStock->price; $data['budget'] = $checkStock->price;
$data['qty_planning'] = $this->sanitizeDecimal($data['qty_planning']); $data['qty_planning'] = $this->sanitizeDecimal($data['qty_planning']);
if ($planDate > $startDate) { if ($planDate >= $startDate) {
$result = AssignMaterial::create($data); $result = AssignMaterial::create($data);
return response()->json(['status'=>'success','message'=>'Data added!', 'code'=>200], 200); return response()->json(['status'=>'success','message'=>'Data added!', 'code'=>200], 200);
}else{ }else{

4
app/Http/Controllers/ProjectController.php

@ -396,8 +396,8 @@ class ProjectController extends Controller
$response = null; $response = null;
// return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200);
return response()->json(['status'=>'success', 'data'=> $response, 'code'=>200], 200); return response()->json(['status'=>'success', 'data'=> '', 'code'=>200], 200);
} }
public function detail($id){ public function detail($id){

Loading…
Cancel
Save