Posting payments automatically

Hi all, I have a case where a bookkeeping agency wants to read payments from a file they have received from the bank. The problem is, that they have somewhat 200 companies in Attain 3.10B and all the payments arrive in the same file. The payments are directed to a company with bank account no. and to an invoice by giro reference number. The payments should be automatically posted through Cash receipt journal… This all should be done at nighttime without user intervention. Well, you can see my distress. A solution that I had in mind was: 1) To open Attain via a hyperlink to a certain form that runs the code and reads the data into a table (or with CFRONT) that is common to all the companies. I would use changeCompany on “Bank Account” for finding out which company each line belongs to. 2) Then I would run code that opens each company and posts the journal …and this is where the difficulties arise: - there is no way to change company globally (with code) for running the posting routines - coding the Posting Routines with CFRONT seemes to be a mission impossible, since I can’t use codeunits from CFRONT? I have thougt of many alternative solutions, the best I’ve figured out so far is to start an instance of Attain for each company with an external application (C++ or VB made) … and then kill each process when a certain mark is shown (a file written or something) - sounds crazy. Any ideas - I am not the first to have met this kind of customer needs, am I? /PEA

For one of our clients we change CU12 to be able to post in any company from any company. We add field in the Gen. Journal Line “Post to Company” and change posting routing. But we had some restrictions: - No Paiment Discouts - No Foreign Currency - No Unreiliset VAT or Sales Tax - Navision 2.6 I think it will be more difficult to do in Attain because of Dimentions.

Hi.You could achieve this but it would be a bit complex. Just read the file line by line (Record by record)… and based on which company it belongs, use the CHANGECOMPANY(CompanyName) function of the Record variable & enter the record in the Cash Receipt Journal Table. In the end, when all the all the entries have been read, just post the transactions one by one using the same ChangeCompany function - or you can do it at the time of entering the records in the Cash Receipt Journal.

It has been my experience that the CHANGECOMPANY function is extreamly limited in scope. I have used that function to send a link to a user from within the system. Let’s use the Customer as an example. When, the user opens the link, they are taken to the customer card in the “other” company. However, if they attempt to go to the ledger entries, either none will appear (Customer No. doesn’t exist in the “real” company) or worse, it will open ANOTHER customer’s entries! (Customer No. exists in both companies) [:0] I can’t help but think this would be true for validation of code and posting.

Hi everybody, William is correct. Validation code is not run when using ChangeCompany. [xx(] Val’s suggestion is actually an option but the code should be interesting [;)] The other thing that I have not used yet [:p] is Navision Application Server … Apparently it can run code from outside of Navision while still having the normal validation stuff … Maybe you want to look into that and let us know how it was [:D] Regards, Cristi Nicola

If you use a record variable with ChangeCompany, all the variables within the record-variable itself still point to the company that you have open. This means that you really can’t run ANY TRIGGERS within the record variable unless you also include the ChangeCompany in the triggers of the variable. If any other objects are called from the record-variable, you must include the ChangeCompany in these object’s code. This would mean lots of modification on Navision (late Attain) basic objects. Complicated but not impossible, but sure asking for trouble. The path I’ve chosen here, is to first import payments to a global table. On the Main Form - OnOpen trigger I then select each company’s rows (if there are any unposted ones), and post them. The user will see a dialog showing the status of posting, and he/she can skip the process if necessary. This is not a classy solution, but it works. Nicola: NAS can be used to automate processing, but the problem of changing the company remains. One can change the company with NAS Manager, which writes the selected company into the registry and then notifies the NAS that changes have been made. I have not taken a look at how to programmatibly notify NAS if I write the changes directly to the registry… And yet there is the question of shutting down NAS when the work is done. /Pauli