Browse Source

Merge branch 'staging' of https://git.oslog.id/ordo/adw-backend into dev-ibnu

pull/1/head
ibnu 11 months ago
parent
commit
069d453529
  1. 6
      app/Helpers/MasterFunctionsHelper.php
  2. 8
      app/Http/Controllers/ActivityController.php
  3. 4
      app/Http/Controllers/DashboardBoDController.php
  4. 13
      app/Http/Controllers/ProjectController.php
  5. 6
      app/Http/Controllers/ReportActivityMaterialController.php
  6. 3
      app/Http/Controllers/UserToProyekController.php
  7. 2
      app/Http/Controllers/VersionGanttController.php
  8. 2
      app/Models/Project.php

6
app/Helpers/MasterFunctionsHelper.php

@ -1702,6 +1702,9 @@ class MasterFunctionsHelper
// if($keyPlanM->duration == 0){ // if($keyPlanM->duration == 0){
// $duration = 2; // $duration = 2;
// Tanggal awal // Tanggal awal
if (count($keyPlanM) == 0) {
continue;
}
$startDate = new DateTime($keyPlanM->planned_start); $startDate = new DateTime($keyPlanM->planned_start);
// Tanggal akhir // Tanggal akhir
$endDate = new DateTime($keyPlanM->planned_end); $endDate = new DateTime($keyPlanM->planned_end);
@ -1733,6 +1736,9 @@ class MasterFunctionsHelper
// hitung progress actual // hitung progress actual
// if (count($dataActualM) > 0 && count($dataActualM[0]) > 0) { // if (count($dataActualM) > 0 && count($dataActualM[0]) > 0) {
foreach ($dataActualM as $keyActualM) { foreach ($dataActualM as $keyActualM) {
if (count($keyPlanM) == 0) {
continue;
}
# hitung untuk persentase progress actual # hitung untuk persentase progress actual
// $progressActualWeek = ((((($keyActualM->qty_actual / $keyActualM->sum_qty_actual) * 100) / $keyActualM->qty_plan)*100)*$keyActualM->bobot_planning)/100; // $progressActualWeek = ((((($keyActualM->qty_actual / $keyActualM->sum_qty_actual) * 100) / $keyActualM->qty_plan)*100)*$keyActualM->bobot_planning)/100;
// jika total report > dari planning // jika total report > dari planning

8
app/Http/Controllers/ActivityController.php

@ -697,9 +697,10 @@ class ActivityController extends Controller
'm_version_gantt.name_version', 'm_version_gantt.name_version',
DB::raw('user_names.user_name as user_name'), DB::raw('user_names.user_name as user_name'),
DB::raw('SUM(report_activity_material.qty) as qty'), 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' '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') ->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('assign_hr_to_activity', 'assign_hr_to_activity.activity_id', '=', 'selfTable.id')
->leftJoin('report_activity_material', 'report_activity_material.activity_id', '=', 'selfTable.id') ->leftJoin('report_activity_material', 'report_activity_material.activity_id', '=', 'selfTable.id')
@ -710,13 +711,12 @@ class ActivityController extends Controller
GROUP BY activity_id) as user_names'), function ($join) { GROUP BY activity_id) as user_names'), function ($join) {
$join->on('user_names.activity_id', '=', 'selfTable.id'); $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.id')
->groupBy('selfTable.name')
->groupBy('selfTable.persentase_progress')
->groupBy('m_version_gantt.name_version') ->groupBy('m_version_gantt.name_version')
->groupBy('assign_material_to_activity.qty_planning')
->groupBy('assign_material_to_activity.id') ->groupBy('assign_material_to_activity.id')
->groupBy('user_names.user_name') ->groupBy('user_names.user_name')
->groupBy('report_activity_material.activity_id')
->get(); ->get();
return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet ], 200); return response()->json(['status' => 'success', 'code' => 200, 'data' => $dataGet ], 200);
} }

4
app/Http/Controllers/DashboardBoDController.php

