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


PHP Property::findById方法代码示例

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


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

示例1: var_dump

    		if(in_array($num_days, $valid_diff)){
    			echo "One Month<br />";	
    		} else {
    			echo "Not one month<br />";	
    		}
    		echo 'Valid Date Range: ';
    		echo var_dump(valid_date_range($start, $end));
    		echo 'Month One == Month Two: ';
    		echo var_dump($month_one == $month_two);*/
    if (empty($prop_id) || empty($start) || empty($end)) {
        $err = "Form fields marked with an asterix are required";
    } elseif (!valid_date_range($start, $end)) {
        $err = "Rent payment status of tenants can only be specified monthly. Specify a month by entering the start and end dates of the month";
    } else {
        $month = get_month_from_date($start);
        $property = Property::findById($prop_id);
        $tenants = Tenant::showPaymentStatusOfTenantsByProperty($prop_id, $start, $end);
    }
}
include_layout_template('admin_header.php');
?>

	<div id="container">
    <h3>Actions</h3>
    <div id="side-bar">
	<?php 
$actions = array("tenants" => "Tenants", "tenant_search" => "Search Tenant", "tenants_old" => "Previous Tenants", "payment_search" => "Search Payment");
echo create_action_links($actions);
?>
    </div>
    <div id="main-content">
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:31,代码来源:status.php

