当前位置: 首页>>代码示例>>PHP>>正文


PHP Room::getNumRoomsForProperty方法代码示例

本文整理汇总了PHP中Room::getNumRoomsForProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::getNumRoomsForProperty方法的具体用法?PHP Room::getNumRoomsForProperty怎么用?PHP Room::getNumRoomsForProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room::getNumRoomsForProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildRecords

 /**
  * 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;
 }
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:51,代码来源:class.CollectionReport.php

示例2: elseif

if (isset($_POST['submit'])) {
    $referer_filename = $_POST['referer'];
    $selected_prop = $_POST['prop_name'];
    //echo var_dump($referer_filename);
    if (empty($selected_prop)) {
        if ($referer_filename == "rooms") {
            $err = "Please choose a property to add rooms to";
        } elseif ($referer_filename == "tenants") {
            $err = "Please choose a property from which to select a vacant room for the tenant";
        }
    } else {
        $session->sessionVar("prop_id", $selected_prop);
        $session->message("Property selection saved");
        $p = Property::findById($selected_prop);
        if ($referer_filename == "rooms") {
            if ($p->getNumRooms() == Room::getNumRoomsForProperty($selected_prop)) {
                $mesg = "You cannot create additional rooms on the selected property. The property already has the maximum number of rooms it can hold. You will first need to adjust the number of rooms the property holds before proceeding";
                $session->message($mesg);
                redirect_to("rooms.php");
            }
            redirect_to("add_room.php");
        } elseif ($referer_filename == "tenants") {
            if ($p->isFullyOccupied()) {
                $mesg = "The property you selected is fully occupied. Choose another property to add the tenant to";
                $session->message($mesg);
                redirect_to("tenants.php");
            }
            redirect_to("choose_room.php");
        }
    }
} else {
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:31,代码来源:choose_prop.php


注:本文中的Room::getNumRoomsForProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。