I'm trying to put two text controls on the bottom of every Ledger entry that will show the Debit Amount and the Credit Amount respectively of whatever is currently shown...
Just like the general journal.. however the general journal shows the total amout and total balance...
I need total debit amount and total credit amount.
can anyone help?
0
Comments
--
Wat is shown can be calculated through the OnAfterGetRecord trigger. This is not advisable in terms of performance.
If you want to show what is the filter you can copy the funcion CalcBalance in Codeunit 230 and modify it to match your requirements.
Greetz,
Marq
I would do COPYFILTERS
Then I would do something like IF Amount < 0 then Credit +=Amount;
and the same for debit..
can someone help me organize.. I don't really know how to do this.
However showing the total what is on the form at the moment if very difficult, if not impossible.
What you can do is make a function which does the totaling for you. If a user selects some records, use SetSelectionFilter and add the columns.
--
Still, the easy way is to total all the records within the filter, as been done by the general journal.
How can I do it this way?
PS. You can simplify the code in the function because you do not have to worry about the xrec.
2. Change the varables to represent table 17 instead of 81
3. Replace "Balance (LCY)" by "Debit Amount" and copy this for "Credit Amount"
Ps. Be sure "debit amount" and "credit amount" are sumindexfields on the current key
4. On form 20 create 2 decimal variables e.g. TotalDebit and TotalCredit, and place them on the form
5. Call the function from OnAfterGetCurrRecord
6. You need not to worry about user imput as in form 39 because G/L Entries are not to be modified (Mostly
Good Luck
I Hope not to have forgotten something because I did not try it myself.
I will try this...
1. Copy the function CalcBalance from codeunit 230 to e.g. Table 17
what do you mean? I copy and I paste it into the table? Where?
to simplify the code, I just don't use xrec..?
sorry, I'm completely lost here
GLEntry is Record for G/L Entry, Credit and Debit are global var of type Decimal.
Call this function for example in OnAfterGetCurrRecord.
Show somewhere the variables Debit and Credit. You are done... (if you are using Native DB, you need to have defined apropriate keys and SumIndexFields for calcualting the sums...)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.