function daOpts()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gdteNow, $gbDateFormatUS, $glChapterID;
     $displayData = array();
     $displayData['js'] = '';
     //------------------------------------------------
     // models, libraries and utilities
     //------------------------------------------------
     $this->load->helper('dl_util/web_layout');
     $this->load->library('generic_form');
     $this->load->helper('dl_util/time_date');
     // time frame support
     $this->load->helper('reports/date_range_def');
     $this->load->helper('reports/date_range');
     $this->load->library('js_build/java_joe_radio');
     $this->load->model('util/mserial_objects', 'cSO');
     $displayData['js'] .= $this->java_joe_radio->insertJavaJoeRadio() . $this->java_joe_radio->insertSetDateRadio();
     tf_initDateRangeMenu($displayData['viewOpts']);
     $this->initViewOpts($displayData['viewOpts']);
     // validation rules
     $this->setValidationRules($displayData['viewOpts']);
     if ($this->form_validation->run() == FALSE) {
         $displayData['frmLink'] = 'reports/pre_data_entry/daOpts';
         $this->load->library('generic_form');
         $displayData['viewOpts']->blockLabel = 'Data Entry Log';
         if (validation_errors() == '') {
             $displayData['strRdoSrc'] = 'client';
             $displayData['strRdoGroup'] = 'individual';
             $this->setInitialRptVal($displayData['viewOpts'], $displayData['formData']);
         } else {
             setOnFormError($displayData);
             $this->setErrRptVal($displayData['viewOpts'], $displayData['formData']);
             $displayData['strRdoSrc'] = set_value('rdoSrc');
             $displayData['strRdoGroup'] = set_value('rdoGroup');
             // time frame support
             $this->de_setDEOptsOnFormError($displayData['viewOpts']);
         }
         // time frame support
         $displayData['dateRanges'] = $strRange = tf_strDateRangeMenu($displayData['viewOpts']);
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('main/menu/reports', 'Reports', 'class="breadcrumb"') . ' | Data Entry Log';
         $displayData['title'] = CS_PROGNAME . ' | Reports';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'reports/pre_data_entry_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         $reportID = $this->strDataEntryLogRpt($displayData['viewOpts'], CENUM_REPORTNAME_DATAENTRYLOG);
         redirect('reports/pre_data_entry/run/' . $reportID);
     }
 }
 function agCommon($enumAgType)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gdteNow, $gbDateFormatUS, $glChapterID;
     //      if (!bTestForURLHack('showFinancials')) return;
     $displayData = array();
     $displayData['js'] = '';
     //------------------------------------------------
     // libraries and utilities
     //------------------------------------------------
     $this->load->helper('dl_util/web_layout');
     $this->load->library('generic_form');
     $this->load->helper('dl_util/time_date');
     $this->load->model('admin/morganization', 'clsChapter');
     $this->load->model('admin/madmin_aco', 'clsACO');
     // time frame support
     $this->load->helper('reports/date_range_def');
     $this->load->helper('reports/date_range');
     $this->load->library('js_build/java_joe_radio');
     $this->load->model('util/mserial_objects', 'cSO');
     $displayData['js'] .= $this->java_joe_radio->insertJavaJoeRadio() . $this->java_joe_radio->insertSetDateRadio();
     tf_initDateRangeMenu($displayData['viewOpts']);
     $this->initViewOpts($displayData['viewOpts']);
     $displayData['viewOpts']->bShowACOAll = $displayData['viewOpts']->bShowMinAmnt = $displayData['viewOpts']->bShowMaxAmnt = $displayData['viewOpts']->bShowSortBy = $displayData['viewOpts']->bShowAcct = $displayData['viewOpts']->bShowCamp = $displayData['viewOpts']->bShowIncludes = $displayData['viewOpts']->bShowYear = false;
     switch ($enumAgType) {
         case CENUM_REPORTNAME_GIFTAGG:
             $displayData['viewOpts']->blockLabel = 'Donations Aggregate Report';
             $displayData['frmLink'] = 'reports/pre_gifts/agOpts';
             $displayData['pageTitle'] = anchor('main/menu/reports', 'Reports', 'class="breadcrumb"') . ' | Donation Aggregate Report';
             break;
         case CENUM_REPORTNAME_GIFTSPONAGG:
             $displayData['viewOpts']->blockLabel = 'Sponsorship Payments Aggregate Report';
             $displayData['frmLink'] = 'reports/pre_gifts/agSponOpts';
             $displayData['pageTitle'] = anchor('main/menu/reports', 'Reports', 'class="breadcrumb"') . ' | Sponsorship Payment Aggregate Report';
             break;
         default:
             screamForHelp($enumAgType . ': unknow aggregate type<br>error on line <b> -- ' . __LINE__ . ' --</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
             break;
     }
     $this->setValidationRules($displayData['viewOpts']);
     if ($this->form_validation->run() == FALSE) {
         $this->load->library('generic_form');
         if (validation_errors() == '') {
             $this->clsChapter->lChapterID = $glChapterID;
             $this->clsChapter->loadChapterInfo();
             $this->setInitialRptVal($displayData['viewOpts'], $displayData['formData']);
         } else {
             setOnFormError($displayData);
             $this->setErrRptVal($displayData['viewOpts'], $displayData['formData']);
             // time frame support
             $this->tf_setTFOptsOnFormError($displayData['viewOpts']);
         }
         // time frame support
         $displayData['dateRanges'] = $strRange = tf_strDateRangeMenu($displayData['viewOpts']);
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['title'] = CS_PROGNAME . ' | Reports';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'reports/pre_gift_time_frame_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         $reportID = $this->strLoadPostGiftRpt($displayData['viewOpts'], $enumAgType);
         /* -------------------------------------
         echo('<font class="debug">'.substr(__FILE__, strrpos(__FILE__, '\\'))
            .': '.__LINE__.'<br>$displayData[viewOpts]   <pre>');
         echo(htmlspecialchars( print_r($displayData['viewOpts'], true))); echo('</pre></font><br>');
         $zzzlPos = strrpos(__FILE__, '\\'); $zzzlLen=strlen(__FILE__); echo('<font class="debug">'.substr(__FILE__, strrpos(__FILE__, '\\',-(($zzzlLen-$zzzlPos)+1))) .': '.__LINE__
         .":\$reportID = $reportID <br></font>\n");
         
         die;
         // ------------------------------------- */
         redirect('reports/reports/run/' . $reportID);
     }
 }
 function showOptsPVA()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gbDateFormatUS;
     $displayData = array();
     $displayData['js'] = '';
     //------------------------------------------------
     // libraries and utilities
     //------------------------------------------------
     $this->load->model('reports/mreports', 'clsReports');
     $this->load->helper('dl_util/web_layout');
     $this->load->helper('dl_util/time_date');
     // time frame support
     $this->load->helper('reports/date_range_def');
     $this->load->helper('reports/date_range');
     $this->load->library('js_build/java_joe_radio');
     $this->load->model('util/mserial_objects', 'cSO');
     $displayData['js'] .= $this->java_joe_radio->insertJavaJoeRadio() . $this->java_joe_radio->insertSetDateRadio();
     tf_initDateRangeMenu($displayData['viewOpts']);
     $displayData['viewOpts']->bShowAggregateDonor = true;
     $displayData['viewOpts']->strFormName = 'frmVHrsPVARpt';
     $displayData['viewOpts']->strID = 'vhrsPVARpt';
     // validation rules
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->tf_setValidationTFRules($displayData['viewOpts']);
     $this->form_validation->set_rules('rdoSort', 'Sorting Option', 'trim|required');
     if ($this->form_validation->run() == FALSE) {
         $this->load->library('generic_form');
         if (validation_errors() == '') {
             $dteStart = strtotime('1/1/2000');
             $dteEnd = time();
             $displayData['bSortVol'] = true;
             $displayData['bSortPHrs'] = $displayData['bSortLHrs'] = false;
             if ($gbDateFormatUS) {
                 $displayData['txtSDate'] = date('m/d/Y', $dteStart);
                 $displayData['txtEDate'] = date('m/d/Y', $dteEnd);
             } else {
                 $displayData['txtSDate'] = date('d/m/Y', $dteStart);
                 $displayData['txtEDate'] = date('d/m/Y', $dteEnd);
             }
         } else {
             setOnFormError($displayData);
             $displayData['txtSDate'] = set_value('txtSDate');
             $displayData['txtEDate'] = set_value('txtEDate');
             $displayData['bSortVol'] = set_value('rdoSort') == 'vol';
             $displayData['bSortPHrs'] = set_value('rdoSort') == 'phrs';
             $displayData['bSortLHrs'] = set_value('rdoSort') == 'lhrs';
             // time frame support
             $this->tf_setTFOptsOnFormError($displayData['viewOpts']);
         }
         // time frame support
         $displayData['dateRanges'] = $strRange = tf_strDateRangeMenu($displayData['viewOpts']);
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('main/menu/reports', 'Reports', 'class="breadcrumb"') . ' | Volunteer Hours - Scheduled vs. Actual';
         $displayData['title'] = CS_PROGNAME . ' | Reports';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'reports/pre_vol_hours_pva_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         /*
                  $strSDate   = trim($_POST['txtSDate']);
                  MDY_ViaUserForm($strSDate, $lMon, $lDay, $lYear, $gbDateFormatUS);
                  $dteStart = strtotime($lMon.'/'.$lDay.'/'.$lYear);
         
                  $strEndDate = trim($_POST['txtEDate']);
                  MDY_ViaUserForm($strEndDate, $lMon, $lDay, $lYear, $gbDateFormatUS);
                  $dteEnd = strtotime($lMon.'/'.$lDay.'/'.$lYear.' 23:59:59');
         */
         tf_getDateRanges($displayData['viewOpts'], $formDates);
         $reportAttributes = array('rptType' => CENUM_REPORTTYPE_PREDEFINED, 'rptName' => CENUM_REPORTNAME_VOLHRS_PVA, 'rptDestination' => CENUM_REPORTDEST_SCREEN, 'lStartRec' => 0, 'lRecsPerPage' => 50, 'bShowRecNav' => true, 'viewFile' => 'pre_generic_rpt_view', 'bSortVol' => trim($_POST['rdoSort']) == 'vol', 'bSortPHrs' => trim($_POST['rdoSort']) == 'phrs', 'bSortLHrs' => trim($_POST['rdoSort']) == 'lhrs', 'dteStart' => $formDates->dteStart, 'dteEnd' => $formDates->dteEnd, 'strDateRange' => $formDates->strDateRange, 'strBetween' => $formDates->strBetween);
         $this->clsReports->createReportSessionEntry($reportAttributes);
         $reportID = $this->clsReports->sRpt->reportID;
         redirect('reports/reports/run/' . $reportID);
     }
 }
 public function opts()
 {
     //--------------------------------------------------------------------
     //
     //--------------------------------------------------------------------
     global $glUserID;
     $displayData = array();
     $displayData['js'] = '';
     //------------------------------------------------
     // libraries and utilities
     //------------------------------------------------
     $this->load->helper('dl_util/web_layout');
     $this->load->library('generic_form');
     $this->load->model('personalization/muser_fields', 'clsUF');
     $this->load->model('admin/mpermissions', 'perms');
     $this->load->model('client_features/mcprograms', 'cprograms');
     $this->load->helper('dl_util/time_date');
     // time frame support
     $this->load->helper('reports/date_range_def');
     $this->load->helper('reports/date_range');
     $this->load->library('js_build/java_joe_radio');
     $this->load->model('util/mserial_objects', 'cSO');
     $displayData['js'] .= $this->java_joe_radio->insertJavaJoeRadio() . $this->java_joe_radio->insertSetDateRadio();
     tf_initDateRangeMenu($displayData['viewOpts']);
     $this->initViewOpts($displayData['viewOpts']);
     // validation rules
     $this->setValidationRules($displayData['viewOpts']);
     if ($this->form_validation->run() == FALSE) {
         //--------------------------
         // load the client programs
         //--------------------------
         $this->cprograms->loadClientPrograms(false);
         $lNumCProgs = $this->cprograms->lNumCProgs;
         $displayData['cprogs'] =& $this->cprograms->cprogs;
         $displayData['lNumCProgs'] = 0;
         $this->perms->loadUserAcctInfo($glUserID, $acctAccess);
         if ($lNumCProgs > 0) {
             foreach ($this->cprograms->cprogs as $cprog) {
                 $cprog->bShowCProgLink = $this->perms->bDoesUserHaveAccess($acctAccess, $cprog->lNumPerms, $cprog->perms);
                 if ($cprog->bShowCProgLink) {
                     ++$displayData['lNumCProgs'];
                 }
             }
         }
         $displayData['frmLink'] = 'cprograms/cprog_enrollees/opts';
         $this->load->library('generic_form');
         $displayData['viewOpts']->blockLabel = 'Enrollees in Client Programs';
         if (validation_errors() == '') {
             $this->setInitialRptVal($displayData['viewOpts'], $displayData['formData']);
         } else {
             setOnFormError($displayData);
             $this->setErrRptVal($displayData['viewOpts'], $displayData['formData']);
             // time frame support
             $this->setCPEOptsOnFormError($displayData['viewOpts']);
         }
         // time frame support
         $displayData['dateRanges'] = $strRange = tf_strDateRangeMenu($displayData['viewOpts']);
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('main/menu/reports', 'Reports', 'class="breadcrumb"') . ' | Client Programs: Enrollees';
         $displayData['title'] = CS_PROGNAME . ' | Reports';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'cprograms/cprograms_enrollee_rpt_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         $reportID = $this->strCProgEnrolleeRpt($displayData['viewOpts'], CENUM_REPORTNAME_CPROG_ENROLLEES);
         redirect('cprograms/cprog_enrollees/run/' . $reportID);
     }
 }
 function opts()
 {
     //------------------------------------------------------------------------
     //
     //------------------------------------------------------------------------
     global $glUserID, $gdteNow;
     if (!bTestForURLHack('showClients')) {
         return;
     }
     $displayData = array();
     $displayData['js'] = '';
     //------------------------------------------------
     // models, libraries and utilities
     //------------------------------------------------
     $this->load->model('client_features/mcpre_post_tests', 'cpptests');
     $this->load->model('admin/mpermissions', 'perms');
     $this->load->helper('dl_util/web_layout');
     $this->load->library('generic_form');
     $this->load->helper('dl_util/time_date');
     // time frame support
     $this->load->helper('reports/date_range_def');
     $this->load->helper('reports/date_range');
     $this->load->library('js_build/java_joe_radio');
     $this->load->model('util/mserial_objects', 'cSO');
     $displayData['js'] .= $this->java_joe_radio->insertJavaJoeRadio() . $this->java_joe_radio->insertSetDateRadio();
     tf_initDateRangeMenu($displayData['viewOpts']);
     //-------------------------
     // validation rules
     //-------------------------
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->tf_setValidationTFRules($displayData['viewOpts']);
     $this->form_validation->set_rules('ddlTests', 'List of tests', 'trim|required|callback_verifyTestDDL');
     if ($this->form_validation->run() == FALSE) {
         $displayData['frmLink'] = 'reports/pre_client_pre_post/opts';
         $this->load->library('generic_form');
         $displayData['viewOpts']->blockLabel = 'Client Pre/Post Test Results';
         // load available tests
         $this->cpptests->loadPPTestsAvailToClient();
         $displayData['lNumPPTests'] = $lNumPPTests = $this->cpptests->lNumPPTests;
         if (validation_errors() == '') {
             $this->setInitialRptVal($displayData['viewOpts'], $displayData['formData']);
             if ($lNumPPTests > 0) {
                 $displayData['formData']->strPrePostList = $this->cpptests->strBuildTestDDL('ddlTests', true, -1);
             }
         } else {
             setOnFormError($displayData);
             $displayData['formData'] = new stdClass();
             $displayData['formData']->txtSDate = set_value('txtSDate');
             $displayData['formData']->txtEDate = set_value('txtEDate');
             if ($lNumPPTests > 0) {
                 $displayData['formData']->strPrePostList = $this->cpptests->strBuildTestDDL('ddlTests', true, (int) set_value('ddlTests'));
             }
             // time frame support
             $this->tf_setTFOptsOnFormError($displayData['viewOpts']);
         }
         // time frame support
         $displayData['dateRanges'] = $strRange = tf_strDateRangeMenu($displayData['viewOpts']);
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('main/menu/reports', 'Reports', 'class="breadcrumb"') . ' | Client Pre/Post Tests';
         $displayData['title'] = CS_PROGNAME . ' | Reports';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'reports/pre_client_pre_post_test';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         $reportID = $this->lLoadPrePostTestRpt($displayData['viewOpts'], CENUM_REPORTNAME_CLIENT_PREPOST);
         redirect('reports/reports/run/' . $reportID);
     }
 }
 function rptOpts($enumRptType)
 {
     //------------------------------------------------------------------------
     //
     //------------------------------------------------------------------------
     global $glUserID;
     $this->load->helper('dl_util/permissions');
     // in autoload
     if (!bAllowAccess('management')) {
         return '';
     }
     $displayData = array();
     $displayData['js'] = '';
     $displayData['enumRptType'] = $enumRptType;
     $displayData['bViaUser'] = $bViaUser = $enumRptType == 'byStaff';
     //------------------------------------------------
     // libraries and utilities
     //------------------------------------------------
     $this->load->helper('dl_util/web_layout');
     $this->load->library('generic_form');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('admin/morganization', 'clsChapter');
     $this->load->model('groups/mgroups', 'groups');
     $this->load->helper('groups/groups');
     $this->load->helper('dl_util/time_date');
     if ($bViaUser) {
         $this->load->model('admin/mpermissions', 'perms');
         $this->load->model('admin/muser_accts', 'cusers');
         $this->load->helper('aayhf/aayhf_staff');
     }
     // time frame support
     $this->load->helper('reports/date_range_def');
     $this->load->helper('reports/date_range');
     $this->load->library('js_build/java_joe_radio');
     $this->load->model('util/mserial_objects', 'cSO');
     $displayData['js'] .= $this->java_joe_radio->insertJavaJoeRadio() . $this->java_joe_radio->insertSetDateRadio();
     tf_initDateRangeMenu($displayData['viewOpts']);
     $this->initViewOpts($displayData['viewOpts']);
     // validation rules
     $this->setValidationRules($displayData['viewOpts']);
     if (!$bViaUser) {
         $this->form_validation->set_rules('ddlStaffGroup', 'Staff Group', 'callback_verifyStaffGroup');
         $this->form_validation->set_rules('ddlSort', 'Sort', 'trim|required');
     }
     if ($bViaUser) {
         $this->loadUserRecs($lNumUsers, $users);
         aayhfStaff\buildUserTable($users, $displayData['usersBEACON']);
         aayhfStaff\buildUserTable($users, $displayData['usersJJMI']);
         aayhfStaff\buildUserTable($users, $displayData['usersSHIFTA']);
         aayhfStaff\buildUserTable($users, $displayData['usersOperations']);
         aayhfStaff\buildUserTable($users, $displayData['usersManagement']);
         aayhfStaff\buildUserTable($users, $displayData['usersPrograms']);
     }
     if ($this->form_validation->run() == FALSE) {
         $displayData['frmLink'] = 'staff/mgr_perf_rpt/rptOpts/' . $enumRptType;
         $this->load->library('generic_form');
         $displayData['viewOpts']->blockLabel = 'Consolidated Status Reports / ' . ($bViaUser ? 'by Staff Member' : 'by Project Group');
         if (validation_errors() == '') {
             $dummy = array();
             $this->setInitialRptVal($displayData['viewOpts'], $displayData['formData']);
             if ($bViaUser) {
                 aayhfStaff\defaultCheckViaStaffGroup($displayData['usersBEACON'], 'BEACON');
                 aayhfStaff\defaultCheckViaStaffGroup($displayData['usersJJMI'], 'JJMI');
                 aayhfStaff\defaultCheckViaStaffGroup($displayData['usersSHIFTA'], 'SHIFT Ascension');
                 aayhfStaff\defaultCheckViaStaffGroup($displayData['usersOperations'], 'Operations');
                 aayhfStaff\defaultCheckViaStaffGroup($displayData['usersManagement'], 'Management');
                 aayhfStaff\defaultCheckViaStaffGroup($displayData['usersPrograms'], 'Programs');
                 $displayData['bRadioBeacon'] = $displayData['bRadioJJMI'] = $displayData['bRadioShiftA'] = $displayData['bRadioManage'] = $displayData['bRadioOps'] = false;
                 $displayData['bRadioPrograms'] = true;
             } else {
                 $displayData['strStaffGroupDDL'] = $this->groups->strDDLActiveGroupEntries('ddlStaffGroup', CENUM_CONTEXT_STAFF, $dummy, false, true);
                 $this->setInitialRptVal($displayData['viewOpts'], $displayData['formData']);
                 $displayData['strReportSortDDL'] = $this->strSortDDL('staff');
             }
         } else {
             setOnFormError($displayData);
             $this->setErrRptVal($displayData['viewOpts'], $displayData['formData']);
             if ($bViaUser) {
                 $this->loadViaUserSettings($displayData);
             } else {
                 if (!isset($_POST['ddlStaffGroup'])) {
                     $_POST['ddlStaffGroup'] = array();
                 }
                 $displayData['strStaffGroupDDL'] = $this->groups->strDDLActiveGroupEntries('ddlStaffGroup', CENUM_CONTEXT_STAFF, $_POST['ddlStaffGroup'], false, true);
                 $displayData['strReportSortDDL'] = $this->strSortDDL($_POST['ddlSort']);
             }
             // time frame support
             $this->tf_setTFOptsOnFormError($displayData['viewOpts']);
         }
         // time frame support
         $displayData['dateRanges'] = $strRange = tf_strDateRangeMenu($displayData['viewOpts']);
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('aayhf/main/aayhfMenu', 'AAYHF', 'class="breadcrumb"') . ' | Consolidated Status Reports / ' . ($bViaUser ? 'Via Staff' : 'Via Project');
         $displayData['title'] = CS_PROGNAME . ' | Reports';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         if ($bViaUser) {
             $displayData['mainTemplate'] = 'aayhf/aayhf_reports/stat_rpt_via_staff_opts_view';
         } else {
             $displayData['mainTemplate'] = 'aayhf/aayhf_reports/stat_rpt_opts_view';
         }
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         if ($bViaUser) {
             $reportID = $this->strLoadPostStaffViaUserStatusRpt($displayData, $displayData['viewOpts'], CENUM_REPORTNAME_AAYHF_STATCONSOL_STAFF);
         } else {
             $reportID = $this->strLoadPostStaffStatusRpt($displayData['viewOpts'], CENUM_REPORTNAME_AAYHF_STATCONSOL);
         }
         redirect('aayhf/aayhf_reports/aayhf_reports/run/' . $reportID);
     }
 }
 function showOpts($enumAckType)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $gdteNow, $gbDateFormatUS, $glChapterID;
     if (!bTestForURLHack('showFinancials')) {
         return;
     }
     $displayData = array();
     $displayData['js'] = '';
     $displayData['formData'] = new stdClass();
     $displayData['enumAckType'] = $enumAckType;
     //------------------------------------------------
     // libraries and utilities
     //------------------------------------------------
     $this->load->model('reports/mreports', 'clsReports');
     $this->load->helper('dl_util/web_layout');
     $this->load->helper('dl_util/time_date');
     $this->load->helper('dl_util/form_verification');
     $this->load->model('admin/madmin_aco', 'clsACO');
     $this->load->model('admin/morganization', 'clsChapter');
     // time frame support
     $this->load->helper('reports/date_range_def');
     $this->load->helper('reports/date_range');
     $this->load->library('js_build/java_joe_radio');
     $this->load->model('util/mserial_objects', 'cSO');
     $displayData['js'] .= $this->java_joe_radio->insertJavaJoeRadio() . $this->java_joe_radio->insertSetDateRadio();
     tf_initDateRangeMenu($displayData['viewOpts']);
     $displayData['viewOpts']->bShowAggregateDonor = true;
     $displayData['viewOpts']->strFormName = 'frmGiftAckRpt';
     $displayData['viewOpts']->strID = 'giftAckRpt';
     // validation rules
     $this->form_validation->set_error_delimiters('<div class="formError">', '</div>');
     $this->tf_setValidationTFRules($displayData['viewOpts']);
     $this->form_validation->set_rules('rdoAck', 'Not Acknowledged');
     $this->form_validation->set_rules('chkSpon', 'Include sponsorships');
     $this->form_validation->set_rules('chkMarkAck', 'Mark as Acknowledged');
     $this->form_validation->set_rules('rdoSort', 'Sort');
     $this->form_validation->set_rules('rdoACO', 'Accounting Country');
     if ($this->form_validation->run() == FALSE) {
         $this->load->library('generic_form');
         switch ($enumAckType) {
             case 'gifts':
                 $strLabel = 'Donations';
                 break;
             case 'hon':
                 $strLabel = 'Honorarium Recipient';
                 break;
             case 'mem':
                 $strLabel = 'Memorial Mail Contact';
                 break;
             default:
                 screamForHelp($enumAckType . ': ack type error<br>error on line <b>' . __LINE__ . '</b>,<br>file ' . __FILE__ . ',<br>function ' . __FUNCTION__);
                 break;
         }
         $displayData['strLabel'] = $strLabel;
         if (validation_errors() == '') {
             $this->clsChapter->lChapterID = $glChapterID;
             $this->clsChapter->loadChapterInfo();
             $displayData['formData']->strACORadio = $this->clsACO->strACO_Radios($this->clsChapter->chapterRec->lDefaultACO, 'rdoACO');
             $displayData['bNotAck'] = true;
             $displayData['bIncludeSpon'] = false;
             $displayData['bMarkAck'] = false;
             $displayData['enumSort'] = 'date';
             $dteStart = strtotime('1/1/2000');
             $dteEnd = $gdteNow;
             if ($gbDateFormatUS) {
                 $displayData['txtSDate'] = date('m/d/Y', $dteStart);
                 $displayData['txtEDate'] = date('m/d/Y', $dteEnd);
             } else {
                 $displayData['txtSDate'] = date('d/m/Y', $dteStart);
                 $displayData['txtEDate'] = date('d/m/Y', $dteEnd);
             }
         } else {
             setOnFormError($displayData);
             $displayData['bNotAck'] = set_value('rdoAck') == 'notAck';
             $displayData['bIncludeSpon'] = set_value('chkSpon') == 'true';
             $displayData['bMarkAck'] = set_value('chkMarkAck') == 'true';
             $displayData['enumSort'] = set_value('rdoSort');
             $displayData['txtSDate'] = set_value('txtSDate');
             $displayData['txtEDate'] = set_value('txtEDate');
             $displayData['formData']->strACORadio = $this->clsACO->strACO_Radios(set_value('rdoACO'), 'rdoACO');
             // time frame support
             $this->tf_setTFOptsOnFormError($displayData['viewOpts']);
         }
         // time frame support
         $displayData['dateRanges'] = $strRange = tf_strDateRangeMenu($displayData['viewOpts']);
         //--------------------------
         // breadcrumbs
         //--------------------------
         $displayData['pageTitle'] = anchor('main/menu/reports', 'Reports', 'class="breadcrumb"') . ' | Donation Acknowledgments';
         $displayData['title'] = CS_PROGNAME . ' | Reports';
         $displayData['nav'] = $this->mnav_brain_jar->navData();
         $displayData['mainTemplate'] = 'reports/pre_gift_ack_view';
         $this->load->vars($displayData);
         $this->load->view('template');
     } else {
         $bFindNonAck = $_POST['rdoAck'] == 'notAck';
         $bIncludeSpon = @$_POST['chkSpon'] == 'true';
         $bMarkAsAck = @$_POST['chkMarkAck'] == 'true';
         $enumSort = trim($_POST['rdoSort']);
         $lACO = (int) $_POST['rdoACO'];
         tf_getDateRanges($displayData['viewOpts'], $formDates);
         $reportAttributes = array('rptType' => CENUM_REPORTTYPE_PREDEFINED, 'rptName' => CENUM_REPORTNAME_GIFTACK, 'rptDestination' => CENUM_REPORTDEST_SCREEN, 'lStartRec' => 0, 'lRecsPerPage' => 50, 'bShowRecNav' => true, 'viewFile' => 'pre_generic_rpt_view', 'bFindNonAck' => $bFindNonAck, 'bIncludeSpon' => $bIncludeSpon, 'bMarkAsAck' => $bMarkAsAck, 'enumSort' => $enumSort, 'enumAckType' => $enumAckType, 'lACO' => $lACO, 'dteStart' => $formDates->dteStart, 'dteEnd' => $formDates->dteEnd, 'strDateRange' => $formDates->strDateRange, 'strBetween' => $formDates->strBetween);
         $this->clsReports->createReportSessionEntry($reportAttributes);
         $reportID = $this->clsReports->sRpt->reportID;
         if ($bMarkAsAck) {
             switch ($enumAckType) {
                 case 'gifts':
                     $strLabel = 'gifts';
                     break;
                 case 'hon':
                     $strLabel = 'honorees';
                     break;
                 case 'mem':
                     $strLabel = 'memorial mail contacts';
                     break;
             }
             $this->clsReports->sRpt->strExportLabel = 'Export / mark ' . $strLabel . ' as acknowledged';
         }
         redirect('reports/reports/run/' . $reportID);
     }
 }