
Hey guys,
I plan to do the following:
I have a report that I can use to apply all my open entries. Now I would like to see which payment was applied with which credit.
For this I want to create something like a G/L Register. I would use a classic G/L Register as a guide.
Have you ever done something like this?
Where in my report should I position myself so that I can then write the data to a separate table? This table should be my G/L Register.
Thank you ;)
Hi,
There is of course a number of different ways to do this, and without knowing the customer and exact requirements, here is my ideas, based on the standard application (codeunit 12):
The register is initialized at the beginning of the process:
[Function StartPosting]
GLReg.LOCKTABLE;
IF GLReg.FINDLAST THEN
GLReg."No." := GLReg."No." + 1
ELSE
GLReg."No." := 1;
GLReg.INIT;
GLReg."From Entry No." := NextEntryNo;
GLReg."From VAT Entry No." := NextVATEntryNo;
GLReg."Creation Date" := TODAY;
GLReg."Creation Time" := TIME;
GLReg."Source Code" := "Source Code";
GLReg."Journal Batch Name" := "Journal Batch Name";
GLReg."User ID" := USERID;
IsGLRegInserted := FALSE;
Then during the process, the entry numbers can get incremented as they get processed. And then in the end, the register gets inserted.
I think that this makes it easy to collect all the needed data in the register because anywhere you are applying entries, you can update the register at the same time as you go along. The disadvantage may be performance, since you lock the table during the whole process, so if you need to write this for heavy multi user scenarios, then I would consider another solution of maybe collecting it all into a temp table, but only insert the register at the end of the process.
Just some ideas - again without knowing everything that the process needs to do. Hope it helps.