RE: Create Sales Invoice From Code and insert line tax amount
As you know in BC the VAT calculation is done based on VAT posting setup and we do not give VAT % on individual documents.
In Sales Line there is no field that store VAT Amount.
The fields store information like Amount, Amount Including VAT, VAT Base Amount and VAT %.
VAT % comes from the VAT posting setup.
VAT base amount is the same as Amount but it is different if you are giving VAT discount. System calculates Amount Incl. VAT using formula:
Amount Including VAT = Amount + VAT Base Amount * VAT % / 100
At the time of posting, VAT amount is calculated again using the formula VAT Amount := Amount Incl. VAT - Amount.
Solution but not recommended: After putting values in item no and quantity you can manipulate the Amount Incl. VAT and Amount fields to get the exact VAT amount but make sure that you are doing calculations correct.