News:

10/23/16 - Welcome to the new forums!

Main Menu

Cover Overpspending

Started by asromzek, February 02, 2018, 01:43:59 PM

Previous topic - Next topic

asromzek

Hey, @Alex... What do you think about adding a "Cover Overspending" (or is it"Cover Overbudgeted"?) option when clicking on a positive category balance when ATB is negative? See Financier Mobile for a working example. ;)
/s implied, unless stated otherwise.

keyboard

Go for the 7 Ball  !!!!!!!

www.createsongstyles.com

Alex

Don't have mobile in front of me... Basically to "borrow" from a category that has a balance to make ATB? (Like make the category budgeted amount negative unless it has $$ budgeted for it for that month.)
I am the Financier owner/admin/coder dude.

asromzek

Yes, imagine that you're over budget for the month: -$100.

If you have a category with a positive balance of $45, clicking on the positive category balance should pop up a dialog that asks if you want to cover overspending (overbudget?). Selecting that will subtract as much as needed, or as much as possible to cover the negative up top. So, in this case the category would drop to $0 and available to budget becomes -$55.

If you have a category that has $324 in it and use it to cover overspending (overbudget?), then the category drops to $224, and available to budget becomes $0.
/s implied, unless stated otherwise.

asromzek

This is the function used in the mobile app...

coverOverspending () {
  if (this.balance <= (0 - this.budgetVue.currentMonth.cache.totalAvailable)) {
    this.budgetVue.currentMonth.categories[this.category.id].budget -= this.balance
  } else if (this.balance > (0 - this.budgetVue.currentMonth.cache.totalAvailable)) {
    this.budgetVue.currentMonth.categories[this.category.id].budget -= (0 - this.budgetVue.currentMonth.cache.totalAvailable)
  }
  this.hideBalanceOptions()
}
/s implied, unless stated otherwise.

asromzek

And some pseudocode...

coverOverspending () {
  if (categoryBalance <= (0 - availableToBudget)) {
    categoryBudget -= categoryBalance
  } else if (categoryBalance  > (0 - availableToBudget)) {
    categoryBudget  -= (0 - availableToBudget)
  }
}
/s implied, unless stated otherwise.

asromzek

The dialog should only show up when clicking on a positive category balance and available to budget is negative.
/s implied, unless stated otherwise.