VAT Amount Line Table(InsertLine Issue)

toootooo Member Posts: 138
EDIT: It was assigning the wrong variable to "VAT Base", working fine now.

Below is the InsertLine function from the VAT Amount Line table(table 290) i have a custom report and sometimes the VAT amount will be zero and because of this the VAT footer wont display on the report due to the first IF statement on the InsertLine function, can anyone suggest a way around this please?
IF ("VAT Base" <> 0) OR ("Amount Including VAT" <> 0) THEN BEGIN
  Positive := "Line Amount" >= 0;
  VATAmountLine := Rec;
  IF FIND THEN BEGIN
    "Line Amount" := "Line Amount" + VATAmountLine."Line Amount";
    "Inv. Disc. Base Amount" := "Inv. Disc. Base Amount" + VATAmountLine."Inv. Disc. Base Amount";
    "Invoice Discount Amount" := "Invoice Discount Amount" + VATAmountLine."Invoice Discount Amount";
    Quantity := Quantity + VATAmountLine.Quantity;
    "VAT Base" := "VAT Base" + VATAmountLine."VAT Base";
    "Amount Including VAT" := "Amount Including VAT" + VATAmountLine."Amount Including VAT";
    "VAT Difference" := "VAT Difference" + VATAmountLine."VAT Difference";
    "VAT Amount" := "Amount Including VAT" - "VAT Base";
    "Calculated VAT Amount" := "Calculated VAT Amount" + VATAmountLine."Calculated VAT Amount";
    MODIFY;
  END ELSE BEGIN
    "VAT Amount" := "Amount Including VAT" - "VAT Base";
    INSERT;
  END;
END;
Sign In or Register to comment.