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
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
reportScheduleDay := DepreciationScheduleDay(*originDate, periodDate, contextRow.HouseType)
|
// Hitung schedule day relatif terhadap cutover_date, bukan dari chick_in_date.
|
||||||
if reportScheduleDay <= 0 {
|
// Ini menangani kasus cut-over flock yang belum 175 hari pada period date,
|
||||||
return nil, nil
|
// 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)
|
cutoverScheduleDay := DepreciationScheduleDay(*originDate, manualInput.CutoverDate, contextRow.HouseType)
|
||||||
startDay := 1
|
startDay := 1
|
||||||
if cutoverScheduleDay > 0 {
|
if cutoverScheduleDay > 0 {
|
||||||
startDay = cutoverScheduleDay
|
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)
|
houseType := NormalizeDepreciationHouseType(contextRow.HouseType)
|
||||||
multiplicationByHouseType, effectiveDates, err := s.hppRepo.GetMultiplicationPercentages(context.Background(), []string{houseType}, reportScheduleDay, contextRow.ProjectFlockID)
|
multiplicationByHouseType, effectiveDates, err := s.hppRepo.GetMultiplicationPercentages(context.Background(), []string{houseType}, reportScheduleDay, contextRow.ProjectFlockID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user