Guys,
I am using this for on the fly calculations.
But I only want it to Put a value in the ctrlTotal if the Checkbox called SendToInvoice is checked? So where would I put the If statement in the function area?
Thanks
var ctrlPrice = Runner.getControl(pageid, 'CostPerHour');
var ctrlQuantity = Runner.getControl(pageid, 'AmountOfHours');
var ctrlTotal = Runner.getControl(pageid, 'Total');
var ctrlTax = Runner.getControl(pageid, 'Tax');
var ctrlSubTotal = Runner.getControl(pageid, 'SubTotal');
var ctrlTaxAmount = Runner.getControl(pageid, 'TaxAmount');
var ctrlSendToInvoice = Runner.getControl(pageid,'SendToInvoice');
function func() {
ctrlSubTotal.setValue((+ctrlPrice.getValue()) * (+ctrlQuantity.getValue()));
ctrlTaxAmount.setValue((+ctrlPrice.getValue()) * (+ctrlQuantity.getValue())*(+ctrlTax.getValue()/100));
if ctrlSendToInvoice,
ctrlTotal.setValue((+ctrlPrice.getValue()) * (+ctrlQuantity.getValue())*(+ctrlTax.getValue()/100)+((+ctrlPrice.getValue())*(+ctrlQuantity.getValue())));
};
ctrlPrice.on('keyup', func);
ctrlQuantity.on('keyup', func);
ctrlTax.on('keyup', func);
ctrlSendToInvoice.on('keyup', func);