Ternary Inside Call

so this doesnt seem to work, i tried searching the forum but I cant seem to figure out why, alternative will be if i do the calculation in jscript but i am thinking maybe its possible and i just dont know, if anyone can shed some light would be much appreciated

<C10>{CALL:bc.bc([= TN('{TICKET TAG:Deposit}') > 0 ? TN('{TICKET TOTAL}') - TN('{TICKET TAG:Deposit}') : TN('{TICKET TOTAL}')])}

I am using this in the printer template

also another question. I am using a tag to hold deposits because where the payment gets accounted for doesnt matter, at the end it will be submitted, i wont be using samba accounting as a primary source.

the question is should i check if the value of deposit is > 0, what is the default value or consequences or using just leaving this TN('{TICKET TOTAL}') - TN('{TICKET TAG:Deposit}') I didnt see any bad results when i tested it

Its probably that it calls for the script to execute before it processes ternary expression.

Since its already a script, do the necessary checks within the script and return nothing if nothing is needed

1 Like