Calculate the Amount Vendor Ledger Entry And Insert Table

vnproc
Member Posts: 41
Hi Everybody,
I create a table with the following fields: Table Name: Cal Balance Vendor
1. Vendor Code
2. Ending Date
3. Currency Code
4. Total Amount
5. Line No
I use this table to save the results of the calculations at the end month. The purpose of reporting liabilities of Vendor.
* I'm new 1 report on the data source Cal Balance Vendor use calculation by Ending Date
I cannot insert data into the table. Please help me with 1 solution.
Thanks very much
I create a table with the following fields: Table Name: Cal Balance Vendor
1. Vendor Code
2. Ending Date
3. Currency Code
4. Total Amount
5. Line No
I use this table to save the results of the calculations at the end month. The purpose of reporting liabilities of Vendor.
* I'm new 1 report on the data source Cal Balance Vendor use calculation by Ending Date
VendLedEntries.SETCURRENTKEY("Vendor No.","Posting Date","Currency Code"); VendLedEntries.SETRANGE("Vendor No.","Vendor Code"); VendLedEntries.SETRANGE("Posting Date",0D, EndingDate); VendLedEntries.SETRANGE("Currency Code","Currency Code"); IF VendLedEntries.FINDSET THEN BEGIN REPEAT VendLedEntries.CALCSUMS(Amount); TotalBalAmount:=VendLedEntries.Amount; UNTIL VendLedEntries.NEXT =0 ; LineNo+=1000 "Cal Balance Vendor".INIT "Cal Balance Vendor"."Amount":=TotalBalAmount; "Cal Balance Vendor"."Ending Date":=EndingDate; "Cal Balance Vendor"."Currency Code":=VendLedEntries."Currency Code"; "Cal Balance Vendor"."Line No":= LineNo; "Cal Balance Vendor".INSERT END;
I cannot insert data into the table. Please help me with 1 solution.
Thanks very much
0
Comments
-
Hello!
Why you don't use Query to get amounts group by vendor and currency?1 -
Given your table definition, my best guess is that the Vendor Code is your key, unless you defined the Line No as your key. Regardless, I would say the Vendor Code is important but you left that out in your code below. Nevertheless, I'm not sure why you chose this method but you're probably over complicating this by creating a separate table to store your report values.
"Cal Balance Vendor".INIT
"Cal Balance Vendor"."Amount":=TotalBalAmount;
"Cal Balance Vendor"."Ending Date":=EndingDate;
"Cal Balance Vendor"."Currency Code":=VendLedEntries."Currency Code";
"Cal Balance Vendor"."Line No":= LineNo;
"Cal Balance Vendor".INSERT1 -
AlexeyShamin wrote: »Hello!
Why you don't use Query to get amounts group by vendor and currency?
I know the Query, but when the Currency Code group is on the Query I won't be able to call the Ending Date on report. When can you give me samples
Thanks0 -
Given your table definition, my best guess is that the Vendor Code is your key unless you defined the Line No as your key. Regardless, I would say the Vendor Code is important but you left that out in your code below. Nevertheless, I'm not sure why you chose this method but you're probably over complicating this by creating a separate table to store your report values.
"Cal Balance Vendor".INIT
"Cal Balance Vendor"."Amount":=TotalBalAmount;
"Cal Balance Vendor"."Ending Date":=EndingDate;
"Cal Balance Vendor"."Currency Code":=VendLedEntries."Currency Code";
"Cal Balance Vendor"."Line No":= LineNo;
"Cal Balance Vendor".INSERT
Thank you for replying. On this table, I use 2 Key (Vendor Code, Currency Code)
0 -
If "Vendor Code" is part of the PK shouldn't you add it to the code?
"Cal Balance Vendor"."Vendor Code" := ???
I believe you can use the CALCSUMS without the REPEAT loop (example below)
1
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