first commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
include '../connect/cms-config.php' ;
|
||||
include '../requires/function.php' ;
|
||||
|
||||
|
||||
$staffs_q = $mysqli->query("SELECT staff_id, staff_star, staff_point_achievement, staff_achievement FROM staff
|
||||
WHERE deleted_at IS NULL AND ( staff_date_resigned >= '".date("Y-m-d",time())."' OR staff_date_resigned = '0000-00-00' OR staff_date_resigned IS NULL )") ;
|
||||
|
||||
if ( $staffs_q->num_rows > 0 ){
|
||||
|
||||
$yesterday_day = date( 'Y-m-d', strtotime( '-1 days' ) ) ;
|
||||
|
||||
while ( $staff = $staffs_q->fetch_assoc() ){
|
||||
|
||||
|
||||
|
||||
|
||||
$staff_id = $staff['staff_id'] ;
|
||||
$staff_star = $staff['staff_star'] ;
|
||||
$staff_point_achievement = $staff['staff_point_achievement'] ;
|
||||
$staff_achievement = $staff['staff_achievement'] ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$mysqli->query( "INSERT INTO staff_monthly_achievement
|
||||
( reported_at, staff_id, staff_point_achievement, staff_star, staff_achievement ) VALUES
|
||||
( '".$yesterday_day."', '".$staff_id."', '".$staff_point_achievement."', '".$staff_star."', '".$staff_achievement."' )" ) ;
|
||||
|
||||
|
||||
|
||||
|
||||
$staff_point_achievement = ( $staff_point_achievement <= 0 ? $staff_point_achievement : 0 ) ;
|
||||
|
||||
$mysqli->query( "UPDATE staff SET
|
||||
staff_star = '0',
|
||||
staff_point_achievement = '".$staff_point_achievement."'
|
||||
WHERE staff_id = '".$staff_id."'" ) ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user