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


PHP Room::findByTenantId方法代码示例

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


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

示例1: elseif

        ?>
</td>
        <td align="right"><?php 
        echo $tnt->getPhoneNumber();
        ?>
</td>
        <td align="right"><?php 
        echo $tnt->getBusinessName();
        ?>
</td>
        <td align="right"><?php 
        echo $tnt->getPaymentStatus();
        ?>
</td>
        <td align="right"><?php 
        echo Room::findByTenantId($tnt->id)->getRent();
        ?>
</td>
        <td align="right"><?php 
        echo $arrears;
        ?>
</td>
    </tr>
    <?php 
    }
    ?>
    </tbody>
    </table>
    <?php 
} elseif (!empty($prop_id)) {
    echo "<p>The selected property has no tenants in it yet</p>";
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:31,代码来源:status.php

示例2:

    <tr>
        <td><label for="receipt">Receipt No
        <span class="required-field">*</span></label></td>
        <td><input type="text" name="receipt" id="receipt" /></td>
        <td><input type="submit" name="submit" value="Search" /></td>
    </tr>
    </table>
    </form>        
    </div>
    
    <?php 
if (!empty($payment)) {
    ?>
    <?php 
    $tenant = Tenant::findById($payment->getTenantId())->getFullName();
    $room_no = Room::findByTenantId($payment->getTenantId())->getRoomLabel();
    ?>
    <table cellpadding="5" class="bordered">
    <thead>
    <tr>
    	<th>Name of Tenant</th>
        <th>Room No.</th>
        <th>Month</th>
        <th>Amount</th>
        <th>Receipt No</th>
        <th>Date Paid</th>
        <th>Agent</th>
    </tr>
    </thead>
    <tbody>
    <tr>
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:31,代码来源:payment_search.php

示例3: editPayment

 /**
  * Edit the amount paid as rent for a particular month
  * @param int $amount The new payment amount
  * @return boolean
  */
 public function editPayment($amount)
 {
     $start = $this->_start_date;
     $end = $this->_end_date;
     $tenant_id = $this->_tid;
     $rent_pm = Room::findByTenantId($tenant_id)->getRent();
     $rent_pm = (int) str_replace(',', '', $rent_pm);
     $amount = (int) str_replace(',', '', $amount);
     $curr_amount = (int) $this->_amount;
     $db = Database::getInstance();
     $mysqli = $db->getConnection();
     if (PaymentStatus::paymentStatusOK($tenant_id, $start, $end) && $amount < $rent_pm) {
         // Change payment status for tenant during period
         $statusObj = PaymentStatus::findByPeriod($tenant_id, $start, $end);
         $statusObj->setStatus(0);
         // Create a new arrears object
         $arrears = new Arrears();
         $bal_owed = $rent_pm - $amount;
         $arrears->setTenantId($tenant_id);
         $arrears->setStartPeriod($start);
         $arrears->setEndPeriod($end);
         $arrears->setAmountOwed($bal_owed);
         // Change Amount
         $this->setPaymentAmount($amount);
         $mysqli->autocommit(false);
         $arrears->save();
         $statusObj->save();
         $this->save();
         if (!$mysqli->commit()) {
             $mysqli->rollback();
             $mysqli->autocommit(true);
             return false;
         } else {
             $mysqli->autocommit(true);
             return true;
         }
     } elseif (!PaymentStatus::paymentStatusOK($tenant_id, $start, $end) && $amount == $rent_pm) {
         // Change payment status for tenant during period
         $statusObj = PaymentStatus::findByPeriod($tenant_id, $start, $end);
         $statusObj->setStatus(1);
         // Find corresponding arrears
         $arrears = Arrears::findByPeriodForTenant($tenant_id, $start, $end);
         // Change Amount
         $this->setPaymentAmount($amount);
         $mysqli->autocommit(false);
         $arrears->delete();
         $statusObj->save();
         $this->save();
         if (!$mysqli->commit()) {
             $mysqli->rollback();
             $mysqli->autocommit(true);
             return false;
         } else {
             $mysqli->autocommit(true);
             return true;
         }
     } elseif (!PaymentStatus::paymentStatusOK($tenant_id, $start, $end) && $amount < $rent_pm) {
         // reduce amount paid and increase amount owed
         $arrears = Arrears::findByPeriodForTenant($tenant_id, $start, $end);
         $new_arrears = $rent_pm - $amount;
         $arrears->setAmountOwed($new_arrears);
         $this->setPaymentAmount($amount);
         $mysqli->autocommit(false);
         $arrears->save();
         $this->save();
         if (!$mysqli->commit()) {
             $mysqli->rollback();
             $mysqli->autocommit(true);
             return false;
         } else {
             $mysqli->autocommit(true);
             return true;
         }
     }
 }
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:80,代码来源:class.Rent.php

示例4: foreach

    <tr>
        <th>Name of Tenant</th>
        <th>Room Label</th>
        <th>Business Name</th>
        <th>Details</th>
    </tr>
    </thead>
    <tbody>
    <?php 
    $tenants = Tenant::findByPropertyId($property->id);
    ?>
    <?php 
    foreach ($tenants as $tenant) {
        ?>
    <?php 
        $room = Room::findByTenantId($tenant->id);
        ?>
    <?php 
        /**echo "Tenant: ";
           echo "<tt></pre>".var_dump($tenant)."</pre></tt>";
           echo "Room: ";
           echo "<tt><pre>".var_dump($room)."</pre></tt>";*/
        ?>
    <tr>
        <td><?php 
        echo $tenant->getFullName();
        ?>
</td>
        <td><?php 
        echo $room->getRoomLabel();
        ?>
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:31,代码来源:tenants.php

示例5: foreach

?>
    
    <?php 
if (!empty($tenants)) {
    ?>
    <?php 
    foreach ($tenants as $tnt) {
        ?>
    <p><a href="tenant.php?tid=<?php 
        echo $tnt->id;
        ?>
"><?php 
        echo $tnt->getFullName();
        ?>
</a>&nbsp;&nbsp;<?php 
        echo "Room No: " . Room::findByTenantId($tnt->id)->getRoomLabel();
        ?>
</p>
    <?php 
    }
    ?>
    <?php 
} elseif (empty($tenants) && !empty($name)) {
    echo "<p>Search returned no results</p>";
}
?>
    
    </div>

<?php 
include_layout_template('admin_footer.php');
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:31,代码来源:tenant_search.php

示例6: recordArrears

 /**
  * Record rent arrears for a particular month in the event
  * that no amont was paid as rent
  * @param int $tenant_id The ID used to identify the tenant
  * @param string $start Date string specifying start of the period
  * @param string $end Date string specifying end of the period
  * @return boolean
  */
 public function recordArrears($tenant_id, $start, $end)
 {
     $db = Database::getInstance();
     $mysqli = $db->getConnection();
     // Get monthly rental amount
     $rent_pm = Room::findByTenantId($tenant_id)->getRent();
     $rent_pm = (int) str_replace(',', '', $rent_pm);
     // Create a new arrears object to hold arrears information
     //$arrears = new Arrears();
     $this->setTenantId($tenant_id);
     $this->setAmountOwed($rent_pm);
     $this->setStartPeriod($start);
     $this->setEndPeriod($end);
     // Payment Status set to 0 - denoting incompletion
     $pst = new PaymentStatus();
     $pst->setTenantId($tenant_id);
     $pst->setStartPeriod($start);
     $pst->setEndPeriod($end);
     $pst->setStatus(0);
     $mysqli->autocommit(false);
     $this->save();
     $pst->save();
     if (!$mysqli->commit()) {
         $mysqli->rollback();
         $mysqli->autocommit(true);
         return false;
     } else {
         $mysqli->autocommit(true);
         return true;
     }
 }
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:39,代码来源:class.Arrears.php

示例7: moveOut

 /**
  * Move out a tenant from a room
  * @return boolean
  */
 public function moveOut()
 {
     $db = Database::getInstance();
     $mysqli = $db->getConnection();
     // Initantiate old tenant object and set its
     // properties to correspond to current objects property values
     $this->_date_left = strftime("%Y-%m-%d", time());
     $this->_active = 0;
     $mysqli->autocommit(false);
     // Set room's status to vacant
     $room = Room::findByTenantId($this->id);
     $room->setRoomStatus(0);
     $room->unsetTenantId();
     if (!$this->save()) {
         $mysqli->rollback();
         $mysqli->autocommit(true);
         return false;
     }
     if (!$room->save()) {
         $mysqli->rollback();
         $mysqli->autocommit(true);
         return false;
     }
     // Try to commit all the changes to database
     if (!$mysqli->commit()) {
         $mysqli->rollback();
         $mysqli->autocommit(true);
         return false;
     }
     return true;
 }
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:35,代码来源:class.Tenant.php

示例8: elseif

        }
    }
}
/////////////////////////////////////////////////////////////////
///////////////////////// PROCESS SUBMIT ////////////////////////
/////////////////////////////////////////////////////////////////
if (isset($_POST['submit'])) {
    $start_date = $_POST['start_date'];
    $end_date = $_POST['end_date'];
    $amount_owed = $_POST['amount'];
    if (empty($start_date) || empty($end_date) || empty($amount_owed)) {
        $err = "Form fields marked with an asterix are required";
    } else {
        $arrears = Arrears::findById($arrears_id);
        $amount = (int) $arrears->removeCommasFromCurrency($_POST['amount']);
        $rent_pm = Room::findByTenantId($tenant_id)->getRent();
        $rent_pm = (int) $arrears->removeCommasFromCurrency($rent_pm);
        if ($amount > $rent_pm) {
            $err = "Arrears cannot exceed the tenants monthly rent";
        } elseif (PaymentStatus::paymentStatusOK($tenant_id, $start, $end)) {
            $mesg = "Tenant already paid the full rent for the specified period and therefore cannot have arrears";
            $session->message($mesg);
            redirect_to("tenant_arrears.php?tid={$tenant_id}");
        } else {
            $arrears->setTenantId($tenant->id);
            $arrears->setStartPeriod($start_date);
            $arrears->setEndPeriod($end_date);
            $arrears->setAmountOwed($amount_owed);
            if ($arrears->save()) {
                $mesg = "Changes Saved";
                $session->message($mesg);
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:31,代码来源:edit_arrears.php

示例9: setRoomId

 /**
  * Set the rid property to the ID of the
  * room occupied by the tenant
  * @param int $tenant_id
  */
 public function setRoomId($tenant_id)
 {
     $room = Room::findByTenantId($tenant_id);
     $this->_rid = $room->id;
 }
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:10,代码来源:class.Deposit.php


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