Crystal Reports Aging A/R Report

I have been given the task of creating an Aging A/R Report from an ODBC Data Source.  I have the connection working and can see the data fine.  What I am having a problem doing is breaking the records out into the different period.
The periods I am trying to get the data into is
Current, 30 Days Past Due, 60 Days Past Due, 90 Days Past Due, 120, Days Past Due
Once I have the data into the report I want to total each records past due by the Customer with the data in the correct buckets.
This is what I was thinking for 30 days past due
IF CurrentDate-{oa_sltrans.due-date}<=0
and CurrentDate-{oa_sltrans.due-date}>=30 then "LessThan30DAYSPD"
But this doesn't work any ideas?
Who is Participating?
MIKEConnect With a Mentor Software Solutions ConsultantCommented:
Here is a formula that I use ofter for all my aging can modify it as needed to fit your AGING DAY requirements.

Try using this formula, changing the datafield names as needed:

if {Yourtablename.field}< dateadd("d",-720, currentdate) then ">720 days" else
if {Yourtablename.field}< dateadd("d",-540, currentdate) then ">540 days" else
if {Yourtablename.field}< dateadd("d",-360, currentdate) then ">360 days" else
if {Yourtablename.field}< dateadd("d",-180, currentdate) then ">180 days" else
if {Yourtablename.field}< dateadd("d",-120, currentdate) then ">120 days" else
if {Yourtablename.field}< dateadd("d",-90, currentdate) then ">90 days" else
if {Yourtablename.field}< dateadd("d",-60,currentdate) then ">60 days" else
if {Yourtablename.field}< dateadd("d",-30, currentdate) then ">30 days" else
if {Yourtablename.field}< dateadd("d",+29, currentdate) then "Current" else "Unknown"

Hope it helps.

Mike V
dkDeveloperConnect With a Mentor Commented:
Hi Rcreese38,

You're real close there -- try using the DateDiff function instead of just subtracting the dates.

As an example...
DateDiff ("d", Date(2006,01,01), Date(2006,02,01))
Would return 31.

Let me know if you need more help than that.

Good Luck!
Hi Rcreese38,

I should have noted that you can use the date fields ({oa_sltrans.due-date} and CurrentDate) directly in the function call, no need to parse those out or anything.

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Rcreese38Author Commented:
I think I am getting closer using the following
IF CurrentDate-{oa_sltrans.due-date}<=30
and CurrentDate-{oa_sltrans.due-date}>=0 then {@AmountPastDue}

@AmountPastDue is a Field with the Total amount past due that I want to place in place for a the name of the customer.
What doesn't seem to be working?

Where are the formulas placed in the report?

MIKESoftware Solutions ConsultantCommented:
As you can see we LOVE to age our A/R......

Rcreese38Author Commented:
Thank you for your comments.  I ended up doing it the following way and it is working.
Here is what I used for
30 Days
IF CurrentDate-{trans.table-date}<=30
and CurrentDate-{trans.table-date}>=0 then {@AmountPastDue}
Where @AmountPastDue is a field that subtracts Due Date - Current Date

From 31-60 Days Past Due
IF CurrentDate-{trans.table.due-date}<=60
and CurrentDate-{trans.table.due-date}>=31 then {@AmountPastDue}
Where @AmountPastDue is a field that subtracts Due Date - Current Date

I will split the points for the help and maybe use this way in the future. Between those who respond with code suggestions.  Thank you for your help
MIKESoftware Solutions ConsultantCommented:
Glad I could be of help to you.

Mike V
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.