示例2: pdf

 /**
  * Generate a report that outlines the rent collection for a particular 
  * property over a specified period of time
  * @param mixed $title The report title
  * @param object $result_obj A result object obtained from a SELECT query
  * @param object $arrears_paid_obj A result object obtained from a SELECT query
  * @param object $arrears_obj A result object obtained from a SELECT query
  * @param object $expenses_obj A result object obtained from a SELECT query
  * @param array $headings Array of table heading names
  * @param array $widths Array of column widths
  * @param array $aligns Array of column alignments
  * @param string $orientation The page orientation of the report
  * @param mixed $page_size Dimensions of page that displays report
  * @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
  */
 public function pdf($title, $result_obj, $arrears_paid_obj, $arrears_obj, $expenses_obj, $headings = NULL, $widths = NULL, $aligns = NULL, $orientation = 'P', $page_size = 'A4', $prop_id, $start, $end)
 {
     define('HORZ_PADDING', 2);
     define('VERT_PADDING', 3);
     $filename = date('Y-m-d') . '-report-' . uniqid() . '.pdf';
     $pdf = new PDF_Report($orientation, 'pt', $page_size);
     $pdf->set_title($title);
     $pdf->setStartPeriod($start);
     $pdf->setEndPeriod($end);
     $pdf->SetX(-1);
     $page_width = $pdf->GetX() + 1;
     $pdf->AliasNbPages();
     $pdf->SetFont('Helvetica', '', 7);
     $pdf->SetLineWidth(0.1);
     $pdf->SetMargins(self::PDF_MARGIN, self::PDF_MARGIN);
     $pdf->SetAutoPageBreak(true, self::PDF_MARGIN);
     $pdf->SetHorizontalPadding(HORZ_PADDING);
     $pdf->SetVerticalPadding(VERT_PADDING);
     $ncols = $this->columnCount($result_obj);
     // Instantiate Helper Variables
     $rent = new Rent();
     $total_collection = Rent::calcTotalCollection($prop_id, $start, $end);
     $paid_arrears = ArrearsPaid::calcCollectionForPropertyDuringPeriod($prop_id, $start, $end);
     $owed_arrears = Arrears::calcArrearsForPropertyDuringPeriod($prop_id, $start, $end);
     $collection_summary = Rent::calcCollectionSummary($prop_id, $start, $end);
     $mgt_fee = $rent->calcManagementFee($prop_id, $start, $end);
     $net_amount = $rent->calcBalanceAfterMgtFee($prop_id, $start, $end);
     $total_expenses = Expense::calcTotalExpenses($prop_id, $start, $end);
     $net_banking = $rent->calcNetBanking($prop_id, $start, $end);
     $rent_collection_array = array(0 => 'Rent Collection', 1 => $total_collection);
     $paid_arrears_array = array(0 => 'Paid Arrears', 1 => $paid_arrears);
     $summary_collection_array = array(0 => 'Total Collection', 1 => $collection_summary);
     $percentage_mgt_fee = Property::findById($prop_id)->getManagementFee();
     $percentage_mgt_fee = '(' . $percentage_mgt_fee . '%)';
     $mgt_fee_array = array(0 => 'Management Fee' . $percentage_mgt_fee, 1 => $mgt_fee);
     $net_amount_array = array(0 => 'Net Collection (Balance after Management Fee)', 1 => $net_amount);
     $total_expenses_array = array(0 => 'Total Expenses', 1 => $total_expenses);
     $net_banking_array = array(0 => 'Banking(Money Deposited to Landlord\'s Account)', 1 => $net_banking);
     if (is_null($headings)) {
         $headings = $this->columnHeadings($result_obj);
     }
     //$pdf->set_headings($headings);
     //$pdf->SetFont('Helvetica', 'B', 8);
     //$pdf->RowX($headings, false);/
     if (is_null($widths)) {
         $w = ($page_width - 2 * self::PDF_MARGIN) / $ncols;
         for ($i = 0; $i < $ncols; $i++) {
             $widths[$i] = $w;
         }
     }
     if (count($widths) == $ncols - 1) {
         $n = 0;
         foreach ($widths as $w) {
             $n += $w;
         }
         $widths[$ncols - 1] = $page_width - 2 * self::PDF_MARGIN - $n;
     }
     $pdf->SetWidths($widths);
     if (!is_null($aligns)) {
         $a = 'R';
         for ($i = 0; $i < $ncols; $i++) {
             $aligns[$i] = $a;
         }
     }
     $pdf->SetAligns($aligns);
     $pdf->AddPage();
     $pdf->SetFont('Helvetica', 'B', 8);
     $pdf->RowX($headings, false);
     $pdf->SetFont('Helvetica', '', 7);
     while ($row = $result_obj->fetch_row()) {
         $pdf->RowX($row);
     }
     if (!is_null($total_collection)) {
         $xPos = $page_width - (self::PDF_MARGIN + $w);
         $pdf->SetX($xPos);
         $pdf->SetFont('Times', 'B', 8);
         $text = "Total: " . $total_collection;
         $pdf->MultiCell($w, 12, $text, 1, 'R');
     }
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetX(0 + self::PDF_MARGIN);
     $pdf->SetFont('Arial', 'B', 10);
//.........这里部分代码省略.........
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:101,代码来源:class.Report.php

示例3: calcCommissionOnCollection

 /**
  * Calculate the amount charged as commission on the collected amount
  * @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 int $commission
  */
 public static function calcCommissionOnCollection($prop_id, $start, $end)
 {
     $total_collection = self::calcTotalPaymentsForPeriod($prop_id, $start, $end);
     $total_collection = (int) str_replace(',', '', $total_collection);
     $mgt_fee = (int) Property::findById($prop_id)->getManagementFee();
     $commission = $total_collection * ($mgt_fee / 100);
     $commission = round($commission, 2);
     return number_format($commission);
 }
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:16,代码来源:class.CollectionReport.php

示例4: generatePdfReport

 /**
  * Generate a PDF report of rent collection for a specified period of time
  * @param int $prop_id The ID used to identify the property
  * @param string $start A date specifying the start period of collection
  * @param string $end The end period of rent collection
  * @return file A PDF file containing the report in tabular format
  */
 public static function generatePdfReport($prop_id, $start, $end)
 {
     $hdgs = array('name', 'room_no', 'date_paid', 'receipt_no', 'amount');
     $aligns = array('L', 'L', 'L', 'L', 'R');
     $widths = NULL;
     $property = Property::findById($prop_id);
     $ttl = $property->getPropertyName();
     $db = Database::getInstance();
     $mysqli = $db->getConnection();
     // Fetch rent payments for period
     $sql = "SELECT CONCAT_WS(' ', t.fname, t.lname) AS name, rm.label AS room_no, ";
     $sql .= "rt.date_paid, rt.receipt_no, FORMAT(rt.amount,0) AS amount FROM tenants t ";
     $sql .= "RIGHT JOIN room rm ON rm.id = t.rid RIGHT JOIN rent rt ON ";
     $sql .= "rt.tid = t.id WHERE rt.date_paid >= '" . $mysqli->real_escape_string($start);
     $sql .= "' AND rt.date_paid <= '" . $mysqli->real_escape_string($end) . "' ";
     $sql .= "AND rt.pid = " . $mysqli->real_escape_string($prop_id);
     $result = $mysqli->query($sql);
     // Check Arrears Paid
     $qry = "SELECT CONCAT_WS(' ', t.fname, t.lname) AS name, rm.label AS room_no, ";
     $qry .= "DATE_FORMAT(ap.start_date, '%M %Y') AS month, ap.date_paid, ap.receipt_no, ";
     $qry .= "FORMAT(ap.amount, 0) as amount FROM tenants t RIGHT JOIN room rm ON ";
     $qry .= "rm.id = t.rid RIGHT JOIN arrears_paid ap ON ap.tid = t.id WHERE (SELECT ";
     $qry .= "CONVERT(ap.date_paid, DATE) BETWEEN '" . $mysqli->real_escape_string($start);
     $qry .= "' AND '" . $mysqli->real_escape_string($end) . "' = 1)";
     $arrears_paid = $mysqli->query($qry);
     // Check Outstanding Arrears
     $arr = "SELECT CONCAT_WS(' ', t.fname, t.lname) AS name, rm.label AS room_no, ";
     $arr .= "DATE_FORMAT(ar.start_date, '%M %Y') AS month, FORMAT(ar.amount, 0) AS ";
     $arr .= "amount FROM tenants t RIGHT JOIN room rm ON rm.id = t.rid RIGHT JOIN ";
     $arr .= "arrears ar ON ar.tid = t.id";
     $arrears = $mysqli->query($arr);
     // Expenses
     $exp = "SELECT name AS name_of_expense, DATE_FORMAT(start_date, '%M %Y') AS month, ";
     $exp .= "incurred AS date_made, FORMAT(amount, 0) AS amount FROM expense ";
     $exp .= "WHERE (SELECT incurred BETWEEN '" . $mysqli->real_escape_string($start) . "' ";
     $exp .= "AND '" . $mysqli->real_escape_string($end) . "' = 1)";
     $expenses = $mysqli->query($exp);
     if ($result->num_rows == 0) {
         return false;
     } else {
         $report = new Report();
         $report->pdf($ttl, $result, $arrears_paid, $arrears, $expenses, $hdgs, $widths, $aligns, 'P', 'A4', $prop_id, $start, $end);
     }
 }
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:51,代码来源:class.Rent.php

示例5: pathinfo

$referer_filename = pathinfo($http_referer, PATHINFO_FILENAME);
//echo "REFERER FILENAME: ".$referer_filename;
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");
        }
开发者ID:ALCHEMIST09,项目名称:one-square-foot,代码行数:31,代码来源:choose_prop.php


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