Get data from DetailVendLedgerEntry

I am trying to get a record from DetailVendLedgerEntry, But I confess, I already confused.

I am on a Purch. Inv. Line DataItem.

I must get Vendor nº and document nº from Purch. Inv. Line. With this data get document Nº and Entry Nº from Vendor Ledger entry, and with that, get on Detail Vendor Ledger Entry , for the entrynº = Vendor Ledher Entry Nº, the last Payment Amount .

This is my try on my report

Purch. Inv. Line - OnAfterGetRecord()

CLEAR(VendLedgerEntry);

IF “Buy-from Vendor No.”<> ‘’ THEN BEGIN
VendLedgerEntry.RESET;

VendLedgerEntry.SETFILTER(VendLedgerEntry.“Buy-from Vendor No.”,“Buy-from Vendor No.”);
VendLedgerEntry.SETFILTER(VendLedgerEntry.“Posting Date”,DateFilter);
VendLedgerEntry.SETRANGE(“Document Type”,VendLedgerEntry.“Document Type”::Invoice);
IF VendLedgerEntry.FINDSET THEN BEGIN
VendLedgerEntry.CALCFIELDS(Amount);

CLEAR(DetailedVendLedEntry);
IF “Document No.”<> ‘’ THEN BEGIN
DetailedVendLedEntry.SETRANGE(“Document Type”,DetailedVendLedEntry.“Document Type”::Payment);
DetailedVendLedEntry.SETRANGE(DetailedVendLedEntry.“Vendor Ledger Entry No.”,VendLedgerEntry.“Entry No.”);
IF DetailedVendLedEntry.FINDSET THEN BEGIN
IF DetailedVendLedEntry.“Document No.” <> ‘’ THEN BEGIN
DetailedVendLedEntry.RESET;

DetailedVendLedEntry.SETFILTER(DetailedVendLedEntry.“Vendor Ledger Entry No.”,“Entry No.”);
IF DetailedVendLedEntry.FIND(’+’) THEN BEGIN
DetailedVendLedEntry.CALCFIELDS(Amount);
Ded := (DetailedVendLedEntry.Amount);

END;
END;
END;
END;
END;
END;
END;

Why are you using “Purch. Inv. Line”? can you explain what’s the final result your’re trying to achieve? where will this be used, why, how? are you trying to figure out if a po invoice has been paid?

I am using Purch Invoice Line, because all my records variables are calculated based on item and Quantity Puch Invoice Lines.

I pretend in My report, get a lot of purchase invoice line information, from a Vendor in a period.

It’s a Kind of a Vendor Statement, but with a lot of changes.

The report is all most ready, but there is a variable XX that will show the Detail Vendor Ledger Entry Payment Amount, for each Invoice found in ledger Entry:

EX: I have a vendor X, his Vendor Ledger entry has 3 Invoices, each one in show in my report, so far so good.

But, if exist, for any of that 3 invoices any payment in Detail Vendor Ledger Entry, pretend to show it, the payment amount in my report, in my variable XX. This is my dificult.

I am getting problems on the vendor ledger Entry and Detail vendor Ledger Entry C/AL

My relation between Vendor Ldger Entry and Detail Vendor Ldger Entry (Invoice <-> Payment) is Entry nº and Vend. Ledger Entry nº, they are the same for the Relation Invoice - Payment.

I can send you my txt file

6283.R50922_24082012.txt (43.1 KB)

0028.Note1.docx (40.4 KB)

Thanks

I went throgh the object and I didnt understand one point.

The sourceexp of the field is Saldo and your calculation is assigned to ded.

Is it correct?

Sorry, I sent the oldest TXT, Here is the correct one.

Ded is the correct variable, Saldo was a past tryed.

Here is the correct TXT

0131.R50922_24082012_1.txt (41.6 KB)

Thanks

Hello Mohana

Did you recive the last TXT objet?

Thanks

Hy Mohana

I am still working on this item, if you have any idear, it will be a big help to me.

Thanks