FindGLAccountType (GLAcc : Code 20) { TMPGLAccountType[GLAccountType::Client].SETRANGE("No.", GLAcc); TMPGLAccountType[GLAccountType::VAT].SETRANGE("No.", GLAcc); CASE TRUE OF TMPGLAccountType[GLAccountType::Client].FINDFIRST: EXIT(GLAccountType::Client); TMPGLAccountType[GLAccountType::VAT].FINDFIRST: EXIT(GLAccountType::VAT); ELSE EXIT(GLAccountType::Diferent); END; } InitGLAccount { GLAccountType := GLAccountType::VAT; IF VATPostingSetup.FINDSET THEN REPEAT InsertTMPGLAcc(VATPostingSetup."Sales VAT Account"); InsertTMPGLAcc(VATPostingSetup."Sales VAT Unreal. Account"); InsertTMPGLAcc(VATPostingSetup."Purchase VAT Account"); InsertTMPGLAcc(VATPostingSetup."Purch. VAT Unreal. Account"); InsertTMPGLAcc(VATPostingSetup."Reverse Chrg. VAT Acc."); InsertTMPGLAcc(VATPostingSetup."Reverse Chrg. VAT Unreal. Acc."); UNTIL VATPostingSetup.NEXT = 0; // Insert Client Accounts GLAccountType := GLAccountType::Client; IF CustomerPostingGroup.FINDSET THEN REPEAT InsertTMPGLAcc(CustomerPostingGroup."Receivables Account"); UNTIL CustomerPostingGroup.NEXT = 0; IF VendorPostingGroup.FINDSET THEN REPEAT InsertTMPGLAcc(VendorPostingGroup."Payables Account"); UNTIL VendorPostingGroup.NEXT = 0;The variable TMPGLAccountType is a Temp variable with 3 dimensions. Now if I call funtion
REPEAT IF FindGLAccountType(CalcGLEntry."G/L Account No.") = GLAccountType::Client THEN EXIT(TRUE); UNTIL CalcGLEntry.NEXT = 0; EXIT(FALSE);and it returns VAT Account. Exemple I want to now if account 1575 (German VAT Account) ir Client I give this to the function FindGLAccountType and I get that it is Client Account.
Comments
You don't appear to have any other filters on your TMPGLAccountType record variable. Only the account number is filtered.
To explain a little clearer, you are doing the exact same thing, regardless of whether or not it is a client account or a VAT account.
If you were looking at a G/L Account card, how would you know whether it is a client account or a VAT account? That's where you should start. I don't see any need for dimensions.
My Blog - nav.education
and into And into TMPGLAccountType[GLAccountType::Client]."No." a GLAccount of value 1410
Now in the Main Program I try tu find what type of GLAccount is the 1575 (I need that for other things). Buth the Function So that the funktion says that GL Account of 1575 is Client Account and not the VAT.
I have write another function But this not work too.
http://www.mandasoft.eu
My Blog - nav.education
I have do this in the erlay version of this solution, Now I want make it bether, it will work much faster and you do not need make additional setups of this
http://www.mandasoft.eu
Additional setup, sure. But faster execution, no way.
Why even bother with the temp tables?
My Blog - nav.education
Secound Question for the performace, you have just once to reade the GL ACCounts from the tables, and not for every Entry.
This solution muss check every GL Entry and if the Client Account do something, if there a VAT do something else, and all others somthing new, this is a report for a client.
If you make a lot of setups there may change somthing or forget, and the report will not show the right. I have all accounts that I need in Setup Tables, so I do not need additional Setup.
And make a 3 Temporary tables, is not a solution, becouse there will be more, and to the future will be esey to change this and not others programing code.
http://www.mandasoft.eu
http://www.mandasoft.eu
I still really think you should just add a field to the card. You can prepopulate it based on current data, and then make it a required field when they add an account. The Chart of Accounts for a company doesn't change very often from my experience so future setup shouldn't be that big of a deal.
My Blog - nav.education