protected function Form_Create() { $objContribution = StewardshipContribution::Load(QApplication::PathInfo(0)); if ($objContribution && is_file($objContribution->Path)) { if ($objContribution) { $this->imgCheckImage = new TiffImageControl($this); $this->imgCheckImage->ImagePath = $objContribution->Path; $this->imgCheckImage->Width = '1000'; } } }
protected function SetupPanel() { $this->objContribution = StewardshipContribution::Load($this->strUrlHashArgument); if (!$this->objContribution || $this->objContribution->StewardshipStackId != $this->objStack->Id || $this->objContribution->StewardshipBatchId != $this->objBatch->Id) { return $this->ReturnTo('#' . $this->objStack->StackNumber); } if (is_file($this->objContribution->Path)) { $this->imgCheckImage = new TiffImageControl($this); $this->imgCheckImage->ImagePath = $this->objContribution->Path; $this->imgCheckImage->Width = '390'; $this->imgCheckImage->AddAction(new QClickEvent(), new QJavaScriptAction("OpenInNewWindow('" . $this->objContribution->ViewLargeUrl . "');")); } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': // Gets the value for intId (Read-Only PK) // @return integer return $this->intId; case 'StewardshipContributionId': // Gets the value for intStewardshipContributionId (Not Null) // @return integer return $this->intStewardshipContributionId; case 'StewardshipFundId': // Gets the value for intStewardshipFundId (Not Null) // @return integer return $this->intStewardshipFundId; case 'Amount': // Gets the value for fltAmount // @return double return $this->fltAmount; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'StewardshipContribution': // Gets the value for the StewardshipContribution object referenced by intStewardshipContributionId (Not Null) // @return StewardshipContribution try { if (!$this->objStewardshipContribution && !is_null($this->intStewardshipContributionId)) { $this->objStewardshipContribution = StewardshipContribution::Load($this->intStewardshipContributionId); } return $this->objStewardshipContribution; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'StewardshipFund': // Gets the value for the StewardshipFund object referenced by intStewardshipFundId (Not Null) // @return StewardshipFund try { if (!$this->objStewardshipFund && !is_null($this->intStewardshipFundId)) { $this->objStewardshipFund = StewardshipFund::Load($this->intStewardshipFundId); } return $this->objStewardshipFund; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
public function pxyViewCheckImage_Click($strFormId, $strControlId, $strParameter) { if (($objContribution = StewardshipContribution::Load($strParameter)) && is_file($objContribution->Path)) { $this->imgHistoricCheckImage->ImagePath = $objContribution->Path; $this->imgHistoricCheckImage->Height = null; $this->imgHistoricCheckImage->AddAction(new QClickEvent(), new QJavaScriptAction("OpenInNewWindow('" . $objContribution->ViewLargeUrl . "');")); } else { $this->imgHistoricCheckImage->ImagePath = __DOCROOT__ . __IMAGE_ASSETS__ . '/no_check_image.tiff'; $this->imgHistoricCheckImage->Height = '100'; $this->imgHistoricCheckImage->RemoveAllActions(QClickEvent::EventName); } }
protected function SetupPanel() { // /stewardship/batch.php/950#1/edit_contribution/UrlHash/UrlHash2/UrlHash3 // 950 = BatchId // #1 = StackNumber // UrlHash can be "New" for new manual entry, an Id # for a ContributionId, or 0 for "Check" entyr // UrlHash2 must be the check hash (if applicable) // Urlhash3 is a PersonId to automagically select $this->blnScanFlag = false; // Creating New? if ($this->strUrlHashArgument == 'new') { // Creating New... Again? if ($this->strUrlHashArgument2 == 'again') { return $this->ReturnTo(sprintf('#%s/edit_contribution/new', $this->objStack->StackNumber)); } $objContribution = new StewardshipContribution(); $objContribution->StewardshipBatch = $this->objBatch; $objContribution->StewardshipStack = $this->objStack; $objContribution->DateEntered = QDateTime::Now(); $objContribution->CreatedByLogin = QApplication::$Login; $objContribution->UnpostedFlag = true; $objContribution->DateCredited = new QDateTime($this->objBatch->DateCredited); $objContribution->StewardshipContributionTypeId = StewardshipContributionType::Cash; // Editing an existing } else { if ($this->strUrlHashArgument) { $objContribution = StewardshipContribution::Load($this->strUrlHashArgument); if (!$objContribution || $objContribution->StewardshipStackId != $this->objStack->Id || $objContribution->StewardshipBatchId != $this->objBatch->Id) { $this->ReturnTo('#' . $this->objStack->StackNumber); } // Scanning? } else { if ($this->strUrlHashArgument2) { $objContribution = StewardshipContribution::CreateFromCheckImage(QApplication::$Login, $this->objStack, $this->strUrlHashArgument2); $this->blnScanFlag = true; $this->imgCheckImage = new TiffImageControl($this); $this->imgCheckImage->ImagePath = $objContribution->TempPath; $this->imgCheckImage->Width = '390'; // Error -- go back } else { $this->ReturnTo('#' . $this->objStack->StackNumber); } } } // Auto-set a new person (if specified) if ($objPerson = Person::Load($this->strUrlHashArgument3)) { $objContribution->Person = $objPerson; } // Setup Fields $this->mctContribution = new StewardshipContributionMetaControl($this, $objContribution); $this->chkNonDeductibleFlag = $this->mctContribution->chkNonDeductibleFlag_Create(); $this->chkNonDeductibleFlag->Name = 'Non-Deductibile?'; $this->chkNonDeductibleFlag->Text = 'Check if contribution is <strong>NOT</strong> deductible'; $this->chkNonDeductibleFlag->HtmlEntities = false; if (!$this->blnScanFlag) { $this->lstStewardshipContributionType = $this->mctContribution->lstStewardshipContributionType_Create(); $this->lstStewardshipContributionType->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstStewardshipContributionType_Change')); $this->txtAuthorization = $this->mctContribution->txtAuthorizationNumber_Create(); $this->txtCheckNumber = $this->mctContribution->txtCheckNumber_Create(); $this->txtCheckNumber->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtAlternateSource = $this->mctContribution->txtAlternateSource_Create(); $this->lstStewardshipContributionType_Change(); } else { // If we're scanning, then make sure we allow selecti onof Check or ReturnedCheck $this->lstStewardshipContributionType = $this->mctContribution->lstStewardshipContributionType_Create(); $intIndex = 0; while ($intIndex < count($this->lstStewardshipContributionType->GetAllItems())) { $objListItem = $this->lstStewardshipContributionType->GetItem($intIndex); if ($objListItem->Value == StewardshipContributionType::Check || $objListItem->Value == StewardshipContributionType::ReturnedCheck) { $intIndex++; } else { $this->lstStewardshipContributionType->RemoveItem($intIndex); } } $this->txtCheckNumber = $this->mctContribution->txtCheckNumber_Create(); $this->txtCheckNumber->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtCheckNumber->Select(); } // Setup Total Amount $this->lblTotalAmount = new QLabel($this); $this->lblTotalAmount->HtmlEntities = false; // Setup Error Panels $this->pnlFundingError = new QPanel($this); $this->pnlFundingError->Visible = false; $this->pnlFundingError->CssClass = 'errorMessage'; $this->pnlPersonError = new QPanel($this); $this->pnlPersonError->Visible = false; $this->pnlPersonError->CssClass = 'errorMessage'; // Setup AmountArray $this->mctAmountArray = array(); $objAmountArray = $this->mctContribution->StewardshipContribution->GetStewardshipContributionAmountArray(QQ::OrderBy(QQN::StewardshipContributionAmount()->Id)); for ($i = 0; $i < 5; $i++) { if (array_key_exists($i, $objAmountArray)) { $objAmount = $objAmountArray[$i]; } else { $objAmount = new StewardshipContributionAmount(); } $mctAmount = new StewardshipContributionAmountMetaControl($this, $objAmount); $this->mctAmountArray[] = $mctAmount; if ($mctAmount->EditMode) { $lstFund = $mctAmount->lstStewardshipFund_Create(null, QQ::All(), QQ::OrderBy(QQN::StewardshipFund()->Name)); } else { $lstFund = $mctAmount->lstStewardshipFund_Create(null, QQ::Equal(QQN::StewardshipFund()->ActiveFlag, true), QQ::OrderBy(QQN::StewardshipFund()->Name)); } $lstFund->Required = false; $lstFund->ActionParameter = $i; $txtAmount = $mctAmount->txtAmount_Create(); $txtAmount->ActionParameter = $i; $txtAmount->Text = sprintf('%.2f', $txtAmount->Text, 2); $lstFund->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstFund_Change')); $this->lstFund_Change(null, null, $i); $txtAmount->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lblTotalAmount_Refresh')); $txtAmount->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'txtAmount_Enter')); $txtAmount->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->lblTotalAmount_Refresh(null, null, null); } // Setup ChangePerson Dialog stuff $this->dlgChangePerson = new StewardshipSelectPersonDialogBox($this, null, $objContribution, $this, 'dlgChangePerson_Select'); $this->btnChangePerson = new QButton($this); $this->btnChangePerson->Text = 'Change'; $this->btnChangePerson->CssClass = 'primary'; $this->btnChangePerson->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnChangePerson_Click')); if ($this->blnScanFlag) { $this->ProcessNewCheck(); $this->btnSaveAndScanAgain = new QButton($this); $this->btnSaveAndScanAgain->CausesValidation = true; $this->btnSaveAndScanAgain->Text = 'Save and Scan Next Check'; $this->btnSaveAndScanAgain->CssClass = 'primary'; $this->btnSaveAndScanAgain->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click')); } else { if (!$this->mctContribution->EditMode) { if (!$this->mctContribution->StewardshipContribution->Person) { $this->btnChangePerson_Click(null, null, null); $this->dlgChangePerson->dtgPeople->NoDataHtml = '<div class="section sectionBatchInfo"><strong>Search For Individual</strong><br/><br/>' . 'Use above fields to find the individual for this new entry.</div>'; } else { $this->mctAmountArray[0]->StewardshipFundIdControl->Focus(); } $this->btnSaveAndScanAgain = new QButton($this); $this->btnSaveAndScanAgain->CausesValidation = true; $this->btnSaveAndScanAgain->Text = 'Save and Enter Next Entry'; $this->btnSaveAndScanAgain->ActionParameter = 'new'; $this->btnSaveAndScanAgain->CssClass = 'primary'; $this->btnSaveAndScanAgain->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click')); } } if (!$this->mctContribution->EditMode) { $this->LoadSelectedFundsFromSession(); } else { $this->btnSave->Text = 'Update'; } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'Id': // Gets the value for intId (Read-Only PK) // @return integer return $this->intId; case 'CreditCardStatusTypeId': // Gets the value for intCreditCardStatusTypeId (Not Null) // @return integer return $this->intCreditCardStatusTypeId; case 'CreditCardTypeId': // Gets the value for intCreditCardTypeId (Not Null) // @return integer return $this->intCreditCardTypeId; case 'CreditCardLastFour': // Gets the value for strCreditCardLastFour (Not Null) // @return string return $this->strCreditCardLastFour; case 'TransactionCode': // Gets the value for strTransactionCode (Unique) // @return string return $this->strTransactionCode; case 'AuthorizationCode': // Gets the value for strAuthorizationCode // @return string return $this->strAuthorizationCode; case 'AddressMatchCode': // Gets the value for strAddressMatchCode // @return string return $this->strAddressMatchCode; case 'DateAuthorized': // Gets the value for dttDateAuthorized // @return QDateTime return $this->dttDateAuthorized; case 'DateCaptured': // Gets the value for dttDateCaptured // @return QDateTime return $this->dttDateCaptured; case 'AmountCharged': // Gets the value for fltAmountCharged // @return double return $this->fltAmountCharged; case 'AmountFee': // Gets the value for fltAmountFee // @return double return $this->fltAmountFee; case 'AmountCleared': // Gets the value for fltAmountCleared // @return double return $this->fltAmountCleared; case 'PaypalBatchId': // Gets the value for intPaypalBatchId // @return integer return $this->intPaypalBatchId; case 'UnlinkedFlag': // Gets the value for blnUnlinkedFlag // @return boolean return $this->blnUnlinkedFlag; case 'StewardshipContributionId': // Gets the value for intStewardshipContributionId (Unique) // @return integer return $this->intStewardshipContributionId; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'PaypalBatch': // Gets the value for the PaypalBatch object referenced by intPaypalBatchId // @return PaypalBatch try { if (!$this->objPaypalBatch && !is_null($this->intPaypalBatchId)) { $this->objPaypalBatch = PaypalBatch::Load($this->intPaypalBatchId); } return $this->objPaypalBatch; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'StewardshipContribution': // Gets the value for the StewardshipContribution object referenced by intStewardshipContributionId (Unique) // @return StewardshipContribution try { if (!$this->objStewardshipContribution && !is_null($this->intStewardshipContributionId)) { $this->objStewardshipContribution = StewardshipContribution::Load($this->intStewardshipContributionId); } return $this->objStewardshipContribution; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'OnlineDonation': // Gets the value for the OnlineDonation object that uniquely references this CreditCardPayment // by objOnlineDonation (Unique) // @return OnlineDonation try { if ($this->objOnlineDonation === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objOnlineDonation) { $this->objOnlineDonation = OnlineDonation::LoadByCreditCardPaymentId($this->intId); } return $this->objOnlineDonation; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'SignupPayment': // Gets the value for the SignupPayment object that uniquely references this CreditCardPayment // by objSignupPayment (Unique) // @return SignupPayment try { if ($this->objSignupPayment === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objSignupPayment) { $this->objSignupPayment = SignupPayment::LoadByCreditCardPaymentId($this->intId); } return $this->objSignupPayment; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * 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 StewardshipContributionMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing StewardshipContribution object creation - defaults to CreateOrEdit * @return StewardshipContributionMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objStewardshipContribution = StewardshipContribution::Load($intId); // StewardshipContribution was found -- return it! if ($objStewardshipContribution) { return new StewardshipContributionMetaControl($objParentObject, $objStewardshipContribution); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a StewardshipContribution 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 StewardshipContributionMetaControl($objParentObject, new StewardshipContribution()); }
public function pxyDeleteContribution_Click($strFormId, $strControlId, $strParameter) { $objContribution = StewardshipContribution::Load($strParameter); if (!$objContribution || $objContribution->StewardshipStackId != $this->objStack->Id || $objContribution->StewardshipBatchId != $this->objBatch->Id) { return; } $objContribution->DeleteAllStewardshipContributionAmounts(); $objContribution->Delete(); $this->objStack->RefreshActualTotalAmount(); $this->objBatch->RefreshActualTotalAmount(false); $this->objBatch->RefreshStatus(); $this->pnlStack_Refresh($this->objStack); $this->pnlBatchTitle->Refresh(); $this->dtgContributions->Refresh(); QApplication::ExecuteJavaScript(sprintf('document.location="#%s";', $this->objStack->StackNumber)); }
/** * Reload this StewardshipContribution from the database. * @return void */ public function Reload() { // Make sure we are actually Restored from the database if (!$this->__blnRestored) { throw new QCallerException('Cannot call Reload() on a new, unsaved StewardshipContribution object.'); } // Reload the Object $objReloaded = StewardshipContribution::Load($this->intId); // Update $this's local variables to match $this->PersonId = $objReloaded->PersonId; $this->StewardshipContributionTypeId = $objReloaded->StewardshipContributionTypeId; $this->StewardshipBatchId = $objReloaded->StewardshipBatchId; $this->StewardshipStackId = $objReloaded->StewardshipStackId; $this->CheckingAccountLookupId = $objReloaded->CheckingAccountLookupId; $this->fltTotalAmount = $objReloaded->fltTotalAmount; $this->dttDateEntered = $objReloaded->dttDateEntered; $this->dttDateCleared = $objReloaded->dttDateCleared; $this->dttDateCredited = $objReloaded->dttDateCredited; $this->strCheckNumber = $objReloaded->strCheckNumber; $this->strAuthorizationNumber = $objReloaded->strAuthorizationNumber; $this->strAlternateSource = $objReloaded->strAlternateSource; $this->blnNonDeductibleFlag = $objReloaded->blnNonDeductibleFlag; $this->strNote = $objReloaded->strNote; $this->CreatedByLoginId = $objReloaded->CreatedByLoginId; $this->blnUnpostedFlag = $objReloaded->blnUnpostedFlag; }