function run()
{
    SFS_bin_Utils_auth();
    $config =& CRM_Core_Config::singleton();
    require_once '../drupal/sfschool/sfschool.module';
    sfschool_civicrm_config($config);
    require_once 'SFS/Utils/ExtendedCare.php';
    SFS_Utils_ExtendedCare::sendBalanceInvoiceEmail(SFS_BALANCE_OVERDUE);
}
function run()
{
    SFS_bin_Utils_auth();
    require_once '../SFS/Utils/Conference.php';
    // send reminder email for all
    $startDate = '2009-12-01';
    $endDate = '2009-12-10';
    require_once 'SFS/Utils/ExtendedCare.php';
    SFS_Utils_ExtendedCare::sendNotSignedOutEmail($startDate, $endDate);
}
Beispiel #3
0
 function run()
 {
     $name = CRM_Utils_Request::retrieve('name', 'String', $this, true);
     $day = CRM_Utils_Request::retrieve('day', 'String', $this, true);
     $sess = CRM_Utils_Request::retrieve('sess', 'String', $this, true);
     $sql = "\nSELECT c.display_name, c.id\nFROM   civicrm_contact c,\n       civicrm_value_extended_care s\nWHERE  s.name = %1\nAND    s.term = %2\nAND    s.day_of_week = %3\nAND    s.session = %4\nAND    s.has_cancelled = 0\nAND    s.entity_id = c.id\n";
     require_once 'SFS/Utils/ExtendedCare.php';
     $params = array(1 => array($name, 'String'), 2 => array(SFS_Utils_ExtendedCare::getTerm(), 'String'), 3 => array($day, 'String'), 4 => array($sess, 'String'));
     $dao = CRM_Core_DAO::executeQuery($sql, $params);
     $values = array();
     while ($dao->fetch()) {
         $values[] = array('contact_id' => $dao->id, 'display_name' => $dao->display_name, 'url' => CRM_Utils_System::url('civicrm/profile/view', "reset=1&gid=4&id={$dao->id}"));
     }
     $this->assign_by_ref('values', $values);
     $classDetails = array('name' => $name, 'time' => SFS_Utils_ExtendedCare::getTime($sess), 'day' => $day);
     $this->assign($classDetails);
     parent::run();
 }
Beispiel #4
0
 function __construct()
 {
     require_once 'CRM/Core/OptionGroup.php';
     require_once 'SFS/Utils/ExtendedCare.php';
     $sql = "SELECT column_name,option_group_id FROM civicrm_custom_field WHERE column_name IN('term', 'day_of_week')";
     $dao = CRM_Core_DAO::executeQuery($sql);
     $options = array();
     while ($dao->fetch()) {
         $options[$dao->column_name] = CRM_Core_OptionGroup::valuesByID($dao->option_group_id);
     }
     $sql = " SELECT DISTINCT( name ) as class\nFROM   sfschool_extended_care_source\nWHERE  is_active = 1";
     $dao = CRM_Core_DAO::executeQuery($sql);
     while ($dao->fetch()) {
         $options['class'][$dao->class] = $dao->class;
     }
     $this->_columns = array($this->_extentedCareTable => array('dao' => 'CRM_Contact_DAO_Contact', 'filters' => array('term' => array('title' => ts('Term'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'type' => CRM_Utils_Type::T_STRING, 'options' => $options['term'], 'default' => SFS_Utils_ExtendedCare::getTerm()), 'day_of_week' => array('title' => ts('Day Of Week'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'type' => CRM_Utils_Type::T_STRING, 'options' => $options['day_of_week']), 'name' => array('title' => ts('Class'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'type' => CRM_Utils_Type::T_STRING, 'options' => $options['class']))), 'civicrm_student' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name' => array('no_display' => true, 'required' => true, 'title' => ts('Student')), 'id' => array('no_display' => true, 'no_repeat' => true, 'required' => true))), 'civicrm_parent' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name' => array('no_display' => true, 'required' => true, 'title' => ts('Parent')), 'id' => array('no_display' => true, 'required' => true))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_display' => true, 'required' => true))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'no_display' => true, 'required' => true))));
     parent::__construct();
 }
 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);
 }
Beispiel #6
0
 static function buildForm(&$form, $childID, $term = null)
 {
     $excare = CRM_Utils_Request::retrieve('excare', 'Integer', $form, false, null, $_REQUEST);
     if ($excare != 1) {
         return;
     }
     require_once 'SFS/Utils/Query.php';
     $grade = SFS_Utils_Query::getGrade($childID);
     if (!is_numeric($grade)) {
         return;
     }
     $parentID = CRM_Utils_Request::retrieve('parentID', 'Integer', $form, false, null, $_REQUEST);
     if ($parentID) {
         $sess =& CRM_Core_Session::singleton();
         $url = CRM_Utils_System::url('civicrm/profile/view', "reset=1&gid=3&id={$parentID}");
         $form->removeElement('cancelURL');
         $form->add('hidden', 'cancelURL', $url);
         $sess->pushUserContext($url);
     }
     $term = self::getTerm($term);
     $classInfo = self::getClassCount($grade, false, $term);
     self::getCurrentClasses($childID, $classInfo, $term);
     $activities = self::getActivities($grade, $classInfo, true, $term);
     self::$_extendedCareElements = array();
     self::$_registeredElements = array();
     foreach ($activities as $day => $dayValues) {
         foreach ($dayValues as $session => $values) {
             if (!empty($values['select'])) {
                 $time = self::getTime($session);
                 $select = array('' => '- select -') + $values['select'];
                 $element =& $form->addElement('select', "sfschool_activity_{$day}_{$session}", "{$day} - {$time}", $select);
                 self::$_extendedCareElements[] = "sfschool_activity_{$day}_{$session}";
             }
         }
     }
     $form->assign_by_ref('extendedCareElements', self::$_extendedCareElements);
     self::setDefaults($form, $activities, $childID, $term);
 }
Beispiel #7
0
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle('Afternoon SignIn - Extended Care');
     require_once 'SFS/Utils/ExtendedCare.php';
     $term = SFS_Utils_ExtendedCare::getTerm($term);
     $sql = "\n( \nSELECT     c.id as contact_id, c.display_name as display_name, s.name as course_name, v.grade as grade,\n           0 as sout_id, 0 as signout_time, e.location as course_location\nFROM       civicrm_contact c\nINNER JOIN civicrm_value_school_information v ON v.entity_id = c.id\nINNER JOIN civicrm_value_extended_care s ON ( s.entity_id = c.id AND s.has_cancelled = 0 AND s.day_of_week = '{$this->_dayOfWeek}' )\nINNER JOIN sfschool_extended_care_source e ON ( s.session = e.session AND s.name = e.name AND s.term = e.term AND s.day_of_week = e.day_of_week ) \nWHERE      v.subtype = 'Student'\nAND        v.grade_sis >= 1\nAND        e.is_active = 1\nAND        s.term = %3\n)\nUNION\n(\nSELECT     c.id as contact_id, c.display_name as display_name, sout.class as course_name, v.grade as grade,\n           sout.id as sout_id, sout.signout_time as signout_time, e.location as course_location\nFROM       civicrm_contact c\nINNER JOIN civicrm_value_school_information v ON v.entity_id = c.id\nINNER JOIN civicrm_value_extended_care_signout sout ON sout.entity_id = c.id\nINNER JOIN sfschool_extended_care_source e ON ( sout.class = e.name )\nWHERE      v.subtype = 'Student'\nAND        v.grade_sis >= 1\nAND        ( sout.is_morning = 0 OR sout.is_morning IS NULL )\nAND        DATE( sout.signin_time ) = %1\nAND        e.is_active = 1\nAND        e.day_of_week = %2\n)\nUNION\n(\nSELECT     c.id as contact_id, c.display_name as display_name, sout.class as course_name, v.grade as grade,\n           -1 as sout_id, 0 as signout_time, e.location as course_location\nFROM       civicrm_contact c\nINNER JOIN civicrm_value_school_information v ON v.entity_id = c.id\nINNER JOIN civicrm_value_extended_care_signout sout ON sout.entity_id = c.id\nINNER JOIN sfschool_extended_care_source e ON ( sout.class = e.name )\nWHERE      v.subtype = 'Student'\nAND        v.grade_sis >= 1\nAND        ( sout.is_morning = 0 OR sout.is_morning IS NULL )\nAND        DAYNAME( sout.signin_time ) = %2\nAND        DATE_ADD( sout.signin_time, INTERVAL 8 DAY ) > '{$this->_date}'\nAND        e.is_active = 1\nAND        e.day_of_week = %2\nGROUP BY   c.id\nORDER BY   id DESC\n)\nORDER BY contact_id, sout_id DESC, course_name, display_name, signout_time\n";
     $params = array(1 => array($this->_date, 'String'), 2 => array($this->_dayOfWeek, 'String'), 3 => array($term, 'String'));
     $dao = CRM_Core_DAO::executeQuery($sql, $params);
     $someSignedIn = false;
     $studentDetails = array();
     while ($dao->fetch()) {
         if (array_key_exists($dao->contact_id, $studentDetails)) {
             continue;
         }
         $courseName = $dao->sout_class ? $dao->sout_class : $dao->course_name;
         if (empty($courseName)) {
             $courseName = $dao->grade <= 5 ? 'Yard Play' : 'Homework';
         }
         $studentDetails[$dao->contact_id] = array('display_name' => $dao->display_name, 'course_name' => $courseName, 'course_location' => $dao->course_location, 'grade' => $dao->grade, 'contact_id' => $dao->contact_id, 'is_marked' => $dao->sout_id > 0 ? 1 : 0, 'signout_block' => self::signoutBlock($dao->signout_time));
         if ($dao->sout_id > 0) {
             $someSignedIn = true;
         }
     }
     $this->assign('studentDetails', $studentDetails);
     $this->assign('someSignedIn', $someSignedIn);
     require_once 'SFS/Utils/Query.php';
     $students = array('' => '- Select Student -') + SFS_Utils_Query::getStudentsByGrade(true, false, true, '');
     $this->add('select', "student_id", ts('Student'), $students);
     $this->add('select', "student_id_top", ts('Student'), $students);
     $classes = array('' => '- Select Class -') + SFS_Utils_Query::getClasses();
     $this->add('select', "course_name", ts('Course'), $classes);
     $this->add('select', "course_name_top", ts('Course'), $classes);
     $timeSlots = array('' => '- Select Time -', 1 => 'Before 3:30 pm', 2 => '3:30 - 4:30 pm', 3 => '4:30 - 5:15 pm', 4 => '5:15 - 6:00 pm', 5 => 'After  6:00 pm');
     $this->add('select', "signout_time", ts('Signout Time'), $timeSlots);
     $this->add('select', "signout_time_top", ts('Signout Time'), $timeSlots);
 }
Beispiel #8
0
 static function getClasses($name = null)
 {
     $sql = "\nSELECT DISTINCT( name )\nFROM   sfschool_extended_care_source\nWHERE  is_active = 1\nAND    term = %1\n";
     if ($name) {
         $name = CRM_Utils_Type::escape($name);
         $sql .= " AND name like '{$name}%'";
     }
     $sql .= " ORDER BY name";
     require_once 'SFS/Utils/ExtendedCare.php';
     $params = array(1 => array(SFS_Utils_ExtendedCare::getTerm(), 'String'));
     $dao = CRM_Core_DAO::executeQuery($sql, $params);
     $classes = array();
     while ($dao->fetch()) {
         $classes[$dao->name] = $dao->name;
     }
     return $classes;
 }
 function postProcess()
 {
     require_once 'SFS/Utils/ExtendedCare.php';
     $this->beginPostProcess();
     $this->assign('node', node_load($this->_nodeId));
     $sql = $this->buildQuery(false);
     $daysOfWeek = SFS_Utils_ExtendedCare::daysOfWeek();
     $dao = CRM_Core_DAO::executeQuery($sql);
     $activityFree = $activityPaid = array();
     $feeAlias = $this->_customTable . '_fee_block';
     $dayAlias = $this->_customTable . '_day_of_week';
     while ($dao->fetch()) {
         $row = array();
         foreach ($this->_columnHeaders as $key => $value) {
             if (property_exists($dao, $key)) {
                 $row[$key] = $dao->{$key};
             }
         }
         if ($dao->{$feeAlias}) {
             $activityPaid[$dao->{$dayAlias}][] = $row;
         } else {
             $activityFree[$dao->{$dayAlias}][] = $row;
         }
     }
     $maxRows = 0;
     $day = 'Monday';
     foreach ($activityPaid as $key => $row) {
         if ($maxRows < count($row)) {
             $maxRows = count($row);
             $day = $key;
         }
     }
     $paidRows = $activityPaid[$day];
     $this->assign('paidCount', $maxRows);
     $maxRows = 0;
     $day = 'Monday';
     foreach ($activityFree as $key => $row) {
         if ($maxRows < count($row)) {
             $maxRows = count($row);
             $day = $key;
         }
     }
     $freeRows = $activityFree[$day];
     $this->assign('freeCount', $maxRows);
     $this->assign('activityPaid', $activityPaid);
     $this->assign('activityFree', $activityFree);
     $this->assign('paidRows', $paidRows);
     $this->assign('freeRows', $freeRows);
     $this->formatDisplay($daysOfWeek, false);
     $this->doTemplateAssignment($daysOfWeek);
     $this->endPostProcess($daysOfWeek);
 }
Beispiel #10
0
 static function addSignOutRecord()
 {
     $pickup = CRM_Utils_Request::retrieve('pickupName', 'String', CRM_Core_DAO::$_nullObject, true, null, 'REQUEST');
     $result = null;
     require_once 'SFS/Utils/ExtendedCare.php';
     for ($i = 1; $i <= 6; $i++) {
         $studentID = CRM_Utils_Request::retrieve("studentID_{$i}", 'Positive', CRM_Core_DAO::$_nullObject, false, null, 'REQUEST');
         $atSchoolMeeting = CRM_Utils_Request::retrieve("atSchoolMeeting_{$i}", 'Boolean', CRM_Core_DAO::$_nullObject, false, false, 'REQUEST');
         if (!empty($studentID)) {
             $className = SFS_Utils_ExtendedCare::processSignOut($pickup, $studentID, $atSchoolMeeting);
             if (empty($className)) {
                 $className = 'Yard Play';
             }
             $studentName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $studentID, 'display_name');
             $result[] = "{$studentName} @ {$className}";
         }
     }
     echo implode(", ", $result);
     exit;
 }
Beispiel #11
0
 function postProcess()
 {
     $this->beginPostProcess();
     $sessionHeaders = array();
     foreach ($this->_sesionOrder as $value => $time) {
         $sessionHeaders[$value] = array('title' => $time, 'type' => 'signout');
     }
     $sql = "\nSELECT distinct value_extended_care_2_civireport.{$this->_colMapper['sessionName']} as session_name, \n       value_extended_care_2_civireport.{$this->_colMapper['sessionOrder']} as session_order,  \n       additional_rows as extra_rows, instructor, location\nFROM   sfschool_extended_care_source value_extended_care_2_civireport\nWHERE  is_active = 1\nAND    term = %1\nAND   {$this->_colMapper['dayOfWeek']} = '{$this->_params['weekday_value']}'\nORDER BY session, name, additional_rows\n";
     $params = array(1 => array(SFS_Utils_ExtendedCare::getTerm('Fall 2009'), 'String'));
     $sname = CRM_Core_DAO::executeQuery($sql, $params);
     $rows = array();
     while ($sname->fetch()) {
         $sql = "\nSELECT contact_civireport.id as contact_civireport_id, \n       contact_civireport.display_name as contact_civireport_display_name, '' as SignIn, '' as SignOut, '' as parent_initial\nFROM   civicrm_value_extended_care value_extended_care_civireport\nINNER  JOIN civicrm_contact as contact_civireport ON value_extended_care_civireport.entity_id = contact_civireport.id\nWHERE  value_extended_care_civireport.{$this->_colMapper['sessionName']} = '{$sname->session_name}' AND \n       value_extended_care_civireport.{$this->_colMapper['sessionOrder']} = '{$sname->session_order}' AND\n       value_extended_care_civireport.{$this->_colMapper['dayOfWeek']} = '{$this->_params['weekday_value']}' AND\n       value_extended_care_civireport.{$this->_colMapper['isCancelled']} != 1 AND\n       term = %1\nGROUP BY contact_civireport.id;\n";
         $this->_columnHeaders = array('contact_civireport_id' => array('no_display' => true), 'contact_civireport_display_name' => array('title' => 'Name'), 'SignIn' => array('title' => 'Sign In', 'type' => 'signin'), 'parent_initial' => array('title' => 'Parent<br/>Initial', 'type' => 'parent'));
         $this->_columnHeaders = array_merge($this->_columnHeaders, $sessionHeaders);
         $index = $sname->session_order . '_' . $sname->session_name;
         $rows[$index] = array();
         $dao = CRM_Core_DAO::executeQuery($sql, $params);
         while ($dao->fetch()) {
             if (property_exists($dao, 'contact_civireport_id')) {
                 if (!$dao->contact_civireport_id) {
                     continue;
                 }
             }
             $row = array();
             foreach ($this->_columnHeaders as $key => $value) {
                 if (property_exists($dao, $key)) {
                     $row[$key] = $dao->{$key};
                 }
             }
             $rows[$index][] = $row;
         }
         // add extra rows
         if ($sname->extra_rows) {
             for ($i = 1; $i <= $sname->extra_rows; $i++) {
                 $rows[$index][] = array('contact_civireport_display_name' => '&nbsp;');
             }
         }
         $classRowCount = count($rows[$index]);
         $rows[$classRowCount . '_' . $index] = $rows[$index];
         unset($rows[$index]);
         $sessionInfo[$classRowCount . '_' . $index] = array();
         $sessionInfo[$classRowCount . '_' . $index]['title'] = $sname->session_name;
         $sessionInfo[$classRowCount . '_' . $index]['session'] = $sname->session_order;
         $sessionInfo[$classRowCount . '_' . $index]['instRoom'] = $sname->instructor && $sname->location ? $sname->instructor . ' - ' . $sname->location : ($sname->instructor ? $sname->instructor : $sname->location);
     }
     // maximize space utilization
     // ksort($rows, SORT_NUMERIC);
     $this->formatDisplay($rows);
     $this->assign_by_ref('sessionInfo', $sessionInfo);
     $this->doTemplateAssignment($rows);
     $this->endPostProcess($rows);
 }
Beispiel #12
0
 function browse($action = null)
 {
     $this->assign('editClass', false);
     $permission = false;
     if (CRM_Core_Permission::check('access CiviCRM')) {
         $this->assign('editClass', true);
         $permission = true;
         $addClassUrl = CRM_Utils_System::url(CRM_Utils_System::currentPath(), 'reset=1&action=add');
         $this->assign('addClass', $addClassUrl);
     }
     require_once 'SFS/Utils/ExtendedCare.php';
     if ($permission) {
         $classInfo = SFS_Utils_ExtendedCare::getClassCount(null, true, $this->_term);
     }
     $activities = array();
     $activities =& SFS_Utils_ExtendedCare::getActivities(null, CRM_Core_DAO::$_nullObject, true, $this->_term);
     $actionEnable -= CRM_Core_Action::ENABLE + 1;
     $values = array();
     foreach ($activities as $day => &$dayValues) {
         $values[$day] = array();
         foreach ($dayValues as $session => &$sessionValues) {
             foreach ($sessionValues['details'] as $id => &$idValues) {
                 if ($permission) {
                     $idValues['action'] = CRM_Core_Action::formLink(self::actionLinks(), $actionEnable, array('id' => $idValues['index']));
                 }
                 if ($permission && isset($classInfo[$idValues['id']])) {
                     $name = urlencode($idValues['name']);
                     $url = CRM_Utils_System::url('civicrm/sfschool/extended/detail', "reset=1&name={$name}&day={$idValues['day']}&sess={$idValues['session']}");
                     $idValues['num_url'] = $url;
                     $idValues['num_students'] = $classInfo[$idValues['id']]['current'];
                 }
                 $idValues['session'] = SFS_Utils_ExtendedCare::getTime($idValues['session']);
                 $values[$day][] =& $idValues;
             }
         }
     }
     $this->assign('schedule', $values);
     if ($permission) {
         $disableActivities = array();
         $disableActivities =& SFS_Utils_ExtendedCare::getActivities(null, CRM_Core_DAO::$_nullObject, false);
         $actionDisable -= CRM_Core_Action::DISABLE + 1;
         $disable = array();
         foreach ($disableActivities as $day => $valueDay) {
             $values[$day] = array();
             foreach ($valueDay as $session => $valueSession) {
                 foreach ($valueSession['details'] as $id => $valueId) {
                     $valueId['action'] = CRM_Core_Action::formLink(self::actionLinks(), $actionDisable, array('id' => $valueId['index']));
                     if (isset($classInfo[$valueId['id']])) {
                         $name = urlencode($valueId['name']);
                         $url = CRM_Utils_System::url('civicrm/sfschool/extended/detail', "reset=1&name={$name}&day={$valueId['day']}&sess={$valueId['session']}");
                         $valueId['num_url'] = $url;
                         $valueId['num_students'] = $classInfo[$valueId['id']]['current'];
                     }
                     $valueId['session'] = SFS_Utils_ExtendedCare::getTime($valueId['session']);
                     $disable[$day][] = $valueId;
                 }
             }
         }
         if (!empty($disable)) {
             $this->assign('disableActivities', $disable);
         }
     }
 }
Beispiel #13
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);
     }
 }