-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|534|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> On Topic -> Calculating Bills using Paychecks

Sun, 20 Nov 2016, 20:23
Hello friends,

I have a math problem that is melting my brain.

I would like to calculate which bills are due for each paycheck. Bills can occur on a daily, weekly, bi-weekly, monthly, or yearly cycle (eventually I would like to have custom intervals, i.e. every 6 months). A paycheck can occur weekly, bi-weekly, or monthly (and eventually I would like custom intervals here too).

My initial idea is to use unix-timestamp and modulo. I cannot figure out the formula.

Another way to look at this problem is as a calendar. How do you determine when a reoccurring event is shown when you have a start and end date.

This seems like a difficult problem, but perhaps I'm overthinking it. That's why I'm asking the community.

Any advice is appreciated.

Quit posting and try Google.
Sun, 20 Nov 2016, 22:54
Imagine it looking like a spreadsheet, with a weekly grid on the left, and a couple of columns on the right to add and remove reccurring in/out values.
It should be relatively easy.

I can imagine this working well as a website, with easily tweakable values and such working well within HTML, but ... security that bitch up to 11!!!
Or, perhaps, do it as a "Saves to your HD, never goes online" page..?

Sounds like a fun challenge, and if I wasn't knee deep in Gamma Collexion, I'd probably give it a whirl myself.
Maybe next week..!

''Load, Next List!''
Mon, 21 Nov 2016, 21:11
My ultimate goal is to go 50 years into the future and see where I stand. How much money have I saved with "X" savings plan. Etc.

I do like your visual approach.

After extensive Googling, I'm convinced that I'm trying to solve a "really hard computer science problem" and I should just give up.


I'll crack it.

The even harder problem is once I figure out how to plot the bills, I need to somehow add them up for the "50 years later calculation" and do even more maths.

Quit posting and try Google.
Tue, 22 Nov 2016, 02:36
I use Microsoft Money to keep track of all this stuff. It's unsupported by Microsoft now, but at least it's free, and it works in Windows 10.

You put all your incomes and expenses into it, and it shows you how much money you haven't got in the form of a cashflow forecast. Don't know if it'll go 50 years ahead but you could just do a year's forecast and multiply by 50.
Tue, 22 Nov 2016, 03:34
With the global economy as up and down as the sea during a Tsunami in a force 10 gale, I'm not sure how accurate a short-term forecast will be, let alone a long-term one...
Tue, 22 Nov 2016, 13:04

I always liked Microsoft money. Admittedly too, calculating finances 50 years into the future is nearly impossible.

I'm almost convinced at this point that I should just insert a table row for each payment. It's a messy solution, but it makes calculating things much easier (using SUM) and would give me the ability to adjust individual payments.

More details about the project: > Reveal 🔎

Quit posting and try Google.
Tue, 22 Nov 2016, 20:45
Estimated inflation! It's the best I can do

Quit posting and try Google.
Fri, 25 Nov 2016, 18:55
Date calculation problem: How many seconds are in a month?

|!!ARGH| Depends on the month. Muhahaha |ARGH!!|

*Why does my life revolve around this.*

Quit posting and try Google.
Sat, 26 Nov 2016, 03:41
Every Sunday/Monday/etc. With multiple selection possible, so you can have something occur on, say, every Tuesday and Thursday.
Every two weeks
Every three weeks
Every four weeks
Monthly (is NOT the same as Every Four Weeks. It's specific to a numbered date in the month)

Biweekly and bimonthly are horror terms. Avoid! People are never sure if you mean "two within the week" or "every two weeks"
Spell it out, and make it obvious, otherwise people will complain that they added it as one, but it "strangely" did the other!! (Because people are stupid, and that's the sort of thing they'd complain about.)

Oh, and "the last Monday of every month", etc..

''Load, Next List!''
Sat, 26 Nov 2016, 16:53
I think this is wise advice. I agree that biweekly is terribly confusing. Much better to say "Every 2 Weeks".

It also gives me an idea. Instead of "bi-monthly", I can set two events:

- Every 1st
- Every 15th

More precise too, because that's how bi-monthly usually works.

Still much to be figured out! I basically have a function that says:

calculate_bill_occurances(start_date, end_date, bill_start_date, bill_interval)

The tricky part is when you say "start_date = 2028/1/1 and bill_start_date = 2016/1/1" (i.e. when the start date range is greatly larger than the bill's initial start date). I need to devise some good math here. I'm gonna try and crack this problem tonight.

I'll probably just hack it with loops I'm really aiming for a demo anyways. It's just proof of concept! I decided early on to just "make the demo for me" so I'm not trying to solve every bizarre finance problem in the book.

Quit posting and try Google.