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. 11
      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){
// $duration = 2;
// Tanggal awal
if (count($keyPlanM) == 0) {
continue;
}
$startDate = new DateTime($keyPlanM->planned_start);
// Tanggal akhir
$endDate = new DateTime($keyPlanM->planned_end);
@ -1733,6 +1736,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

8
app/Http/Controllers/ActivityController.php

@ -697,9 +697,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')
@ -710,13 +711,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);
}

4
app/Http/Controllers/DashboardBoDController.php

@ -61,7 +61,7 @@ class DashboardBoDController extends Controller
$totalExpenditure = $totalInvoice = $totalPaidInvoice = 0;
// 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)
/* ->orWhere('akhir_proyek', 'like', $year) */
->pluck('sum')
@ -315,7 +315,7 @@ class DashboardBoDController extends Controller
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)
/* ->orWhere('akhir_proyek', 'like', $year) */
->where('divisi_id', $id)

11
app/Http/Controllers/ProjectController.php

@ -53,7 +53,8 @@ class ProjectController extends Controller
'mulai_proyek' => 'required',
'akhir_proyek' => 'required',
'rencana_biaya' => 'required',
'type_proyek_id' => 'required'
'type_proyek_id' => 'required',
'value_proyek' => 'required'
]);
$data = $request->all();
@ -602,16 +603,16 @@ 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;

6
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;
@ -132,6 +133,7 @@ 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');
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")
->join("m_req_material as m", "m.id", "=", "assign_material_to_activity.material_id")
->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')
->get();
if ($baselineDuration > 0) {
@ -172,7 +174,7 @@ class ReportActivityMaterialController extends Controller
->join("m_req_material as m", "m.id", "=", "amta.material_id")
->join("m_users as u", "u.id", "=", "report_activity_material.user_id")
->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')
->get();
if ($baselineDuration > 0) {

3
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);

2
app/Http/Controllers/VersionGanttController.php

@ -117,11 +117,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();
}
}
}

2
app/Models/Project.php

@ -23,8 +23,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',

Loading…
Cancel
Save