Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: 60 days month end formula Post Reply Post New Topic
Author Message
Pirrus blue
Newbie
Newbie
Avatar

Joined: 02 Aug 2011
Online Status: Offline
Posts: 6
Quote Pirrus blue Replybullet Topic: 60 days month end formula
    Posted: 08 Aug 2011 at 12:33am

Hi

I am using crystal xi to produce invoices which display a due date. Most of my customers are on a 60 days from month end terms and I would like to display this on the invoice.

 

The current formula I am using is;

 

Dateadd('d',-(DAY(dateadd('m',1,dateadd('d',60,{sales_anal.invoice_date})))),dateadd('m',1,dateadd('d',60,{sales_anal.invoice_date})))

 

and this seems to work fine for all dates apart from the 1st of each month.

 

For example

 

When the invoice date is 01/07/2011 an incorrect due date of the 31/08/2011 is returned but for invoices dated the 02/07/2011 a due date of the 31/09/2011 is returned, which would be the correct date for both invoices.

 

Is there another formula i can use to prevent the 1st of the month anomaly?

 

Many thanks

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Aug 2011 at 4:13am
based on the logic of going to the end of the month then adding 60 days I get that the your sample items should be due on 29-9-11 not the 31st so I am not sure if this is what you want but you can try
 
dateserial(year({sales_anal.invoice_date}),month({sales_anal.invoice_date})+1,(1-1) + 60)


Edited by DBlank - 08 Aug 2011 at 4:13am
IP IP Logged
Pirrus blue
Newbie
Newbie
Avatar

Joined: 02 Aug 2011
Online Status: Offline
Posts: 6
Quote Pirrus blue Replybullet Posted: 08 Aug 2011 at 4:25am
Thank you very much, that formula works a treat!Smile
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.