Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8902

Internal Reconciliation - upto a specific date in ageing receivables

$
0
0

Hi!

 

I have run the following query to produce an ageing report. However, the ageing shows reconciled transactions as outstanding in the ageing buckets.

 

 

My query is as follows:

 

DECLARE @D1 DATETIME

SET @D1=  '1900-01-01 00:00:00.000'

 

select T1.cardcode 'Bp Code',T1.cardname 'Name',sysdeb 'Debit Amount',syscred 'Credit Amount',

(T0.SYSDEB-T0.SYSCRED) as 'Balance Due',

case T0.transtype

when '13' then 'INV'

when '14' then 'AR CN'

when '24' then 'INCOMING'

else 'Other'

end 'Type',

Ref1,

fccurrency 'BP Currency',

CONVERT(VARCHAR(10), refdate, 103) 'Posting Date',

CONVERT(VARCHAR(10), duedate, 103) 'Due Date',

CONVERT(VARCHAR(10), taxdate, 103) 'Doc Date' ,

CASE

when (DATEDIFF(dd,taxdate,{?Age})) <= 30

then

case

when SYSCRED <> 0 then -SYSCRED

else SYSDEB

end

end "0-30 days",

case when ((datediff(dd,TaxDate,{?Age})) > 30 and (datediff(dd,TaxDate,{?Age}))<= 60)

then

case

when SYSCRED <> 0 then -SYSCRED

else SYSDEB

end

end "31 to 60 days",

case when ((datediff(dd,TaxDate,{?Age})) > 60 and (datediff(dd,TaxDate,{?Age}))<= 90)

then

case

when SYSCRED <> 0 then -SYSCRED

else SYSDEB

end

end "61 to 90 days",

CASE

when (DATEDIFF(dd,TaxDate,{?Age})) > 90

then

case

when SYSCRED= 0 then SYSDEB

when SYSDEB= 0 then -SYSCRED

end

end "90 + days"

from dbo.JDT1 T0

INNER JOIN dbo.OCRD T1 ON T0.shortname = T1.cardcode and T1.cardtype = 'c'

INNER JOIN CRD1 T2 ON T1.CardCode = T2.CardCode

where T0.intrnmatch = '0' and T0.TaxDate >= @D1 and T0.TaxDate <= {?Age}

  ORDER BY T1.CARDCODE, T0.taxdate


In this instance, {?Age} refers to the date as at which I am running the report


What code should I be using in the above query so that it does not show reconciled transactions as at my ageing date i.e. items reconciled before  and upto the ageing date of the report


Viewing all articles
Browse latest Browse all 8902

Trending Articles



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