Primefaces Datatable rowindex after using summaryrow - jsf

I am using primefaces datatable with a rowIndexVar="rowIndex" property for a Sl. No. column used as so : value="#{rowIndex+1}"
I am also using summaryRow where I calculate total hours , sorted by date and employee. I wanted to know if I could start with a fresh rowIndex from 1 after each summaryRow. Right now it goes from 1 till the size of the list,but I want it like ->
1 10/03/2015 7:00 am 8:00 am 1 hr
2 10/03/2015 8:30 am 10:00 am 1.5 hr
-------------------------------------------------------
<summaryRow> Total hours worked for 10/03/2015 : 2.5 hr
-------------------------------------------------------
1 11/03/2015 7:00 am 9:00 am 2 hr
2 11/03/2015 9:05 11:05 am 2 hr
-----------------------------------------------------
<summaryRow> Total hours worked for 11/03/2015 :4 hr
------------------------------------------------------
Instead of it being continuously
1
2
3
4 ..etc

No, sorry. This is not possible. Closest you can come is use your own numbers dynamically in model

Related

How to dynamically calculate the overtime left and the overtime used without a circular reference in Excel?

The goal is to fix a circular reference in my logic in this "two weeks pay" input workbook.
It's a temporary sheet for when people are outside the office and can't access the system.
That said, that sheet still should give them accurate data.
There's 26 sheets that contains the times done by an employee for example, in a typical format, for 2 weeks in each (a year in total).
Stripped of all formatting and non-useful information for this enquiry, they would look somewhat like this (with proper dates) :
+-----------+----------+--------+----------+--------+-------+------+
| Date | AM start | AM end | PM start | PM end | total | over |
+-----------+----------+--------+----------+--------+-------+------+
| Monday | 8:00 | 12:00 | 13:00 | 16:00 | 7:00 | 0:00 |
+-----------+----------+--------+----------+--------+-------+------+
| Tuesday | 8:00 | 12:00 | 13:00 | 15:00 | 6:00 | 0:00 |
+-----------+----------+--------+----------+--------+-------+------+
| Wednesday | 8:00 | 12:00 | 13:00 | 17:00 | 8:00 | 1:00 |
+-----------+----------+--------+----------+--------+-------+------+
| ... | .... | .... | .... | .... | .... | .... |
+-----------+----------+--------+----------+--------+-------+------+
Then on another sheet, there's some calculation has to what is the paid amount (maximum 70 hours per 2 weeks), the overtime done that has to be paid, etc.
A B C D E F G
+-------+------------+----------+---------------+-----------------------+-------+---------------------+
1 | Pay # | Hours paid | Overtime | Used overtime | Total hours worked | | Total overtime left |
+-------+------------+----------+---------------+-----------------------+-------+---------------------+
2 | 1 | 70:00 | 5:00 | 0:00 | 75:00 | | 0:00 |
+-------+------------+----------+---------------+-----------------------+-------+---------------------+
3 | 2 | 70:00 | 0:00 | 5:00 | 65:00 | | |
+-------+------------+----------+---------------+-----------------------+-------+---------------------+
4 | ... | ... | ... | .... | | | |
+-------+------------+----------+---------------+-----------------------+-------+---------------------+
In the above table, the pay #2 got 70 hours paid, but the person would have done only 65 hours and used 5 hours of the overtime done the past two weeks.
A1:E4 is connected together, G1:G2 is data by itself, not linked to the pay numbers or other data in that sheet (in other words, there is only one cell that contains that total overtime left and F is used to separate both tables).
G2 currently have 0:00 because the 5:00 it would have had has been used to complete the second pay.
The Hours paid cell (B) contains this formula :
=IF($E$2>=2.91666666666667,2.91666666666667,IF((2.91666666666667- $E$2)<=$G$2;2.91666666666667,$E$2+$D$2))
Step 1 [condition] : If the total hours worked for that two weeks is greater than or equals to 70 hours (the 2.91666666666667 is used here instead of "70:00" to make the comparison works);
Step 1.1 [true] : Then put "70:00" in the cell because there's a 70 hours maximum per two weeks (this is fine since we have another cell that stores the overtime done (in this example, C));
Step 1.2 [false->condition] : Else, the total hours worked for that two weeks is lower than 70 hours so check if 70 hours minus the total hours worked for that two weeks is lower than the total overtime left to be used (used to check if there's overtime left that can be used this time to make the pay the highest it can be up to a maximum of 70 hours);
Step 1.2.1 [true] : If it is, put 70 hours because we'll use some of the overtime left to be paid to complete this two weeks;
Step 1.2.2 [false] : Otherwise, put the total hours worked for that two weeks added to the used overtime for that week (this cell is explained later with her formula and this step is for when there's overtime left, but not enough to make it go up to 70 hours so we put the amount of time it ends up being).
The important part here is to remember that B needs D, hence why I explained it's formula.
The Overtime (C) and "Total hours worked" (E) cells contains basic formulas that either gives the amount of time over 70 hours or the total hours worked; no need to explain it here, it works.
The Used overtime cell (D) is where it gets tricky. To explain it, we'll need to know what's up with G2.
The Total overtime left cell (G2) is the total of overtime hours minus the sum of all cells in D (used overtime).
It's purpose is to get an up to date value of how much overtime there is left to be paid.
Back to Used Overtime.
You probably start to see circular reference here; D needs G2 to work and G2 is the sum of all cells in D (in the table range, not all of them).
The formula requires the notion of how much overtime there is left so it can check if we can use some.
Here's the formula :
=IF($E$2>=2.91666666666667,"00:00",IF((2.91666666666667-$E$2)<=$G$2,(2.91666666666667-$E$2),IF(($G$2+$E$2)<=2.91666666666667,$G$2,"00:00")))
Step 1 [condition] : If the total hours worked for that two weeks is greater than or equals to 70 hours;
Step 1.1 [true] : Then put 0 hours since that pay is already at the 70 hours maximum;
Step 1.2 [false->condition] : Else, the total hours worked for that two weeks is lower than 70 hours and could grow higher if we still have overtime to be paid so check if 70 hours minus the total hours worked for that two weeks (the amount of time we could add from the overtime left) is lower than or equals to the total overtime left to be paid;
Step 1.2.1 [true] : Then put 70 hours minus the total of hours worked for that two weeks (the amount of time we will add from the overtime left to make this pay grows to the maximum of 70 hours);
Step 1.2.2 [false->condition] : Otherwise, check if the total overtime left added to the total of hours worked for that two weeks is lower than or equals to 70 hours (if so, then it means that we can add all the overtime left here without getting over 70 hours);
Step 1.2.2.1 [true] : If it is then the value is the total overtime left since it will make the total hours worked for that two weeks still be under the maximum yet pay for the overtime that was left to be paid;
Step 1.2.2.2 [false] : Otherwise, put 0 hours since we will not be adding overtime to this pay because there is no overtime left to be added.
How could I both have the accurate overtime left and yet have the used overtime both dynamically calculating themselves without a circular reference ?
What if every row had an up to date value for Total Overtime Left after that pay period?
Formula for G2: =C2-D2
Then every G cell after that only needs to add the Overtime Left from the previous pay period + overtime - used overtime:
G3: =G2+C3-D3
And it just goes on from there.

Customizing Weekday/Workday Function to reflect actual working hours

So my company services clients with insurance products and we have two teams: Liability and Crime. There are generally one 4 different types of task: Binding, Issuance, Quoting and Rapids.
I currently have made a spreadsheet based on data obtained through our workflow.
The main formulas I use to calculate service due date for Crime/Liability team is:
=IF(OR(WEEKDAY(IF(A2="Binding",C2+(1/8),IF(A2="Quoting",C2+(1/8),IF(A2="Issuance",C2+2,IF(A2="Rapids",C2+(1/8),"")))))=1,WEEKDAY(IF(A2="Binding",C2+(1/8),IF(A2="Quoting",C2+(1/8),IF(A2="Issuance",C2+2,IF(A2="Rapids",C2+(1/8),"")))))=7,IF(A2="Binding",C2+(1/8),IF(A2="Quoting",C2+(1/8),IF(A2="Issuance",C2+2,IF(A2="Rapids",C2+(1/8),"")))))+2,IF(A2="Binding",C2+(1/8),IF(A2="Quoting",C2+(1/8),IF(A2="Issuance",C2+2,IF(A2="Rapids",C2+(1/8),"")))))
Where you have 3 hours to finish binding, quoting, rapids, and you have two days for issuance.
We are now expanding our service to California, which is three hours behind EST time, so now comes the issue: We want to expand our working hours (est time) to 9 am - 8 pm to cover west coast. But, does is it possible to tell excel to do that via a weekday/workday function?
The goal is to have the due dates wrap around weekends to Monday and anything after 8 pm (est time) to being due next day.
For example: If a binding task comes in at 7:00 pm, then you would have 1 hour till 8 pm, and so the task would be due at 11:00 am the next day. Is this even possible to do with just excel? Any help would be immensely appreciated guys, thank you!
Your formula can be simplified greatly if you have a lookup table in your workbook somewhere that returns the due time values. For the example below, my lookup table is in Sheet2, A1:
Sheet 1 - Example Data
| A | ... | C | D |
+--------+ ... +-----------------+----------------+
1 | Task | | Received | Due |
2 |Binding | |19/02/2018 09:00 |19/02/2018 12:00|
3 |Quoting | |19/02/2018 13:00 |19/02/2018 15:00|
Sheet 2 - Lookup table:
| A | B |
+--------+-------+
1 |Binding | 0.125 |
2 |Quoting | 0.125 |
3 |Issuance| 2 |
4 |Rapids | 0.125 |
Formula
The formula in Sheet1 D2 is:
=C2+INDEX(Sheet2!B:B,MATCH(Sheet1!A2,Sheet2!A:A,0))
From there it should be a lot simpler to construct an IF STATEMENT to rollover to the next day if the order is received past 5pm (would be due after 8pm).

Excel | Populate multiple cells based on If condition

I have a sheet full of staff names with their breaks (every staff has 3 breaks) and on the other side I have intervals list for the time written horizontally in 1 row [00:00,00:05,00:10...etc Untill you reach 23:55]
I want excel to populate the interval cells based on the break duration.
So, If John Doe is on break from 00:05 to 00:20. I want to populate the intervals from 00:05 to 00:20 with number 1, and If another staff's break is falling within the same duration, that will add another 1 to make it 2.
my table structure as follows:
Emp ID | Emp Name | Break Start | Break End | Duration (15 min or 20 min) 00:00|00:05|00:10|00:15|00:20|00:25 ....etc
123 | John Doe | 00:05 | 00:20 | 00:15 1 1 1
456 | Richard | 00:10 | 00:25 | 00:15 1 1 1
What I already have as Formula, Is =IF(The break start cell = The Interval Cell,1,0) , But It only populates the interval cell which equals the break start, Ignoring the other adjacent cells that needs to be populated also according to the break duration. like we did above in the structure.
Thanks Guys! :)
You want:
=IF(AND(The Interval Cell >= The break start cell , The break start cell + Duration Cell > The Interval Cell),1,0)

Daily and Hourly Averages from (m/d/yyyy h:mm) timestamps in Excel

I have an Excel 2007 spreadsheet with date entries in this format m/d/yyyy h:mm (one cell). I would like find the hourly and daily average of all the columns of this spreadsheet and save each time aggregation to a new worksheet.
The data is recorded every ~10 minutes, but throughout the dates of data collection there was some time slips. Not every hour has the same number of rows. Also, the ending minute is either 0 or 6 depending on the time correction.
What would be a good way to approach this task within Excel 2007? It seems like this might be possible with a pivot table if I can create a formula that will select the correct range for the timestamps. Thanks.
For example, an date time entry in TIMESTAMP, 10/31/2012 0:06 which is in one cell.
TIMESTAMP Month Day Year Hour Min Rain_mm Rain_mm_2 AirTC AirTC_2 FuelM FuelM_2 VW ... there are ~16 variables (total) after the data time
10/31/2012 0:06 10 31 2012 0 06 0 0 26.11 26.08 2.545 6.4 0.049
10/31/2012 0:16 10 31 2012 0 16 0 0 25.98 25.97 2.624 6.6 0.049
10/31/2012 0:26 10 31 2012 0 26 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:36 10 31 2012 0 36 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:46 10 31 2012 0 46 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:56 10 31 2012 0 56 0 0 25.87 25.87 2.753 7.3 0.049
10/31/2012 1:06 10 31 2012 0 06 0 0 25.74 25.74 2.879 8.1 0.051
## The above is just over one hour of collection on one day ##
...
## Different Day ### Notice Missing Time Stamp
11/30/2012 0:00 11 30 2012 0 06 0 0.1 26.12 26.18 2.535 6.4 0.049
11/30/2012 0:10 11 30 2012 0 16 0 0.1 25.90 25.77 2.424 6.6 0.049
11/30/2012 0:20 11 30 2012 0 26 0.1 0.2 24.12 24.43 2.542 6.4 0.046
11/30/2012 0:30 11 30 2012 0 36 0.1 0 24.22 22.32 2.543 6.5 0.048
11/30/2012 0:50 11 30 2012 0 56 0.1 0.2 26.77 25.87 2.743 6.3 0.049
11/30/2012 1:00 11 30 2012 0 06 0 0 24.34 24.77 2.459 5.1 0.050
## so forth on so on ##
After clarification of the requirement for daily averages edited to cover both daily and hourly averages:
Add a column (here B) for ‘H’ (ie hour) with =HOUR(A2) copied down.
(Note: Though formatted to show only m/d/y content of ColumnA is, in line with title, assumed to be all of mm/dd/yyyy hh:mm. Makes existing columns [with names jumbled] Month, Day, Year, Hour redundant).
Select data range.
Data, Subtotal, At each change in: TIMESTAMP, Use function: Average, Add subtotal to: check only columns G and to the right, OK.
Uncheck Replace current subtotals in Subtotal and apply At each change in: H, Use function: Average, and Add subtotal to: as before, OK.
Replace =SUBTOTAL(1, in Min column with =MIN( .
Delete ‘spare’ Grand Average row.
Reformat as required.
Hopefully this will be achieved and is what is required!:
Note midnight 'tonight' is counted as within first hour of tomorrow.
I had a similar need and worked it out this way:
Add a column for Date (assuming your dd/mm/yyyy hh:mm:ss data is in cell A2)
=DATE(YEAR(A2),MONTH(A2),DAY(A2))
Add a column for Year. If you have weeks from a single year, the year column can be neglected.
=YEAR(A2)
Add a column for Week Number
=WEEKNUM(A2)
Add 2 pivot tables, 1 for daily and 1 for weekly analysis.
Choose fields "Date" and the quantities you want. Put "Date" in the Rows section and sum/average of values in the Values section. You will get a date wise sum/average of the values you need.
In the weekly pivot table, do the same as above, just add "Year" and "Week no" in the Rows section instead of "Dates" as in above.
Hope this helps

MDB query for Time

I have table as
Id Name Date Time
1 S 1-Dec-2009 9:00
2 N 1-Dec-2009 10:00
1 S 1-Dec-2009 10:30
1 S 1-Dec-2009 11:00
2 N 1-Dec-2009 11:10
Need query to display as
Id Name Date Time
1 S 1-Dec-2009 9:00
1 S 1-Dec-2009 11:00
2 N 1-Dec-2009 10:00
2 N 1-Dec-2009 11:10
My backend database is MS Access and using VB6 for Max and Min time
I would make an additional two [int] columns, say hour and minute and then use an MS Access query to sort them. It would be MUCH easier to call that in VB. The query itself would be something like the following:
SELECT * FROM YOURTABLE ORDER BY id, hour, minute;

Resources