/** * 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(); } }
$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()); $objGiverList = array(); while ($objContribution = StewardshipContribution::InstantiateCursor($objContributionCursor)) { $objContributionAmtArray = StewardshipContributionAmount::LoadArrayByStewardshipContributionId($objContribution->Id); foreach ($objContributionAmtArray as $objContributionAmt) { $strAccountNumber = StewardshipFund::Load($objContributionAmt->StewardshipFundId)->AccountNumber; if ($strAccountNumber == '7011.010' || substr($strAccountNumber, 0, 1) == '4') { $iMonth = 0; $fltTotalGiftAmount += $objContributionAmt->Amount; $fltTotalGifts++; if ($objContribution->DateCredited->IsLaterOrEqualTo(new QDateTime("1/1/" . $intYear)) && $objContribution->DateCredited->IsEarlierThan(new QDateTime("2/1/" . $intYear))) { $iMonth = 0; } else { if ($objContribution->DateCredited->IsLaterOrEqualTo(new QDateTime("2/1/" . $intYear)) && $objContribution->DateCredited->IsEarlierThan(new QDateTime("3/1/" . $intYear))) { $iMonth = 1; } else { if ($objContribution->DateCredited->IsLaterOrEqualTo(new QDateTime("3/1/" . $intYear)) && $objContribution->DateCredited->IsEarlierThan(new QDateTime("4/1/" . $intYear))) { $iMonth = 2; } else {
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, StewardshipContributionAmount::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
/** * Deletes all associated StewardshipContributionAmounts * @return void */ public function DeleteAllStewardshipContributionAmounts() { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateStewardshipContributionAmount on this unsaved StewardshipFund.'); } // Get the Database Object for this Class $objDatabase = StewardshipFund::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (StewardshipContributionAmount::LoadArrayByStewardshipFundId($this->intId) as $objStewardshipContributionAmount) { $objStewardshipContributionAmount->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `stewardship_contribution_amount` WHERE `stewardship_fund_id` = ' . $objDatabase->SqlVariable($this->intId) . ' '); }
/** * Static Helper Method to Create using PK arguments * You must pass in the PK arguments on an object to load, or leave it blank to create a new one. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to * edit, or if we are also allowed to create a new one, etc. * * @param mixed $objParentObject QForm or QPanel which will be using this StewardshipContributionAmountMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing StewardshipContributionAmount object creation - defaults to CreateOrEdit * @return StewardshipContributionAmountMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objStewardshipContributionAmount = StewardshipContributionAmount::Load($intId); // StewardshipContributionAmount was found -- return it! if ($objStewardshipContributionAmount) { return new StewardshipContributionAmountMetaControl($objParentObject, $objStewardshipContributionAmount); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a StewardshipContributionAmount object with PK arguments: ' . $intId); } } // If EditOnly is specified, throw an exception } else { if ($intCreateType == QMetaControlCreateType::EditOnly) { throw new QCallerException('No PK arguments specified'); } } // If we are here, then we need to create a new record return new StewardshipContributionAmountMetaControl($objParentObject, new StewardshipContributionAmount()); }
/** * 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); }
/** * @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)); }
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)); }