2, 2 => 2, 3 => 2, 4 => 3, 5 => 3, 6 => 3, 7 => 4, 8 => 4, 9 => 4, 10 => 1, 11 => 1, 12 => 1, ]; $month = TTDate::getMonth( $epoch ); if ( isset( $year_quarter_months[$month] ) ) { return $year_quarter_months[$month]; } return false; } function _outputXML( $type = null ) { $xml = new SimpleXMLElement( '' ); $this->setXMLObject( $xml ); $xml->addChild( 'header' ); $xml->header->addAttribute( 'fileSpecVersion', '4.00.0' ); $xml->header->addChild( 'facilityId', $this->facility_code ); $xml->header->addChild( 'stateCode', $this->state_code ); $xml->header->addChild( 'reportQuarter', $this->getFederalYearQuarterMonth( $this->date ) ); $xml->header->addChild( 'federalFiscalYear', TTDate::getFiscalYearFromEpoch( $this->date, 'US' ) ); $xml->header->addChild( 'softwareVendorName', APPLICATION_NAME ); $xml->header->addChild( 'softwareVendorEmail', 'support@timetrex.com' ); $xml->header->addChild( 'softwareProductName', APPLICATION_NAME ); $xml->header->addChild( 'softwareProductVersion', APPLICATION_VERSION ); $xml->addChild( 'employees' ); $xml->addChild( 'staffingHours' ); $xml->staffingHours->addAttribute( 'processType', 'merge' ); $records = $this->getRecords(); if ( is_array( $records ) && count( $records ) > 0 ) { //Process records into Employee -> Date -> Hour Entries $tmp_rows = []; foreach ( $records as $record ) { $tmp_rows[$record['employee_number']][$record['date_stamp']][$record['pbj_job_title_code']][] = $record; } unset( $records ); if ( isset( $tmp_rows ) ) { $e = 0; foreach ( $tmp_rows as $key => $date_data ) { $xml->employees->addChild( 'employee' ); $xml->staffingHours->addChild( 'staffHours' ); $d = 0; foreach ( $date_data as $date_stamp => $hour_data ) { $h = 0; foreach ( $hour_data as $title_code => $title_data ) { foreach ( $title_data as $data ) { $this->arrayToObject( $data ); //Convert record array to object if ( $d == 0 && $h == 0 ) { $xml->employees->employee[$e]->addChild( 'employeeId', $this->employee_number ); $xml->employees->employee[$e]->addChild( 'hireDate', date( 'Y-m-d', $this->{'hire-date_stamp'} ) ); if ( $this->{'termination-date_stamp'} != '' ) { $xml->employees->employee[$e]->addChild( 'terminationDate', date( 'Y-m-d', $this->{'termination-date_stamp'} ) ); } $xml->staffingHours->staffHours[$e]->addChild( 'employeeId', $this->employee_number ); $xml->staffingHours->staffHours[$e]->addChild( 'workDays' ); } if ( $h == 0 ) { $xml->staffingHours->staffHours[$e]->workDays->addChild( 'workDay' ); $xml->staffingHours->staffHours[$e]->workDays->workDay[$d]->addChild( 'date', date( 'Y-m-d', $date_stamp ) ); $xml->staffingHours->staffHours[$e]->workDays->workDay[$d]->addChild( 'hourEntries' ); } $xml->staffingHours->staffHours[$e]->workDays->workDay[$d]->hourEntries->addChild( 'hourEntry' ); $xml->staffingHours->staffHours[$e]->workDays->workDay[$d]->hourEntries->hourEntry[$h]->addChild( 'hours', round( TTDate::getHours( $this->pbj_hours ), 2 ) ); /* 1=Administrator 2=Medical Director 3=Other Physician 4=Physician Assistant 5=Registered Nurse Director of Nursing 6=Registered Nurse with Administrative Duties 7=Registered Nurse 8=Licensed Practical/Vocational Nurse with Administrative Duties 9=Licensed Practical/Vocational Nurse 10=Certified Nurse Aide 11=Nurse Aide in Training 12=Medication Aide/Technician 13=Nurse Practitioner 14=Clinical Nurse Specialist 15=Pharmacist 16=Dietitian 17=Feeding Assistant 18=Occupational Therapist 19=Occupational Therapy Assistant 20=Occupational Therapy Aide 21=Physical Therapist 22=Physical Therapy Assistant 23=Physical Therapy Aide 24=Respiratory Therapist 25=Respiratory Therapy Technician 26=Speech/Language Pathologist 27=Therapeutic Recreation Specialist 28=Qualified Activities Professional 29=Other Activities Staff 30=Qualified Social Worker 31=Other Social Worker 32=Dentist 33=Podiatrist 34=Mental Health Service Worker 35=Vocational Service Worker 36=Clinical Laboratory Service Worker 37=Diagnostic X-ray Service Worker 38=Blood Service Worker (optional) 39=Housekeeping Service Worker (opt 40=Other Service Worker (optional) */ $xml->staffingHours->staffHours[$e]->workDays->workDay[$d]->hourEntries->hourEntry[$h]->addChild( 'jobTitleCode', ( is_numeric( $this->pbj_job_title_code ) ? (int)$this->pbj_job_title_code : 0 ) ); /* 1=Exempt 2=Non-Exempt 3=Contract */ //Default to Non-Exempt as that is most common. $xml->staffingHours->staffHours[$e]->workDays->workDay[$d]->hourEntries->hourEntry[$h]->addChild( 'payTypeCode', ( is_numeric( $this->pbj_pay_type_code ) ? (int)$this->pbj_pay_type_code : 2 ) ); $this->revertToOriginalDataState(); $h++; } } $d++; } $e++; } } } return true; } function _outputPDF( $type ) { return false; } } ?>