if ($intYear < 1950 || $intYear > 2500) { exit(0); } // Setup Zend Framework load set_include_path(get_include_path() . ':' . __INCLUDES__); require_once 'Zend/Loader.php'; Zend_Loader::loadClass('Zend_Pdf'); print "Generating Statistics PDF for " . $intYear . "\r\n"; // Delete Old Files exec('rm -r -f ' . STATISTICS_PDF_PATH . '/StatisticsFor' . $intYear . '*.pdf'); // Create the PDF Object for the PDF $objStatisticPdf = new Zend_Pdf(); $dtxAfterValue = new QDateTime("1/1/" . $intYear); $dtxBeforeValue = new QDateTime("12/31/" . $intYear); // Get the Data $objContributionCursor = StewardshipContribution::QueryCursor(QQ::AndCondition(QQ::GreaterOrEqual(QQN::StewardshipContribution()->DateCredited, $dtxAfterValue), QQ::LessOrEqual(QQN::StewardshipContribution()->DateCredited, $dtxBeforeValue))); // Setup the data holders $fltTotalGifts = 0; $fltTotalAdditionalUniqueGivers = 0; $fltTotalGiftsOver1000 = 0; $fltTotalGiftsOver10000 = 0; $fltTotalAverageGiftSize = 0; $fltTotalGiftAmount = 0; $fltTotalGivers = 0; $objDataGridArray = array(); $objMonthlyTotal = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $objMonthlyCount = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $objOver1000 = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $objOver10000 = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $objUniqueGiver = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); $objGiverCount = array(array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array(), array());
$objMarriedPersonArray[] = $objParticipation->Person; } } if (count($objMarriedPersonArray) == 2) { $objMarriedPersonArray[0]->DeleteAllMarriages(); $objMarriedPersonArray[1]->DeleteAllMarriages(); $objMarriedPersonArray[0]->CreateMarriageWith($objMarriedPersonArray[1]); } else { if (count($objMarriedPersonArray)) { print "\r\nWhat!? Household " . $objHousehold->Id . " has a marriage count of " . count($objMarriedPersonArray) . "!\r\n"; } } $objHousehold->Save(); } QDataGen::DisplayForEachTaskEnd('Refreshing Household data'); $objStewardshipCursor = StewardshipContribution::QueryCursor(QQ::All()); QDataGEn::DisplayForEachTaskStart('Refreshing Contributions', StewardshipContribution::CountAll()); while ($objContribution = StewardshipContribution::InstantiateCursor($objStewardshipCursor)) { QDataGen::DisplayForEachTaskNext('Refreshing Contributions'); $objContribution->RefreshTotalAmount(); } QDataGen::DisplayForEachTaskEnd('Refreshing Contributions'); $objStewardshipCursor = StewardshipStack::QueryCursor(QQ::All()); QDataGEn::DisplayForEachTaskStart('Refreshing Stacks', StewardshipStack::CountAll()); while ($objStack = StewardshipStack::InstantiateCursor($objStewardshipCursor)) { QDataGen::DisplayForEachTaskNext('Refreshing Stacks'); $objStack->RefreshActualTotalAmount(); } QDataGen::DisplayForEachTaskEnd('Refreshing Stacks'); $objStewardshipCursor = StewardshipBatch::QueryCursor(QQ::All()); QDataGEn::DisplayForEachTaskStart('Refreshing Batches', StewardshipBatch::CountAll());
/** * Create and setup QListBox lstStewardshipContribution * @param string $strControlId optional ControlId to use * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return QListBox */ public function lstStewardshipContribution_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstStewardshipContribution = new QListBox($this->objParentObject, $strControlId); $this->lstStewardshipContribution->Name = QApplication::Translate('Stewardship Contribution'); $this->lstStewardshipContribution->Required = true; if (!$this->blnEditMode) { $this->lstStewardshipContribution->AddItem(QApplication::Translate('- Select One -'), null); } // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objStewardshipContributionCursor = StewardshipContribution::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objStewardshipContribution = StewardshipContribution::InstantiateCursor($objStewardshipContributionCursor)) { $objListItem = new QListItem($objStewardshipContribution->__toString(), $objStewardshipContribution->Id); if ($this->objStewardshipPostLineItem->StewardshipContribution && $this->objStewardshipPostLineItem->StewardshipContribution->Id == $objStewardshipContribution->Id) { $objListItem->Selected = true; } $this->lstStewardshipContribution->AddItem($objListItem); } // Return the QListBox return $this->lstStewardshipContribution; }
public function btnCalculateTotal_Click() { $this->CalculateQuery($objCondition, $objClauses, $blnQueried); if ($blnQueried) { $objContributionCursor = StewardshipContribution::QueryCursor($objCondition, $objClauses); $fltTotal = 0.0; while ($objContribution = StewardshipContribution::InstantiateCursor($objContributionCursor)) { // We need to look at a specific fund, if that was specified if ($this->lstFund->SelectedValue) { foreach ($objContribution->GetStewardshipContributionAmountArray() as $objAmount) { if ($objAmount->StewardshipFundId == $this->lstFund->SelectedValue) { $fltTotal += $objAmount->Amount; } } } else { $fltTotal += $objContribution->TotalAmount; } } QApplication::DisplayAlert('Total: ' . QApplication::DisplayCurrency($fltTotal)); } else { QApplication::DisplayAlert('No query was specified.'); } $this->btnCalculateTotal->Display = true; $this->btnCalculateLabel->Display = false; }