Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2004
    Posts
    684
    Thanks
    24
    Thanked 1 Time in 1 Post

    Ideas on how to best build monthly invoice system

    Not sure if this is the best forum to post this in or what, so mods feel free to move it if need be.

    Currently our site uses an invoicing system that invoices the user for their outstanding balance each month; so if they rack up $35 of fees in month #1 they will be sent an invoice for $35; if they don't pay it and rack up another $35 in month two their next invoice will be for $70.00.

    We just purchased some billing software so we can better manage accounts (Blesta) and I am using their API to help build it into our site and send out invoices via it.

    However, Blesta seems to prefer you to send out invoices for that particular months fees; so in the above example the user would get two separate invoices for $35.

    So, I'm trying to change our system to work that way, but I'm having trouble coming up with a way to correctly do it.

    We have a field in our users table that holds their outstanding balance and we also have a table that holds all their associated fees for they get, tracked separately, including any refunds / credit adjustments.

    I've thought of just calculating up the fees from that table for the particular month to get the invoice amount, but it won't really work because:

    Consider this situation..

    Say they got a $30 credit in month one, so we didn't send them an invoice for that month........ then in month #2 they spent $5...... but if we just calculate by the month we would be sending them an invoice for $5 when they still have $25 credit remaining

    Then to counter that, say we only send them an invoice if their outstanding balance is in debit..... that won't work either because:

    Consider this situation..

    Month #1 they got $30 credit so no invoice is sent, month #2 they spent $35........ they have a balance due, so we should invoice them for $5, but their monthly spend came up to $35 so it would end up invoicing them for $35 instead

    I thought of another method as well but that also had a flaw.

    Our table that tracks all the fees/refunds structure looks like this:

    Ideas on how to best build monthly invoice system-data-structure.png

    Any ideas here!?

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Posts
    454
    Thanks
    0
    Thanked 20 Times in 20 Posts
    NO Limits!! DHCreationStation.com
    ------------------------------------------------------------
    Broken items wanted for tinkerin'! PostItNow@BrokenEquipment.com
    Global Complaint Dept.

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Posts
    684
    Thanks
    24
    Thanked 1 Time in 1 Post
    Quote Originally Posted by c1lonewolf View Post
    I don't mean to be rude, but did you even read my post? I already mentioned we purchased Blesta and we were trying to come up with the best way to use it with our existing system.

  • #4
    Regular Coder
    Join Date
    Sep 2011
    Posts
    408
    Thanks
    18
    Thanked 26 Times in 26 Posts
    Quote Originally Posted by cyphix View Post
    I don't mean to be rude, but did you even read my post? I already mentioned we purchased Blesta and we were trying to come up with the best way to use it with our existing system.
    Those are still invoicing systems. If you know what you're doing at all then you can use the source from them for ideas on creating your own.
    If I've helped you out, show your appreciation by clicking the "Thanks" link as well as a link below!

    AdFly
    Facebook | Twitter
    Google | YouTube

  • #5
    Regular Coder
    Join Date
    Oct 2004
    Posts
    356
    Thanks
    0
    Thanked 16 Times in 16 Posts
    Do you have a transactions table as well? If you do, when creating the new invoice you could add a "balance carried forward" transaction with the debt/credit left from the previous invoice.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •