</tr> <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>
if (!$session->isLoggedIn()) { redirect_to('../index.php'); } if (!$ac->hasPermission('post_rent')) { $mesg = "You don't have permission to access this page"; $session->message($mesg); redirect_to($_SERVER['HTTP_REFERER']); } if (isset($_GET['tid']) && !empty($_GET['tid'])) { $tenant_id = (int) $_GET['tid']; if (!is_int($tenant_id)) { $mesg = "Deposit payment could not be recorded. An invalid value was sent through URL"; $session->message($mesg); redirect_to('tenants.php'); } else { $tenant = Tenant::findById($tenant_id); // Check if tenant moved out if ($tenant->hasMovedOut()) { $mesg = "Invalid operation. This tenant already moved"; $session->message($mesg); redirect_to("tenant.php?tid={$tenant_id}"); } if ($tenant->hasPaidDeposit('house')) { $mesg = "Tenant has already paid house deposit"; $session->message($mesg); redirect_to("tenant_deposit.php?tid={$tenant_id}"); } } } ///////////////////////////////////////////////////////////////// ///////////////////////// PROCESS SUBMIT ////////////////////////
/** * Generate the HTML of the receipt print */ public function buildArrearsReceipt() { global $session; $html = '<div id="outerHTML">'; $html .= '<div id="printArea">'; $html .= '<h2 align="center">Salesforce</h2>'; $html .= '<h3 align="center">Official Receipt: Arrears Payment</h3>'; $html .= '<div id="receipt-header">'; $html .= '<p align="center">'; $html .= 'Kenyatta Street, New Muya House<br />'; $html .= '2<sup>nd</sup> Flr, Room 105.<br />'; $html .= 'Tel: + 254 721 156 315 / + 254 720 711 115<br />'; $html .= 'www.salesforce.co.ke Email: info@salesforce.co.ke'; $html .= '</p></div>'; $html .= '<hr align="center" />'; $html .= '<div id="receipt-body">'; $html .= '<p><strong>Receipt No:</strong> <span style="color:#F00;">'; $html .= $this->_receipt_no; $html .= '</span></p>'; $html .= '<p><strong>Tenant:</strong> '; $tenant = Tenant::findById($this->_tid); $html .= $tenant->getFullName() . '</p>'; $html .= '<p><strong>Room No:</strong> '; $html .= Room::findById(Tenant::findById($this->_tid)->getRoomId())->getRoomLabel(); $html .= '</p><p><strong>Payment Amount:</strong> '; //$html .= number_format($session->sessionVar('amount')); $html .= number_format($this->_amount); if ($tenant->hasArrears()) { $arrears = new Arrears(); $html .= '</p><p><strong>Arrears</strong> '; $html .= $arrears->calcTotalArrearsFromTenant($this->_tid); } $html .= '</p><p><strong>Month:</strong> '; $html .= $this->_getMonthFromDate($this->_start_date); $html .= '</p><p><strong>Company Agent:</strong> '; $html .= $this->_agent . '</p>'; $html .= '<p><strong>Date:</strong> '; $html .= $this->_date_paid . " "; $html .= '</p></div>'; $html .= '</div></div>'; print $html; }
/** * Get oustanding arrears for a property during a specified * period of time * @param int $prop_id The ID used to identify the property * @param string $start Date string specifying start of the period * @param string $end Date string specifying end of the period * @return array An array of Arrears objects */ public static function getOutstandingArrearsForProperty($prop_id, $start, $end) { $arrears = static::findByPeriod($start, $end); $arrears_for_prop = array(); for ($i = 0; $i < count($arrears); $i++) { $cur_bal = $arrears[$i]; $tenant = Tenant::findById($cur_bal->getTenantId()); if ($tenant->getPropertyId() == $prop_id) { $arrears_for_prop[] = $cur_bal; } } return $arrears_for_prop; }
?> <table cellpadding="5" class="bordered"> <thead> <tr> <th style="width:200px;">Tenant</th> <th style="width:100px;">Month</th> <th style="width:150px;">Amount</th> </tr> </thead> <tbody> <?php foreach ($arrears as $ar) { ?> <tr> <td align="right"><?php echo Tenant::findById($ar->getTenantId())->getFullName(); ?> </td> <td align="right"><?php echo $ar->getMonth(); ?> </td> <td align="right"><?php echo $ar->getAmountOwed(); ?> </td> </tr> <?php } ?> <tr>
/** * Get a record of all deposit refunds that were made during specified period * for a particular property * @param int $prop_id ID used to identify the property * @param string $start Date string specifying start of period * @param string $end Date string specifying end of period * @return array Array of deposit objects */ public static function findRefundsForPeriodByProperty($prop_id, $start, $end) { $db = Database::getInstance(); $mysqli = $db->getConnection(); $sql = "SELECT * FROM " . static::$table_name . " WHERE date_ref "; $sql .= "BETWEEN '" . $mysqli->real_escape_string($start) . "' AND '"; $sql .= $mysqli->real_escape_string($end) . "' = 1 AND status = 1"; $refunds = static::findBySql($sql); $property_deposits = array(); $num_refunds = count($refunds); $counter = 0; while ($counter < $num_refunds) { $dpt = $refunds[$counter]; $tenant = Tenant::findById($dpt->getTenantId()); if ($tenant->getPropertyId() == $prop_id) { $property_deposits[] = $dpt; } $counter++; } return $property_deposits; }