on 03-31-2015 2:16 PM
Hi all,
I have a sample Chart of Accounts Level 4 as in the image below.
I want to have a query for a trial balance level 4 such that I get Account Codes, Account Names and Balances as per the same level 4.
The results should look like:
611110 Management Staff Salaries -5,250,254.87
611120 Subordinate Staff Wages -2,187,123.13
611140 Leave Pay & Travel Allowance -987,322.00
611160 Travelling Expenses -1,567,873.76 etc........(Compare this to above image)
How do I modify the below query to get the results above?
SELECT DISTINCT T2.AcctCode, T2.AcctName, SUM(T1.Debit - T1.Credit) AS 'Balance'
FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.[TransId] = T1.[TransId]
INNER JOIN OACT T2 ON T1.[Account] = T2.[AcctCode]
WHERE T0.TaxDate BETWEEN '2014-09-01' AND '2014-09-30'
GROUP BY T2.AcctCode, T2.AcctName
Hi,
Try:
SELECT T3.AcctCode, T3.AcctName, SUM(T1.Debit - T1.Credit) AS 'Balance'
FROM OJDT T0
INNER JOIN JDT1 T1 ON T0.[TransId] = T1.[TransId]
INNER JOIN OACT T2 ON T1.[Account] = T2.[AcctCode]
INNER JOIN OACT T3 ON T3.[AcctCode] = T2.[FatherNum]
WHERE T0.TaxDate BETWEEN '2014-09-01' AND '2014-09-30'
GROUP BY T3.AcctCode, T3.AcctName
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, how to do this same query in level 3?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try this
SELECT DISTINCT T2.AcctCode, T2.AcctName, SUM(T1.Debit - T1.Credit) AS 'Balance'
FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.[TransId] = T1.[TransId]
INNER JOIN OACT T2 ON T1.[Account] = T2.[AcctCode]
WHERE T0.TaxDate BETWEEN '2006-09-01' AND '2014-09-30' AND T2.Levels=4
GROUP BY T2.AcctCode, T2.AcctName
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SELECT * FROM OACT T0
ORDER BY GroupMask, GrpLine
Using this query will give you the correct sequence as Chart of Account, so just pay attention to FatherNum. With the help to group sub account with their FatherNum, you should be able to generate what you want. If you can not do it, let us know.
Frank
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
10 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.