/** * This will save this object's StewardshipBatch instance, * updating only the fields which have had a control created for it. */ public function SaveStewardshipBatch() { try { // Update any fields for controls that have been created if ($this->lstStewardshipBatchStatusType) { $this->objStewardshipBatch->StewardshipBatchStatusTypeId = $this->lstStewardshipBatchStatusType->SelectedValue; } if ($this->calDateEntered) { $this->objStewardshipBatch->DateEntered = $this->calDateEntered->DateTime; } if ($this->calDateCredited) { $this->objStewardshipBatch->DateCredited = $this->calDateCredited->DateTime; } if ($this->txtBatchLabel) { $this->objStewardshipBatch->BatchLabel = $this->txtBatchLabel->Text; } if ($this->txtDescription) { $this->objStewardshipBatch->Description = $this->txtDescription->Text; } if ($this->txtItemCount) { $this->objStewardshipBatch->ItemCount = $this->txtItemCount->Text; } if ($this->txtReportedTotalAmount) { $this->objStewardshipBatch->ReportedTotalAmount = $this->txtReportedTotalAmount->Text; } if ($this->txtActualTotalAmount) { $this->objStewardshipBatch->ActualTotalAmount = $this->txtActualTotalAmount->Text; } if ($this->txtPostedTotalAmount) { $this->objStewardshipBatch->PostedTotalAmount = $this->txtPostedTotalAmount->Text; } if ($this->lstCreatedByLogin) { $this->objStewardshipBatch->CreatedByLoginId = $this->lstCreatedByLogin->SelectedValue; } // Update any UniqueReverseReferences (if any) for controls that have been created for it if ($this->lstPaypalBatch) { $this->objStewardshipBatch->PaypalBatch = PaypalBatch::Load($this->lstPaypalBatch->SelectedValue); } // Save the StewardshipBatch object $this->objStewardshipBatch->Save(); // Finally, update any ManyToManyReferences (if any) } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
/** * Reload this PaypalBatch 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 PaypalBatch object.'); } // Reload the Object $objReloaded = PaypalBatch::Load($this->intId); // Update $this's local variables to match $this->strNumber = $objReloaded->strNumber; $this->dttDateReceived = $objReloaded->dttDateReceived; $this->dttDateReconciled = $objReloaded->dttDateReconciled; $this->blnReconciledFlag = $objReloaded->blnReconciledFlag; $this->StewardshipBatchId = $objReloaded->StewardshipBatchId; }
/** * 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 PaypalBatchMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing PaypalBatch object creation - defaults to CreateOrEdit * @return PaypalBatchMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objPaypalBatch = PaypalBatch::Load($intId); // PaypalBatch was found -- return it! if ($objPaypalBatch) { return new PaypalBatchMetaControl($objParentObject, $objPaypalBatch); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a PaypalBatch 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 PaypalBatchMetaControl($objParentObject, new PaypalBatch()); }
protected function Form_Create() { $this->objBatch = PaypalBatch::Load(QApplication::PathInfo(0)); if (!$this->objBatch) { QApplication::Redirect('/stewardship/paypal'); } $this->strPageTitle .= $this->objBatch->Number; $this->dtgTransactions = new QDataGrid($this); $this->dtgTransactions->SetDataBinder('dtgTransactions_Bind'); $this->dtgTransactions->AddColumn(new QDataGridColumn('Date Captured', '<?= $_ITEM[0]; ?>', 'Width=150px', 'HtmlEntities=false', 'VerticalAlign=top')); $this->dtgTransactions->AddColumn(new QDataGridColumn('Total Amount Charged', '<?= $_ITEM[1]; ?>', 'Width=150px', 'VerticalAlign=top')); $this->dtgTransactions->AddColumn(new QDataGridColumn('Transaction Code', '<?= $_ITEM[2]; ?>', 'Width=120px', 'VerticalAlign=top')); $this->dtgTransactions->AddColumn(new QDataGridColumn('Account Funding', '<?= $_ITEM[3]; ?>', 'Width=330px', 'HtmlEntities=false', 'VerticalAlign=top', 'FontSize=10px')); $this->dtgTransactions->AddColumn(new QDataGridColumn('Funding Amount', '<?= $_ITEM[4]; ?>', 'Width=150px', 'HtmlEntities=false', 'VerticalAlign=top', 'FontSize=10px')); $this->dtgFunding = new QDataGrid($this); $this->dtgFunding->SetDataBinder('dtgFunding_Bind'); $this->dtgFunding->AddColumn(new QDataGridColumn('Fund', '<?= $_ITEM[0]; ?>', 'Width=340px', 'HtmlEntities=false')); $this->dtgFunding->AddColumn(new QDataGridColumn('Account Number', '<?= $_ITEM[1]; ?>', 'Width=200px')); $this->dtgFunding->AddColumn(new QDataGridColumn('Amount', '<?= $_ITEM[2]; ?>', 'HtmlEntities=false', 'Width=380px', 'HtmlEntities=false')); $this->dtgUnaccounted = new CreditCardPaymentDataGrid($this); $this->dtgUnaccounted->MetaAddColumn('DateCaptured', 'Width=200px'); $this->dtgUnaccounted->MetaAddColumn('AmountCharged', 'Html=<?= QApplication::DisplayCurrency($_ITEM->AmountCharged); ?>', 'Width=150px'); $this->dtgUnaccounted->MetaAddColumn('TransactionCode', 'Width=500px'); $this->dtgUnaccounted->SortColumnIndex = 0; $this->dtgUnaccounted->SetDataBinder('dtgUnaccounted_Bind'); $this->dtgUnaccounted->NoDataHtml = 'Good! There are no unaccounted-for credit card transaction entries in this PayPal batch.'; $this->pxyEditFundDonationLineItem = new QControlProxy($this); $this->pxyEditFundDonationLineItem->AddAction(new QClickEvent(), new QAjaxAction('pxyEditFundDonationLineItem_Click')); $this->pxyEditFundDonationLineItem->AddAction(new QClickEvent(), new QTerminateAction()); $this->pxyEditFundSignupPayment = new QControlProxy($this); $this->pxyEditFundSignupPayment->AddAction(new QClickEvent(), new QAjaxAction('pxyEditFundSignupPayment_Click')); $this->pxyEditFundSignupPayment->AddAction(new QClickEvent(), new QTerminateAction()); $this->lblInstructionHtml = new QLabel($this); $this->lblInstructionHtml->TagName = 'p'; $this->lblInstructionHtml->HtmlEntities = false; $this->dtxDateCredited = new QDateTimeTextBox($this); $this->dtxDateCredited->Name = 'Date to Credit Stewardship Contributions'; $this->dtxDateCredited->Text = QDateTime::NowToString('MMMM D YYYY'); $this->dtxDateCredited->Required = true; $this->btnPost = new QButton($this); $this->btnPost->Text = 'Post to NOAH'; $this->btnPost->CssClass = 'primary'; $this->btnPost->CausesValidation = $this->dtxDateCredited; $this->btnSplit = new QButton($this); $this->btnSplit->Text = 'Split This Batch'; $this->btnSplit->CssClass = 'alternate'; $this->btnSplit->SetCustomStyle('float', 'right'); $this->btnSplit->AddAction(new QClickEvent(), new QAjaxAction('btnSplit_Click')); $this->dlgEditFund = new QDialogBox($this); $this->dlgEditFund->MatteClickable = false; $this->dlgEditFund->HideDialogBox(); $this->dlgEditFund->Template = dirname(__FILE__) . '/dlgEditFund.tpl.php'; $this->lblDialogFund = new QLabel($this->dlgEditFund); $this->lblDialogFund->Text = 'Please specify the appropriate Stewardship Funding Account for this line item.'; $this->lblDialogFund->Visible = false; $this->lstDialogFund = new QListBox($this->dlgEditFund); $this->lstDialogFund->Name = 'Stewardship Fund'; $this->lstDialogFund->AddItem('- Select One -', null); $this->lstDialogFund->Required = true; foreach (StewardshipFund::LoadArrayByActiveFlag(true, QQ::OrderBy(QQN::StewardshipFund()->Name)) as $objFund) { $this->lstDialogFund->AddItem($objFund->Name, $objFund->Id); } $this->lstDialogFund->AddItem('- Other (Non-Donation)... -', -1); $this->lstDialogFund->AddAction(new QChangeEvent(), new QAjaxAction('lstDialogFund_Change')); $this->lstDialogFund->Visible = false; $this->txtDialogOther = new QTextBox($this->dlgEditFund); $this->txtDialogOther->Name = 'Non-Donation Funding Account'; $this->txtDialogOther->Visible = false; $this->lblDialogSplitFund = new QLabel($this->dlgEditFund); $this->lblDialogSplitFund->Visible = false; $this->lstDialogSplitFund = array(); $this->txtDialogSplitOther = array(); $this->txtDialogSplitAmount = array(); $this->lblDialogSplitFundTitle = array(); for ($i = 0; $i < 2; $i++) { $this->lblDialogSplitFundTitle[$i] = new QLabel($this->dlgEditFund); $this->lblDialogSplitFundTitle[$i]->HtmlEntities = false; $this->lblDialogSplitFundTitle[$i]->Text = '<h4>Line Item ' . ($i + 1) . '</h4>'; $this->lblDialogSplitFundTitle[$i]->Visible = false; $this->lstDialogSplitFund[$i] = new QListBox($this->dlgEditFund); $this->lstDialogSplitFund[$i]->Name = 'Stewardship Fund'; $this->lstDialogSplitFund[$i]->AddItem('- Select One -', null); $this->lstDialogSplitFund[$i]->Required = true; foreach (StewardshipFund::LoadArrayByActiveFlag(true, QQ::OrderBy(QQN::StewardshipFund()->Name)) as $objFund) { $this->lstDialogSplitFund[$i]->AddItem($objFund->Name, $objFund->Id); } $this->lstDialogSplitFund[$i]->AddItem('- Other (Non-Donation)... -', -1); $this->lstDialogSplitFund[$i]->ActionParameter = $i; $this->lstDialogSplitFund[$i]->AddAction(new QChangeEvent(), new QAjaxAction('lstDialogSplitFund_Change')); $this->lstDialogSplitFund[$i]->Visible = false; $this->txtDialogSplitOther[$i] = new QTextBox($this->dlgEditFund); $this->txtDialogSplitOther[$i]->Name = 'Non-Donation Funding Account'; $this->txtDialogSplitOther[$i]->Visible = false; $this->txtDialogSplitAmount[$i] = new QFloatTextBox($this->dlgEditFund); $this->txtDialogSplitAmount[$i]->Name = 'Funding Amount'; $this->txtDialogSplitAmount[$i]->Visible = false; } $this->rbtnUpdateFundSelection = new QRadioButtonList($this->dlgEditFund); $this->rbtnUpdateFundSelection->AddItem('Change Stewardship Funding Account of the Line Item', 1); $this->rbtnUpdateFundSelection->AddItem('Split this Line Item into two separate Funding Accounts', 2); $this->rbtnUpdateFundSelection->HtmlBefore = 'Select how you would like to update this Stewardship Fund'; $this->rbtnUpdateFundSelection->AddAction(new QChangeEvent(), new QAjaxAction('rbtnUpdateFundSelection_Change')); $this->btnDialogSave = new QButton($this->dlgEditFund); $this->btnDialogSave->CssClass = 'primary'; $this->btnDialogSave->Text = 'Update'; $this->btnDialogSave->CausesValidation = QCausesValidation::SiblingsAndChildren; $this->btnDialogSave->AddAction(new QClickEvent(), new QAjaxAction('btnDialogSave_Click')); $this->btnDialogCancel = new QLinkButton($this->dlgEditFund); $this->btnDialogCancel->CssClass = 'cancel'; $this->btnDialogCancel->Text = 'Cancel'; $this->btnDialogCancel->AddAction(new QClickEvent(), new QAjaxAction('btnDialogCancel_Click')); $this->btnDialogCancel->AddAction(new QClickEvent(), new QTerminateAction()); $this->dlgSplit = new QDialogBox($this); $this->dlgSplit->MatteClickable = false; $this->dlgSplit->HideDialogBox(); $this->dlgSplit->Template = dirname(__FILE__) . '/dlgSplit.tpl.php'; $this->lstSplitItem = new QListBox($this->dlgSplit); $this->lstSplitItem->Name = 'Transaction Split Point'; $this->lstSplitItem->AddItem('- Select One -', null); $this->lstSplitItem->Required = true; foreach ($this->objBatch->GetCreditCardPaymentArray(QQ::OrderBy(QQN::CreditCardPayment()->DateCaptured)) as $objPayment) { $this->lstSplitItem->AddItem('After ' . $objPayment->DateCaptured->ToString('MMM D YYYY h:mm z'), $objPayment->Id); } $this->txtSplitNameCurrent = new QTextBox($this->dlgSplit); $this->txtSplitNameCurrent->Name = 'Batch Number/Title for Original Batch'; $this->txtSplitNameCurrent->Text = $this->objBatch->Number . ' (1)'; $this->txtSplitNameNew = new QTextBox($this->dlgSplit); $this->txtSplitNameNew->Name = 'Batch Number/Title for New Batch'; $this->txtSplitNameNew->Text = $this->objBatch->Number . ' (2)'; $this->btnSplitSave = new QButton($this->dlgSplit); $this->btnSplitSave->CssClass = 'primary'; $this->btnSplitSave->Text = 'Split'; $this->btnSplitSave->CausesValidation = QCausesValidation::SiblingsAndChildren; $this->btnSplitSave->AddAction(new QClickEvent(), new QAjaxAction('btnSplitSave_Click')); $this->btnSplitCancel = new QLinkButton($this->dlgSplit); $this->btnSplitCancel->CssClass = 'cancel'; $this->btnSplitCancel->Text = 'Cancel'; $this->btnSplitCancel->AddAction(new QClickEvent(), new QAjaxAction('btnSplitCancel_Click')); $this->btnSplitCancel->AddAction(new QClickEvent(), new QTerminateAction()); $this->Transactions_Refresh(); }