Browse Source

total expenditure integration

pull/3/head
Muhammad Sulaiman Yusuf 2 years ago
parent
commit
5581e04ac8
  1. 11
      app/Http/Controllers/DashboardBoDController.php

11
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;
}

Loading…
Cancel
Save