Advertisement
Guest User

Untitled

a guest
Mar 17th, 2017
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Vedit 1.11 KB | None | 0 0
  1. IF (SalesHeader."Applies-to Doc. No." <> '') OR (SalesHeader."Applies-to ID" <> '') THEN BEGIN
  2.   IF SalesHeader."Applies-to Doc. No." <> '' THEN BEGIN
  3.     SETCURRENTKEY("Document No.");
  4.     SETRANGE("Document No.",SalesHeader."Applies-to Doc. No.");
  5.     SETRANGE("Document Type",SalesHeader."Applies-to Doc. Type");
  6.     SETRANGE("Customer No.",SalesHeader."Bill-to Customer No.");
  7.     IF SalesHeader."Applies-to Entry No." <> 0 THEN
  8.       SETRANGE("Entry No.",SalesHeader."Applies-to Entry No.");
  9.   END ELSE BEGIN
  10.     SETCURRENTKEY("Customer No.","Applies-to ID",Open,Positive,"Due Date");
  11.     SETRANGE("Customer No.",SalesHeader."Bill-to Customer No.");
  12.     SETRANGE("Applies-to ID",SalesHeader."Applies-to ID");
  13.   END;
  14.   SETRANGE("Currency Code",SalesHeader."Currency Clause Code");
  15.   IF (SalesHeader."Document Type" IN [SalesHeader."Document Type"::"Credit Memo",SalesHeader."Document Type"::"Return Order"]) THEN
  16.       SETRANGE("Document Type","Document Type"::Invoice)
  17.   ELSE BEGIN
  18.     SETRANGE(Positive,FALSE);
  19.     SETRANGE(Prepayment,TRUE);
  20.   END;
  21.   SETFILTER("Amount to Apply",'<>0');
  22.   EXIT(FINDFIRST);
  23. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement