Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 calculating Intrest in layout.

Author  Topic 

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-19 : 11:37:10
I have some old code that was used in cristal reports and thought it might help with my problem. I need this to calcuate intrest for every piece of equipment.

IF ({equipdet.ACQUIRED_DATE} < Date(2007,01,01)) THEN ({equipdet.Book Value}*(CurrentDate - Date(2007,01,01)) * .07/365) ELSE IF ({equipdet.ACQUIRED_DATE} > Date(2007,01,01)) THEN {equipdet.Book Value}*(CurrentDate - {equipdet.ACQUIRED_DATE})*
.07/365


I am just not sure how to write this in the layout view.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-19 : 12:55:38
[code]=Switch(Fields!ACQUIRED_DATE.Value< CDate("1 Jan 2007"),Fields!BookValue.Value*(Now() - CDate("1 Jan 2007"))* .07/365,Fields!ACQUIRED_DATE.Value> CDate("1 Jan 2007"),Fields!BookValue.Value*(Now() - CDate(Fields!ACQUIRED_DATE.Value))* .07/365)[/code]
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-19 : 13:51:07
came back with an error.

=Switch(Fields!eqprecdt.Value< CDate("1 Jan 2007"),Fields!cnvf00109.Value*(Now() - CDate("1 Jan 2007"))* .07/365,Fields!eqprecdt.Value> CDate("1 Jan 2007"),Fields!cnvf00109.Value*(Now() - CDate(Fields!eqprecdt.Value))* .07/365)

Fields!eqprecdt.value = ACQUIRED_Date
Fields!cnvf00109.value = Fields!BookValue
Go to Top of Page

midpenntech
Posting Yak Master

137 Posts

Posted - 2008-05-19 : 14:46:31
not sure whats missing in the code?
Go to Top of Page
   

- Advertisement -