Skip to Content
0
Former Member
Jun 09, 2008 at 08:06 PM

Customer Receivables Aging - Query

2633 Views

I hope someone can help me on this.

I have looked all over the forumn for assistance before posting.

I am looking for a SQL Query that produces the same results that the 'Customer Receivables Aging' report produces.

So far I have this but when ever I attemt to seubtract Credits the totals are off.

SELECT "OCRD"."U_ASINumber", "OCRG"."GroupName", "OCRD"."U_Channel", "OINV"."DocTotal", "OINV"."DocDueDate", "OINV"."DocStatus", "OCRD"."CardName", "OCRD"."CardCode"

FROM ("DRI_DUCK"."dbo"."OINV" "OINV" INNER JOIN "DRI_DUCK"."dbo"."OCRD" "OCRD" ON "OINV"."CardCode"="OCRD"."CardCode") INNER JOIN "DRI_DUCK"."dbo"."OCRG" "OCRG" ON "OCRD"."GroupCode"="OCRG"."GroupCode"

WHERE "OCRG"."GroupName"=N'Corporate' AND "OCRD"."U_Channel"=N'2'

ORDER BY "OCRD"."CardCode", "OCRD"."U_ASINumber"

Ant help would be great.

Thanks,

Craig