protected function setRegistrationStatus() { $backup_event_id = -1; $status_message = 'No registration created!'; if (isset($this->reg_id) && $this->reg_id != '') { // check cim_hrdb_person to determine if a person has been affiliated with registration $regs = new RowManager_RegistrationManager(); $regs->setRegID($this->reg_id); $person = new RowManager_PersonManager(); $regCheck = new MultiTableManager(); $regCheck->addRowManager($regs); $regCheck->addRowManager($person, new JoinPair($regs->getJoinOnPersonID(), $person->getJoinOnPersonID())); $regsList = $regCheck->getListIterator(); $regsArray = $regsList->getDataList(); // variables to be used for later checks $person_id = ''; $confirm_num = ''; $person_address = ''; $person_email = ''; $person_city = ''; $person_province = '0'; $person_pcode = ''; $person_phone = ''; reset($regsArray); // should be only one registration status (for 1 reg_id) foreach (array_keys($regsArray) as $k) { $record = current($regsArray); $backup_event_id = $record['event_id']; $person_id = $record['person_id']; $confirm_num = $record['registration_confirmNum']; $person_email = $record['person_email']; $person_address = $record['person_addr']; $person_city = $record['person_city']; $person_province = $record['province_id']; $person_pcode = $record['person_pc']; $person_phone = $record['person_phone']; next($regsArray); } // determine whether any person records were found for registration if (!isset($regsArray) || count($regsArray) < 1) { $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE); $status_message = 'No person record associated with registration.'; // ASSUMPTION: set reg_id ==> created registration record return RowManager_StatusManager::INCOMPLETE . '|' . $status_message; } else { if (isset($regsArray) && ($person_email == '' || $person_address == '' || $person_city == '' || $person_province == '' || $person_province == '0' || $person_pcode == '' || $person_phone == '')) { $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE); $status_message = 'Please ensure that you have entered the following data:' . '<br> name, e-mail address, permanent address, city, province, postal code, and phone number.'; return RowManager_StatusManager::INCOMPLETE . '|' . $status_message; } } // check cim_hrdb_assignment to determine that the person has been assigned to a campus $assign = new RowManager_AssignmentsManager(); $assign->setPersonID($person_id); $status = new RowManager_CampusAssignmentStatusManager(); $campusAssign = new MultiTableManager(); $campusAssign->addRowManager($assign); $campusAssign->addRowManager($status, new JoinPair($assign->getJoinOnStatusID(), $status->getJoinOnStatusID())); $regsList = $campusAssign->getListIterator(); $regsArray = $regsList->getDataList(); // variables to be used for later checks $assignArray = array(); $this->campus_id = ''; reset($regsArray); // should be only one campus assignment status (for now, later maybe not) foreach (array_keys($regsArray) as $k) { $record = current($regsArray); if ($record['assignmentstatus_desc'] != RowManager_AssignmentsManager::UNKNOWN_STATUS) { $this->campus_id = $record['campus_id']; $assignArray[$this->campus_id] = $record['assignmentstatus_desc']; } next($regsArray); } // determine whether a campus assignment exists for the found person linked to the registration if (!isset($assignArray) || count($assignArray) < 1) { $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE); $status_message = "Please ensure that the registrant is assigned to a valid campus and has a valid status."; return RowManager_StatusManager::INCOMPLETE . '|' . $status_message; } // check cim_reg_fieldvalues to determine whether field values have been set for the registration $fields = new RowManager_FieldManager(); $fields->setEventID($this->event_id); $TRUE = 1; $fields->setIsRequired($TRUE); $fieldsList = $fields->getListIterator(); $fieldsArray = $fieldsList->getDataList(); // reset($fieldsArray); // should be only one campus assignment status (for now, later maybe not) // foreach (array_keys($fieldsArray) as $k) // { // $record = current($fieldsArray); // // next($fieldsArray); // } $fieldValues = new RowManager_FieldValueManager(); $fieldValues->setRegID($this->reg_id); $valuesList = $fieldValues->getListIterator(); $valuesArray = $valuesList->getDataList(); // reset($regsArray); // should be only one campus assignment status (for now, later maybe not) // foreach (array_keys($regsArray) as $k) // { // $record = current($regsArray); // // $assignArray[$record['campus_id'] = $record['assignmentstatus_desc'] // next($regsArray); // } // ensure that the REQUIRED fields for an event all have a record for the particular registration if (count($valuesArray) < count($fieldsArray)) { $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE); $status_message = 'Some required event-specific field values were NOT set for the registration.'; return RowManager_StatusManager::INCOMPLETE . '|' . $status_message; } if (!isset($this->event_id) || $this->event_id == '') { $this->event_id = $backup_event_id; // should have been set earlier when retrieving reg. data... } // retrieve event deposit for later use $event = new RowManager_EventManager(); $event->setEventID($this->event_id); $eventsList = $event->getListIterator(); $eventsArray = $eventsList->getDataList(); $event_deposit = -1; $event_basePrice = -1; reset($eventsArray); // should be only one event per event_id foreach (array_keys($eventsArray) as $k) { $record = current($eventsArray); $event_deposit = $record['event_deposit']; next($eventsArray); } if ($event_deposit == -1) { $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE); $status_message = 'Invalid event associated with registration.'; return RowManager_StatusManager::INCOMPLETE . '|' . $status_message; } // check cim_reg_cashtransaction and cim_reg_cctransaction tables to determine if event deposit has been paid $ccTransaction = new RowManager_CreditCardTransactionManager(); $ccTransaction->setRegID($this->reg_id); $ccTransList = $ccTransaction->getListIterator(); $ccTransArray = $ccTransList->getDataList(); $ccAmount = 0; reset($ccTransArray); foreach (array_keys($ccTransArray) as $k) { $record = current($ccTransArray); $ccAmount += $record['cctransaction_amount']; next($ccTransArray); } // check cash $cashTransaction = new RowManager_CashTransactionManager(); $cashTransaction->setRegID($this->reg_id); $cashTransList = $cashTransaction->getListIterator(); $cashTransArray = $cashTransList->getDataList(); $cashAmount = 0; reset($cashTransArray); foreach (array_keys($cashTransArray) as $k) { $record = current($cashTransArray); $cashAmount += $record['cashtransaction_amtPaid']; next($cashTransArray); } // check scholarship $scholarship = new RowManager_ScholarshipAssignmentManager(); $scholarship->setRegID($this->reg_id); $scholarshipList = $scholarship->getListIterator(); $scholarshipArray = $scholarshipList->getDataList(); $scholarshipAmount = 0; reset($scholarshipArray); foreach (array_keys($scholarshipArray) as $k) { $record = current($scholarshipArray); $scholarshipAmount += $record['scholarship_amount']; next($scholarshipArray); } if ($ccAmount + $cashAmount + $scholarshipAmount < $event_deposit) { $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE); $status_message = 'The event deposit of $' . $event_deposit . ' has not been paid.'; return RowManager_StatusManager::INCOMPLETE . '|' . $status_message; } // check that confirmation # exists and is in proper format (check that format is 'E<event_id>R<reg_id>C<campus_id>') $anyNum = '[0-9]+'; // allow any number for campus ID because person may have been assigned new campuses $pattern = '(E' . $this->event_id . 'R' . $this->reg_id . 'C' . $anyNum . ')'; if (!isset($confirm_num) || preg_match($pattern, $confirm_num) < 1) { // if campus-id missing from confirm. # then // search for campus-id, since user may have created new campus assignment during process $pattern = '(E' . $this->event_id . 'R' . $this->reg_id . 'C)'; if (preg_match($pattern, $confirm_num) >= 1) { $campusAssigned = new RowManager_AssignmentsManager(); $campusAssigned->setPersonID($person_id); $assignmentsList = $campusAssigned->getListIterator(); $assignmentsArray = $assignmentsList->getDataList(); $assignment = current($assignmentsArray); $campusID = $assignment['campus_id']; // retrieve latest campus_id assigned to registrant // update confirmation # in database for the proper registration $updateArray = array(); $updateArray['registration_id'] = $this->reg_id; $updateArray['registration_confirmNum'] = $confirm_num . $campusID; // append the new campus_ID $regsManager = new RowManager_RegistrationManager($this->reg_id); $regsManager->loadFromArray($updateArray); $regsManager->updateDBTable(); } else { $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE); $status_message = 'The confirmation number has not been properly set.'; return RowManager_StatusManager::INCOMPLETE . '|' . $status_message; } } // $status = new RowManager_StatusManager(); // $status->setStatusDesc(RowManager_StatusManager::REGISTERED); // // $statusList = $status->getListIterator(); // $statusArray = $statusList->getDataList(); // $status_id = -1; // reset($statusArray); // should be only 1 record for a particular status description // foreach (array_keys($statusArray) as $k) // { // $record = current($statusArray); // $status_id = $record['status_id']; // // next($statusArray); // } // // if ($status_id == -1) // { // $status_message = 'The registration status could not be properly set to REGISTERED.'; // return RowManager_StatusManager::INCOMPLETE.'|'.$status_message; // } // // $updateValues = array(); // $updateValues['registration_id'] = $this->reg_id; // $updateValues['registration_status'] = $status_id; // mark registration as being REGISTERED // // // Store values in RegistrationManager object // $regs->loadFromArray( $updateValues ); // // echo "<pre>".print_r($this->formValues ,true)."</pre>"; // // // update information // $regs->updateDBTable(); $success = $this->storeRegStatus($this->reg_id, RowManager_StatusManager::REGISTERED); if ($success == false) { $status_message = 'The registration status could not be properly set to REGISTERED.'; return RowManager_StatusManager::INCOMPLETE . '|' . $status_message; } else { $status_message = ''; return RowManager_StatusManager::REGISTERED . '|' . $status_message; } } else { return RowManager_StatusManager::UNASSIGNED . '|' . $status_message; } }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Make a new Template object //$this->pathModuleRoot.'templates/'; // Replace $path with the following line if you want to create a // template tailored for this page: $path = $this->pathModuleRoot . 'templates/'; // store the link values // $this->linkValues[ 'view' ] = 'add/new/href/data/here'; // store the link labels $this->linkLabels['add'] = $this->labels->getLabel('[Add]'); $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]'); $this->linkLabels['del'] = $this->labels->getLabel('[Delete]'); $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]'); // $this->linkLabels[ 'view' ] = 'new link label here'; // $adminLink = $this->linkValues[ 'adminHome' ]; // $this->template->set('adminLink', $adminLink ); // get pricing info // get base price for event participation $event = new RowManager_EventManager($this->event_id); $eventBasePrice = $event->getEventBasePrice(); // get price rules for specific event $priceRules = new RowManager_PriceRuleManager(); $priceRules->setEventID($this->event_id); $ruleManager = $priceRules->getListIterator(); $priceRulesArray = $ruleManager->getDataList(); // echo "<pre>".print_r($priceRulesArray,true)."</pre>"; // array storing the rules applied to a particular registrant $rulesApplied = array(); $priceGetter = new FinancialTools(); $basePriceForThisGuy = $priceGetter->getBasePriceForRegistrant($this->reg_id, $this->event_id, $this->campus_id, $eventBasePrice, $priceRulesArray, $rulesApplied); // get Personal Info $registration = new RowManager_RegistrationManager(); $registration->setRegID($this->reg_id); $person = new RowManager_PersonManager(); $assignment = new RowManager_AssignmentsManager(); // assigns campus to person $campus = new RowManager_CampusManager(); // $campus->setCampusID($this->campus_id); $personalInfo = new MultiTableManager(); $personalInfo->addRowManager($person); $personalInfo->addRowManager($assignment, new JoinPair($person->getJoinOnPersonID(), $assignment->getJoinOnPersonID())); $personalInfo->addRowManager($campus, new JoinPair($campus->getJoinOnCampusID(), $assignment->getJoinOnCampusID())); $personalInfo->addRowManager($registration, new JoinPair($registration->getJoinOnPersonID(), $person->getJoinOnPersonID())); $this->listManager = $personalInfo->getListIterator(); $personInfoArray = $this->listManager->getDataList(); // echo "<pre>".print_r($this->listManager,true)."</pre>"; // echo "<pre>".print_r($personInfoArray,true)."</pre>"; // cycle through registrations and store balance owing for each $this->owingArray = array(); $priceGetter = new FinancialTools(); reset($personInfoArray); foreach (array_keys($personInfoArray) as $k) { $personData = current($personInfoArray); $this->person_id = $personData['person_id']; $this->person_info['person_fname'] = ''; $this->person_info['person_fname'] = $personData['person_fname']; $this->person_info['person_lname'] = ''; $this->person_info['person_lname'] = $personData['person_lname']; $this->person_info['campus_desc'] = ''; $this->person_info['campus_desc'] = $personData['campus_desc']; $this->person_info['person_email'] = ''; $this->person_info['person_email'] = $personData['person_email']; $this->person_info['gender_id'] = ''; $this->person_info['gender_id'] = $personData['gender_id']; $this->person_info['person_local_addr'] = ''; $this->person_info['person_local_addr'] = $personData['person_local_addr']; $this->person_info['person_local_city'] = ''; $this->person_info['person_local_city'] = $personData['person_local_city']; $this->person_info['person_local_province_id'] = ''; $this->person_info['person_local_province_id'] = $personData['person_local_province_id']; $this->person_info['person_local_pc'] = ''; $this->person_info['person_local_pc'] = $personData['person_local_pc']; $this->person_info['person_local_phone'] = ''; $this->person_info['person_local_phone'] = $personData['person_local_phone']; $this->person_info['person_addr'] = ''; $this->person_info['person_addr'] = $personData['person_addr']; $this->person_info['person_city'] = ''; $this->person_info['person_city'] = $personData['person_city']; $this->person_info['province_id'] = ''; $this->person_info['province_id'] = $personData['province_id']; $this->person_info['person_pc'] = ''; $this->person_info['person_pc'] = $personData['person_pc']; $this->person_info['person_phone'] = ''; $this->person_info['person_phone'] = $personData['person_phone']; $this->person_info['registration_status'] = $personData['registration_status']; next($personInfoArray); } $this->linkValues["EditPersonInfo"] .= $this->person_id; $this->prepareTemplate($path); // set current registration status ID $this->template->set('currentRegStatus', $this->person_info['registration_status']); // get list of registration statuses $regStatuses = new RowManager_StatusManager(); $regStatusesList = $regStatuses->getListIterator(); $regStatusesArray = $regStatusesList->getDataList(); $statusList = array(); reset($regStatusesArray); foreach (array_keys($regStatusesArray) as $k) { $record = current($regStatusesArray); $statusList[key($regStatusesArray)] = $record['status_desc']; next($regStatusesArray); } // echo 'status list = <pre>'.print_r($statusList, true).'</pre>'; // set registration status information $this->template->set('statusFormAction', $this->formAction); $this->template->set('statusList', $statusList); $this->template->set('statusButtonText', 'Update'); // set some variables calculated previously; placed here because I need to get PERSON_ID for link // which had to be set before prepareTemplate(), which has to be executed BEFORE setting variables... $this->template->set('eventBasePrice', $eventBasePrice); $this->template->set('priceRules', $rulesApplied); $this->template->set('basePriceForThisGuy', $basePriceForThisGuy); //$priceGetter->calcBalanceOwing($this->reg_id); // NOT NEEDED BECAUSE TOTALS CALCULATED $this->template->set('person', $this->person_info); // get provinces and genders $provinces = new RowManager_ProvinceManager(); $provinceList = $provinces->getListIterator(); $provincesArray = $provinceList->getDataList(); // echo "<pre>".print_r($provincesArray,true)."</pre>"; $province_info = array(); reset($provincesArray); foreach (array_keys($provincesArray) as $k) { $province = current($provincesArray); $province_info[$province['province_id']] = $province['province_desc']; next($provincesArray); } $this->template->set('list_province_id', $province_info); $genders = new RowManager_GenderManager(); $genderList = $genders->getListIterator(); $genderArray = $genderList->getDataList(); // echo "<pre>".print_r($genderArray,true)."</pre>"; $gender_info = array(); reset($genderArray); foreach (array_keys($genderArray) as $k) { $gender = current($genderArray); $gender_info[$gender['gender_id']] = $gender['gender_desc']; next($genderArray); } $this->template->set('list_gender_id', $gender_info); // send in scholarships table, cash transactions table, and credit card transactions table $this->template->set('scholarshipsAdminBox', $this->generateScholarshipsTable()); $this->template->set('cashTransAdminBox', $this->generateCashTransactionsTable()); $this->template->set('ccTransAdminBox', $this->generateCCTransactionsTable()); // get scholarship total $scholarships = new RowManager_ScholarshipAssignmentManager(); $scholarships->setRegID($this->reg_id); $scholarshipTotal = new MultiTableManager(); $scholarshipTotal->addRowManager($scholarships); $scholarshipTotal->setFunctionCall('SUM', 'scholarship_amount'); $scholarshipTotal->setGroupBy('registration_id'); $scholarshipsList = $scholarshipTotal->getListIterator(); $scholarshipsArray = $scholarshipsList->getDataList(); reset($scholarshipsArray); foreach (array_keys($scholarshipsArray) as $k) { $scholarshp = current($scholarshipsArray); $scholarship_total = $scholarshp['SUM(scholarship_amount)']; next($scholarshipsArray); } if (!isset($scholarship_total)) { $scholarship_total = 0; } $this->template->set('scholarshipTotal', $scholarship_total); // get cash total $cashTrans = new RowManager_CashTransactionManager(); $cashTrans->setRegID($this->reg_id); $cashTrans->setReceived(true); $cashTransTotal = new MultiTableManager(); $cashTransTotal->addRowManager($cashTrans); $cashTransTotal->setFunctionCall('SUM', 'cashtransaction_amtPaid'); $cashTransTotal->setGroupBy('reg_id'); $cashTransList = $cashTransTotal->getListIterator(); $cashTransArray = $cashTransList->getDataList(); reset($cashTransArray); foreach (array_keys($cashTransArray) as $k) { $cash_trans = current($cashTransArray); $cash_total = $cash_trans['SUM(cashtransaction_amtPaid)']; next($cashTransArray); } if (!isset($cash_total)) { $cash_total = 0; } $this->template->set('cashTotal', $cash_total); // get cash owed $cashOwed = new RowManager_CashTransactionManager(); $cashOwed->setRegID($this->reg_id); $cashOwed->setReceived(false); $cashOwedTotal = new MultiTableManager(); $cashOwedTotal->addRowManager($cashOwed); $cashOwedTotal->setFunctionCall('SUM', 'cashtransaction_amtPaid'); $cashOwedTotal->setGroupBy('reg_id'); $cashOwedList = $cashOwedTotal->getListIterator(); $cashOwedArray = $cashOwedList->getDataList(); reset($cashOwedArray); foreach (array_keys($cashOwedArray) as $k) { $cash_owed = current($cashOwedArray); $cash_owing = $cash_owed['SUM(cashtransaction_amtPaid)']; next($cashOwedArray); } if (!isset($cash_owing)) { $cash_owing = 0; } $this->template->set('cashOwed', $cash_owing); // get credit card total $ccTrans = new RowManager_CreditCardTransactionManager(); $ccTrans->setProcessed(true); $ccTrans->setRegID($this->reg_id); $ccTransTotal = new MultiTableManager(); $ccTransTotal->addRowManager($ccTrans); $ccTransTotal->setFunctionCall('SUM', 'cctransaction_amount'); $ccTransTotal->setGroupBy('reg_id'); $ccTransList = $ccTransTotal->getListIterator(); $ccTransArray = $ccTransList->getDataList(); reset($ccTransArray); foreach (array_keys($ccTransArray) as $k) { $cc_trans = current($ccTransArray); $cc_total = $cc_trans['SUM(cctransaction_amount)']; next($ccTransArray); } if (!isset($cc_total)) { $cc_total = 0; } $this->template->set('ccTotal', $cc_total); // TODO??: get credit card transactions NOT processed // set form for editing registration-specific form fields' values $this->template->set('eventFieldsFormSingle', $this->generateFieldValuesForm()); // store any additional link Columns // example: //$title = $this->labels->getLabel( '[title_groups]'); //$columnLabel = $this->labels->getLabel( '[groups]'); //$link = $this->linkValues[ 'groups' ]; //$fieldName = 'accessgroup_id'; //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName); // store the page labels // NOTE: use this location to update any label tags ... // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // store the Row Manager's XML Node Name // $this->template->set( 'rowManagerXMLNodeName', RowManager_RegistrationManager::XML_NODE_NAME ); $this->template->set('rowManagerXMLNodeName', MultiTableManager::XML_NODE_NAME); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'registration_id'); // Load over-payment message, if necessary if ($this->ccTrans_subPage->hasOverPaid()) { $this->template->set('attemptedOverpayment', true); } // TODO: somehow merge the primary join with the balance owing join.... for efficiency /* * Set up any additional data transfer to the Template here... */ // $this->template->set( 'dataList', $this->dataList); $templateName = 'page_EditRegistrationDetails.tpl.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_EditCampusRegistrations.php'; return $this->template->fetch($templateName); }
/** * function getCCTransactions * <pre> * Returns array of arrays, indexed by credit card transaction ID * </pre> * @param $regID [INTEGER] registration ID * @return [ARRAY] the array of credit card transaction records for registration $regID */ function getCCTransactions($regID) { $ccTransactions = new RowManager_CreditCardTransactionManager(); $ccTransactions->setRegID($regID); $ccTransIterator = $ccTransactions->getListIterator(); $ccTransArray = $ccTransIterator->getDataList(); //echo "<pre>".print_r($ccTransArray,true)."</pre>"; return $ccTransArray; }
private function deleteAssociatedRegRecords($reg_id) { // delete any CC transactions linked to the registration record $ccTrans = new RowManager_CreditCardTransactionManager(); $ccTrans->setRegID($reg_id); $ccTransList = $ccTrans->getListIterator(); $ccTransArray = $ccTransList->getDataList(); reset($ccTransArray); foreach (array_keys($ccTransArray) as $k) { $record = current($ccTransArray); $ccTransID = $record['cctransaction_id']; // delete any CC transaction receipts linked to the registration record $ccReceipt = new RowManager_ReceiptManager($ccTransID); $ccReceipt->deleteEntry(); // delete CC trans record now that we know CC trans. ID $deleteCCtrans = new RowManager_CreditCardTransactionManager($ccTransID); $deleteCCtrans->deleteEntry(); next($ccTransArray); } // delete any cash transactions linked to the registration record $cashTrans = new RowManager_CashTransactionManager(); $cashTrans->setRegID($reg_id); $cashTransList = $cashTrans->getListIterator(); $cashTransArray = $cashTransList->getDataList(); reset($cashTransArray); foreach (array_keys($cashTransArray) as $k) { $record = current($cashTransArray); $cashTransID = $record['cashtransaction_id']; // delete cash trans record now that we know cash trans. ID $deleteCashTrans = new RowManager_CashTransactionManager($cashTransID); $deleteCashTrans->deleteEntry(); next($cashTransArray); } // delete any scholarships linked to the registration record $scholarship = new RowManager_ScholarshipAssignmentManager(); $scholarship->setRegID($reg_id); $scholarshipList = $scholarship->getListIterator(); $scholarshipArray = $scholarshipList->getDataList(); reset($scholarshipArray); foreach (array_keys($scholarshipArray) as $k) { $record = current($scholarshipArray); $scholarshipID = $record['scholarship_id']; // delete cash trans record now that we know scholarship ID $deleteScholarship = new RowManager_ScholarshipAssignmentManager($scholarshipID); $deleteScholarship->deleteEntry(); next($scholarshipArray); } // delete any field values linked to the registration record $fieldValues = new RowManager_FieldValueManager(); $fieldValues->setRegID($reg_id); $fieldValuesList = $fieldValues->getListIterator(); $fieldValuesArray = $fieldValuesList->getDataList(); reset($fieldValuesArray); foreach (array_keys($fieldValuesArray) as $k) { $record = current($fieldValuesArray); $fieldValueID = $record['fieldvalues_id']; // delete cash trans record now that we know field value ID $deleteFieldValue = new RowManager_FieldValueManager($fieldValueID); $deleteFieldValue->deleteEntry(); next($fieldValuesArray); } }
protected function getPreviousPaid() { // Get previously processed CC transactions $ccTransManager = new RowManager_CreditCardTransactionManager(); $ccTransManager->setRegID($this->reg_id); $ccTransManager->setProcessed(true); $ccTransList = $ccTransManager->getListIterator(); $ccTransArray = $ccTransList->getDataList(); $paid = 0; reset($ccTransArray); foreach (array_keys($ccTransArray) as $key) { $record = current($ccTransArray); $paid += $record['cctransaction_amount']; next($ccTransArray); } // Get previously processed cash transactions $cashTransManager = new RowManager_CashTransactionManager(); $cashTransManager->setRegID($this->reg_id); $cashTransManager->setReceived(true); $cashTransList = $cashTransManager->getListIterator(); $cashTransArray = $cashTransList->getDataList(); reset($cashTransArray); foreach (array_keys($cashTransArray) as $key) { $record = current($cashTransArray); $paid += $record['cashtransaction_amtPaid']; next($cashTransArray); } return $paid; }
function getCCtransTotal() { $ccTrans = new RowManager_CreditCardTransactionManager(); $ccTrans->setRegID($this->reg_id); $ccTrans->setProcessed(true); $ccTransTotal = new MultiTableManager(); $ccTransTotal->addRowManager($ccTrans); $ccTransTotal->setFunctionCall('SUM', 'cctransaction_amount'); $ccTransTotal->setGroupBy('reg_id'); $ccTransList = $ccTransTotal->getListIterator(); $ccTransArray = $ccTransList->getDataList(); $cc_total = 0; reset($ccTransArray); foreach (array_keys($ccTransArray) as $k) { $cc_trans = current($ccTransArray); $cc_total = $cc_trans['SUM(cctransaction_amount)']; next($ccTransArray); } return $cc_total; }