worknova.manus/cron/cronjob.php
LAPTOP-V9RRD1TL\Michelle's Computer f8f8fcaf96 first commit
2025-07-21 21:38:17 +08:00

70 lines
4.1 KiB
PHP

<?php
include '../connect/cms-config.php' ;
$current_timestamp = time() ;
$current_year = date( "Y", $current_timestamp ) ;
$current_month = date( "m", $current_timestamp ) ;
$current_day = date( "d", $current_timestamp ) ;
$current_hour = date( "H", $current_timestamp ) ;
$current_minute = date( "i", $current_timestamp ) ;
// run every minutes
if ( $CRONJOBS['rms_pay_bill'] == 'yes' ){ file_get_contents( PATH . 'cron/rms_pay_bill.php' ) ; }
if ( $CRONJOBS['rms_prepaid_check_status'] == 'yes' ){ file_get_contents( PATH . 'cron/rms_prepaid_check_status.php' ) ; }
if ( $CRONJOBS['generate_attendance'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_attendance.php' ) ; }
if ( $CRONJOBS['push_notification'] == 'yes' ){ file_get_contents( PATH . 'cron/push_notification.php' ) ; }
if ( $CRONJOBS['punchs/user'] == 'yes' ){ file_get_contents( PATH . 'apiv3/punchs/user.php' ) ; }
// run every day in 00:00
if ( $current_hour == 0 && $current_minute == 0 ){
if ( $CRONJOBS['generate_leave_day'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_leave_day.php' ) ; }
}
// run every day in 08:00
if ( $current_hour == 8 && $current_minute == 0 ){
if ( $CRONJOBS['push_task_notification'] == 'yes' ){ file_get_contents( PATH . 'cron/push_task_notification.php' ) ; }
if ( $CRONJOBS['push_holiday'] == 'yes' ){ file_get_contents( PATH . 'cron/push_holiday.php' ) ; }
if ( $CRONJOBS['push_passport_permit_leave_advance'] == 'yes' ){ file_get_contents( PATH . 'cron/push_passport_permit_leave_advance.php' ) ; }
if ( $CRONJOBS['push_application_form_reminder'] == 'yes' ){ file_get_contents( PATH . 'cron/push_application_form_reminder.php' ) ; }
}
// run every day in 09:35 & 14:35
if ( ( $current_hour == 9 && $current_minute == 35 ) ||
( $current_hour == 14 && $current_minute == 35 ) ){
if ( $CRONJOBS['generate_attendance_to_text'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_attendance_to_text.php' ) ; }
}
// run every first day of month, because got year end cut off function, the other cronjob need to delay 1 hour
if ( $current_day == 1 && $current_hour == 0 && $current_minute == 0 ){
if ( $CRONJOBS['generate_staff_achievement'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_staff_achievement.php' ) ; }
}
// run every month and give point
if ( $current_day == 1 && $current_hour == 1 && $current_minute == 0 ){
if ( $CRONJOBS['generate_monthly_performance_point'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_monthly_performance_point.php' ) ; }
if ( ( $current_month == 1 || $current_month == 4 || $current_month == 7 || $current_month == 10 ) ){ // runing report by seasonly
if ( $CRONJOBS['generate_seasonly_improvement_point'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_seasonly_improvement_point.php' ) ; }
}
}
// run every 10 days of month, because need count full attendance report
if ( $current_day == 10 && $current_hour == 0 && $current_minute == 0 ){
if ( $CRONJOBS['generate_monthly_attendance_point'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_monthly_attendance_point.php' ) ; }
}
// run every 25 days of month, because generate salary
if ( $current_day == 25 && $current_hour == 9 && $current_minute == 0 ){
if ( $CRONJOBS['push_staff_resignation'] == 'yes' ){ file_get_contents( PATH . 'cron/push_staff_resignation.php' ) ; }
}
// run every 27 days of month, because generate salary
if ( $current_day == 27 && $current_hour == 0 && $current_minute == 0 ){
if ( $CRONJOBS['generate_payment_slip'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_payment_slip.php' ) ; }
}
// run seasonly to summary report
if ( $current_day == 15 && $current_hour == 0 && $current_minute == 0 ){
if ( $CRONJOBS['generate_seasonly_summary_point'] == 'yes' ){ file_get_contents( PATH . 'cron/generate_seasonly_summary_point.php' ) ; }
}
?>