Browse Source

recalculate planned cost after deleting assigned material

pull/3/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
12415c6e77
  1. 4
      app/Http/Controllers/AssignMaterialController.php

4
app/Http/Controllers/AssignMaterialController.php

@ -166,13 +166,15 @@ class AssignMaterialController extends Controller
);
$materialResource->update($dataUpdate);
}
$activity = Activity::where('id', $data->activity_id)->first();
$activity->rencana_biaya -= $data->budget * $data->qty_planning;
$activity->save();
$delete = $data->delete();
}else{
return response()->json(['status'=>'failed','message'=>'Data Assign material not found!','code'=>400], 400);
die();
}
if($delete){
return response()->json(['status'=>'success','message'=>'Assign material successfully deleted!','code'=>200], 200);
}else{

Loading…
Cancel
Save