/** * Refreshes pledge infromation (e.g. amount contributed, status, etc.) * @param boolean $blnSave whether or not to save */ public function Refresh($blnSave = true) { $objAmountArray = StewardshipContributionAmount::QueryArray(QQ::AndCondition(QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipFundId, $this->StewardshipFundId), QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipContribution->PersonId, $this->PersonId))); $fltTotal = 0; foreach ($objAmountArray as $objAmount) { $fltTotal += $objAmount->Amount; } $this->fltContributedAmount = $fltTotal; $this->fltRemainingAmount = max(0, $this->fltPledgeAmount - $this->fltContributedAmount); $this->blnFulfilledFlag = $this->fltRemainingAmount < 1.0; if ($this->blnFulfilledFlag) { $this->blnActiveFlag = false; } if ($blnSave) { $this->Save(); } }
/** * Load an array of StewardshipContributionAmount objects, * by StewardshipFundId Index(es) * @param integer $intStewardshipFundId * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query * @return StewardshipContributionAmount[] */ public static function LoadArrayByStewardshipFundId($intStewardshipFundId, $objOptionalClauses = null) { // Call StewardshipContributionAmount::QueryArray to perform the LoadArrayByStewardshipFundId query try { return StewardshipContributionAmount::QueryArray(QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipFundId, $intStewardshipFundId), $objOptionalClauses); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
/** * @param integer[] $intPersonIdArray * @param integer $intYear * @param integer $intQuarter optional, can be 1, 2 or 3 to limit results to JUST Q1, Q1-Q2, Q1-Q3 data if applicable * @return StewardshipContributionAmount[] */ public static function GetContributionAmountArrayForPersonArray($intPersonIdArray, $intYear, $intQuarter = null) { switch ($intQuarter) { case 1: $strEndMonthDay = '-03-31 23:59:59'; break; case 2: $strEndMonthDay = '-06-30 23:59:59'; break; case 3: $strEndMonthDay = '-09-30 23:59:59'; break; default: $strEndMonthDay = '-12-31 23:59:59'; break; } $objCondition = QQ::AndCondition(QQ::In(QQN::StewardshipContributionAmount()->StewardshipContribution->PersonId, $intPersonIdArray), QQ::GreaterOrEqual(QQN::StewardshipContributionAmount()->StewardshipContribution->DateCredited, new QDateTime($intYear . '-01-01 00:00:00')), QQ::LessOrEqual(QQN::StewardshipContributionAmount()->StewardshipContribution->DateCredited, new QDateTime($intYear . $strEndMonthDay))); return StewardshipContributionAmount::QueryArray($objCondition, QQ::OrderBy(QQN::StewardshipContributionAmount()->StewardshipContribution->DateCredited, QQN::StewardshipContributionAmount()->Id)); }
/** * Main utility method to aid with data binding. It is used by the default BindAllRows() databinder but * could and should be used by any custom databind methods that would be used for instances of this * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. * * If a paginator is set on this DataBinder, it will use it. If not, then no pagination will be used. * It will also perform any sorting (if applicable). * * @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 void */ public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null) { // Setup input parameters to default values if none passed in if (!$objCondition) { $objCondition = QQ::All(); } $objClauses = $objOptionalClauses ? $objOptionalClauses : array(); // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below if ($this->Paginator) { $this->TotalItemCount = StewardshipContributionAmount::QueryCount($objCondition, $objClauses); } // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add // the OrderByClause to the $objClauses array if ($objClause = $this->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be a Query result from StewardshipContributionAmount, given the clauses above $this->DataSource = StewardshipContributionAmount::QueryArray($objCondition, $objClauses); }
public function dtgLineItems_Unposted_Bind() { $this->dtgLineItems->DataSource = StewardshipContributionAmount::QueryArray(QQ::AndCondition(QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipContribution->UnpostedFlag, true), QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipContribution->StewardshipBatchId, $this->objBatch->Id)), QQ::OrderBy(QQN::StewardshipContributionAmount()->StewardshipContribution->Person->LastName, QQN::StewardshipContributionAmount()->StewardshipContribution->Person->FirstName)); }