[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 546
  • Last Modified:

Finance Charge Computation

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.
1 Solution
Anthony PerkinsCommented:
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

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Tackle projects and never again get stuck behind a technical roadblock.
Join Now