Dreamweaver
Well-known member
- Local time
- Today, 09:58
- Joined
- Nov 28, 2005
- Messages
- 2,466
This relates to the UK Holidays Gov.com To be honest Not sure If I'm overthinking things
I have worked out 2 ways of doing this and both give differrent values but i expected that but wanted to see
The varibles I'm useing are here
This part of the code calculates the number of days to assign for a new employee who started say today 6th may 2020
On the gov site it calculates how much holiday a employee has accurecd like 28 ÷ 12 × 3
So I thought I would try altering that so my calc is like:
This give a value of 16.33333 but I want it to be rounded do use An integer for EStHo which gives me 16
my problem with this is it doesn't take into account the current month or maybe I'm being a dunce lol
So What I did Originally was work around the current week like:
I have confired the value stored in preferences I.E. 5.6 and the Daysworking are stored in an employees record which is updated from the shifts system which is selected when an employee is added.
this function is for when an new employee is added or there shift pattern is altered.
my question is can anybody better at math than me "That will be most people" see if there is a better way or correct what I Have done
I do think I will have to except a value like 17.5 instead of rounded up to 18 which it gives at the moment
I have worked out 2 ways of doing this and both give differrent values but i expected that but wanted to see
The varibles I'm useing are here
Code:
Dim Bnk As Boolean 'Does Company Pay Bank Holidays
Dim LstRun As Long 'Date AlLotments Last Run
Dim CPub As Integer 'Only expect 10-15 max
Dim StHo As Single, SCalc As Single ' The Statutory Holidays Allowence
Dim Cclo As Integer 'How Many company closures should be anywere near 20 a year
Dim Pref As DAO.Recordset, Emp As DAO.Recordset
Dim EStHo As Integer 'Make sure it's a whole number
Dim ECl As Integer 'Holds The Number Of Closures for a given Shift
Dim Wk As Integer, Ial As Single
This part of the code calculates the number of days to assign for a new employee who started say today 6th may 2020
On the gov site it calculates how much holiday a employee has accurecd like 28 ÷ 12 × 3
So I thought I would try altering that so my calc is like:
Code:
StHo = Pref("HolidayCalculation") 'Value from preferences table
StHo = (!DaysWorking * StHo)
Wk = Format(Date, "m")
Wk = 12 - Wk
EStHo = (StHo / 12) * Wk
'StHo=5.6 Which is used like 5x5.6 = 28 which is standard rate in UK
This give a value of 16.33333 but I want it to be rounded do use An integer for EStHo which gives me 16
my problem with this is it doesn't take into account the current month or maybe I'm being a dunce lol
So What I did Originally was work around the current week like:
Code:
SCalc = StHo / 52 'Get Bass Rate For Year
Wk = Format(Date, "ww") 'What week are we on
Wk = 52 - Wk 'How many weeks are left in the year
Ial = Wk * SCalc 'Calc Number of days Ial Is A Integer As want whole number
'!DaysWorking gets it's value from the shifts System
EStHo = !DaysWorking * Ial 'Get Statutary Allowence
I have confired the value stored in preferences I.E. 5.6 and the Daysworking are stored in an employees record which is updated from the shifts system which is selected when an employee is added.
this function is for when an new employee is added or there shift pattern is altered.
my question is can anybody better at math than me "That will be most people" see if there is a better way or correct what I Have done
I do think I will have to except a value like 17.5 instead of rounded up to 18 which it gives at the moment