ServWise.com Posted January 31, 2020 Share Posted January 31, 2020 (edited) Hi, It would seem that the VAT number for the customer is not available to display within the invoice, in debug mode $taxCode is blank even though the client has a valid VAT code entered in the admin area. EDIT: I just did a test with a new client registered since upgrade to v7.9.1 and there VAT number is showing on the invoice so it seem to be only clients pre v7.9.1 even if the vat number has been updated (resaved) on there profile. Edited January 31, 2020 by ServWise.com 0 Quote Link to comment Share on other sites More sharing options...
ServWise.com Posted January 31, 2020 Author Share Posted January 31, 2020 (edited) Further investigation seems to suggest that it is something to do with the "Store Client Data Snapshot" functionality. I have this enabled but it seems to have stopped recording this data as if I change my test client data it also changes on a recently generated test invoice which it should not. So with a client with an older invoice (generated Pre- upgrade) this invoice has data recorded within the mod_invoicedata table and because of this their VAT number is for some reason not being output at all to the invoice template, but in new invoices since the upgrade no data has been recorded for them in the mod_invoicedata table and the invoice template is pulling their vat numbers direct from their live profile. Edited January 31, 2020 by ServWise.com 0 Quote Link to comment Share on other sites More sharing options...
ServWise.com Posted January 31, 2020 Author Share Posted January 31, 2020 Okay I think I understand what is going on. In v7.9 you are now storing a extended field called tax_id, prior to this I was using a custom field for the VAT number which was stored as customfield1 so for older invoices they dont have a tax_id and so are missing this data from the invoices. I will add some code to check both and display one or the other if they exist. 0 Quote Link to comment Share on other sites More sharing options...
ServWise.com Posted January 31, 2020 Author Share Posted January 31, 2020 Just to finish of this post as I think it could be of use to others who like me were using a custom field prior to the latest version. To fix this I added the following code which uses the new taxid field if available otherwise swaps to the older customfield1 for older invoices invoicepdf.php from line 94 if (array_key_exists('tax_id', $clientsdetails) && $clientsdetails['tax_id']) { $pdf->Cell(0, 4, $taxIdLabel . ': ' . $clientsdetails['tax_id'], 0, 1, 'L'); } elseif ($clientsdetails['customfields1']!=""){ $pdf->Cell(0, 4, $taxIdLabel . ': ' . $clientsdetails['customfields1'], 0, 1, 'L'); } viewinvoice.php from line 100 {if $clientsdetails.tax_id} <br />{$taxIdLabel}: {$clientsdetails.tax_id} {elseif $clientsdetails.customfields1} <br />{$taxIdLabel}: {$clientsdetails.customfields1} {/if} 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Support Manager WHMCS John Posted February 3, 2020 WHMCS Support Manager Share Posted February 3, 2020 Hi @ServWise.com, To migrate your VAT Numbers from the custom field to the native field, please navigate to Setup > Payments > Tax Configuration. Then click the Migrate button. https://docs.whmcs.com/Tax_Configuration#Custom_Field_Migration 1 Quote Link to comment Share on other sites More sharing options...
ServWise.com Posted February 3, 2020 Author Share Posted February 3, 2020 Hi, thanks for the response, i actually didn't know about this (would have saved me some migration time) as I actually I already migrated them myself via my own SQL script, problem is that it is the "saved" invoice data which needs to be updated which is some form of ; delimited field data that stores a record of the clients details for each invoice so it won't change if the client changes their billing details. I guess I could go through and replace the text custom1 with tax_id in that data and it might work also. Regards Sam 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.