HOME / COMMUNITY Switch to knowledge base

Enter line totals inclusive of VAT

#1

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?

0 Likes

#2

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);
0 Likes

#3

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 ?

0 Likes

#4

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.

0 Likes

#5

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);
0 Likes

#6

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

0 Likes

#7

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.

0 Likes

#8

Beat me to it, I was just doing something similar!

0 Likes

#9

That makes sense but nope that still just ticks the box (so to speak)

0 Likes

#10

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");
    }
  }
});
1 Like

#12

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

0 Likes

closed #13

This topic was automatically closed after 7 days. New replies are no longer allowed.

0 Likes