feat[BE]: add overhead and ekspedisi items to profit loss report; include total depletion in closing report calculation

This commit is contained in:
aguhh18
2025-12-18 14:49:48 +07:00
parent 096a446450
commit f2df7f4847
2 changed files with 57 additions and 29 deletions
@@ -450,7 +450,13 @@ func (s closingService) GetClosingKeuangan(c *fiber.Ctx, projectFlockID uint) (*
s.Log.Warnf("GetProductionWeightAndQtyByProjectFlockID error: %v", err)
}
report := dto.ToClosingKeuanganReport(projectFlock.Category, purchaseItems, budgets, realizations, deliveryProducts, chickins, totalWeightProduced)
// Fetch depletion data to calculate actual population for cost allocation
totalDepletion, err := s.RecordingRepo.GetTotalDepletionByProjectFlockID(c.Context(), projectFlockID)
if err != nil {
s.Log.Warnf("GetTotalDepletionByProjectFlockID error: %v", err)
}
report := dto.ToClosingKeuanganReport(projectFlock.Category, purchaseItems, budgets, realizations, deliveryProducts, chickins, totalWeightProduced, totalDepletion)
return &report, nil
}