Can't Get Amount from Cust. Ledger Entry.
zulq
Member Posts: 204
Hi Am building a report that shows Customer Arrears. I am using the Customer and the Cust. Ledger Entry tables.
Below is my Code:
CustLedgerEntry.SETRANGE("Customer No.","No.");
CustLedgerEntry.SETFILTER("Start Period",'>=%1',DateFrom);
CustLedgerEntry.SETFILTER("End Period",'<=%1',DateTo);
IF (DateFrom <> 0D) AND (DateTo > DateFrom) THEN BEGIN
Calendar.RESET;
Calendar.SETRANGE("Period Type",Calendar."Period Type"::Month);
Calendar.SETRANGE("Period Start",DateFrom,DateTo);
Months := Calendar.COUNT;
END ELSE
Months := 0;
MonthsOwed := 0;
AmountOwed := 0;
IF CustLedgerEntry.FIND('-')
THEN BEGIN
MonthsPaid := CustLedgerEntry.COUNT;
END ELSE BEGIN
MonthsPaid := 0;
END;
IF (MonthsPaid < Months)
THEN BEGIN
MonthsOwed := Months - MonthsPaid;
END;
IF CustLedgerEntry.FIND('+')
THEN BEGIN
LastAmount := CustLedgerEntry."Original Amount";
END;
IF MonthsPaid <> 0
THEN BEGIN
AmountOwed := LastAmount * MonthsPaid;
END;
All fields are coming correctly from the Cust. Ledger Entry except the Amounts. I've used several of the varying amounts in the Cust. Ledger Entry but none of them work.
Am I missing something! Please help...
Below is my Code:
CustLedgerEntry.SETRANGE("Customer No.","No.");
CustLedgerEntry.SETFILTER("Start Period",'>=%1',DateFrom);
CustLedgerEntry.SETFILTER("End Period",'<=%1',DateTo);
IF (DateFrom <> 0D) AND (DateTo > DateFrom) THEN BEGIN
Calendar.RESET;
Calendar.SETRANGE("Period Type",Calendar."Period Type"::Month);
Calendar.SETRANGE("Period Start",DateFrom,DateTo);
Months := Calendar.COUNT;
END ELSE
Months := 0;
MonthsOwed := 0;
AmountOwed := 0;
IF CustLedgerEntry.FIND('-')
THEN BEGIN
MonthsPaid := CustLedgerEntry.COUNT;
END ELSE BEGIN
MonthsPaid := 0;
END;
IF (MonthsPaid < Months)
THEN BEGIN
MonthsOwed := Months - MonthsPaid;
END;
IF CustLedgerEntry.FIND('+')
THEN BEGIN
LastAmount := CustLedgerEntry."Original Amount";
END;
IF MonthsPaid <> 0
THEN BEGIN
AmountOwed := LastAmount * MonthsPaid;
END;
All fields are coming correctly from the Cust. Ledger Entry except the Amounts. I've used several of the varying amounts in the Cust. Ledger Entry but none of them work.
Am I missing something! Please help...
Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?
0
Answers
-
Hi
Do the followingIF CustLedgerEntry.FIND('+') THEN BEGIN CustLedgerEntry.CALCFIELDS("Original Amount"); LastAmount := CustLedgerEntry."Original Amount"; END;0 -
Thanks Albertvh.
But now I want to change the Amount to positive how do I do that?
Thanks.Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?0 -
HI Zulq
LastAmount := -CustLedgerEntry."Original Amount";
<Edit>
or
LastAmount := ABS(CustLedgerEntry."Original Amount");
<End Edit>0 -
Thanks a lot Albertvh.Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions