query( "SELECT staff_id, staff_idno, staff_name, staff_shortname, staff_image, branch_id 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 ) AND updated_at >= '".date( "Y-m-d H:i:s", strtotime("-1 minutes") )."'" ) ; if ( $select_staff->num_rows > 0 ){ $status = '200' ; $array_branch = [] ; $select_branch = $mysqli->query( "SELECT * FROM branch WHERE deleted_at IS NULL" ) ; if ( $select_branch->num_rows > 0 ){ while ( $row_branch = $select_branch->fetch_assoc() ){ $array_branch[$row_branch['branch_id']] = $row_branch ; } } while ( $row_staff = $select_staff->fetch_assoc() ){ $staff_image = ( $row_staff['staff_image'] != '' ? PATH.'uploads/Staff/'.dataFilter($row_staff['staff_image']) : '' ) ; $punch_companyid = PUNCHCOMPANYID ; if ( $row_staff['branch_id'] > 0 ){ if ( arrayCheck( $array_branch[$row_staff['branch_id']] ) ){ if ( $array_branch[$row_staff['branch_id']]['branch_binding_id'] > 0 ){ $punch_companyid = $array_branch[$row_staff['branch_id']]['branch_binding_id'] ; } } } call( 'curl', PUNCHURL.'/api/user.php', 'POST', [], [ 'company_id' => $punch_companyid, 'staff_idno' => $row_staff['staff_idno'], 'staff_name' => $row_staff['staff_name'], 'staff_shortname' => $row_staff['staff_shortname'], 'staff_image' => $staff_image ] ) ; } } require( $require_sub.'footer.php' ) ; ?>