Implement basic budgeting input #39

Merged
jacob1123 merged 16 commits from budgeting into master 2022-03-05 22:12:15 +01:00
Showing only changes of commit caf39fe5ea - Show all commits

View File

@ -98,6 +98,15 @@ func (h *Handler) budgetingForMonth(c *gin.Context) {
categoriesWithBalance, moneyUsed := h.calculateBalances( categoriesWithBalance, moneyUsed := h.calculateBalances(
budget, firstOfNextMonth, firstOfMonth, categories, cumultativeBalances) budget, firstOfNextMonth, firstOfMonth, categories, cumultativeBalances)
availableBalance := h.getAvailableBalance(budget, moneyUsed, cumultativeBalances, firstOfNextMonth) availableBalance := h.getAvailableBalance(budget, moneyUsed, cumultativeBalances, firstOfNextMonth)
for i := range categoriesWithBalance {
cat := &categoriesWithBalance[i]
if cat.ID != budget.IncomeCategoryID {
continue
}
cat.Available = availableBalance
cat.AvailableLastMonth = availableBalance
}
data := struct { data := struct {
Categories []CategoryWithBalance Categories []CategoryWithBalance