Continued to modify the application for optimizing the script and for changing the computation, put back the old computation to fix the net sales for non-vat transactions then apply the new formula by starting to deduct the transactions with vat exempt, checked the modified formula, as per checking, it is OK, the expected value for non-vat and with vat is correct, modified the application again to get the total gross and net sales.