Jump to content
ServWise.com

VAT number not available to Invoice v7.9.1

Recommended Posts

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 by ServWise.com

Share this post


Link to post
Share on other sites

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 by ServWise.com

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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}

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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