WITH ItemLedgEntry DO BEGIN
CASE TRUE OF
"Document Type" = "Document Type"::"Sales Shipment":
IF SalesShipmentLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(SalesShipmentLine."VAT Bus. Posting Group",SalesShipmentLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Sales Return Receipt":
IF ReturnReceiptLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(ReturnReceiptLine."VAT Bus. Posting Group",ReturnReceiptLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Sales Invoice":
IF SalesInvLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(SalesInvLine."VAT Bus. Posting Group",SalesInvLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Sales Credit Memo":
IF SalesCMLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(SalesCMLine."VAT Bus. Posting Group",SalesCMLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Purchase Receipt":
IF PurchRcptLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(PurchRcptLine."VAT Bus. Posting Group",PurchRcptLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Purchase Return Shipment":
IF ReturnShipmentLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(ReturnShipmentLine."VAT Bus. Posting Group",ReturnShipmentLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Purchase Invoice":
IF PurchInvLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(PurchInvLine."VAT Bus. Posting Group",PurchInvLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Purchase Credit Memo":
IF PurchCMLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(PurchCMLine."VAT Bus. Posting Group",PurchCMLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Service Shipment":
IF ServiceShipmentLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(ServiceShipmentLine."VAT Bus. Posting Group",ServiceShipmentLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Service Credit Memo":
IF ServiceCrMemoLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(ServiceCrMemoLine."VAT Bus. Posting Group",ServiceCrMemoLine."VAT Prod. Posting Group") THEN;
"Document Type" = "Document Type"::"Service Invoice":
IF ServiceINVLine.GET("Document No.","Document Line No.") THEN
IF VATPostingSetup.GET(ServiceInvLine."VAT Bus. Posting Group",ServiceInvLine."VAT Prod. Posting Group") THEN;
END;
END;
EXIT(VATPostingSetup."EU Service");