mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
support setting the last 1 to 3 days of the month to scheduled transaction frequency
This commit is contained in:
@@ -727,6 +727,16 @@ func (s *TransactionService) CreateScheduledTransactions(c core.Context, current
|
||||
continue
|
||||
}
|
||||
|
||||
if template.ScheduledFrequencyType == models.TRANSACTION_SCHEDULE_FREQUENCY_TYPE_MONTHLY {
|
||||
maxDayInMonth := utils.GetMaxDayOfMonth(currentTime.Year(), currentTime.Month())
|
||||
|
||||
for i := 0; i < len(frequencyValues); i++ {
|
||||
if frequencyValues[i] < 0 {
|
||||
frequencyValues[i] = int64(maxDayInMonth) + frequencyValues[i] + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frequencyValueSet := utils.ToSet(frequencyValues)
|
||||
templateTimeZone := time.FixedZone("Template Timezone", int(template.ScheduledTimezoneUtcOffset)*60)
|
||||
transactionUnixTime := todayFirstUnixTimeInUTC + int64(template.ScheduledAt)*60
|
||||
|
||||
Reference in New Issue
Block a user