Finance Charge Computation

Posted on 2004-11-14
Last Modified: 2008-01-16
I am trying to create a statement to send to customers.
I would like the statement to include a finance charge.
The underlying recordset of my report returns a row for each outstanding invoice.

The finance charge computation is like this for each line:
   BalanceDue * (InvoiceDate - CurrentDate) \ 30 * MonthlyInterestRate
      (I would like to use integer division if possible - hence the backslash before the 30)

I'm not sure how to do this inside an SQL statement (or if it can be done). I need to get it back with my recordset so that my report writer (MS Access) can total it.

The main issues:
1. How to include the computation overall - can something this complex be done?
2. How to get the date difference in DAYS (not microseconds since 1900, or however it stores it).
3. How to refer to CurrentDate.
4. Can integer division be used?

Thanks very much.
Question by:tk3
    1 Comment
    LVL 75

    Accepted Solution

    1. Yes.
    2. Use the DATEDIFF() function with "day" as the DatePart.
    3. Use the GETDATE() function.
    4. Yes, but not with "\".  Use the CAST function to convert to an integer as in:
           BalanceDue * CAST(InvoiceDate - CurrentDate As Integer) / 30 * MonthlyInterestRate

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now