mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-06-09 15:07:49 +00:00
fix calculate schedule day
This commit is contained in:
@@ -1487,17 +1487,22 @@ func (s *hppV2Service) buildManualCutoverDepreciationPart(
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
reportScheduleDay := DepreciationScheduleDay(*originDate, periodDate, contextRow.HouseType)
|
||||
if reportScheduleDay <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Hitung schedule day relatif terhadap cutover_date, bukan dari chick_in_date.
|
||||
// Ini menangani kasus cut-over flock yang belum 175 hari pada period date,
|
||||
// karena bisnis sudah menetapkan cutover_date sebagai awal depresiasi.
|
||||
// Rumus setara secara matematis dengan DepreciationScheduleDay ketika flock >= 175 hari.
|
||||
cutoverScheduleDay := DepreciationScheduleDay(*originDate, manualInput.CutoverDate, contextRow.HouseType)
|
||||
startDay := 1
|
||||
if cutoverScheduleDay > 0 {
|
||||
startDay = cutoverScheduleDay
|
||||
}
|
||||
|
||||
daysSinceCutover := int(dateOnly(periodDate).Sub(dateOnly(manualInput.CutoverDate)).Hours() / 24)
|
||||
reportScheduleDay := startDay + daysSinceCutover
|
||||
if reportScheduleDay <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
houseType := NormalizeDepreciationHouseType(contextRow.HouseType)
|
||||
multiplicationByHouseType, effectiveDates, err := s.hppRepo.GetMultiplicationPercentages(context.Background(), []string{houseType}, reportScheduleDay, contextRow.ProjectFlockID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user