/**
  * Build records that will be used in rendering the reports
  * @param int $prop_id ID used to identify the property
  * @param string $start Date string specifying start of the period
  * @param sring $end Date string specifyinng end of the period
  * @return array $record_objects An array of record objects
  */
 public static function buildRecords($prop_id, $start, $end)
 {
     $room_count = Room::getNumRoomsForProperty($prop_id);
     $rooms = Room::findByPropertyId($prop_id);
     $record_objects = array();
     $aobj = new Arrears();
     for ($i = 0; $i < $room_count; $i++) {
         $record = new self();
         $rm = $rooms[$i];
         $record->room_label = $rm->getRoomLabel();
         if (!is_null($rm->getTenantId())) {
             $tenant = Tenant::findByRoomId($rm->id);
             $rent_obj = Rent::findByPeriodForTenant($tenant->id, $start, $end);
             $rent_paid = !is_null($rent_obj) ? $rent_obj->getPaymentAmount() : NULL;
             $receipt = !is_null($rent_obj) ? $rent_obj->getReceiptNo() : NULL;
             $remarks = !is_null($rent_obj) ? $rent_obj->getRemarks() : NULL;
             $arrears_paid = ArrearsPaid::calcAmountPaidByTenantDuringPeriod($tenant->id, $start, $end);
             $arrears = $aobj->calcTotalArrearsFromTenant($tenant->id);
             $deposit_obj = Deposit::findByPeriodForTenant($tenant->id, $start, $end);
             $deposit_paid = !is_null($deposit_obj) ? $deposit_obj->getPaymentAmount() : NULL;
             $kplc_obj = DepositKPLC::findByPeriodForTenant($tenant->id, $start, $end);
             $kplc_paid = !is_null($kplc_obj) ? $kplc_obj->getPaymentAmount() : NULL;
             $eldowas_obj = DepositEldowas::findByPeriodForTenant($tenant->id, $start, $end);
             $eldowas_paid = !is_null($eldowas_obj) ? $eldowas_obj->getPaymentAmount() : NULL;
             $totals = $tenant->calcPaymentsMadeDuringPeriod($start, $end);
             $record->tenant = $tenant->getFullName();
             $record->receipt_no = $receipt;
             $record->rent_pm = $rm->getRent();
             $record->rent_paid = $rent_paid;
             $record->arrears_paid = $arrears_paid;
             $record->arrears = $arrears;
             $record->house_deposit = $deposit_paid;
             $record->kplc_deposit = $kplc_paid;
             $record->eldowas_deposit = $eldowas_paid;
             $record->totals = $totals;
             $record->remarks = $remarks;
         } else {
             $record->tenant = "VACANT";
             $record->rent_pm = $rm->getRent();
         }
         $record_objects[] = $record;
     }
     return $record_objects;
 }