Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: date range in sql Post Reply Post New Topic
Author Message
juliesabre
Newbie
Newbie


Joined: 05 Nov 2015
Online Status: Offline
Posts: 2
Quote juliesabre Replybullet Topic: date range in sql
    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
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 16 Nov 2015 at 4:53am
You should not cross-post questions.
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.016 seconds.