本文整理汇总了PHP中Room::findByPropertyId方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::findByPropertyId方法的具体用法?PHP Room::findByPropertyId怎么用?PHP Room::findByPropertyId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::findByPropertyId方法的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;
}
示例2: foreach
<h3><?php
echo $property->getPropertyName();
?>
</h3>
</div>
<table cellpadding="5" class="bordered">
<thead>
<tr>
<th>Room Label</th>
<th>Vacant</th>
<th>Rent/Month</th>
</tr>
</thead>
<tbody>
<?php
$rooms = Room::findByPropertyId($property->id);
?>
<?php
foreach ($rooms as $room) {
?>
<tr>
<td align="right"><?php
echo $room->getRoomLabel();
?>
</td>
<td align="right"><?php
echo $room->isVacant() ? "YES" : "NO";
?>
</td>
<td align="right"><?php
echo $room->getRent();