Print Page | Close Window

date range in sql

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=21767
Printed Date: 27 Apr 2024 at 6:15pm


Topic: date range in sql
Posted By: juliesabre
Subject: date range in sql
Date Posted: 09 Nov 2015 at 10:02pm
Hi
New to the forum and new to Crystal Reporting - I know this question isn't entirely about Crystal reports but can anyone help - I have put a formula in Crystal using the DATEADD function to calculate due dates of debtors based on the payment terms. This is fine in Crystal but I wondered - does anyone now how to get this formula into SQL so I can import the SQL view to excel rather than export the crystal report to excel.
the formula is as follows:-

if{ArInvoice.TermsCode} = "01" then dateadd('m',3,{ArInvoice.InvoiceDate}) - day(dateadd('m',3,{ArInvoice.InvoiceDate})) else if{ArInvoice.TermsCode} = "10" then dateadd('m',2,{ArInvoice.InvoiceDate}) - day(dateadd('m',2,{ArInvoice.InvoiceDate})) else if {ArInvoice.TermsCode} = "02" then dateadd("d",60,{ArInvoice.InvoiceDate}) else if {ArInvoice.TermsCode} = "03" then dateadd("d",30,{ArInvoice.InvoiceDate}) else if {ArInvoice.TermsCode} = "04" then {ArInvoice.InvoiceDate} else if{ArInvoice.TermsCode} = "9" then dateadd('d',(-(DAY(dateadd('m',1,dateadd('d',30,{ArInvoice.InvoiceDate}))))+15),dateadd('m',1,dateadd('d',30,{ArInvoice.InvoiceDate}))) else if {ArInvoice.TermsCode} = "12" then dateadd("d",90,{ArInvoice.InvoiceDate})

Thanks

juliesabre



Replies:
Posted By: kevlray
Date Posted: 16 Nov 2015 at 4:53am
You should not cross-post questions.



Print Page | Close Window