Get Open status from Vendor Ledger Entry

fmhigue
Member Posts: 290
I am running a report based on Purch. Inv. Header and I want to include the status of each invoice. I got the following code but what else I need to do
VendorLedgerEntry.SETFILTER("Vendor No.","Purch. Inv. Header"."Buy-from Vendor No.");
VendorLedgerEntry.SETFILTER("Document No.","Purch. Inv. Header"."No.");
VendorLedgerEntry.SETFILTER("Vendor No.","Purch. Inv. Header"."Buy-from Vendor No.");
VendorLedgerEntry.SETFILTER("Document No.","Purch. Inv. Header"."No.");
0
Comments
-
When posting Purch. Invoices, there is a test in Codeunit 12 - Gen. Jnl.-Post Line that goes like this:
// Test Internal number OldVendLedgEntry.RESET; OldVendLedgEntry.SETCURRENTKEY("Document No.","Document Type"); OldVendLedgEntry.SETRANGE("Document No.",CVLedgEntryBuf."Document No."); OldVendLedgEntry.SETRANGE("Document Type",CVLedgEntryBuf."Document Type"); IF OldVendLedgEntry.FIND('-') THEN ERROR(...
This test insures that (for certain document types), the Document No. is guaranteed to be unique...
So, all you need is:VendorLedgerEntry.SETCURRENTKEY("Document No.","Document Type"); VendorLedgerEntry.SETRANGE("Document No.","Purch. Inv. Header".""No."); VendorLedgerEntry.SETRANGE("Document Type",VendorLedgerEntry."Document Type"::Invoice);
Note also that Purch. Invoices are posted to the "Pay-to Vendor", not the "Buy-from Vendor"...0 -
Avon:
I used the setcurrentkey and setrange as you said but the how do I assign the value from VendorLedgerEntry.Open current record to a variable. The status on each invoice will be printed too.
Paco0 -
Place the following code in the 'OnAfterGetRecord' trigger of the "Purch. Inv. Header" dataitem:
VendorLedgerEntry.SETCURRENTKEY("Document No.","Document Type"); VendorLedgerEntry.SETRANGE("Document No.","Purch. Inv. Header".""No."); VendorLedgerEntry.SETRANGE("Document Type",VendorLedgerEntry."Document Type"::Invoice); VendorLedgerEntry.FIND('-');
Then, in the Sections of your report, add a textbox control, and set its SourceExpression to VendorLedgerEntry.Open. I don't think you need to assign the field to some other variable -- just use the field directly off the record.0 -
It's working now!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions