Browse Source

Merge pull request 'staging upload' (#79) from staging into master

Reviewed-on: ordo/adw-backend#79
pull/3/head
ibnu 2 years ago
parent
commit
7cca0875bf
  1. 3
      app/Helpers/MasterFunctionsHelper.php
  2. 2
      app/Http/Controllers/ActivityController.php
  3. 2
      app/Http/Controllers/ReportActivityMaterialController.php

3
app/Helpers/MasterFunctionsHelper.php

@ -212,6 +212,7 @@ class MasterFunctionsHelper {
->where('activity_id', '=', $keyActualM->activity_id)
->groupBy('activity_id')
->first();
$reportCount = DB::table('report_activity_material')->where('activity_id', '=', $keyActualM->activity_id)->count();
$dataTempReport [$w]['activity_id'] = $keyActualM->activity_id;
$dataTempReport [$w]['qty'] = $keyActualM->qty;
$dataTempReport [$w]['report_date'] = $keyActualM->report_date;
@ -231,7 +232,7 @@ class MasterFunctionsHelper {
// $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->bobot_planning;
$sumPercentageActual+=$keyActualM->bobot_planning/$reportCount;
// $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual;
}else{
if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){

2
app/Http/Controllers/ActivityController.php

@ -488,7 +488,7 @@ class ActivityController extends Controller
if (!empty($activity_row['predecessor'])) {
$key = array_search($activity_row['predecessor'], array_column($data['activities'], 'no'));
if (!$predecessorActivity = Activity::find($data['activities'][$key]['activity_id']))
if (!isset($data['activities'][$key]['activity_id']) || !$predecessorActivity = Activity::find($data['activities'][$key]['activity_id']))
continue;
$predecessorFinishDate = new \DateTime($predecessorActivity->end_date);

2
app/Http/Controllers/ReportActivityMaterialController.php

@ -35,7 +35,7 @@ class ReportActivityMaterialController extends Controller
/* $data['assign_material_id'] = AssignMaterial::where('activity_id', $request->activity_id)->pluck('id')->first(); */
$data['assign_material_id'] = $request->assign_material_id;
$data['qty'] = $this->sanitizeDecimal($data['qty']);
if($reportDate > $startDate){
if($reportDate >= $startDate){
$created = ReportActivityMaterial::create($data);
return response()->json(['status'=>'success','message'=>'Input progress report activity created','code'=>200,'data'=>array('report_id'=>$created->id)]);
} else {

Loading…
Cancel
Save