Quantcast
Channel: SCN: Message List - Reporting and Printing
Viewing all articles
Browse latest Browse all 2719

customers recievable as of date

$
0
0

Dear Experts,

 

I have created this query for Customers Recievables, the problem that I am having is that it only shows the open invoices even if it was closed after the date in my parameter.

 

my requirements is like the Built-In Customers Recievables Aging in SAP but with the remarks on each invoice on the end.

 

here is the query i used:

 

SELECT 'IN' "Invoice/Credit Notes", T0.[CardCode], T0.[CardName], T0.[DocDate], T0.[DocDueDate], T0.[DocNum],

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) < 30 then (T0.[DocTotal]-T0.[PaidToDate]) end as '0-30',

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) BETWEEN 31 and 60 then (T0.[DocTotal]-T0.[PaidToDate]) end as '31-60',

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) BETWEEN 61 and 90 then (T0.[DocTotal]-T0.[PaidToDate]) end as '61-90',

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) BETWEEN 91 and 120 then (T0.[DocTotal]-T0.[PaidToDate]) end as '91-120',

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) > 120 then (T0.[DocTotal]-T0.[PaidToDate]) end as '120',

T0.[Comments] FROM OINV T0  INNER JOIN OCTG T1 ON T0.GroupNum = T1.GroupNum INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN OCRG T3 ON T2.GroupCode = T3.GroupCode WHERE T0.[DocStatus] ='O' AND  T0.[DocDate] <=[%1] AND  T2.[Cardcode] = 'CCBARTES A/S'

 

UNION ALL

 

SELECT 'CN',T0.[CardCode], T0.[CardName], T0.[DocDate], T0.[DocDueDate], T0.[DocNum],

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) < 30 then -(T0.[DocTotal]-T0.[PaidToDate]) end as '0-30',

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) BETWEEN 31 and 60 then -(T0.[DocTotal]-T0.[PaidToDate]) end as '31-60',

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) BETWEEN 61 and 90 then -(T0.[DocTotal]-T0.[PaidToDate]) end as '61-90',

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) BETWEEN 91 and 120 then -(T0.[DocTotal]-T0.[PaidToDate]) end as '91-120',

CASE WHEN DATEDIFF(DAY, T0.DocDueDate, [%1]) > 120 then -(T0.[DocTotal]-T0.[PaidToDate]) end as '120',

T0.[Comments] FROM ORIN T0  INNER JOIN OCTG T1 ON T0.GroupNum = T1.GroupNum INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode INNER JOIN OCRG T3 ON T2.GroupCode = T3.GroupCode WHERE T0.[DocStatus] ='O' AND  T0.[DocDate] <=[%1] AND  T2.[Cardcode] = 'CCBARTES A/S'

 

 

Thanks!

 

Carlo


Viewing all articles
Browse latest Browse all 2719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>