The result is fine if the status still Unpaid because the Proforma Invoice number show as is.

But when this Invoice has been Paid the Invoice Number value from Database is change with sequential Invoice Number, so the custom code that I created didn't show the previous Invoice Number which is a Proforma Invoice Number.

Is there any idea how to get the Proforma Invoice Number after Invoice has been Paid ?

Share this post

Link to post

Share on other sites

Is there any idea how to get the Proforma Invoice Number after Invoice has been Paid ?

Despite I am not a developer, and so do not understand above code...Sometimes after proforma gets paid, I had need to know what was that proforma number before that proforma converted to invoice (gets paid)...And I saw the only way I found was checking previous emails sent out...Would be a must have a way to track proforma invoice number to.

Sometime clients pay me by bank transfer, so according to my custom email template I advice them to identify on bank payment description inform proforma number that they receive in their email and also their names on description...and it works fine, so in my bank history payment received I saw there and I make manual payment on WHMCS choosing one of custom mail in payment gateway I have created for each bank account. But after a made manual payment, like you said I can not easily track past proforma number...

Share this post

Link to post

Share on other sites

But after a made manual payment, like you said I can not easily track past proforma number...

That's my pain, actually I've create custom invoicing module with modulesgarden but it has been over 2 years and still buggy and can't be implemented until now where the one of the feature is adding some notes about proforma invoice number after the invoice Paid. With that I can show the Virtual Account number which is previously as Proforma Invoice Number.

I'm still find some workaround about this, maybe one of the member in here have a solution 🙂

Share this post

Link to post

Share on other sites

Please check the screenshot, the number shown should be the Proforma Invoice number and even when the Proforma Invoice is changed to Tax Invoice after payment this number remains the same as Proforma. Hope this helps...

Share this post

Link to post

Share on other sites

where the one of the feature is adding some notes about proforma invoice number after the invoice Paid.

this would be much appreciated. Would help a lot on tracking things...that also is one those thing that WHMCS helps a lot....actually WHMCS could implement this as core of software...but when we think in future requests we start feel fever 😨

Share this post

Link to post

Share on other sites

Please check the screenshot, the number shown should be the Proforma Invoice number and even when the Proforma Invoice is changed to Tax Invoice after payment this number remains the same as Proforma. Hope this helps...

As far as I know this is not always true since it depends on how Auto-Tags have been used. {NUMBER} in fact doesn't always corresponds to tblinvoice.id (the number in the query string) because it can be freely changed from Tax Configuration > Next Invoice Number. You have two option here:

Share this post

Link to post

Share on other sites

Please check the screenshot, the number shown should be the Proforma Invoice number and even when the Proforma Invoice is changed to Tax Invoice after payment this number remains the same as Proforma. Hope this helps...

Thanks for the suggestion, but I can't use this method since my Invoice format Tags is not follow the incremental invoice ID.

8 hours ago, Kian said:

As far as I know this is not always true since it depends on how Auto-Tags have been used. {NUMBER} in fact doesn't always corresponds to tblinvoice.id (the number in the query string) because it can be freely changed from Tax Configuration > Next Invoice Number. You have two option here:

In my code, I'm using variable from invoice number and when I see the table invoice_mod which is save the data of the invoice, I didn' see the value of it.

Would you elaborate your suggestion, thank you.

I've try some workaround, when I add payment to make the invoice become Paid. I added the transacion ID as same as the Virtual Account number.

So, I change the variable when the Invoice Paid using {$transaction.transid|substr:9} instead of {$invoicenum}

Why I substr to 9 ? Because to prevent our Admin if they forgot to input the transaction ID. Instead of show zero value it will show some variable of Custom Client Fields without the proforma invoice number.

This is not solved at all, still need manual input from admin but can be used as workaround for now.

Here's my code if you want to see, check the line substr($trans['transid'],9) on invoicepdf.tpl and {$transaction.transid|substr:9} on viewinvoice.tpl :

Share this post

Link to post

Share on other sites

Invoice numbers (aka {NUMBER} and tblinvoices.invoicenum) are not part of Snapshots.

I was saying that the only way to preserve this value is that you code an action hook that stores it somewhere. Basically I'm suggesting to extend the concept of "Client Data Snapshot" to invoice numbers. This way you always know what was the original number the proforma before it turned into an invoice. It sounds boring... well it is.

The quickest workaround is to do what @VirtualWorldGlobal suggested. Get rid of {NUMBER} and use {ID} so that you can do the following.

Is there a better way to do this? I tried just using $templatefile, but it's not available.

Next, I am creating a new secondary sidebar. I have created some client custom fields in WHMCS Admin and I can see them in the Smarty template debug, they are included in the $clientsdetails array as 'customfields2' and 'customfields3' -- how do I access these in my hook?