Oyseka Posted February 13, 2005 Share Posted February 13, 2005 I am trying to design a rental system with automatic invoicing based on the date such that: if the rental start date is in the current month and the start date is not the 1st of the month then Rental/Number of days in the month*(number of days in the month-Rental start date)+commision. And conversely if the rental end date is in the current month etc. Can anyone help construct this formula please Chris Link to comment Share on other sites More sharing options...
transpower Posted February 13, 2005 Share Posted February 13, 2005 Case (Month(rentalStartDate)=Month(Status(CurrentDate)and Day(rentalStartDate) > 1 ; (rentalAmount/numberDaysinMonth)*(Date(Month(Status(CurrentDate)))+1,0,Year(Status(CurrentDate)))-rentalStartDate)+commission The other calculations would be similar. In version 7, using Let, we could simplify the calculation drastically. Link to comment Share on other sites More sharing options...
Oyseka Posted February 14, 2005 Author Share Posted February 14, 2005 Thank you for your help, I have today received my FMP7 (V7.02) and installed it, how would Let be simpler. By the way FMP7 appears much slower launching a solution than either 5.5 or 6. Is this because these solutions were designed in previous versions and then converted. Chris Link to comment Share on other sites More sharing options...
Oyseka Posted February 15, 2005 Author Share Posted February 15, 2005 I can not get this expression to work, numberDaysinMonth, I have tried different syntax but to no avail Chris Link to comment Share on other sites More sharing options...
Fenton Posted February 15, 2005 Share Posted February 15, 2005 It's hard to know what the last day of the month is. But it's easy to know what the first day of next month is, then substract 1: Day ( Date ( Month ( Get (CurrentDate) ) + 1; 1; Year ( Get (CurrentDate)) ) - 1 ) Actually, there is a special, rather odd way to get the last day of the month. It's day 0 of next month. So this also works: Day ( Date ( Month ( Get (CurrentDate) ) + 1 ; 0; Year ( Get (CurrentDate)) ) ) Link to comment Share on other sites More sharing options...
stanley Posted February 15, 2005 Share Posted February 15, 2005 Fenton: Nicely done. It's always good to see some code that gets the cereal into the bowl in just the right (non-rectilinear) way. -Stanley Link to comment Share on other sites More sharing options...
Oyseka Posted February 16, 2005 Author Share Posted February 16, 2005 Wow, now I know why I feel dumb, it's because I am. Thanks for all your help Chris Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6608 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now