/**
  * Calculate rent amount after deducting deposit refunds from the amount
  * that was arrived at after adding deposit payments to the previous balance
  * @param int $prop_id 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 int $amount_less_deposit_refunds
  */
 public function calcAmountLessDepositRefunds($prop_id, $start, $end)
 {
     $balance_plus_dep = $this->calcAmountPlusDepositPayments($prop_id, $start, $end);
     $balance_plus_dep = (int) $this->_sanitizeMoneyString($balance_plus_dep);
     $deopsit_refunds = Deposit::calcRefundsForPeriodByProperty($prop_id, $start, $end);
     $deopsit_refunds = (int) $this->_sanitizeMoneyString($deopsit_refunds);
     $new_balance = $balance_plus_dep - $deopsit_refunds;
     return number_format($new_balance, 2);
 }
 /**
  * Calculate the sum total of all deductions made on a property during
  * a specified period of time
  * @param int $prop_id ID used to identify the property
  * @param string $start Date string specifying start of the period
  * @param srting $end Date string specifying end of period
  * @return int $total_deductions
  */
 public static function calcTotalDeductionsForPeriod($prop_id, $start, $end)
 {
     $total_deductions = 0;
     $commission = self::calcCommissionOnCollection($prop_id, $start, $end);
     $commission = (int) str_replace(',', '', $commission);
     $expenses = Expense::calcTotalExpenses($prop_id, $start, $end);
     $expenses = (int) str_replace(',', '', $expenses);
     $house_dep_refunds = Deposit::calcRefundsForPeriodByProperty($prop_id, $start, $end);
     $house_dep_refunds = (int) str_replace(',', '', $house_dep_refunds);
     $kplc_refunds = DepositKPLC::calcRefundsForPeriodByProperty($prop_id, $start, $end);
     $kplc_refunds = (int) str_replace(',', '', $kplc_refunds);
     $eldowas_refunds = DepositEldowas::calcRefundsForPeriodByProperty($prop_id, $start, $end);
     $eldowas_refunds = (int) str_replace(',', '', $eldowas_refunds);
     $deductions = array($commission, $expenses, $house_dep_refunds, $kplc_refunds, $eldowas_refunds);
     $total_deductions = array_sum($deductions);
     return number_format($total_deductions);
 }