Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm having a bit of trouble with a calculation ... maybe someone can help me out or put me on the right direction?!
I have ServiceContracts with a BeginDate ... I need to calculate the exact days available according to the selected $Year and $Month.
Contractnr | BeginDate | ... |
1 | 5-9-2009 | ... |
2 | 20-12-2009 | ... |
3 | 2-3-2010 | ... |
4 | 6-9-2010 | ... |
... | ... | ... |
Also I have to manage to get the exact number of hours for each day:
Day | Hours |
Monday | 5 |
Tuesday | 9 |
Wednesday | 9 |
Thursday | 9 |
Friday | 12 |
Saturday | 9 |
Sunday | 0 |
There are different possibilities to take into account with the calculations:
$Year not selected ($Month should be deselected!!) -- ServiceContract.BeginDate until today()
$Year selected $Month not selected
- year(ServiceContract.BeginDate) < $Year and year(today()) = $Year -- days $Year until today()
- year(ServiceContract.BeginDate) < $Year and year(today()) <> $Year -- days $Year
- year(ServiceContract.BeginDate) = $Year and year(today()) = $Year -- ServiceContract.BeginDate until today()
- year(ServiceContract.BeginDate) = $Year and year(today()) <> $Year -- ServiceContract.BeginDate until end $Year
- year(ServiceContract.BeginDate) > $Year -- 0
$Year selected $Month selected
- year(ServiceContract.BeginDate) < $Year and month(today()) = $Month -- days $Year until today()
- year(ServiceContract.BeginDate) < $Year and month(today()) < $Month -- days $Month
- year(ServiceContract.BeginDate) = $Year and month(ServiceContract.BeginDate) = $Month -- ServiceContract.BeginDate until today()
- year(ServiceContract.BeginDate) = $Year and month(ServiceContract.BeginDate) < $Month -- days $Month
- year(ServiceContract.BeginDate) = $Year and month(ServiceContract.BeginDate) > $Month -- 0
- year(ServiceContract.BeginDate) > $Year -- 0
Has someone got an idea??
Is it better to do most of the calculations during the LOAD?? Or should I do most of these things in the frontend??
Anyone can help me on my way??
Thx in advance!!
Anita
I now partly solved this ...
At the Load side I'm making calculations per year/month ... so at the front side I only need to sum up these things.
Now I only need to do something with opening times ... but also the calculation shall be done at the LOAD side ... this to make the performance on the front-side better.
I now partly solved this ...
At the Load side I'm making calculations per year/month ... so at the front side I only need to sum up these things.
Now I only need to do something with opening times ... but also the calculation shall be done at the LOAD side ... this to make the performance on the front-side better.