Jump to content

Automatically change invoice date when converted from proforma invoice


ValentinD

Recommended Posts

In many UE states, it is mandatory that all the sequential invoice numbers be in chronological order (reported to the issue date), but WHMCS does not cover this legal requirement.

It is also a legal requirement that the invoice should be added to its issue date accounting month and this is also not covered by WHMCS.

Let's say, for example, that I have three proforma invoices 1 for client 1, 2 for client 2 and 3 for client 3 issued on 21, 22, 23 of March.

If client 3 pays his Proforma invoice on April 13th - we will have proforma 3 converted into invoice INV-1, issued on March 23rd;

If client 2 pays his proforma invoice in May 12, we will have proforma 2 converted into invoice INV-2, issued on March 22nd

If client 1 pays his proforma invoice in June 1st, we will have proforma 1 converted into invoice INV-3, issued on March 21st

We now have the following invoices:

INV1/2021-03-23 (converted in April 12th)

INV2/2021-03-22 (converted in March 3rd)

INV3/2021-03-21 (converted in June 1st)

- the invoices are anything but chronological, which would make the WHMCS user liable for a fine.

- all of the invoices are marked as issued in a month that is already closed, so they'll have to be added to the books later than the month they were supposed to.

Both the WHMCS user and their client are liable for fines.

There should be an built-in option or a hook that would change the Invoice date to the date it has been converted from proforma to invoice and all these problems will not exist no more.

 

 

 

 

Link to comment
Share on other sites

I have created a hook in case somebody is interested:

function change_date_on_invoice_paid($params)
{

    $postData = array(
        'invoiceid' => $params['invoiceid'],
        'date' => date("Y-m-d")
    );

    $action = localAPI('UpdateInvoice', $postData);

}

add_hook("InvoicePaid", 1, "change_date_on_invoice_paid");

 

Link to comment
Share on other sites

  • 1 month later...
add_hook("InvoicePaid", 1, "change_date_on_invoice_paid");

must be changed to

 

add_hook("InvoicePaidPreEmail", 1, "change_date_on_invoice_paid");

in order for the client to get the invoice with the updated date;

Link to comment
Share on other sites

Join the conversation

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

Guest
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