Пример #1
0
 protected function CalculateQuery(&$objCondition, &$objClauses, &$blnQueried)
 {
     $objCondition = QQ::All();
     $objClauses = array();
     $blnQueried = false;
     if ($intFundId = $this->lstFund->SelectedValue) {
         $blnQueried = true;
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipPledge()->StewardshipFundId, $intFundId));
     }
     if (!is_null($blnFlag = $this->lstActiveFlag->SelectedValue)) {
         $blnQueried = true;
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipPledge()->ActiveFlag, $blnFlag));
     }
     if (!is_null($blnFlag = $this->lstFulfilledFlag->SelectedValue)) {
         $blnQueried = true;
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipPledge()->FulfilledFlag, $blnFlag));
     }
 }
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a StewardshipPledge-based QQNode.
  * It will also verify that it is a proper StewardshipPledge-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_pledge') {
             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_pledge".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'Id':
                     return QQN::StewardshipPledge()->Id;
                 case 'PersonId':
                     return QQN::StewardshipPledge()->PersonId;
                 case 'Person':
                     return QQN::StewardshipPledge()->Person;
                 case 'StewardshipFundId':
                     return QQN::StewardshipPledge()->StewardshipFundId;
                 case 'StewardshipFund':
                     return QQN::StewardshipPledge()->StewardshipFund;
                 case 'DateStarted':
                     return QQN::StewardshipPledge()->DateStarted;
                 case 'DateEnded':
                     return QQN::StewardshipPledge()->DateEnded;
                 case 'PledgeAmount':
                     return QQN::StewardshipPledge()->PledgeAmount;
                 case 'ContributedAmount':
                     return QQN::StewardshipPledge()->ContributedAmount;
                 case 'RemainingAmount':
                     return QQN::StewardshipPledge()->RemainingAmount;
                 case 'FulfilledFlag':
                     return QQN::StewardshipPledge()->FulfilledFlag;
                 case 'ActiveFlag':
                     return QQN::StewardshipPledge()->ActiveFlag;
                 default:
                     throw new QCallerException('Simple Property not found in StewardshipPledgeDataGrid 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');
             }
         }
     }
 }
Пример #3
0
 /**
  * Count StewardshipPledges
  * by StewardshipFundId Index(es)
  * @param integer $intStewardshipFundId
  * @return int
  */
 public static function CountByStewardshipFundId($intStewardshipFundId, $objOptionalClauses = null)
 {
     // Call StewardshipPledge::QueryCount to perform the CountByStewardshipFundId query
     return StewardshipPledge::QueryCount(QQ::Equal(QQN::StewardshipPledge()->StewardshipFundId, $intStewardshipFundId), $objOptionalClauses);
 }
