Reference: updateAreaTotalsSpaceAndTime Workflow Rule
Space / Space Inventory (Transactional)
Space / Occupancy (Transactional)
Space / Space Chargeback / Space Chargeback (Transactional)
Reference: updateAreaTotalsSpaceAndTime Workflow Rule
The
AbCommonResources-SpaceServiceUpdateAreaTotalsSpaceTime
workflow rule (defined in the
updateAreaTotalsSpaceAndTim
e method from
SpaceService.java
), makes these calculations:
Class Name: [com.archibus.service.space.]SpaceService.java
updateAreaTotalsSpaceAndTime() { Date dateFrom; Date dateTo; { Calculate date range for new or modified records from rmpct table ( rmpct.date_last_calc, rmpct.date_last_modified) } Call: updateAreaTotalsSpaceTime(dateFrom, dateTo); } updateAreaTotalsSpaceTime(dateFrom, dateTo) { AllRoomPercentageUpdate.updateSpaceTime(dateFrom, dateTo, jobStatus); }
Class name: [com.archibus.service.space.]AllRoomPercentageUpdate.java
updateSpaceTime(dateFrom, dateTo, jobStatus) { List<DataRecord> records = {get all records from rmpct table} For (record IN records) { IF ( record.rmpct.status = ‘REQUESTED’ ) { record.rmpct.pct_time = 0.0 } ELSE { updateSpaceTimeToRmpctHrmpctRecord(dateFrom, dateTo, record, "rmpct"); } Save current rmpct record } // End For //Calculate Percentage of Room Area: sql statement UPDATE rmpct SET area_rm = (pct_space / 100) * (pct_time / 100) * (SELECT ${sql.isNull('area',0.0)} FROM rm WHERE rm.bl_id = rmpct.bl_id AND rm.fl_id = rmpct.fl_id AND rm.rm_id = rmpct.rm_id ) WHERE rmpct.bl_id is not null AND rmpct.fl_id is not null AND rmpct.rm_id is not null // Perform remainder of AREA UPDATE CALCULATION Call: calculate(); // All room area update: calculate groups Call: AllRoomAreaUpdate.calculateGroups(); } updateSpaceTimeToRmpctHrmpctRecord(dateFrom, dateTo, record, tableName) { //Calculate Total Days in Report Span. //Elapsed days should be calculated INCLUSIVE between two date values totalDays = (dateTo – dateFrom) + 1 dateStart = [tableName].date_start dateEnd = [tableName].date_end percentTime = [tableName].pct_time dayPart = [tableName].day_part IF (dateStart = null AND dateEnd = null) { // If all date values are blank then percent record is in use 100% of the time [tableName].pct_time = 100 } ELSE IF (dateStart = null) { IF (dateEnd < dateFrom) { // If end date is out of range, do not process the record [tableName].pct_time = 0 } ELSE { dateStart = dateFrom // If end date > report end, use report end date IF (dateEnd > dateTo) { dateEnd = dateTo } // Calculate number of days for current record days = (dateEnd – dateStart) + 1 percentTime = 100 * days/totalDays [tableName].pct_time = percentTime } } ELSE { // if date start is out of range, do not process the record IF ( dateStart > dateTo ) { // if date start is out of range, do not process the record [tableName].pct_time = 0 } ELSE { // calculate percent time // if start date is less then report start, use report start // Calculate number of days for current record days = (dateEnd – dateStart) + 1 percentTime = 100 * days/totalDays [tableName].pct_time = percentTime } } // if start date or end date are out of range, do not process the record [tableName].pct_time = 0 // if start date and / or end date are defined calculate percent time // Calculate number of days for current record days = (dateEnd – dateStart) + 1 percentTime = 100 * days/totalDays [tableName].pct_time = percentTime //If dayPart <> 0 than record uses 50% of the most recently calculated percent time IF (dayPart != 0) { [tableName].pct_time = percentTime/2 } } calculate() { // Perform remainder of AREA UPDATE CALCULATION // Sum AREA from RMPCT to RM //Calculate UNALLOCATED ROOM AREA // Sum total room area from RM to FL // calculate only for rooms without category or rooms with room categories that have //used_in_calcs ‘all_totals’ or ‘rm_totals’ or // sum area from RMPCT to FL //calculate RENTABLE and USABLE area in FL //Perform calculation for BOMA 2017 // Calculate area_rm_dp and area_rm_comn area in FL // Sum area from FL to BL //Calculate BL R/U and U/R ratio fields //Calculate SITE R/U and U/R ratio fields // Sum area from RMCPT to DP // Sum rmpct area from DP to DV // Sum rmpct area from DV to BU // Calculate RMSTD AREA and COUNT // Calculate RMTYPE AREA & COUNT // SUM AREA and COUNT from RMPCT to RMCAT // Calculate RMSTD AVERAGE AREA // Calculate RMCAT AVG AREA // Calculate RMTYPE AVG AREA // Calculate GROS AREA }