简体   繁体   English

我如何查询 select GL/Accounts 的金额、营业额和运营成本? SAP B1

[英]How can I do query which will select GL/Accounts with their amount, Turnover and Operating Costs? SAP B1

How can I do query which will select GL/Accounts with their amount of Turnover and Operating Costs in Chart of Accounts?我如何查询 select GL/Accounts 及其在会计科目表中的营业额和运营成本?

For example例如

SELECT GL/Account,Amount FROM OACT WHERE their_type='Turnover' SELECT GL/账户,金额来自 OACT,其中 their_type='Turnover'

SELECT GL/Account,Amount FROM OACT WHERE their_type='Operating Costs' SELECT GL/账户,金额来自 OACT,其中 their_type='运营成本'

I tried to search in OACT table of SAP B1 but there is no column which stores Turnover, Operating Costs or Assets,....我试图在 SAP B1 的 OACT 表中搜索,但没有存储营业额、运营成本或资产的列,....

How can I do the above query without set condition of one by one account?如果不设置一个一个账户的条件,如何进行上述查询?

for example例如

SELECT GL/Account,Amount FROM OACT WHERE AcctCode='0001' or AcctCode='0002' or AcctCode='0003' or AcctCode='0004' SELECT 总帐/账户,金额来自 OACT,其中 AcctCode='0001' 或 AcctCode='0002' 或 AcctCode='0003' 或 AcctCode='0004'

Please anyone can help me请任何人都可以帮助我

You will have to join the OACT table with JDT1 that has the amounts.您必须将 OACT 表与具有金额的 JDT1 连接起来。

I am not sure of the Rwandan standard for chart of accounts but you can have something like:我不确定会计科目表的卢旺达标准,但您可以使用以下内容:

SELECT T0.AcctCode, T0.AcctName, T0.FatherNum, SUM(T1.Debit - T1.Credit) * -1 AS 'Amount'
FROM OACT T0
INNER JOIN JDT1 T1 ON T0.[AcctCode] = T1.[Account] 
WHERE T0.AcctCode LIKE '41%' AND T0.Postable = 'Y'
AND (T1.RefDate BETWEEN {?StartDate} AND {?EndDate})

GROUP BY T0.AcctCode, T0.AcctName, T0.FatherNum

Above is assuming that all accounts starting with 41 refer to turnover.以上假设所有以 41 开头的帐户均指营业额。 Also not sure whether all posting you done are done on one level, eg 4 or on multiple levels.也不确定您所做的所有发布是在一个级别上完成的,例如 4 级还是多个级别。

while accepted answer could have helped you, I would like to let you know that OACT has a column nammed ActType which values are E for expenses or operating costs, I for profit or turnover and N for none of the Expenses or Profit.虽然接受的答案可能对您有所帮助,但我想让您知道OACT有一个名为ActType的列,其值为E表示费用或运营成本, I表示利润或营业额, N表示没有费用或利润。

SELECT T0.AcctCode, T0.AcctName, T0.FatherNum, SUM(T1.Credit - T1.Debit) AS    
'Balance' FROM JDT1 T1
INNER JOIN OACT T0 ON T0.[AcctCode] = T1.[Account] 
WHERE T0.ActType='I' 
AND (T1.RefDate BETWEEN {?StartDate} AND {?EndDate}) 
GROUP BY T0.AcctCode, T0.AcctName, T0.FatherNum

For operating costs对于运营成本

SELECT T0.AcctCode, T0.AcctName, T0.FatherNum, SUM(T1.Debit - T1.Credit) AS    
'Balance' FROM JDT1 T1
INNER JOIN OACT T0 ON T0.[AcctCode] = T1.[Account] 
WHERE T0.ActType='E' 
AND (T1.RefDate BETWEEN {?StartDate} AND {?EndDate}) 
GROUP BY T0.AcctCode, T0.AcctName, T0.FatherNum

Note that some accounts are both TurnOver and OperatingCost at the sametime.请注意,某些帐户同时是TurnOverOperatingCost In this case, their actType will be N在这种情况下,他们的actType将为N

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM