Browse Source

update dashboard bod error

pull/1/head
wahyu 11 months ago
parent
commit
2d7c424f0f
  1. 4
      app/Http/Controllers/DashboardBoDController.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)

Loading…
Cancel
Save