public static LessOrEqual ( QQNode $objQueryNode, $mixValue ) | ||
$objQueryNode | QQNode |
<h2>Select all People where: the first name is alphabetically "greater than" the last name</h2> <ul> <?php $objPersonArray = Person::QueryArray(QQ::GreaterThan(QQN::Person()->FirstName, QQN::Person()->LastName)); foreach ($objPersonArray as $objPerson) { _p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false); } ?> </ul> <h2>Select all Projects where: the manager's first name is alphabetically "greater than" the last name, or who's name contains "Website"</h2> <ul> <?php $objProjectArray = Project::QueryArray(QQ::OrCondition(QQ::GreaterThan(QQN::Project()->ManagerPerson->FirstName, QQN::Project()->ManagerPerson->LastName), QQ::Like(QQN::Project()->Name, '%Website%'))); foreach ($objProjectArray as $objProject) { _p(sprintf('<li>%s (managed by %s %s)</li>', $objProject->Name, $objProject->ManagerPerson->FirstName, $objProject->ManagerPerson->LastName), false); } ?> </ul> <h2>Select all Projects where: the Project ID <= 2 AND (the manager's first name is alphabetically "greater than" the last name, or who's name contains "Website")</h2> <ul> <?php $objProjectArray = Project::QueryArray(QQ::AndCondition(QQ::OrCondition(QQ::GreaterThan(QQN::Project()->ManagerPerson->FirstName, QQN::Project()->ManagerPerson->LastName), QQ::Like(QQN::Project()->Name, '%Website%')), QQ::LessOrEqual(QQN::Project()->Id, 2))); foreach ($objProjectArray as $objProject) { _p(sprintf('<li>%s (managed by %s %s)</li>', $objProject->Name, $objProject->ManagerPerson->FirstName, $objProject->ManagerPerson->LastName), false); } ?> </ul> </div> <?php require '../includes/footer.inc.php';
public static function _(QQNode $objQueryNode, $strSymbol, $mixValue, $mixValueTwo = null) { try { switch (strtolower(trim($strSymbol))) { case '=': return QQ::Equal($objQueryNode, $mixValue); case '!=': return QQ::NotEqual($objQueryNode, $mixValue); case '>': return QQ::GreaterThan($objQueryNode, $mixValue); case '<': return QQ::LessThan($objQueryNode, $mixValue); case '>=': return QQ::GreaterOrEqual($objQueryNode, $mixValue); case '<=': return QQ::LessOrEqual($objQueryNode, $mixValue); case 'in': return QQ::In($objQueryNode, $mixValue); case 'not in': return QQ::NotIn($objQueryNode, $mixValue); case 'like': return QQ::Like($objQueryNode, $mixValue); case 'not like': return QQ::NotLike($objQueryNode, $mixValue); case 'is null': return QQ::IsNull($objQueryNode, $mixValue); case 'is not null': return QQ::IsNotNull($objQueryNode, $mixValue); case 'between': return QQ::Between($objQueryNode, $mixValue, $mixValueTwo); case 'not between': return QQ::NotBetween($objQueryNode, $mixValue, $mixValueTwo); default: throw new QCallerException('Unknown Query Comparison Operation: ' . $strSymbol, 0); } } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
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());
protected function dtgPerson_Bind() { $dtAfterValue = new QDateTime($this->dtxAfterValue->Text); $dtBeforeValue = new QDateTime($this->dtxBeforeValue->Text); $objConditions = QQ::All(); $objConditions = QQ::AndCondition($objConditions, QQ::GreaterOrEqual(QQN::Person()->Comment->DatePosted, $dtAfterValue)); $objConditions = QQ::AndCondition($objConditions, QQ::LessOrEqual(QQN::Person()->Comment->DatePosted, $dtBeforeValue)); $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Person()->Comment->CommentCategory->Name, "Pastoral")); $this->dtgPerson->TotalItemCount = count(Person::QueryArray($objConditions)); $objPersonArray = Person::QueryArray($objConditions, $this->dtgPerson->LimitClause); $this->dtgPerson->DataSource = $objPersonArray; }
<?php QCryptography::$Key = CRYPTO_KEY; $objCrypto = new QCryptography(null, false); // iterate through all recurring payments within the time period. $objRecurringPaymentCursor = RecurringPayments::QueryCursor(QQ::AndCondition(QQ::LessOrEqual(QQN::RecurringPayments()->StartDate, date('Y-m-d')), QQ::GreaterOrEqual(QQN::RecurringPayments()->EndDate, date('Y-m-d')))); while ($objRecurringPayment = RecurringPayments::InstantiateCursor($objRecurringPaymentCursor)) { // display information.. print sprintf("Payment of: %s within time period: %s - %s\n", $objRecurringPayment->Amount, $objRecurringPayment->StartDate, $objRecurringPayment->EndDate); print sprintf("name : %s\nAddress: %s %s\n City: %s\nState: %s\nZip: %s\n", $objCrypto->Decrypt($objRecurringPayment->CardHolderName), $objCrypto->Decrypt($objRecurringPayment->Address1), $objCrypto->Decrypt($objRecurringPayment->Address2), $objCrypto->Decrypt($objRecurringPayment->City), $objRecurringPayment->State, $objCrypto->Decrypt($objRecurringPayment->Zip)); print sprintf("Account Number: %s\nExpiration Date: %s\nSecurity code: %s\n", $objCrypto->Decrypt($objRecurringPayment->AccountNumber), $objRecurringPayment->ExpirationDate, $objCrypto->Decrypt($objRecurringPayment->SecurityCode)); print sprintf("CreditCard Type: %d\n", $objRecurringPayment->CreditCardTypeId); // identify if any are due today $startDate = $objRecurringPayment->StartDate; $timePeriod = 0; switch ($objRecurringPayment->PaymentPeriod->Id) { case 1: // weekly $timePeriod = 7 * 24 * 60 * 60; break; case 2: // bi-weekly $timePeriod = 2 * 7 * 24 * 60 * 60; break; case 3: // monthly $timePeriod = 30 * 24 * 60 * 60; break; case 4: // quarterly $timePeriod = 4 * 30 * 24 * 60 * 60;
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); }
public function dtgStewardshipContributionAmount_Bind() { $this->fltTotal = 0; if ($this->chkCombined && $this->chkCombined->Checked) { $intPersonIdArray = array(); foreach ($this->objForm->objHousehold->GetHouseholdParticipationArray() as $objParticipation) { $intPersonIdArray[] = $objParticipation->PersonId; } $objCondition = QQ::In(QQN::StewardshipContributionAmount()->StewardshipContribution->PersonId, $intPersonIdArray); } else { $objCondition = QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipContribution->PersonId, $this->objPerson->Id); } if ($this->lstYear->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::GreaterOrEqual(QQN::StewardshipContributionAmount()->StewardshipContribution->DateCredited, new QDateTime($this->lstYear->SelectedValue . '-01-01 00:00:00')), QQ::LessOrEqual(QQN::StewardshipContributionAmount()->StewardshipContribution->DateCredited, new QDateTime($this->lstYear->SelectedValue . '-12-31 23:59:59'))); } if ($this->lstFund->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipFundId, $this->lstFund->SelectedValue)); } $this->dtgStewardshipContributionAmount->MetaDataBinder($objCondition); // Add 'Totals' Row $objDataSource = $this->dtgStewardshipContributionAmount->DataSource; $objDataSource[] = new StewardshipContributionAmount(); $this->dtgStewardshipContributionAmount->DataSource = $objDataSource; }
public static function LoadArrayByEndDateRange($dttAfterDateStart, $dttBeforeDateStart, $objCondition = null, $objOptionalClauses = null) { // This will return an array of Membership objects $objCondition = QQ::AndCondition($objCondition, QQ::AndCondition(QQ::GreaterOrEqual(QQN::Membership()->DateEnd, $dttAfterDateStart), QQ::LessOrEqual(QQN::Membership()->DateEnd, $dttBeforeDateStart))); return Membership::QueryArray($objCondition, $objOptionalClauses); }