Author Topic: Cover Overpspending  (Read 292 times)

Offline asromzek

Cover Overpspending
« on: February 02, 2018, 01:43:59 PM »
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.

Offline keyboard

Re: Cover Overpspending
« Reply #1 on: February 02, 2018, 03:21:06 PM »
I Like... I Like....
Go for the 7 Ball  !!!!!!!

www.createsongstyles.com

Offline Alex

Re: Cover Overpspending
« Reply #2 on: February 02, 2018, 03:39:41 PM »
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.

Offline asromzek

Re: Cover Overpspending
« Reply #3 on: February 02, 2018, 04:24:29 PM »
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.

Offline asromzek

Re: Cover Overpspending
« Reply #4 on: February 02, 2018, 04:29:10 PM »
This is the function used in the mobile app...

Code: [Select]
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.

Offline asromzek

Re: Cover Overpspending
« Reply #5 on: February 02, 2018, 04:33:41 PM »
And some pseudocode...

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

Offline asromzek

Re: Cover Overpspending
« Reply #6 on: February 02, 2018, 04:34:42 PM »
The dialog should only show up when clicking on a positive category balance and available to budget is negative.
/s implied, unless stated otherwise.