mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
add command for normalize data recording population not match; adjust closing overhead and keuangan
This commit is contained in:
@@ -156,7 +156,7 @@ func (s closingKeuanganService) calculateClosingKeuangan(c *fiber.Ctx, projectFl
|
||||
|
||||
hppSection := s.buildHPPSection(c, projectFlock, projectFlockKandangs, costs, productionData)
|
||||
|
||||
profitLossSection := s.buildProfitLossSection(projectFlock, costs, productionData)
|
||||
profitLossSection := s.buildProfitLossSection(c, projectFlock, projectFlockKandangs, costs, productionData)
|
||||
|
||||
data := dto.ToClosingKeuanganData(hppSection, profitLossSection)
|
||||
return &data, nil
|
||||
@@ -386,7 +386,7 @@ func (s closingKeuanganService) buildHPPSection(c *fiber.Ctx, projectFlock *enti
|
||||
return dto.ToHPPSection(hppItems, hppSummary)
|
||||
}
|
||||
|
||||
func (s closingKeuanganService) buildProfitLossSection(projectFlock *entity.ProjectFlock, costs *CostData, production *ProductionData) dto.ProfitLossSection {
|
||||
func (s closingKeuanganService) buildProfitLossSection(c *fiber.Ctx, projectFlock *entity.ProjectFlock, projectFlockKandangs []entity.ProjectFlockKandang, costs *CostData, production *ProductionData) dto.ProfitLossSection {
|
||||
|
||||
totalWeightProduced := production.TotalWeightProduced
|
||||
totalEggWeightKg := production.TotalEggWeightKg
|
||||
@@ -394,6 +394,11 @@ func (s closingKeuanganService) buildProfitLossSection(projectFlock *entity.Proj
|
||||
totalWeightSold := production.TotalWeightSold
|
||||
totalBirdSold := production.TotalBirdSold
|
||||
actualPopulation := production.TotalPopulationIn - production.TotalDepletion
|
||||
// Prefer recording-based population (consistent with buildHPPSection) so per-ekor
|
||||
// P&L matches the normalized recording population for cut-over flocks.
|
||||
if lastPopulation, ok := s.getLastPopulationFromRecordings(c, projectFlockKandangs); ok {
|
||||
actualPopulation = lastPopulation
|
||||
}
|
||||
|
||||
isLaying := projectFlock.Category == string(utils.ProjectFlockCategoryLaying)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user