akust0m Posted March 21, 2019 Share Posted March 21, 2019 (edited) Hi there! It's required in Australia if GST is charged to have the wording 'Tax Invoice' instead of just 'Invoice'. We achieve this with a language override in the file 'lang/overrides/english.php'. $_LANG["invoicenumber"] = "Tax Invoice #"; $_LANG['invoicefilename'] = "Tax-Invoice-"; However, we have some overseas clients that we don't charge GST to. These customers have the 'Exempt from Tax' option set to 'Yes' in their account. Is there a way to ensure that those that are exempt from tax have the wording 'Invoice' but those that are not exempt from tax have the wording 'Tax Invoice'? Thanks! Edited March 21, 2019 by akust0m 0 Quote Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted March 21, 2019 Share Posted March 21, 2019 Hey @akust0m Out of the box I cant think of a way to do this, the only thing I can suggest is possibly a hook but that wouldn't help with the pdf I'll move this to the Developer Board where someone might be abole to provide a creative solution 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 21, 2019 Share Posted March 21, 2019 8 hours ago, akust0m said: Is there a way to ensure that those that are exempt from tax have the wording 'Invoice' but those that are not exempt from tax have the wording 'Tax Invoice'? where exactly are you trying to do this? the language string 'invoicenumber' isn't used in the invoice templates (pdf or html) by default, though is used at the complete stage after ordering. 8 hours ago, akust0m said: Is there a way to ensure that those that are exempt from tax have the wording 'Invoice' but those that are not exempt from tax have the wording 'Tax Invoice'? you'd be able to access the $clientsdetails array (either at complete or when they're viewing an invoice) and that will contain their tax exempt status (1 for yes, 0 for no) and that could be used for your conditional, e.g if 1, then you strip 'Tax ' from the string, or use a different string entirely... that could be achieved in the templates or using a hook. altering the filename could be trickier and would certainly require a hook, but does the actual filename matter for tax purposes ? 0 Quote Link to comment Share on other sites More sharing options...
akust0m Posted March 26, 2019 Author Share Posted March 26, 2019 (edited) Hi @brian!, thank you for your reply. We have the term 'Tax Invoice' currently set when viewing an invoice in HTML and PDF. This is also reflected in the PDF filename as well. This was achieved using the following language overrides in 'lang/overrides/english.php': $_LANG["invoicenumber"] = "Tax Invoice #";$_LANG['invoicefilename'] = "Tax-Invoice-"; The filename doesn't matter so much, but we'd like to have just 'Invoice' for tax exempt customers for HTML and PDF invoice copies. Can an 'if' statement be used directly in the language overrides file to check if their tax exempt status is 1 or 0? So, if not exempt, then apply what we have above. Edited March 26, 2019 by akust0m 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 26, 2019 Share Posted March 26, 2019 9 hours ago, akust0m said: Can an 'if' statement be used directly in the language overrides file to check if their tax exempt status is 1 or 0? So, if not exempt, then apply what we have above. no - you'd get errors if you try to add an if statement as you describe into the language files... don't do it! ⚠️ 9 hours ago, akust0m said: We have the term 'Tax Invoice' currently set when viewing an invoice in HTML and PDF. This is also reflected in the PDF filename as well. if we take the PDF as an example, in invoicepdf.tpl you might have changed... $pdf->Cell(0, 8, $pagetitle, 0, 1, 'L', '1'); to... $pdf->Cell(0, 8, Lang::trans('invoicenumber'), 0, 1, 'L', '1'); what I might have been tempted to do instead would be to have two different language override strings - i'd have kept invoicenumber as it is by default (so delete your override), but created a new string for tax exempt customers... $_LANG["invoicenumber"] = "Invoice #"; $_LANG["taxinvoicenumber"] = "Tax Invoice #"; and then in invoicepdf.tpl, added the logic in there as to which string to use... if ($clientsdetails["taxexempt"] == "1") { $invoicenumber = Lang::trans('taxinvoicenumber').$invoicenum; } else { $invoicenumber = Lang::trans('invoicenumber').$invoicenum; } $pdf->Cell(0, 8, $invoicenumber, 0, 1, 'L', '1'); with regards to viewinvoice.tpl, then one option would have been an action hook to modify $pagetitle, but seeing as you've already edited the template to add this new language string, you could do this instead... {if $clientsdetails.taxexempt eq '1'}{$LANG.taxinvoicenumber}{else}{$LANG.invoicenumber}{/if}{$invoicenum} which is basically the Smarty equivalent code of what i've done in the PDF template. as I explained previously, if your site only uses one language, then you could employ alternate methods to do this, but if your site uses multiple languages, then the above solution should work consistently for you. 🙂 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.