Calculation and logic validation

@stelio, this post discussed previously should help you solve your issue: