Page 1 of 1

Mass Punch of weekdays in CV 12.6.5

Posted: Fri Feb 12, 2021 9:07 am
by andy
I just installed a new version after using a *much* older version and there used to be a Mass Punch function where you could select 1 or more people and give them an in-punch at a particular time for a range of dates. The old version has the option to do weekdays only by selecting which of the 7 days to include.

I'm not seeing that on the current version (CV 12.6.5). There is a grayed out thing called Mass Edit.... if that is where I should do what I want, how to I enable it?

I found a way to semi-do a mass punch for one person by selecting a range of dates before doing the punch, but there is no automatic way to omit the weekends.

In a related question, is there a way to set up a schedule where people are supposed to work M-F only? Would that solve this somehow?

Thanks!!!!

Re: Mass Punch of weekdays in CV 12.6.5

Posted: Fri Feb 12, 2021 9:28 am
by shaunw
Attendance -> Punches, click "New", then click the icon in the date field to open the date selection box, there you can select a range or any number of individual dates that you wish. Not quite as easy as just picking M-F, but slightly more flexible.

If you are primarily interested in auto-punching employees, the Professional Edition of TimeTrex offers the capability to fully automate that on any recurring basis.

Re: Mass Punch of weekdays in CV 12.6.5

Posted: Sun Feb 14, 2021 2:18 pm
by andy
Can you point me to where I can access the code that generates and deals with the screen to enter a date range and individual date entry? I'd like to try to modify it by adding a button that filters weekdays.

Thanks!

Re: Mass Punch of weekdays in CV 12.6.5

Posted: Mon Feb 22, 2021 6:18 am
by andy
Still hoping for a little help. Where in the installation can I find the code to creates this page and submits the data of what punches to add?

URL:
localhost/timetrex/interface/html5/?desktop=1#!m=TimeSheet&user_id=05bb247f-e465-479a-b963-692f581b6f47&show_wage=0&mode=punch&a=new&t=punch&tab=Punch

Looks like:

Image

Thanks!

Re: Mass Punch of weekdays in CV 12.6.5

Posted: Tue Feb 23, 2021 5:38 am
by andy
Looks like this is happening in this file:
/usr/share/timetrex/html/interface/html5/views/attendance/punches/PunchesViewController.js

Is that correct?

Is this where to do additional parsing of the dates to check the day of week before adding them to the list?

parserDatesRange( date ) {
var dates = date.split( ' - ' );
var resultArray = [];
var beginDate = Global.strToDate( dates[0] );
var endDate = Global.strToDate( dates[1] );

var nextDate = beginDate;

while ( nextDate.getTime() < endDate.getTime() ) {
resultArray.push( nextDate.format() );
nextDate = new Date( new Date( nextDate.getTime() ).setDate( nextDate.getDate() + 1 ) );
}

resultArray.push( dates[1] );

return resultArray;
}

----------------


Is there any documentation about how the data is dealt with here:
buildMassEditSaveRecord( mass_edit_record_ids, changed_fields ) {
var $this = this;
var mass_records = [];
$.each( mass_edit_record_ids, function( index, value ) {
var common_record = Global.clone( changed_fields );
common_record.id = value;
mass_records.push( common_record );
} );
return mass_records;
}

buildMassAddRecord( current_edit_record ) {
var record = [];
var dates_array = current_edit_record.punch_dates;

if ( dates_array.indexOf( ' - ' ) > 0 ) {
dates_array = this.parserDatesRange( dates_array );
}

for ( var i = 0; i < dates_array.length; i++ ) {
var common_record = Global.clone( current_edit_record );
delete common_record.punch_dates;
common_record.punch_date = dates_array[ i ];
var user_id = this.current_edit_record.user_id;

if ( Global.isArray( user_id ) ) {
for ( var j = 0; j < user_id.length; j++ ) {
var final_record = Global.clone( common_record );
final_record.user_id = this.current_edit_record.user_id[ j ];
final_record = this.uniformVariable( final_record );
record.push( final_record );
}
} else {
common_record = this.uniformVariable( common_record );
record.push( common_record );
}

}
-----------
Thanks!