GenJnlLine.TRANSFERFIELDS(GenJnlLine2); IF GenJnlLine."Document Date" = 0D THEN GenJnlLine."Document Date" := GenJnlLine."Posting Date"; InitCodeUnit; IF Cust."No." <> DtldCustLedgEntry."Customer No." THEN Cust.GET(DtldCustLedgEntry."Customer No."); Cust.CheckBlockedCustOnJnls(Cust,0,TRUE); Cust.TESTFIELD("Customer Posting Group"); CustPostingGr.GET(Cust."Customer Posting Group"); CustPostingGr.TESTFIELD("Receivables Account"); VATEntry.LOCKTABLE; DtldCustLedgEntry.LOCKTABLE; CustLedgEntry.LOCKTABLE; DtldCustLedgEntry.TESTFIELD("Entry Type",DtldCustLedgEntry."Entry Type"::Application); DtldCustLedgEntry2.RESET; DtldCustLedgEntry2.FINDLAST; NextDtldLedgEntryEntryNo := DtldCustLedgEntry2."Entry No." + 1; DtldCustLedgEntry2.SETCURRENTKEY("Transaction No.","Customer No.","Entry Type"); //////This one DtldCustLedgEntry2.ASCENDING(FALSE); //////This one DtldCustLedgEntry2.SETRANGE("Transaction No.",DtldCustLedgEntry."Transaction No."); DtldCustLedgEntry2.SETRANGE("Customer No.",DtldCustLedgEntry."Customer No."); DtldCustLedgEntry2.SETFILTER("Entry Type",'>%1',DtldCustLedgEntry."Entry Type"::"Initial Entry"); //////This one DtldCustLedgEntry2.FINDSET;//////This one
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
OK! Thanks a lot!
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog