Exemplo n.º 1
0
 function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $startDate = CRM_Utils_Date::processDate($params['start_date'], null, false, 'Ymd');
     $endDate = CRM_Utils_Date::processDate($params['end_date'], null, false, 'Ymd');
     $includeMorning = CRM_Utils_Array::value('include_morning', $params, false);
     $showDetails = CRM_Utils_Array::value('show_details', $params, false);
     $notSignedOut = CRM_Utils_Array::value('not_signed_out', $params, false);
     $showBalances = CRM_Utils_Array::value('show_balances', $params, false);
     require_once 'SFS/Utils/ExtendedCare.php';
     if ($showBalances) {
         $showDetails = false;
         $summary =& SFS_Utils_ExtendedCare::balanceDetails();
     } else {
         $summary =& SFS_Utils_ExtendedCare::signoutDetails($startDate, $endDate, $includeMorning, $showDetails, $notSignedOut, $params['student_id']);
     }
     $this->assign('summary', $summary);
     $this->assign('showBalances', $showBalances);
     $this->assign('showDetails', $showDetails);
 }
Exemplo n.º 2
0
 function browse($id, $startDate, $endDate, $actionPermission)
 {
     require_once 'SFS/Utils/ExtendedCare.php';
     require_once 'SFS/Utils/ExtendedCareFees.php';
     $this->view($id, $startDate, $endDate, $actionPermission, true);
     if (date('Ymd') <= date('Ymd', strtotime($endDate))) {
         $endDateNew = date('Ymd');
     } else {
         $endDateNew = date('Ymd', mktime(0, 0, 0, date('m', strtotime($endDate)), date('t', strtotime($endDate)), date('Y', strtotime($endDate))));
         if (date('Ymd') <= $endDateNew) {
             $endDateNew = date('Ymd');
         }
     }
     $details = SFS_Utils_ExtendedCareFees::feeDetails($startDate, $endDateNew, null, false, true, $id, null);
     $feeDetails = array_pop($details);
     $monthlySignout = SFS_Utils_ExtendedCare::signoutDetailsPerMonth($startDate, $endDate, $id);
     if (!empty($feeDetails) && $actionPermission) {
         foreach ($feeDetails['details'] as $key => $value) {
             $feeDetails['details'][$key]['action'] = CRM_Core_Action::formLink(self::actionLinks(), null, array('objectID' => $key, 'id' => $id, 'object' => 'fee'));
         }
     }
     $this->assign_by_ref('feeDetail', $feeDetails);
     if (!empty($monthlySignout)) {
         $detailLink = array(CRM_Core_Action::VIEW => array('name' => ts('View Details'), 'url' => CRM_Utils_System::currentPath(), 'qs' => 'reset=1&action=view&id=%%id%%&year=%%year%%&month=%%month%%', 'title' => ts('View Details')));
         foreach ($monthlySignout as $month => $detail) {
             $monthlySignout[$month]['action'] = CRM_Core_Action::formLink($detailLink, null, array('id' => $id, 'year' => $detail['year'], 'month' => $detail['month']));
         }
     }
     $this->assign_by_ref('monthlySignout', $monthlySignout);
     // get remaining balance
     $balanceDetails = SFS_Utils_ExtendedCare::balanceDetails($id);
     if (!empty($balanceDetails)) {
         $balanceDetails = array_pop($balanceDetails);
         $this->assign_by_ref('balanceDetails', $balanceDetails);
     } else {
         $this->assign('balanceDetails', null);
     }
     if ($actionPermission) {
         $addBlockUrl = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&id={$id}&action=add&object=signout");
         $addFeeUrl = CRM_Utils_System::url(CRM_Utils_System::currentPath(), "reset=1&id={$id}&action=add&object=fee");
         $this->assign('addActivityBlock', $addBlockUrl);
         $this->assign('addFeeEntity', $addFeeUrl);
     }
 }