Gracias.
A continuación se muestra la consulta:
SELECT T1.Account, T4.AcctName, Count(T3.Quantity), Sum(T1.Debit-T1.Credit) -1, (Sum(T1.Debit-T1.Credit) -1)/Count(T3.Quantity) FROM OJDT T0 INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId INNER JOIN OINV T2 ON T0.TransId = T2.TransId INNER JOIN INV1 T3 ON T2.DocEntry = T3.DocEntry Inner Join OACT T4 on T1.Account=T4.AcctCode Where T0.RefDate between [%0] and [%1] and T4.ActType='I' and T1.Account not in('50701', '50702', '50703') and T1.Account=T3.Acctcode Group by T1.Account, T4.AcctName
¿Puedes ayudar?
Raymond