if (!$session->isLoggedIn()) { redirect_to('../index.php'); } $properties = Property::findAll(); /////////////////////////////////////////////////////////////////////////// /////////////////////////////// PROCESS SUBMIT //////////////////////////// /////////////////////////////////////////////////////////////////////////// if (isset($_GET['submit'])) { $prop_id = $_GET['prop']; $start = $_GET['start']; $end = $_GET['end']; if (empty($prop_id) || empty($start) || empty($end)) { $err = "Form fields marked with an asterix are required"; } else { $property = Property::findById($prop_id); $expenses = Expense::findByPeriodForProperty($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", "expense_new" => "New Expense"); echo create_action_links($actions); ?> </div> <div id="main-content"> <a class="new-item" href="expense_new.php" title="record a new expense">New Expense</a>
//echo var_dump($prop_id); if (isset($_POST['submit'])) { $start_date = $_POST['start_date']; $end_date = $_POST['end_date']; if (empty($start_date) || empty($end_date)) { $err = "Choose a month from which to display rent payments from"; } elseif (!valid_date_range($start_date, $end_date)) { $err = "Reports can only be specified monthly"; } else { // continue with processing //echo var_dump($prop_id); $payments = Rent::getPaymentsFromProperty($prop_id, $start_date, $end_date); //echo var_dump($payments); $arrears_paid = ArrearsPaid::getPaidArrearsForProperty($prop_id, $start_date, $end_date); $arrears = Arrears::getOutstandingArrearsForProperty($prop_id, $start_date, $end_date); $expenses = Expense::findByPeriodForProperty($prop_id, $start_date, $end_date); $deposits = Deposit::findPaymentsForPeriodByProperty($prop_id, $start_date, $end_date); $refunds = Deposit::findRefundsForPeriodByProperty($prop_id, $start_date, $end_date); $refunds_kplc = DepositKPLC::findRefundsForPeriodByProperty($prop_id, $start_date, $end_date); $refunds_eldowas = DepositEldowas::findRefundsForPeriodByProperty($prop_id, $start_date, $end_date); $records = CollectionReport::buildRecords($prop_id, $start_date, $end_date); $deductions = CollectionReport::calcTotalDeductionsForPeriod($prop_id, $start_date, $end_date); //echo var_dump($records); //echo var_dump($arrears_paid); } } elseif (isset($_POST['report'])) { // Generate PDF report $start_date = $_POST['start_date']; $end_date = $_POST['end_date']; if (empty($start_date) || empty($end_date)) { $err = "Choose a period to use in generating report";