Restrict GL lookup to revenue accounts  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Restrict GL lookup to revenue accounts

Postby pricerc » Wed May 04, 2022 3:03 pm

Is this correct?

Code: Select all
[ExpSign] = 1 AND [AccClass] = 0 AND [IsEnabled] = 1 AND [PostingAcc] = 1 AND [DistributionAcc] = 0
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Restrict GL lookup to revenue accounts

Postby pricerc » Wed May 04, 2022 4:26 pm

also need to add GL_Category.[AccType] = 0
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Restrict GL lookup to revenue accounts  Topic is solved

Postby Mike.Sheen » Wed May 04, 2022 6:02 pm

If you're wanting to come up with a query for the user to select an account, is there any reason why you wouldn't want the user to select a distribution account? I would expect it to be perfectly reasonable to have a distribution sales account set up to disperse posts to that to other accounts.

It looks like you've arrived at your answer yourself, but here's a query with some comments which might clear things up for anyone else in the distant future stumbling across this (I'm not excluding distribution accounts):

Code: Select all
select GL_Ledger.AccountNo, GL_Ledger.Description, GL_Ledger.ExpSign, GL_Ledger.AccClass, GL_Category.AccType, GL_Category.Description Category
FROM GL_Ledger
JOIN GL_Category ON GL_Category.GLCategoryID = GL_Ledger.GLCategoryID
WHERE GL_Ledger.AccClass = 0 --Normal = 0, RetainedEarnings = 1, Bank = 2, CreditorsControl = 3, DebtorsControl = 4, InventoryControl = 5
AND GL_Ledger.ExpSign = 1 -- Debit = 0, Credit = 1
AND GL_Ledger.IsEnabled = 1 -- Duh
AND GL_Ledger.PostingAcc = 1 -- Duh
AND GL_Category.AccType = 0 -- ProfitAndLoss = 0, BalanceSheet = 1
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Restrict GL lookup to revenue accounts

Postby pricerc » Wed May 04, 2022 6:48 pm

Mike.Sheen wrote:If you're wanting to come up with a query for the user to select an account, is there any reason why you wouldn't want the user to select a distribution account?


Not sure. As it happens, this particular customer has no distribution accounts, so it's moot.

That said, I will remove that restriction and allow the customers' accountants to make their own choices :)

This is for selecting an account for credit card surcharges attached to a sales invoice.

The code will hardly ever be used (probably only once when the plugin is activated), and I probably don't need to filter it at all, but I thought I might as well at least filter out obviously wrong accounts.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 16 guests