My EPOS Z read provides a VAT inclusive value and currently I tick the option on the sales invoice in order to allow me to enter this number.
Is there a means by which I can default this option on such that I am not required to tick the box on every invoice?
Do you have a power user subscription? You should be able to do this using the custom scripts.
Adding the following should check the box by default;
$("#chkVatIncInvoicing").attr("checked",true);
Yes I am a power user. Added, saved and activated the script but box is still unchecked. I closed and reopened QF and still the same, am I missing something ?
I don’t currently have an account I can actually test this on so all I can say for now is it should work! Hopefully someone else will be able to test this before I manage to do so.
Looking at it in my browser’s DOM inspector (right click the checkbox and “inspect element”) it looks like chkVatIncInvoicing
is a CSS class rather than an ID, and also it’s better to use prop
rather than attr
in this case. Try:
$("input.chkVatIncInvoicing").prop("checked",true);
Thanks Ian and Lurch for your help. Ian’s script checks the box but the action doesn’t actually take place. So when I manually check the box it changes the Net box to Gross and allows me to enter a value but when the script does it then nothing happens (still shows Net and cannot enter values) so I have to uncheck and check again.
Hope this makes sense
What if you wrap it in a ready handler?
jQuery(function($) {
$("input.chkVatIncInvoicing").prop("checked",true);
});
There will be another bit of code somewhere that adds an event listener on that checkbox to respond to the tick and change the table columns, and we need to make sure that handler has been added before we trigger the change ourselves.
Beat me to it, I was just doing something similar!
That makes sense but nope that still just ticks the box (so to speak)
Ah, OK, looks like it’s a click
listener rather than change
listener, so try
jQuery(function($) {
// only do this on new invoice creation, not when editing an existing invoice
if(window.location.search == "") {
var chk = $("input.chkVatIncInvoicing");
// click the box if it isn't already ticked
if(!chk.prop("checked")) {
chk.trigger("click");
}
}
});
Thank you Ian, you have solved my problem and improved life immeasurably :-). Note to self: Need more knowledge on code.
Thanks again guys for your support
This topic was automatically closed after 7 days. New replies are no longer allowed.