Browse Source

Merge pull request 'dev-wahyu' (#284) from dev-wahyu into staging

Reviewed-on: ordo/adw-backend#284
pull/1/head
ibnu 1 year ago
parent
commit
823929f901
  1. 4
      app/Http/Controllers/DashboardBoDController.php
  2. 8
      app/Http/Controllers/ProjectController.php
  3. 2
      app/Http/Controllers/VersionGanttController.php

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)

8
app/Http/Controllers/ProjectController.php

@ -602,16 +602,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;

2
app/Http/Controllers/VersionGanttController.php

@ -117,13 +117,11 @@ 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();
} }
} }
}
public function list() public function list()
{ {

Loading…
Cancel
Save