diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php
index ed7a377..14a759f 100644
--- a/app/Helpers/MasterFunctionsHelper.php
+++ b/app/Helpers/MasterFunctionsHelper.php
@@ -589,15 +589,13 @@ class MasterFunctionsHelper
// if (new \DateTime($loopDay) < $today) {
// $statusCutOfDate = true;
// }
- if (new \DateTime($loopDay) == new \DateTime($loopDay . ' Friday')) {
- $progressPlanKomulatifWeek[] += round($tmpProgressPlanWeek, 2);
- if (new \DateTime($loopDay . ' Friday') <= new \DateTime($today . ' Friday')) {
- // $tempPercentageReal[] = round($tempTtlPercentActual, 2);
- $progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2);
- }
- $dateWeek[] = [$loopDay];
+ $progressPlanKomulatifWeek[] += round($tmpProgressPlanWeek, 2);
+ if (new \DateTime($loopDay . ' Friday') <= new \DateTime($today . ' Friday')) {
+ // $tempPercentageReal[] = round($tempTtlPercentActual, 2);
+ $progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2);
}
+ $dateWeek[] = [$loopDay];
// $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek;
foreach ($dataPlanM as $keyPlanM) {
# hitung untuk persentase progress planning
@@ -1471,15 +1469,13 @@ class MasterFunctionsHelper
$dataActivityPlan = [];
$dataActivityActual = [];
$today = date('Y-m-d');
- if (new \DateTime($loopDay) == new \DateTime($loopDay . ' Friday')) {
- $progressPlanKomulatifWeek[] += round($tmpProgressPlanWeek, 2);
- if (new \DateTime($loopDay . ' Friday') <= new \DateTime($today . ' Friday')) {
- // $tempPercentageReal[] = round($tempTtlPercentActual, 2);
- $progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2);
- }
- $dateWeek[] = [$loopDay];
+ $progressPlanKomulatifWeek[] += round($tmpProgressPlanWeek, 2);
+ if (new \DateTime($loopDay . ' Friday') <= new \DateTime($today . ' Friday')) {
+ // $tempPercentageReal[] = round($tempTtlPercentActual, 2);
+ $progressActualKomulatifWeek[] += round($tmpProgressActualWeek, 2);
}
+ $dateWeek[] = [$loopDay];
// $progressPlanKomulatifWeek[] += $tmpProgressPlanWeek;
// if (count($dataPlanM) > 0 && count($dataPlanM[0]) > 0) {
foreach ($dataPlanM as $keyPlanM) {
@@ -1740,6 +1736,9 @@ class MasterFunctionsHelper
// if($keyPlanM->duration == 0){
// $duration = 2;
// Tanggal awal
+ if (count($keyPlanM) == 0) {
+ continue;
+ }
$startDate = new DateTime($keyPlanM->planned_start);
// Tanggal akhir
$endDate = new DateTime($keyPlanM->planned_end);
@@ -1771,6 +1770,9 @@ class MasterFunctionsHelper
// hitung progress actual
// if (count($dataActualM) > 0 && count($dataActualM[0]) > 0) {
foreach ($dataActualM as $keyActualM) {
+ if (count($keyPlanM) == 0) {
+ continue;
+ }
# hitung untuk persentase progress actual
// $progressActualWeek = ((((($keyActualM->qty_actual / $keyActualM->sum_qty_actual) * 100) / $keyActualM->qty_plan)*100)*$keyActualM->bobot_planning)/100;
// jika total report > dari planning
diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php
old mode 100644
new mode 100755
index a9a56e4..44f5a2a
--- a/app/Http/Controllers/ActivityController.php
+++ b/app/Http/Controllers/ActivityController.php
@@ -691,6 +691,7 @@ class ActivityController extends Controller
'selfTable.name',
'persentase_progress',
'selfTable.start_date',
+ 'selfTable.id',
'selfTable.end_date',
'selfTable.planned_start',
'selfTable.planned_end',
@@ -700,9 +701,10 @@ class ActivityController extends Controller
'm_version_gantt.name_version',
DB::raw('user_names.user_name as user_name'),
DB::raw('SUM(report_activity_material.qty) as qty'),
- 'assign_material_to_activity.qty_planning',
+ // DB::raw('SUM(assign_material_to_activity.qty_planning) as qty_planning'),
'assign_material_to_activity.id as join_third_id'
)
+ ->addSelect(DB::raw('(SELECT SUM(assign_material_to_activity.qty_planning) FROM assign_material_to_activity WHERE assign_material_to_activity.activity_id = report_activity_material.activity_id) as qty_planning'))
->join('m_version_gantt', 'm_version_gantt.id', '=', 'selfTable.version_gantt_id')
->leftJoin('assign_hr_to_activity', 'assign_hr_to_activity.activity_id', '=', 'selfTable.id')
->leftJoin('report_activity_material', 'report_activity_material.activity_id', '=', 'selfTable.id')
@@ -713,13 +715,12 @@ class ActivityController extends Controller
GROUP BY activity_id) as user_names'), function ($join) {
$join->on('user_names.activity_id', '=', 'selfTable.id');
})
+ ->where('assign_material_to_activity.id', '=', DB::raw('report_activity_material.assign_material_id'))
->groupBy('selfTable.id')
- ->groupBy('selfTable.name')
- ->groupBy('selfTable.persentase_progress')
->groupBy('m_version_gantt.name_version')
- ->groupBy('assign_material_to_activity.qty_planning')
->groupBy('assign_material_to_activity.id')
->groupBy('user_names.user_name')
+ ->groupBy('report_activity_material.activity_id')
->get();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet], 200);
}
diff --git a/app/Http/Controllers/AssignMaterialController.php b/app/Http/Controllers/AssignMaterialController.php
index 3d78384..0d7b303 100644
--- a/app/Http/Controllers/AssignMaterialController.php
+++ b/app/Http/Controllers/AssignMaterialController.php
@@ -7,6 +7,7 @@ use App\Models\AssignMaterial;
use App\Models\RequestMaterial;
use App\Models\Activity;
use App\Models\ReportActivityMaterial;
+use Illuminate\Support\Facades\DB;
use Datatables;
class AssignMaterialController extends Controller
@@ -140,28 +141,29 @@ class AssignMaterialController extends Controller
$id_activity = $request->query('idact');
$data =
AssignMaterial::select(
- AssignMaterial::raw('SUM(qty_planning) as qty_planning'),
+ DB::raw('(SELECT SUM(assign_material_to_activity.qty_planning) FROM assign_material_to_activity WHERE assign_material_to_activity.activity_id = ram.activity_id) as qty_planning'),
+ DB::raw('SUM(ram.qty) as qty_sum'),
"m.description as material_name",
"assign_material_to_activity.activity_id",
- "assign_material_to_activity.type"
- // "assign_material_to_activity.material_id",
)
->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
+ ->join("report_activity_material as ram", "ram.assign_material_id", "=", "assign_material_to_activity.id")
->groupBy("m.description")
+ ->groupBy("ram.activity_id")
->groupBy("assign_material_to_activity.activity_id")
- ->groupBy("assign_material_to_activity.type")
->where("assign_material_to_activity.activity_id", $id_activity)->get();
return Datatables::of($data)
->addIndexColumn()
- ->addColumn('qty_sum', function($row){
- $val_qty_act = AssignMaterial::select(ReportActivityMaterial::raw('SUM(ram.qty) as qty_sum'),"m.description as material_name1")
- ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
- ->join("report_activity_material as ram", "ram.assign_material_id", "=", "assign_material_to_activity.id")
- ->groupBy("m.description")
- ->where("m.description", strval($row->material_name))
- ->where("ram.activity_id", $row->activity_id)->first();
- return $val_qty_act ? $val_qty_act->qty_sum : '-';
- })
+ // ->addColumn('qty_planning', function($row){
+ // $val_qty_act = AssignMaterial::select(ReportActivityMaterial::raw('SUM(ram.qty) as qty_sum'),"m.description as material_name1","m.id")
+ // ->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
+ // ->join("report_activity_material as ram", "ram.assign_material_id", "=", "assign_material_to_activity.id")
+ // ->groupBy("m.description")
+ // ->groupBy("m.id")
+ // ->where("m.description", strval($row->material_name))
+ // ->where("ram.activity_id", $row->activity_id)->first();
+ // return $val_qty_act ? $val_qty_act->qty_sum : '-';
+ // })
->addColumn('status_activity', function($row){
$val_status = AssignMaterial::select("status_activity")
->join('m_req_material as m', 'm.id', '=', 'assign_material_to_activity.material_id')
@@ -196,8 +198,8 @@ class AssignMaterialController extends Controller
->addColumn('action', function($row){
$dataPlan = AssignMaterial::select('assign_material_to_activity.id')->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
->where('activity_id', $row->activity_id)->where('m.description', $row->material_name)->first();
- $actionBtn = '';
- $actionBtn .= '';
+ $actionBtn = '';
+ $actionBtn .= '';
return $actionBtn;
})
->rawColumns(['action'])->make(true);
diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php
index 7ef300e..78fda02 100644
--- a/app/Http/Controllers/AuthController.php
+++ b/app/Http/Controllers/AuthController.php
@@ -13,6 +13,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Password;
use Illuminate\Validation\ValidationException;
+
class AuthController extends Controller
{
public function __construct()
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 02049ab..a084601 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -7,8 +7,8 @@ use Illuminate\Support\Facades\Http;
use App\Models\UserToActivity;
use App\Models\Activity;
use App\Models\AssignMaterial;
-use App\Models\User;
use App\Models\Divisi;
+use App\Models\User;
use Laravel\Lumen\Routing\Controller as BaseController;
use App\Models\ReportK3Detail;
@@ -33,7 +33,6 @@ class Controller extends BaseController
$this->currentDate = date("Y-m-d H:i:s");
$this->currentName = auth()->user() ? auth()->user()->name : "system";
$this->currentId = auth()->user() ? auth()->user()->id : 0;
- $this->companyId = auth()->user() ? auth()->user()->company_id : 0;
$this->pathImage = config('assets.image');
$this->pathDocument = config('assets.project');
$this->pathActivityDocument = config('assets.activity');
diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php
index 8e4c50a..f1c8e16 100644
--- a/app/Http/Controllers/DashboardBoDController.php
+++ b/app/Http/Controllers/DashboardBoDController.php
@@ -47,13 +47,17 @@ class DashboardBoDController extends Controller
{
if (empty($search))
return response()->json(['status' => 'error', 'message' => 'Empty query string!'], 400);
+ if (empty($search))
+ return response()->json(['status' => 'error', 'message' => 'Empty query string!'], 400);
+ $url = str_replace("SEARCH", $search, config('api.adw') . '/project_cost?project_no=SEARCH');
$url = str_replace("SEARCH", $search, config('api.adw') . '/project_cost?project_no=SEARCH');
$token = config('api.adw_token');
$response = $this->curlReq($url, $token);
if (@$response->data->project_no == "")
- return null;
+ if (@$response->data->project_no == "")
+ return null;
return $response;
}
@@ -309,7 +313,7 @@ class DashboardBoDController extends Controller
}
$selisihProgress = $planningProgress - $actualProgress;
try {
- if ($selisihProgress > 0 && $selisihProgress <= 5) {
+ if ($selisihProgress > 0 && $selisihProgress <= 20) {
$return['warning'] += 1;
$projects[$index]->status = 'warning';
} elseif ($selisihProgress == 0) {
diff --git a/app/Http/Controllers/DivisiController.php b/app/Http/Controllers/DivisiController.php
index d46c927..dad48a9 100644
--- a/app/Http/Controllers/DivisiController.php
+++ b/app/Http/Controllers/DivisiController.php
@@ -83,13 +83,26 @@ class DivisiController extends Controller
public function search(Request $request)
{
- $payload = $request->all();
- $dataBuilder = $this->setUpPayload($payload, 'm_divisi');
- $builder = $dataBuilder['builder'];
- $countBuilder = $dataBuilder['count'];
- $dataGet = $builder->get();
- $totalRecord = $countBuilder->count();
- return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200);
+ $parentDivisi = Divisi::whereNull('parent')->with('children')->get();
+ $divisions = [];
+ foreach ($parentDivisi as $objRow) {
+ $objRow->children = $this->getAllChildren($objRow);
+ // $objRow->key = rand(1, 1000);
+ $divisions[] = $objRow;
+ }
+ $countData = count($divisions);
+ if ($countData == 0)
+ return response()->json(['status' => 'failed', 'message' => 'Data not found!', 'code' => 404], 404);
+
+ return response()->json(['status' => 'success', 'code' => 200, 'data' => $divisions, 'totalRecord' => $countData], 200);
+
+ // $payload = $request->all();
+ // $dataBuilder = $this->setUpPayload($payload, 'm_divisi');
+ // $builder = $dataBuilder['builder'];
+ // $countBuilder = $dataBuilder['count'];
+ // $dataGet = $builder->get();
+ // $totalRecord = $countBuilder->count();
+ // return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet, 'totalRecord' => $totalRecord], 200);
//return $this->list();
// cant use builder for this case
}
diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php
index f4af843..60407a0 100644
--- a/app/Http/Controllers/ProjectController.php
+++ b/app/Http/Controllers/ProjectController.php
@@ -51,9 +51,11 @@ class ProjectController extends Controller
$this->validate($request, [
'nama' => 'required',
'mulai_proyek' => 'required',
+ 'mulai_proyek' => 'required',
'akhir_proyek' => 'required',
'rencana_biaya' => 'required',
- 'type_proyek_id' => 'required'
+ 'type_proyek_id' => 'required',
+ 'value_proyek' => 'required'
]);
$data = $request->all();
@@ -80,18 +82,54 @@ class ProjectController extends Controller
if (empty($id) || !is_int((int)$id))
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400);
- $result = Project::query()
- ->from('m_proyek AS mp')
- ->where('mp.id', $id)
- ->selectRaw('value_proyek,scoupe_of_work,kode_sortname,jumlah_stakeholder,nama,mulai_proyek,akhir_proyek,area_kerja,rencana_biaya,biaya_actual,company,pm_id,type_proyek_id,divisi_id,persentase_progress,keterangan,durasi_proyek,progress_by_worklog,currency_symbol,late_consequence,assumtion,currency_code,currency_name,project_objectives,considered_success_when,potential_risk,testing_environment,budget_health,phase_id,calculation_status');
-
- if (!is_null($result->first()['divisi_id'])) {
- $result->leftJoin('m_divisi', 'mp.divisi_id', '=', 'm_divisi.id')
- ->addSelect(DB::raw('m_divisi.name AS nama_divisi'));
- }
-
- $result = $result->first();
+ // $result = Project::query()
+ // ->from('m_proyek AS mp')
+ // ->where('mp.id', $id)
+ // ->selectRaw('value_proyek,scoupe_of_work,kode_sortname,jumlah_stakeholder,nama,mulai_proyek,akhir_proyek,
+ // area_kerja,rencana_biaya,biaya_actual,company,pm_id,type_proyek_id,divisi_id,persentase_progress,keterangan,durasi_proyek,progress_by_worklog,currency_symbol,late_consequence,assumtion,currency_code,currency_name,project_objectives,considered_success_when,potential_risk,testing_environment,budget_health,phase_id,calculation_status');
+ // if (!is_null($result->first()['divisi_id'])) {
+ // $result->leftJoin('m_divisi', 'mp.divisi_id', '=', 'm_divisi.id')
+ // ->addSelect(DB::raw('m_divisi.name AS nama_divisi'));
+ // }
+ $result = Project::select(
+ 'value_proyek',
+ 'scoupe_of_work',
+ 'kode_sortname',
+ 'jumlah_stakeholder',
+ 'nama',
+ 'mulai_proyek',
+ 'akhir_proyek',
+ 'area_kerja',
+ 'rencana_biaya',
+ 'biaya_actual',
+ 'company',
+ 'pm_id',
+ 'type_proyek_id',
+ 'divisi_id',
+ 'persentase_progress',
+ 'keterangan',
+ 'durasi_proyek',
+ 'progress_by_worklog',
+ 'currency_symbol',
+ 'late_consequence',
+ 'assumtion',
+ 'currency_code',
+ 'currency_name',
+ 'project_objectives',
+ 'considered_success_when',
+ 'potential_risk',
+ 'testing_environment',
+ 'budget_health',
+ 'phase_id',
+ 'calculation_status',
+ 'md.name as divisi_name',
+ 'nickname',
+ 'sponsor'
+ )
+ ->join('m_divisi as md', 'md.id', '=', 'm_proyek.divisi_id')
+ ->where('m_proyek.id', $id)
+ ->first();
if (!$result)
return response()->json(['status' => 'failed', 'message' => 'Data not found!', 'code' => 404], 404);
@@ -510,29 +548,20 @@ class ProjectController extends Controller
return response()->json(['status' => 'success', 'data' => $response, 'code' => 200], 200);
}
- public function getByUser($id) {
+ public function getByUser($id)
+ {
+ $alias = "utp";
$userProyek = UserToProyek::query()
- ->from('assign_hr_to_proyek AS ahtp')
+ ->from('assign_hr_to_proyek AS ' . $alias)
->where([
['is_customer', true],
['user_id', $id]
])
- ->leftJoin('m_users', 'ahtp.user_id', '=', 'm_users.id')
- ->leftJoin('m_proyek AS mp', 'ahtp.proyek_id', '=', 'mp.id')
- ->leftJoin('m_type_proyek', 'mp.type_proyek_id', '=', 'm_type_proyek.id')
- ->select(
- 'mp.id',
- 'mp.nama',
- 'mp.rencana_biaya',
- 'mp.type_proyek_id',
- 'mp.currency_symbol',
- 'mp.mulai_proyek',
- 'mp.akhir_proyek',
- 'm_users.name AS join_first_name',
- 'm_users.username AS join_first_username',
- 'm_type_proyek.name AS join_second_name',
- 'm_type_proyek.name AS join_second_description'
- )->get();
+ ->leftJoin('m_users', $alias . '.user_id', '=', 'm_users.id')
+ ->leftJoin('m_proyek', $alias . '.proyek_id', '=', 'm_proyek.id')
+ ->leftJoin('m_type_proyek', 'm_proyek.type_proyek_id', '=', 'm_type_proyek.id')
+ ->select('m_proyek.*', 'm_type_proyek.name AS join_second_name', 'm_users.name AS join_first_name')
+ ->get();
$totalRecord = $userProyek->count();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $userProyek, 'totalRecord' => $totalRecord], 200);
@@ -559,7 +588,7 @@ class ProjectController extends Controller
$actualStartExist = Activity::where('proyek_id', $id)->whereNotNull('actual_start')->exists();
if ($result['type_proyek_id'] === 9) {
// $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')
->orderBy('end_date', 'desc')
->first();
@@ -599,10 +628,12 @@ class ProjectController extends Controller
$plannedEnd = Activity::where('version_gantt_id', $ganttId)
->orderByDesc('planned_end')
->value('planned_end');
- $result->header->start_date = $startDate;
- $result->header->end_date = $maxEndDate->end_date;
- $result->header->planned_start = $plannedStart;
- $result->header->planned_end = $plannedEnd;
+ if (isset($result->header)) {
+ $result->header->start_date = $startDate;
+ $result->header->end_date = $maxEndDate->end_date;
+ $result->header->planned_start = $plannedStart;
+ $result->header->planned_end = $plannedEnd;
+ }
return response()->json(['status' => 'success', 'code' => 200, 'data' => $result, 'gantt' => $ganttId], 200);
}
@@ -622,15 +653,15 @@ class ProjectController extends Controller
->value('end_date');
if (isset($payload['till_date'])) {
if (isset($payload['scurve'])) {
- $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date', '<=', $endDate)->orderBy('end_date', 'asc')->get();
+ $overdueActivities = Activity::join('m_version_gantt', 'm_activity.version_gantt_id', '=', 'm_version_gantt.id')->where('m_activity.proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date', '<=', $endDate)->orderBy('end_date', 'asc')->get();
} else {
- $overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date', '<=', $endDate)->orderBy('end_date', 'asc')->get();
+ $overdueActivities = Activity::join('m_version_gantt', 'm_activity.version_gantt_id', '=', 'm_version_gantt.id')->where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->whereDate('end_date', '<=', $endDate)->orderBy('end_date', 'asc')->get();
}
} else {
if (isset($payload['scurve'])) {
- $overdueActivities = Activity::where('proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get();
+ $overdueActivities = Activity::join('m_version_gantt', 'm_activity.version_gantt_id', '=', 'm_version_gantt.id')->where('m_activity.proyek_id', $payload['id'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get();
} else {
- $overdueActivities = Activity::where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get();
+ $overdueActivities = Activity::join('m_version_gantt', 'm_activity.version_gantt_id', '=', 'm_version_gantt.id')->where('version_gantt_id', $payload['gantt'])->whereNotNull('parent_id')->where('persentase_progress', '!=', 100)->orderBy('end_date', 'asc')->get();
}
}
$result->overdueActivities = $overdueActivities;
diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php
index e451129..a55e15f 100644
--- a/app/Http/Controllers/ReportActivityMaterialController.php
+++ b/app/Http/Controllers/ReportActivityMaterialController.php
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Helpers\MasterFunctionsHelper;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
use App\Models\ReportActivityMaterial;
use App\Models\Activity;
use App\Models\AssignMaterial;
@@ -64,10 +65,18 @@ class ReportActivityMaterialController extends Controller
} else {
$sumAssignMaterial = AssignMaterial::where('activity_id', $request->activity_id)->sum('qty_planning');
$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(
"actual_start" => null,
- "actual_end" => null,
- "persentase_progress" => $sumReportActivityMaterial/$sumAssignMaterial*100,
+ "actual_end" => null,
+ "persentase_progress" => $persentaseProgress,
"updated_by" => $this->currentName
);
if ($sumReportActivityMaterial > 0) {
@@ -124,8 +133,10 @@ class ReportActivityMaterialController extends Controller
public function datatables(Request $request){
$id_activity = $request->query('idAct');
+ $id_am = $request->query('idAmi');
$type = $request->query('type');
$materialName = $request->query('materialName');
+ $materialId = $request->query('materialId');
if($type == 'plan'){
$activity = Activity::findOrFail($id_activity);
$baselineDuration = 0;
@@ -135,6 +146,7 @@ class ReportActivityMaterialController extends Controller
$data = AssignMaterial::select("assign_material_to_activity.*","m.description as material_name", "m.uom as uom")
->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
->where('assign_material_to_activity.activity_id', $id_activity)
+ ->where('assign_material_to_activity.id', $id_am)
->where('m.description', $materialName)
->orderBy('assign_material_to_activity.id', 'asc')
->get();
diff --git a/app/Http/Controllers/UserToActivityController.php b/app/Http/Controllers/UserToActivityController.php
index b387c24..bfe4f22 100644
--- a/app/Http/Controllers/UserToActivityController.php
+++ b/app/Http/Controllers/UserToActivityController.php
@@ -158,7 +158,7 @@ class UserToActivityController extends Controller
$dataBuilder = $this->setUpPayload($payload, 'assign_hr_to_activity');
$builder = $dataBuilder['builder'];
- $countBuilder = $dataBuilder['count'];
+ // $countBuilder = $dataBuilder['count'];
if (isset($join_column)) {
$startDate = $join_column['start_date'];
$endDate = $join_column['end_date'];
@@ -187,8 +187,35 @@ class UserToActivityController extends Controller
}
$dataGet = $filteredData;
}
- $totalRecord = $countBuilder->count();
- return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>$totalRecord], 200);
+ // $totalRecord = $countBuilder->count();
+ return response()->json(['status'=>'success','code'=>200,'data'=>$dataGet, 'totalRecord'=>count($dataGet)], 200);
+ }
+
+ public function activityUser(Request $request){
+ $payload = $request->all();
+ $activity = DB::table('m_activity as ma')
+ ->select('ahta.id', 'ma.id as activity_id', 'ma.proyek_id', 'ma.name as join_second_name', 'ma.start_date as join_second_start_date',
+ 'ma.end_date as join_second_end_date', 'ma.persentase_progress', 'mvg.name_version', 'mp.nama as nama_proyek', 'mp.type_proyek_id')
+ ->join('assign_hr_to_activity as ahta', 'ahta.activity_id', '=', 'ma.id')
+ ->join('m_version_gantt as mvg', 'mvg.id', '=', 'ma.version_gantt_id')
+ ->join('m_proyek as mp', 'mp.id', '=', 'ma.proyek_id')
+ ->where('ahta.user_id', $payload['user_id'])
+ ->where('ma.start_date', '<=', $payload['end_date'])
+ ->where('ma.end_date', '>=', $payload['start_date'])
+ ->where('ma.proyek_id', $payload['proyek_id'])
+ ->get();
+
+ if ($payload['status'] != "") {
+ $filteredData = [];
+ foreach ($activity as $value) {
+ $assignMaterial = AssignMaterial::where('activity_id', $value->activity_id)->first();
+ if ($assignMaterial->status_activity == $payload['status']) {
+ $filteredData[] = $value;
+ }
+ }
+ $activity = $filteredData;
+ }
+ return response()->json(['status'=>'success','code'=>200,'data'=>$activity, 'totalRecord'=>count($activity)], 200);
}
public function list()
diff --git a/app/Http/Controllers/UserToProyekController.php b/app/Http/Controllers/UserToProyekController.php
index 0e8736e..1f6e55c 100644
--- a/app/Http/Controllers/UserToProyekController.php
+++ b/app/Http/Controllers/UserToProyekController.php
@@ -50,7 +50,8 @@ class UserToProyekController extends Controller
"user_id" => $item,
"proyek_id" => $request->proyek_id,
"created_by" => $this->currentName,
- 'is_customer'=>true
+ 'is_customer'=>true,
+ 'project_role'=> $request->project_role
);
$result = UserToProyek::create($dataInsert);
diff --git a/app/Http/Controllers/VersionGanttController.php b/app/Http/Controllers/VersionGanttController.php
index 37cb585..91984a2 100644
--- a/app/Http/Controllers/VersionGanttController.php
+++ b/app/Http/Controllers/VersionGanttController.php
@@ -121,11 +121,9 @@ class VersionGanttController extends Controller
->where('m_activity.parent_id', null)
->get();
foreach ($progress as $item) {
- if ($item->persentase_progress) {
- $item->progress = $item->persentase_progress;
- $item->bobot = $item->bobot_planning;
- $item->save();
- }
+ $item->progress = $item->persentase_progress;
+ $item->bobot = $item->bobot_planning;
+ $item->save();
}
}
diff --git a/app/Models/HumanResource.php b/app/Models/HumanResource.php
index 6e8b9fe..425f0a5 100644
--- a/app/Models/HumanResource.php
+++ b/app/Models/HumanResource.php
@@ -34,6 +34,5 @@ class HumanResource extends Model
'updated_by',
'divisi_id',
'status_boundary',
- 'company_id'
];
}
diff --git a/app/Models/Project.php b/app/Models/Project.php
index 43c0a1e..cfd463f 100644
--- a/app/Models/Project.php
+++ b/app/Models/Project.php
@@ -15,6 +15,7 @@ class Project extends Model
'kode_sortname',
'jumlah_stakeholder',
'nama',
+ 'nickname',
'mulai_proyek',
'akhir_proyek',
'area_kerja',
@@ -23,8 +24,10 @@ class Project extends Model
'biaya_actual',
'company',
'pm_id',
+ 'scoupe_of_work',
'type_proyek_id',
'divisi_id',
+ 'value_proyek',
'persentase_progress',
'keterangan',
'durasi_proyek',
diff --git a/app/Models/ProjectRole.php b/app/Models/ProjectRole.php
index 9d15c1a..52a7b46 100644
--- a/app/Models/ProjectRole.php
+++ b/app/Models/ProjectRole.php
@@ -12,6 +12,6 @@ class ProjectRole extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
- 'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id'
+ 'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by'
];
}
diff --git a/app/Models/RoleMenu.php b/app/Models/RoleMenu.php
index 2a59ede..3540ea6 100644
--- a/app/Models/RoleMenu.php
+++ b/app/Models/RoleMenu.php
@@ -12,6 +12,6 @@ class RoleMenu extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
- 'role_id', 'menu_id', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id', "create", "read", "update", "delete"
+ 'role_id', 'menu_id', 'created_at', 'created_by', 'updated_at', 'updated_by'
];
}
diff --git a/app/Models/Satuan.php b/app/Models/Satuan.php
index 9779db6..05305af 100644
--- a/app/Models/Satuan.php
+++ b/app/Models/Satuan.php
@@ -12,6 +12,6 @@ class Satuan extends Model
const UPDATED_AT = 'updated_at';
protected $fillable = [
- 'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by', 'company_id'
+ 'name', 'description', 'created_at', 'created_by', 'updated_at', 'updated_by'
];
}
diff --git a/routes/web.php b/routes/web.php
index e680928..3716661 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -78,6 +78,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->post('/project/get-overdue-activities', 'ProjectController@getOverdueActivities');
$router->post('/project/get-integration-invoice', 'ProjectController@getInvoiceIntegration');
$router->post('/project/get-report-distribution', 'ProjectController@getReportDistribution');
+ $router->get('/project/get-integration-project-cost={name}', 'ProjectController@getProjectCostIntegration');
/* $router->get('/project/get-expenditure/{id}/{date?}', 'ProjectController@getExpenditure'); */
@@ -228,6 +229,7 @@ $router->group(['prefix' => 'api', 'middleware' => 'cors'], function () use ($ro
$router->get('/user-to-activity/edit/{id}', 'UserToActivityController@edit');
$router->put('/user-to-activity/update/{id}', 'UserToActivityController@update');
$router->post('/user-to-activity/search', 'UserToActivityController@search');
+ $router->post('/user-to-activity/by-date-status', 'UserToActivityController@activityUser');
$router->post('/user-to-activity/search-analysis', 'UserToActivityController@searchAnalysis');
$router->post('/user-to-activity/list-filtered', 'UserToActivityController@listFiltered');
$router->delete('/user-to-activity/delete/{id}', 'UserToActivityController@delete');