Пример #4
0
 /**
  * Given an existing Zend_Pdf record, this will generate the PDF Receipt page(s) for this Person or Household for the given year.
  * @param Zend_Pdf $objPdf
  * @param mixed $objPersonOrHousehold
  * @param integer $intYear
  * @param boolean $blnDrawLegal whether or not to include the "legal" tax information (e.g. yes for annual, no for quarterly)
  * @param integer $intQuarter optional, can be 1, 2 or 3 to limit results to JUST Q1, Q1-Q2, Q1-Q3 data if applicable
  */
 public static function GenerateReceiptInPdf(Zend_Pdf $objPdf, $objPersonOrHousehold, $intYear, $blnDrawLegal, $intQuarter = null)
 {
     $intPersonIdArray = self::GetPersonIdArrayForPersonOrHousehold($objPersonOrHousehold);
     // Get the Contributions
     $objContributionAmountArray = self::GetContributionAmountArrayForPersonArray($intPersonIdArray, $intYear, $intQuarter);
     // Get the Pledges
     $objCondition = QQ::AndCondition(QQ::In(QQN::StewardshipPledge()->PersonId, $intPersonIdArray), QQ::OrCondition(QQ::Equal(QQN::StewardshipPledge()->ActiveFlag, true), QQ::AndCondition(QQ::GreaterOrEqual(QQN::StewardshipPledge()->DateStarted, new QDateTime($intYear . '-01-01 00:00:00')), QQ::LessOrEqual(QQN::StewardshipPledge()->DateStarted, new QDateTime($intYear . '-12-31 23:59:59'))), QQ::AndCondition(QQ::GreaterOrEqual(QQN::StewardshipPledge()->DateEnded, new QDateTime($intYear . '-01-01 00:00:00')), QQ::LessOrEqual(QQN::StewardshipPledge()->DateEnded, new QDateTime($intYear . '-12-31 23:59:59'))), QQ::AndCondition(QQ::GreaterOrEqual(QQN::StewardshipPledge()->DateEnded, new QDateTime($intYear . '-12-31 23:59:59')), QQ::LessOrEqual(QQN::StewardshipPledge()->DateStarted, new QDateTime($intYear . '-01-01 00:00:00')))));
     $objPledgeArray = StewardshipPledge::QueryArray($objCondition, QQ::OrderBy(QQN::StewardshipPledge()->DateStarted, QQN::StewardshipPledge()->DateEnded));
     // New Page every 38
     $intPageNumber = 1;
     $objPageOneOfThis = null;
     $intTotalPages = floor((count($objContributionAmountArray) - 1) / 38) + 1;
     for ($intIndex = 0; $intIndex < count($objContributionAmountArray); $intIndex += 38) {
         $objPage = $objPdf->newPage(Zend_Pdf_Page::SIZE_LETTER);
         if (!$objPageOneOfThis) {
             $objPageOneOfThis = $objPage;
         }
         $objPdf->pages[] = $objPage;
         // Draw Header
         if ($intPageNumber == 1) {
             self::DrawHeader($objPage);
             self::DrawAddress($objPage, $objPersonOrHousehold);
             self::DrawFooter($objPage, $blnDrawLegal);
             self::DrawSummary($objPage, $objContributionAmountArray, $intYear);
             self::DrawPledges($objPage, $objPledgeArray);
         }
         // Draw Page Info
         $intY = $intPageNumber == 1 ? STEWARDSHIP_TOP - 1.7125 * 72 : STEWARDSHIP_TOP - 0.5 * 72;
         self::DrawInfo($objPage, $objPersonOrHousehold, $intYear, $intQuarter, $intY, $intPageNumber, $intTotalPages);
         // Draw Items
         $intY = $intPageNumber == 1 ? STEWARDSHIP_TOP - 3.5 * 72 : STEWARDSHIP_TOP - 1.5 * 72;
         self::DrawItems($objPage, array_slice($objContributionAmountArray, $intIndex, 38), $intY);
         // Draw Footer
         $intPageNumber++;
     }
     $blnNonDeductibleFound = false;
     foreach ($objContributionAmountArray as $objAmount) {
         if ($objAmount->StewardshipContribution->NonDeductibleFlag) {
             $blnNonDeductibleFound = true;
         }
     }
     if ($blnNonDeductibleFound) {
         $objPage = $objPageOneOfThis;
         $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(0));
         $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8);
         $objPage->drawText('(*) denotes a contribution that does not qualify for tax deduction.', 14, 149, 'UTF-8');
     }
 }
Пример #5
0
 public function dtgPledges_Bind()
 {
     if ($this->chkCombined && $this->chkCombined->Checked) {
         $intPersonIdArray = array();
         foreach ($this->objForm->objHousehold->GetHouseholdParticipationArray() as $objParticipation) {
             $intPersonIdArray[] = $objParticipation->PersonId;
         }
         $objCondition = QQ::In(QQN::StewardshipPledge()->PersonId, $intPersonIdArray);
     } else {
         $objCondition = QQ::Equal(QQN::StewardshipPledge()->PersonId, $this->objPerson->Id);
     }
     $this->dtgPledges->MetaDataBinder($objCondition, QQ::Clause(QQ::Expand(QQN::StewardshipPledge()->Person->LastName), QQ::Expand(QQN::StewardshipPledge()->StewardshipFund->Name)));
 }