Work day calculator
Hi All, I'd like to do a function in Numbers whereby a day is considered as 8h and I can then multiply a day rate by this.
I want to enter the data as days and hours.
eg:
Header 1
Duration
Day rate
Header 4
01d 4h -> (this is calculated as 1.5 days)
$400
$600
01d 9h -> (automatically corrects to 2d 1hr -> 2.125)
$400
$850
0d 5h -> (calculated as .625 days because 8hr day)
$400
$250
any help appreciated
I think you will add lots of complexity trying to use the duration (which can represent Weeks Days Hours Minutes Seconds and Milliseconds)
If you enter in hours only (just a number like, 12) not as a duration ("1d 4h" or "12h") you can computer Work Days like this.
Assume you enter work hours in cell B2 AND
that a work day is the same as 8 hours
C2=B2/8
Similar Messages
-
How is lead time in working days calculated in 2LIS_05_QVUDN
I was wondering if someone knows how lead time is being caclulated for 2LIS_05_QVUDN. I've found the tables associated and the function module but I can't find the actual calculation
ThanksHello
The lead time in working days works like this
If you have 1 inspection lot for a material -the time from Lot creation to Usage decision given is the lead time.
Lot created Usage Decision made Lead Time
for eg Material X , inspection lot no 14/05/2008 10: 00 14/05/2008 14: 00 4 Hours
it converts the hours in to days . =4/24= 0.16 days
For total lead time individual lot's lead time sum is calculated
Hope this clarifies your doubt
Regards
gajesh -
Hi
I want to be able to calculate the difference between two dates on my form minus weekends. Is there a way to do this?.
I have two Date/time fields one for depart and one for arrive, and i have a numerical field which contains the difference in days.
I have the following FormCalc code on the numerical field calculate event.
Date2Num(form1.page4.section11.sect11Body.arrivalDate.rawValue, "YYYY-MM-DD") - Date2Num(form1.page4.section11.sect11Body.departureDate.rawValue, "YYYY-MM-DD")
This works, but i want to know if its possible to calculate only the working days.
For eg. Depart Thurs 12th July
Returning Wed 18th July
Would equate to: 6 days or 4 working days.
I've had a look for some javascript but couldn't find anything.
Any ideas?
thanksHello dbuchanan,<br /><br />Same as above, I have two date fields called "leaveStart" and "leaveEnd" respectively. Leave starts on the first day absent, and leave ends on the first day back at work. No scrips in any of these.<br />Then I have a numeric field called "numDays" - read only. In this field I use this JavaScript in the 'calculate' propertyy: <br /><br />// An array with this years public holidays<br />//Should probably be a bit more dynamic than this<br />var hdayar = [<br /> "2007/01/01", <br /> "2007/03/21", <br /> "2007/04/06", <br /> "2007/04/09", <br /> "2007/04/27", <br /> "2007/05/01", <br /> "2007/06/16", <br /> "2007/08/09",<br /> "2007/09/24",<br /> "2007/12/16",<br /> "2007/12/17",<br /> "2007/12/25",<br /> "2007/12/26",<br /> "2008/01/01"];<br /><br />var startBox = xfa.resolveNode("leaveStart");<br />var endBox = xfa.resolveNode("leaveEnd");<br /><br />/***Clear field at every 'calculate' event***/<br />this.rawValue = "";<br /><br />/***Leave***/<br />// Only calculate further if both the start and end dates are known<br />if ((startBox.rawValue) && (endBox.rawValue)){ <br /> var start = util.scand("yyyy-mm-dd", startBox.rawValue);<br /> var end = util.scand("yyyy-mm-dd", endBox.rawValue);<br /> var lsday = start.getDay();<br /> var leday = end.getDay();<br /> <br /> // Exit if ether start or the end date falls on a Sunday (0) or Saturday (6)<br /> if (((lsday == 0)||(lsday == 6))||((leday == 0)||(leday == 6))) {<br /> }<br /> <br /> // only calculate further if the end date after the start date <br /> else if (end.getTime() > start.getTime()){<br /><br /> //calculate number of days<br /> var days = end.getTime() - start.getTime();<br /> days = Math.floor(days / (1000 * 60 * 60 *24)); //remove decimals<br /> <br /> //calculate number of weeks<br /> var modulo = (days)%7;<br /> var fweeks = days - modulo;<br /> var weeks = (fweeks)/7;<br /> <br /> //calculate number of week-end days<br /> var we_days = weeks * 2;<br /> if (leday < lsday){<br /> we_days = we_days + 2<br /> }<br /> <br /> //test for public holidays<br /> var phdays = 0;<br /> for (var i = 0; i <hdayar.length; i++){<br /> if ((Date.parse(hdayar[i]) >= Date.parse(start)) && (Date.parse(hdayar[i]) <= Date.parse(end))) {<br /> phdays ++;<br /> }<br /> }<br /> <br /> //total workdays is days - weekends - publick holidays<br /> this.rawValue = days - we_days - phdays;<br /> }<br />}<br /><br />So now we handle weekends and holidays correctly - I think. Until someone finds the other bugs in here :-)<br /><br />Regards<br />Jan
-
Hello Folks,
Any idea about the Std Variable for the last working day calculation.
I have a customised Characteristics to which I want to use this variable then what steps should I follow or by installing it through content will it directly get attached, I mean will be available while choosing the variables for this characteristics in a query.
Thanks,
Suyog.Hi,
Create a customer exit variable to get last working day of the month and write the following logic in ZXRSRU01:
*Last working day of the given period(Cal Yr/Month)
WHEN '<Customer exit variable>'.
DATA : BEGIN OF i_holidays OCCURS 0.
INCLUDE STRUCTURE iscal_day.
DATA : END OF i_holidays,
v_fdate LIKE sy-datum,
v_ldate LIKE sy-datum.
IF i_step = 2.
READ TABLE i_t_var_range INTO loc_var_range
WITH KEY vnam = '<Cal yr/month selection variabel>'.
IF sy-subrc = 0.
CONCATENATE loc_var_range-low
'01' INTO v_fdate.
* to get last day of the given period
CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
EXPORTING
day_in = v_fdate
IMPORTING
last_day_of_month = v_ldate.
*To get holiday list in the given period
CALL FUNCTION 'HOLIDAY_GET'
EXPORTING
holiday_calendar = <Fact cal ID>
factory_calendar = <Fact cal ID>
date_from = v_fdate
date_to = v_ldate
TABLES
holidays = i_holidays.
SORT i_holidays BY date DESCENDING.
DELETE ADJACENT DUPLICATES FROM i_holidays.
DO.
READ TABLE i_holidays WITH KEY date = v_ldate.
IF sy-subrc NE 0.
v_ldate = v_ldate - 1.
ELSE.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = v_ldate.
APPEND l_s_range TO e_t_range.
CLEAR:l_s_range.
EXIT.
ENDIF.
ENDDO.
ENDIF.
ENDIF.
Assumptions:
Running a report by entering Cal yr/month as selection value.
hope it works...
regards,
Raju -
Calculation of no. of working days (per Factory Cal) between 2 date chars
This question could be considered to be in continuation of a previous post called "Working days of month with factory calendar"
I have two date Characteristics: say Date1 and Date2. I need to find the number of working days between them based on the factory calendar.
(And yes we have already defined the default factory calendar in IMG under 'General Reporting settings' ).
The previous post proposed the following:
1) Convert date1 into factorydate (standard functionmodule)
2) Convert date2 into factorydate (standard functionmodule)
Perform date1 - date2 to get number of working days.
I agree that there is a std function module to convert cal date to factory date called: 'DATE_CONVERT_TO_FACTORYDATE'
But what are the steps for calling the conversion? Should I create a new Formula variable of 'Customer Exit type' give it a name and define the Function module in CMOD? But then how do I attach the formula variable to the date characteristic. Note that my infoobjects are Chars so I cannot do date1- date2 in the query as is possible with keyfigures!
Please help! (my version is BW 3.0)
Thanks
NareshHi,
For the above scenario when you need to calculate date 1 - date 2. we can't build a new formulae or calculated KF directly because those are the chars.
So we need make chars to act as KF through Formulae with replacement path.
create a formulae variable on those 2 Date chars with Processing type as replaccement then those 2 Dates can be avilable to build a formulae as ur requirement.
Let me know if you need any more information.
Thanks,
Raju -
How to set the payment Due date calculation as per working days.
how to make changes in the vendor Payment terms so that while calculating the Payment due date as per Payment terms, system calculates it based on Working Days & not the Calender days ?
Help is much appriciated.
Thank you,
AmitHi,
This is the standard settings by SAP, normally we couldn't change it to working day.
Good luck
Tao -
Date calculations based on working days
I need to add date calculations to a worksheet to show the time elapsed between two actions.
Just a straightforward subtraction works fine, but what I really need to be able to do is calculate the number of working days between the two point (as something taking 5 days over Christmas with the 2 bank holidays is different equivalent to something taking 3 days in a normal week)
At the moment I'm exporting the data into excel for analysis of this, but would really like to be able to do it in Disco so that the end users can go straight to the report using viewer, rather than having to do the conversion for them.
Is this possible?
CheersHi,
Every thing is possible, the Q is how complicated is it....
My suggestion is to create a table with all the dates of the non-working days for ex:
create a table with all the MON-THURSDAYS, union to this table the holidays you know of such as christmas and so on.
After getting this table you can create a function that returns the number of working days between 1 date to another by subtracting the days exists in this table.
I started with that, you are more then welcome to get ahead with it and let us know what happened...
create table holiday
D_date date,
d_day varchar2(20)
create or replace procedure holiday_proc is
d_date date;
begin
d_date := trunc(sysdate);
while d_date<'01-jan-2010'
loop
if to_char(trunc(d_date),'Day') not in ('Saturday ','Sunday ') then
INSERT INTO Holiday (d_date,d_day)
(select trunc(d_date),to_char(trunc(d_date),'Day') from dual);
end if;
d_date := d_date+1;
end loop;
commit;
end holiday_proc; -
Calculating the planned delivery time in calendar days or working days
Hi,
It seems that there is a way to calculate the planned delivery time in calendar days instead of working days.
When I use the "Planned delivery time calculation" (WPDTC), in Evaluation Options, I got the message :
"Note that follow-on applications are currently interpreting the planned delivery time as calendar days.
If they should be interpreting the planned delivery time as working days, you need to modify these applications. If the planned delivery time should be calculated in working days, there needs to be a factory calendar in Customizing with the calendar ID Country of vendor."
When MRP create a PR -with MDBT, MD03 or MD01- I want my Planned delivery time to be in working days.
I can't manage to make that "If the planned delivery time should be calculated in working days, there needs to be a factory calendar in Customizing with the calendar ID Country of vendor."
I would appreciate your help.
Thanks
PYRHi,
I understand that it makes sense that vendors calendar has to be different (compared to my plant).
But, I still don't understand why in the SAP help, they say "If the planned delivery time should be calculated in working days, there needs to be a factory calendar in Customizing with the calendar ID Country of vendor."
It seems that planned delivery time may follow a calendar.
Thanks,
PYR -
Suggestions on calculating work days instead of Calendar days
Hi there,
I would like for someone to suggest how would I approach a project in calculating a date that would consider if a date is a holiday or a work day. For example: If I take current date + 7 normally it would be a week (7 days). However, if a day in that week is a holiday, then it would return the 8th day. If the 8th day falls into a weekend, then, get the next work date.
Any ideas would be greatly appreciated.
Thanks for your assistance in advance.Thanks. This give me a pretty good start. I am thinking that I need a table that store holidays (Non-work days excluding weekend). Once I load this table into memory, then I would check the first date + 7. Then compare the two dates against the array to see if there is a holiday. If there is, then I would increment the end date by 1 and validay if it is a weekend date. If it is, I would continue to incurement until it is nolonger an weekend date. Once I have that, I would check the date against the array (where I left off) and continue to validate to see if there are more holidays.
What do you think about this approach? -
Sales Order : Calcul delivery date with only working days
HI,
When I create sale order, the delivery date is calculed with the number of days mentionned in type of sale document. SAP add this number of days into the day's date.
Is it possible to calculate this delivery date only with working days in the corporate calendar ???
Thank'sHI
Delivery date in the Sales order will be calculated the calender only basedon the Transportation lead time and Pick/Pack time and excluding the holidays
Please cross the same in your instance
Regards,
Ram. -
Function for calculating working days
Dear Oracle
Is there any function to calculate no of working days if I pass From date & To date?.
Thanks
Christy.This would work for normal weekdays, but what about bank holidays?
They change from country to country, so you need to create a package yourself.
We got one that looks like the following:
create or replace
package body zentr_date_functions as
function eastern (p_year in number) return date is
-- Get easter sunday (working from 1900 to 2099)
-- CKL 02.09.1998 nach c't 18/98
l_a pls_integer;
l_b pls_integer;
l_c pls_integer;
l_d pls_integer;
l_e pls_integer;
l_p pls_integer;
function make_date(p_d in pls_integer, p_m in pls_integer, p_y in pls_integer) return date is
begin
return to_date(to_char(p_d, '00')||to_char(p_m, '00')||to_char(p_y, '0000'), 'DDMMYYYY');
end;
begin
if p_year not between 1900 and 2099 then
return null;
end if;
l_a := mod(p_year, 19);
l_b := mod(p_year, 4);
l_c := mod(p_year, 7);
l_d := mod(19 * l_a + 24, 30);
l_e := mod(2 * l_b + 4 * l_c + 6 * l_d + 5, 7);
l_p := 22 + l_d + l_e;
if l_p > 31 then
if l_p = 56 and l_d = 28 and l_a > 10 then
return make_date(18, 4, p_year);
elsif l_p = 57 then
return make_date(19, 4, p_year);
else
return make_date(l_p - 31, 4, p_year);
end if;
else
return make_date(l_p, 3, p_year);
end if;
end eastern;
function is_workday (p_date in date) return number as
-- is this a working day?
l_eastern date;
begin
if to_char(p_date, 'DY', 'NLS_DATE_LANGUAGE = AMERICAN') in ('SAT', 'SUN') then
return 0;
end if;
if to_char(p_date, 'DDMM') in ('0101', '0105', '0310', '2412', '2512', '2612', '3112') then
-- fixed date bank holidays in lower saxony, Germany
return 0;
end if;
if to_number(to_char(p_date, 'MM')) not between 3 and 6 then
return 1;
end if;
if to_number(to_char(p_date, 'YYYY')) not between 1900 and 2099 then
-- calculation not possible
return null;
end if;
l_eastern := eastern (to_number(to_char(p_date, 'YYYY')));
if trunc(p_date) in (l_eastern - 2, l_eastern + 1, l_eastern + 39, l_eastern + 50) then
-- good friday, easter monday, ascension day, pentecost monday
return 0;
end if;
return 1;
end is_workday;
function workdays_between (p_date1 in date, p_date2 in date) return number as
-- count number of working days between p_date1 and p_date2 (incl. both)
l_count pls_integer := 0;
begin
for i in 0 .. p_date2 - p_date1 loop
l_count := l_count + is_workday(p_date1 + i);
end loop;
return l_count;
end workdays_between;
end;
/ -
We've recently adopted BOBJ/Webi at my company and I find the software to be rather easy to use in some instances and mind-wreckingly hard in others. One roadblock myself and other users are bumping into is calculating work days. A definition of a work day in this instance would be Monday through Friday. The monkey wrench is that we would also like to subtract out holidays, such as July 4th and Thanksgiving. Then end product would be calculating out what work day the current date is and how many days it is out of so that a simple straight-line extrapolation can be made (Metric/Current Work Day)*Total Work Days. Also, what we invoice/ship is not accounted for until the following day... for example, today (2.22.10) would be the 15th workday in February out of 20 total work days.
Appreciate any and all help/assistance/counsel I can get on this.
RyanHi Ryan,
If I have understood your question then I think following solution may help you.
Do you have your Universe created on the top of BW query or is it some other Database?
If it is some other database then create couple of Filter at Universe level: Such as Holidays so that you can use this one to subtract holidays:
For Example:
ucase(Calendar_year_lookup.Holiday_Flag)
ucase(Calendar_year_lookup.Holiday_Flag) = 'Y'
Then you create another Dimension for Work days that would be between Monday to Friday.
Once they are created in Universe you export Universe.
Now create a formula where you would use month minus custom dimension workdays and minus holidays to get actual work days which would be from Monday to Friday and son on.
Basically we can achieve this by using filters and formulas.
Wish you good luck.
Bashir Awan -
Calculating Number of Working Days
Hi All,
I'm creating a crystal report where I have to calculate the Number of Working Days between a date range, this should exclude the Weekends(done) but also exclude the public holidays which have defined in Holidays Calender.
I'm not using procedure , Operating directly with tables.
Any help would be appreciated.
RegardsHello Pari,
Check Exclude Holidays and weekends from Last7Day function link for function to exclude weekends.
and How to query the number of working days between two dates to get holidays defined in holiday calander.
Thanks,
Neetu -
How to show no. of actual working days in Payslip in case of +ve time mgt
Dear Experts,
We have a requirement of showing no. of actual working days in payslip, which should be Calendar Days-(Paid+Unpaid absence). I created an w/t 1WRD for actual working days. Our paid absence w/t is 2006 and unpaid absence is 2005 copied from /845 and /846 respectively, both the absences are included in absence valuation table and working fine in that respect. But issue is i wrote a small PCR for calculating actual working days like below:
ZWRD
NUM=TKSOLL Set
NUM-E 2005
NUM-E 2006
ADDWTE1WRD
But still its fetching full working days i.e. calendar days 30 or 31 not deducting paid or unpaid absence for a month.
Pls help, what else should i do.
Regards
TanSorry, i am unable to paste RT, but its exactly as below
01, April, 2011
1WRD Working days 30.00
2006 Paid Absence 2.00
02, May, 2011
1WRD Working days 31.00
2005 Unpaid Absence 1.00
regards
Tan -
Hi all,
I am searching for a FM which will say 3rd work day of a factory calendar or 4th work day of a factory calendar etc. I could see there are few FMs to say first work day - last work day but not the Nth work day. If we input some date and factory calendar, we should get which work day it is. For example if we give 09/02/2010 and factory calendar name it should return as 2nd workday etc. Any help will be appreciated..
Thanks in advance.
Moderator message: date calculation questions = FAQ, please search before posting.
locked by: Thomas Zloch on Sep 15, 2010 4:39 PMhi,
Please check with this fm DATE_CONVERT_TO_FACTORYDATE.
Keerthi
Maybe you are looking for
-
How do I get iTunes to recognise media on a new external hard drive?
I had moved my entire iTunes library to an external HDD after running out of space on my 2007 Macbook. Unfortunately my HDD then broke so I sent it for data recovery. Now I've got it back I can't seem to be able to get iTunes to automatically recog
-
How do i add a newline or carriage return to make my xml file look pretty?
Hi guys I'm writing an xml file with jsp, the problem is, it writes it in one big chunk of text. e.g. <start>hello, my name is joe</start><middle>I like trees</middle><end>boo</end> Now what I want to do is present this xml file in a decent manner, e
-
hello everybody, i am trying to write a online quize, and for that i used backend access and front end as servlet/jsp with tomcat server, and my program is working very efficiently on same computer, but when there are more than 15 or 10 to computer t
-
Internet Problems - poor connectivity
I have a Lenovo X100e laptop with Windows 7 Professional. It's been a great computer, but when I go on the internet, it behaves as if the connection is slow or wonky, even if the connection is fast. This is especially true of video streaming, which s
-
Has anyone else had issues saving files should hard drive issue force reinstall of Story?
In theory there should be a way to protect one's work offline to one's local hard drive. No one has told me what I've done wrong, nor what to do to get files back. I saved frequently to an external hard drive, saved using the procedure of "save now