|
|
@ -26,7 +26,14 @@ TIMESHEET=$(ls "$TIMESHEET_DIR" | grep ".csv")
|
|
|
|
# generated by clock in
|
|
|
|
# generated by clock in
|
|
|
|
CURRENT_SESSION="$TIMESHEET_DIR/.session"
|
|
|
|
CURRENT_SESSION="$TIMESHEET_DIR/.session"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createTimesheet() {
|
|
|
|
createTimesheet() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# creates directory on fresh installs
|
|
|
|
|
|
|
|
if [[ ! -d "$TIMESHEET_DIR" ]] ; then
|
|
|
|
|
|
|
|
mkdir -p "$TIMESHEET_DIR"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
payperiods=$((($(date +%s) - $(date -d "Dec-30-22" +%s)) / (14*24*3600)))
|
|
|
|
payperiods=$((($(date +%s) - $(date -d "Dec-30-22" +%s)) / (14*24*3600)))
|
|
|
|
period_end=$(date -d "Dec-30-22 + $((($payperiods + 1) * 14)) days" +%b-%d-%y)
|
|
|
|
period_end=$(date -d "Dec-30-22 + $((($payperiods + 1) * 14)) days" +%b-%d-%y)
|
|
|
|
TIMESHEET=$(printf "%s.csv" "$period_end")
|
|
|
|
TIMESHEET=$(printf "%s.csv" "$period_end")
|
|
|
@ -44,6 +51,11 @@ getTimesheet() {
|
|
|
|
period_end=$(date -d "$(echo "$TIMESHEET" | awk -F . '{print $1}') + 1 days" +%s)
|
|
|
|
period_end=$(date -d "$(echo "$TIMESHEET" | awk -F . '{print $1}') + 1 days" +%s)
|
|
|
|
if [[ $(date +%s) -ge $period_end ]] ; then
|
|
|
|
if [[ $(date +%s) -ge $period_end ]] ; then
|
|
|
|
# past timesheet, moving to archive and creating new
|
|
|
|
# past timesheet, moving to archive and creating new
|
|
|
|
|
|
|
|
# creates directory on fresh installs
|
|
|
|
|
|
|
|
if [[ ! -d "$ARCHIVE_DIR" ]] ; then
|
|
|
|
|
|
|
|
mkdir -p "$ARCHIVE_DIR"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
mv "${TIMESHEET_DIR}/${TIMESHEET}" "$ARCHIVE_DIR"
|
|
|
|
mv "${TIMESHEET_DIR}/${TIMESHEET}" "$ARCHIVE_DIR"
|
|
|
|
createTimesheet
|
|
|
|
createTimesheet
|
|
|
|
fi
|
|
|
|
fi
|