@ -61,7 +61,7 @@ class DashboardBoDController extends Controller
$totalExpenditure = $totalInvoice = $totalPaidInvoice = 0; $totalExpenditure = $totalInvoice = $totalPaidInvoice = 0;
// we can't use eloquent's sum() method because someone decided to use varchar as datatype in rencana_biaya field // we can't use eloquent's sum() method because someone decided to use varchar as datatype in rencana_biaya field
$totalBudgets = Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))')) $totalBudgets = Project::select(DB::raw("SUM(CAST(REPLACE(rencana_biaya, ',', '.') AS DOUBLE PRECISION))"))
->where('mulai_proyek', 'like', $year) ->where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */ /* ->orWhere('akhir_proyek', 'like', $year) */
->pluck('sum') ->pluck('sum')
@ -315,7 +315,7 @@ class DashboardBoDController extends Controller
private function countTotalProjectValueInDivision($id, $year) private function countTotalProjectValueInDivision($id, $year)
{ {
return Project::select(DB::raw('SUM(CAST("rencana_biaya" AS DOUBLE PRECISION))')) return Project::select(DB::raw("SUM(CAST(REPLACE(rencana_biaya, ',', '.') AS DOUBLE PRECISION))"))
->where('mulai_proyek', 'like', $year) ->where('mulai_proyek', 'like', $year)
/* ->orWhere('akhir_proyek', 'like', $year) */ /* ->orWhere('akhir_proyek', 'like', $year) */
->where('divisi_id', $id) ->where('divisi_id', $id)

13
app/Http/Controllers/ProjectController.php

@ -53,7 +53,8 @@ class ProjectController extends Controller
'mulai_proyek' => 'required', 'mulai_proyek' => 'required',
'akhir_proyek' => 'required', 'akhir_proyek' => 'required',
'rencana_biaya' => 'required', 'rencana_biaya' => 'required',
'type_proyek_id' => 'required' 'type_proyek_id' => 'required',
'value_proyek' => 'required'
]); ]);
$data = $request->all(); $data = $request->all();
@ -543,7 +544,7 @@ class ProjectController extends Controller
$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();
}else{ }else{
// $actualEndExist = Activity::where('version_gantt_id', $ganttId)->exists(); // $actualEndExist = Activity::where('version_gantt_id', $ganttId)->exists();
$maxEndDate = Activity::where('version_gantt_id', $ganttId)->select('end_date') $maxEndDate = Activity::where('version_gantt_id', $ganttId)->select('end_date')
@ -602,16 +603,16 @@ class ProjectController extends Controller
->value('end_date'); ->value('end_date');
if(isset($payload['till_date'])) { if(isset($payload['till_date'])) {
if (isset($payload['scurve'])) { 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 { } 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 { else {
if (isset($payload['scurve'])) { 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 { } 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; $result->overdueActivities = $overdueActivities;

6
app/Http/Controllers/ReportActivityMaterialController.php

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Helpers\MasterFunctionsHelper; use App\Helpers\MasterFunctionsHelper;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Models\ReportActivityMaterial; use App\Models\ReportActivityMaterial;
use App\Models\Activity; use App\Models\Activity;
use App\Models\AssignMaterial; use App\Models\AssignMaterial;
@ -132,6 +133,7 @@ class ReportActivityMaterialController extends Controller
public function datatables(Request $request){ public function datatables(Request $request){
$id_activity = $request->query('idAct'); $id_activity = $request->query('idAct');
$id_am = $request->query('idAmi');
$type = $request->query('type'); $type = $request->query('type');
$materialName = $request->query('materialName'); $materialName = $request->query('materialName');
if($type == 'plan'){ if($type == 'plan'){
@ -143,7 +145,7 @@ class ReportActivityMaterialController extends Controller
$data = AssignMaterial::select("assign_material_to_activity.*","m.description as material_name", "m.uom as uom") $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") ->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.activity_id', $id_activity)
->where('m.description', $materialName) ->where('assign_material_to_activity.id', $id_am)
->orderBy('assign_material_to_activity.id', 'asc') ->orderBy('assign_material_to_activity.id', 'asc')
->get(); ->get();
if ($baselineDuration > 0) { if ($baselineDuration > 0) {
@ -172,7 +174,7 @@ class ReportActivityMaterialController extends Controller
->join("m_req_material as m", "m.id", "=", "amta.material_id") ->join("m_req_material as m", "m.id", "=", "amta.material_id")
->join("m_users as u", "u.id", "=", "report_activity_material.user_id") ->join("m_users as u", "u.id", "=", "report_activity_material.user_id")
->where('report_activity_material.activity_id', $id_activity) ->where('report_activity_material.activity_id', $id_activity)
->where('m.description', $materialName) ->where('report_activity_material.assign_material_id', $id_am)
->orderBy('report_activity_material.report_date', 'asc') ->orderBy('report_activity_material.report_date', 'asc')
->get(); ->get();
if ($baselineDuration > 0) { if ($baselineDuration > 0) {

3
app/Http/Controllers/UserToProyekController.php

@ -50,7 +50,8 @@ class UserToProyekController extends Controller
"user_id" => $item, "user_id" => $item,
"proyek_id" => $request->proyek_id, "proyek_id" => $request->proyek_id,
"created_by" => $this->currentName, "created_by" => $this->currentName,
'is_customer'=>true 'is_customer'=>true,
'project_role'=> $request->project_role
); );
$result = UserToProyek::create($dataInsert); $result = UserToProyek::create($dataInsert);

2
app/Http/Controllers/VersionGanttController.php

@ -117,11 +117,9 @@ class VersionGanttController extends Controller
->where('m_activity.parent_id', null) ->where('m_activity.parent_id', null)
->get(); ->get();
foreach($progress as $item) { foreach($progress as $item) {
if($item->persentase_progress){
$item->progress = $item->persentase_progress; $item->progress = $item->persentase_progress;
$item->bobot = $item->bobot_planning; $item->bobot = $item->bobot_planning;
$item->save(); $item->save();
}
} }
} }

2
app/Models/Project.php

@ -23,8 +23,10 @@ class Project extends Model
'biaya_actual', 'biaya_actual',
'company', 'company',
'pm_id', 'pm_id',
'scoupe_of_work',
'type_proyek_id', 'type_proyek_id',
'divisi_id', 'divisi_id',
'value_proyek',
'persentase_progress', 'persentase_progress',
'keterangan', 'keterangan',
'durasi_proyek', 'durasi_proyek',

Loading…
Cancel
Save