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