From 5581e04ac8bdb35f62456b7d8afdaea1260f7d3d Mon Sep 17 00:00:00 2001 From: Muhammad Sulaiman Yusuf Date: Tue, 18 Oct 2022 14:19:18 +0700 Subject: [PATCH] total expenditure integration --- app/Http/Controllers/DashboardBoDController.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/app/Http/Controllers/DashboardBoDController.php b/app/Http/Controllers/DashboardBoDController.php index 42170cc..c0ccd94 100644 --- a/app/Http/Controllers/DashboardBoDController.php +++ b/app/Http/Controllers/DashboardBoDController.php @@ -71,20 +71,11 @@ class DashboardBoDController extends Controller foreach($projects as $project){ $project->expenses = 0; - // expenditure - $assignedMaterials = AssignMaterial::where('proyek_id', $project->id)->get(); - foreach($assignedMaterials as $assignedMaterial) { - $reportedMaterials = ReportActivityMaterial::where('assign_material_id', $assignedMaterial->id)->get(); - foreach($reportedMaterials as $reportedMaterial) { - $project->expenses += $reportedMaterial->qty * $assignedMaterial->budget; - } - } - $totalExpenditure += $project->expenses; - $resp = null; if($project->kode_sortname != ""){ $resp = $this->getInvoiceIntegration($project->kode_sortname); /* $resp = $project->kode_sortname; */ + $totalExpenditure+= $resp->data->total_invoice_amount ?? 0; $totalInvoice += $resp->data->total_invoice_amount ?? 0; $totalPaidInvoice += $resp->data->total_invoice_paid_amount ?? 0; }