/** * This will move all the transactions for a given year to be credited to another person * @param integer $intYear * @param Person $objPerson */ public function MoveStewardshipTransactions($intYear, Person $objPerson) { StewardshipContribution::GetDatabase()->TransactionBegin(); $objArray = StewardshipContribution::QueryArray(QQ::AndCondition(QQ::Equal(QQN::StewardshipContribution()->PersonId, $this->intId), QQ::GreaterOrEqual(QQN::StewardshipContribution()->DateCredited, new QDateTime($intYear . '-01-01')), QQ::LessThan(QQN::StewardshipContribution()->DateCredited, new QDateTime($intYear + 1 . '-01-01')))); foreach ($objArray as $objContribution) { $objContribution->Person = $objPerson; $objContribution->Save(); foreach ($objContribution->GetStewardshipPostLineItemArray() as $objLineItem) { $objLineItem->Person = $objPerson; $objLineItem->Save(); } } StewardshipContribution::GetDatabase()->TransactionCommit(); }
public function dtgContributions_Bind() { if ($this->objStack) { $objCondition = QQ::Equal(QQN::StewardshipContribution()->StewardshipStackId, $this->objStack->Id); $this->dtgContributions->MetaDataBinder($objCondition, QQ::OrderBy(QQN::StewardshipContribution()->Id)); } }
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());
foreach ($_CONTROL->ParentControl->objSelectedPerson->GetAddressArray() as $objAddress) { ?> <li><?php _p($objAddress->AddressShortLine); ?> </li> <?php } ?> </ul> <h4>Recent Contributions (up to 15)</h4> <ul> <?php foreach ($_CONTROL->ParentControl->objSelectedPerson->GetStewardshipContributionArray(array(QQ::OrderBy(QQN::StewardshipContribution()->Id, false), QQ::LimitInfo(15))) as $objContribution) { ?> <li> <?php _p($objContribution->LineDescription); ?> <?php if (is_file($objContribution->Path)) { ?> | <a href="#" <?php $_CONTROL->ParentControl->pxyViewCheckImage->RenderAsEvents($objContribution->Id); ?> >View Image</a> <?php } ?>
protected function CalculateQuery(&$objCondition, &$objClauses, &$blnQueried) { $objCondition = QQ::All(); $objClauses = array(); $blnQueried = false; if ($strName = trim($this->txtName->Text)) { Person::PrepareQqForSearch($strName, $objCondition, $objClauses, QQN::StewardshipContribution()->Person); $blnQueried = true; } if ($intFundId = $this->lstFund->SelectedValue) { $blnQueried = true; $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipContribution()->StewardshipContributionAmount->StewardshipFundId, $intFundId)); } if (strlen($strText = trim($this->txtAmount->Text))) { $blnQueried = true; $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipContribution()->TotalAmount, $strText)); } if (strlen($strText = trim($this->txtCheckNumber->Text))) { $blnQueried = true; $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::StewardshipContribution()->CheckNumber, '%' . $strText . '%')); } if (strlen($strText = trim($this->txtAuthorizationNumber->Text))) { $blnQueried = true; $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::StewardshipContribution()->AuthorizationNumber, '%' . $strText . '%')); } $dttStart = $this->txtDateCreditedStart->DateTime; $dttEnd = $this->txtDateCreditedEnd->DateTime; if ($dttStart || $dttEnd) { $blnQueried = true; if ($dttStart && $dttEnd) { $objCondition = QQ::AndCondition($objCondition, QQ::GreaterOrEqual(QQN::StewardshipContribution()->DateCredited, $dttStart), QQ::LessOrEqual(QQN::StewardshipContribution()->DateCredited, $dttEnd)); } else { if ($dttStart) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipContribution()->DateCredited, $dttStart)); } else { $objCondition = QQ::AndCondition($objCondition, QQ::LessOrEqual(QQN::StewardshipContribution()->DateCredited, $dttEnd)); } } } $dttStart = $this->txtDateEnteredStart->DateTime; $dttEnd = $this->txtDateEnteredEnd->DateTime; if ($dttStart || $dttEnd) { $blnQueried = true; if ($dttStart && $dttEnd) { $objCondition = QQ::AndCondition($objCondition, QQ::GreaterOrEqual(QQN::StewardshipContribution()->StewardshipBatch->DateEntered, $dttStart), QQ::LessOrEqual(QQN::StewardshipContribution()->StewardshipBatch->DateEntered, $dttEnd)); } else { if ($dttStart) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipContribution()->StewardshipBatch->DateEntered, $dttStart)); } else { $objCondition = QQ::AndCondition($objCondition, QQ::LessOrEqual(QQN::StewardshipContribution()->StewardshipBatch->DateEntered, $dttEnd)); } } } }
public static function LoadArrayByDateRange($dttAfter, $dttBefore, $objOptionalClauses = null) { // This will return an array of StewardshipContribution objects return StewardshipContribution::QueryArray(QQ::AndCondition(QQ::GreaterOrEqual(QQN::StewardshipContribution()->DateCredited, $dttAfter), QQ::LessOrEqual(QQN::StewardshipContribution()->DateCredited, $dttBefore)), $objOptionalClauses); }
/** * Count StewardshipContributions * by CreatedByLoginId Index(es) * @param integer $intCreatedByLoginId * @return int */ public static function CountByCreatedByLoginId($intCreatedByLoginId, $objOptionalClauses = null) { // Call StewardshipContribution::QueryCount to perform the CountByCreatedByLoginId query return StewardshipContribution::QueryCount(QQ::Equal(QQN::StewardshipContribution()->CreatedByLoginId, $intCreatedByLoginId), $objOptionalClauses); }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a StewardshipContribution-based QQNode. * It will also verify that it is a proper StewardshipContribution-based QQNode, and will throw an exception otherwise. * * @param mixed $mixContent * @return QQNode */ protected function ResolveContentItem($mixContent) { if ($mixContent instanceof QQNode) { if (!$mixContent->_ParentNode) { throw new QCallerException('Content QQNode cannot be a Top Level Node'); } if ($mixContent->_RootTableName == 'stewardship_contribution') { if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } $objCurrentNode = $mixContent; while ($objCurrentNode = $objCurrentNode->_ParentNode) { if (!$objCurrentNode instanceof QQNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } } return $mixContent; } else { throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "stewardship_contribution".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'Id': return QQN::StewardshipContribution()->Id; case 'PersonId': return QQN::StewardshipContribution()->PersonId; case 'Person': return QQN::StewardshipContribution()->Person; case 'StewardshipContributionTypeId': return QQN::StewardshipContribution()->StewardshipContributionTypeId; case 'StewardshipBatchId': return QQN::StewardshipContribution()->StewardshipBatchId; case 'StewardshipBatch': return QQN::StewardshipContribution()->StewardshipBatch; case 'StewardshipStackId': return QQN::StewardshipContribution()->StewardshipStackId; case 'StewardshipStack': return QQN::StewardshipContribution()->StewardshipStack; case 'CheckingAccountLookupId': return QQN::StewardshipContribution()->CheckingAccountLookupId; case 'CheckingAccountLookup': return QQN::StewardshipContribution()->CheckingAccountLookup; case 'TotalAmount': return QQN::StewardshipContribution()->TotalAmount; case 'DateEntered': return QQN::StewardshipContribution()->DateEntered; case 'DateCleared': return QQN::StewardshipContribution()->DateCleared; case 'DateCredited': return QQN::StewardshipContribution()->DateCredited; case 'CheckNumber': return QQN::StewardshipContribution()->CheckNumber; case 'AuthorizationNumber': return QQN::StewardshipContribution()->AuthorizationNumber; case 'AlternateSource': return QQN::StewardshipContribution()->AlternateSource; case 'NonDeductibleFlag': return QQN::StewardshipContribution()->NonDeductibleFlag; case 'Note': return QQN::StewardshipContribution()->Note; case 'CreatedByLoginId': return QQN::StewardshipContribution()->CreatedByLoginId; case 'CreatedByLogin': return QQN::StewardshipContribution()->CreatedByLogin; case 'UnpostedFlag': return QQN::StewardshipContribution()->UnpostedFlag; case 'CreditCardPayment': return QQN::StewardshipContribution()->CreditCardPayment; default: throw new QCallerException('Simple Property not found in StewardshipContributionDataGrid content: ' . $mixContent); } } else { if ($mixContent instanceof QQAssociationNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } else { throw new QCallerException('Invalid Content type'); } } } }