Jump to content

Field nextinvoicedate not set pro-rata when new order is paid for with account credit

Recommended Posts

I've found 2 accounts on my server where the second invoice was raised on the wrong date. Both were monthly billing cycles. I have WHMCS set up so that first invoices are pro-rated to make all renewals fall on the first of a month. In both cases, the account was set up early enough in the month that a month and a bit was paid for. The invoice said that they had paid, say, from 12th September until 31st October this year.


But then, the required number of days before 12th October this year, the next invoice was raised. It claimed to be an invoice for services from 13th October until 12th November. So the client was invoiced twice for 13th-31st October.


It took me a while to track this down. In the admin area, under Clients -> Products / Services, the "next due date" had correctly shown the first of the following month. But when I looked at the database (a backup of the database before that mistaken invoice was generated), I saw that in tblHosting the "Next Due Date" was the first November, but the "Next Invoice Date" had been not first November but 13th October.


I then found one other hosting account with the same issue, but that one had not yet raised an erroneous invoice because it was on an annual billing cycle. It's "next invoice date" was set to one year exactly after sign-up, even though pro-ration should have set the next invoice date to be the first of that month.


My next puzzle was why this only happened sometimes. Thinking through the "new hosting account" logic, as I understand it, something happens when an invoice is paid to make sure that the next invoice date is set correctly. So something didn't happen when the "invoice paid" event fired. And then I found what those 3 clients had in common. All 3 had signed up for the hosting package in question paying entirely with account credit. So there was no subsequent event when the invoice was paid - the invoice was generated at sign-up with the status already set to "paid".


Hence the title of this post: "Field nextinvoicedate not set pro-rata when new order is paid for with account credit"

Link to comment
Share on other sites

  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated