protected function Form_Create() { $this->lblLabel = new QLabel($this); $this->lblLabel->Text = "Members who left after "; $this->dtxBeforeValue = new QDateTimeTextBox($this); $this->dtxBeforeValue->Name = "Members who Exited Before:"; $this->dtxBeforeValue->Required = true; $this->beforeCalValue = new QCalendar($this, $this->dtxBeforeValue); $this->dtxBeforeValue->RemoveAllActions(QClickEvent::EventName); $this->dtxBeforeValue->AddAction(new QChangeEvent(), new QAjaxAction('dtxDate_Change')); $this->dtxBeforeValue->Text = QApplication::PathInfo(1); $this->dtxAfterValue = new QDateTimeTextBox($this); $this->dtxAfterValue->Name = "Members who exited After:"; $this->dtxAfterValue->Required = true; $this->afterCalValue = new QCalendar($this, $this->dtxAfterValue); $this->dtxAfterValue->RemoveAllActions(QClickEvent::EventName); $this->dtxAfterValue->AddAction(new QChangeEvent(), new QAjaxAction('dtxDate_Change')); $this->dtxAfterValue->Text = QApplication::PathInfo(0); $this->dtgExitingMembers = new QDataGrid($this); $this->dtgExitingMembers->AddColumn(new QDataGridColumn('Name', '<?= $_ITEM->Person->FullName; ?>', 'Width=270px')); $this->dtgExitingMembers->AddColumn(new QDataGridColumn('Membership End Date', '<?= $_ITEM->DateEnd; ?>', 'Width=270px')); $this->dtgExitingMembers->AddColumn(new QDataGridColumn('Termination Reason', '<?= $_ITEM->TerminationReason; ?>', 'Width=270px')); $dtAfterValue = new QDateTime($this->dtxAfterValue->Text); $dtBeforeValue = new QDateTime($this->dtxBeforeValue->Text); $objMembershipArray = Membership::LoadArrayByEndDateRange($dtAfterValue, $dtBeforeValue); $this->iTotalCount = count($objMembershipArray); $this->dtgExitingMembers->DataSource = $objMembershipArray; }
protected function Form_Create() { $this->lblLabel = new QLabel($this); $this->lblLabel->Text = "Members who left after "; $this->dtxBeforeValue = new QDateTimeTextBox($this); $this->dtxBeforeValue->Name = "Members who Exited Before:"; $this->dtxBeforeValue->Required = true; $this->beforeCalValue = new QCalendar($this, $this->dtxBeforeValue); $this->dtxBeforeValue->RemoveAllActions(QClickEvent::EventName); $this->dtxBeforeValue->AddAction(new QChangeEvent(), new QAjaxAction('dtxDate_Change')); $this->dtxBeforeValue->Text = QApplication::PathInfo(1); $this->dtxAfterValue = new QDateTimeTextBox($this); $this->dtxAfterValue->Name = "Members who exited After:"; $this->dtxAfterValue->Required = true; $this->afterCalValue = new QCalendar($this, $this->dtxAfterValue); $this->dtxAfterValue->RemoveAllActions(QClickEvent::EventName); $this->dtxAfterValue->AddAction(new QChangeEvent(), new QAjaxAction('dtxDate_Change')); $this->dtxAfterValue->Text = QApplication::PathInfo(0); $this->dtgExitingMembers = new QDataGrid($this); $this->dtgExitingMembers->AddColumn(new QDataGridColumn('Name', '<?= $_ITEM->Person->FullName; ?>', 'Width=270px')); $this->dtgExitingMembers->AddColumn(new QDataGridColumn('Membership End Date', '<?= $_ITEM->DateEnd; ?>', 'Width=270px')); $this->dtgExitingMembers->AddColumn(new QDataGridColumn('Termination Reason', '<?= $_ITEM->TerminationReason; ?>', 'Width=270px')); $dtAfterValue = new QDateTime($this->dtxAfterValue->Text); $dtBeforeValue = new QDateTime($this->dtxBeforeValue->Text); $objcondition = QQ::Equal(QQN::Membership()->Person->AttributeValue->Attribute->Name, 'Post-2016'); $objMembershipArray = Membership::LoadArrayByEndDateRange($dtAfterValue, $dtBeforeValue, $objcondition); $this->iTotalCount = count($objMembershipArray); $this->dtgExitingMembers->DataSource = $objMembershipArray; $chartArray = array(); $terminationReason = array(); foreach ($objMembershipArray as $member) { if (array_key_exists($member->TerminationReason, $terminationReason)) { $terminationReason[$member->TerminationReason]++; } else { $terminationReason[$member->TerminationReason] = 1; } } ksort($terminationReason, SORT_STRING); foreach ($terminationReason as $key => $value) { $objItem = new memberArray(); $objItem->reason = $key; $objItem->count = $value; $chartArray[] = $objItem; } QApplication::ExecuteJavaScript('initializeChart(' . json_encode($chartArray) . ');'); }
<?php require dirname(__FILE__) . '/../../includes/prepend.inc.php'; QApplication::Authenticate(); $dtAfterValue = new QDateTime(QApplication::PathInfo(0)); $dtBeforeValue = new QDateTime(QApplication::PathInfo(1)); $bIsExit = false; if (QApplication::PathInfo(2) == "exit") { $bIsExit = true; } $objMembershipArray; if ($bIsExit) { $objMembershipArray = Membership::LoadArrayByEndDateRange($dtAfterValue, $dtBeforeValue, QQ::All()); } else { $objMembershipArray = Membership::LoadArrayByStartDateRange($dtAfterValue, $dtBeforeValue, QQ::All()); } $iTotalCount = count($objMembershipArray); if (!$objMembershipArray || !QApplication::PathInfo(0) || !QApplication::PathInfo(1)) { if ($bIsExit) { QApplication::Redirect('/individuals/report_exit_members.php'); } else { QApplication::Redirect('/individuals/reports.php'); } } // Disable strict no-cache for IE due to IE issues with downloading no-cache items if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) { header("Pragma:"); header("Expires:"); } header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename=MemberReport.csv');