protected function Form_Create() { // Attempt to load by Token and then by ID $this->objSignupForm = SignupForm::LoadByToken(QApplication::PathInfo(0)); if (!$this->objSignupForm) { $this->objSignupForm = SignupForm::Load(QApplication::PathInfo(0)); } // Ensure it is the correct type and it exists if (!$this->objSignupForm) { $this->strHtmlIncludeFilePath = '_notfound.tpl.php'; return; } $this->strPageTitle = $this->objSignupForm->Name . ' - Payment'; // Ensure it is Active if (!$this->objSignupForm->ActiveFlag) { $this->strHtmlIncludeFilePath = '_notactive.tpl.php'; return; } // Ensure we have Products that require some kind of payment if (!$this->objSignupForm->CountFormProducts()) { $this->strHtmlIncludeFilePath = '_notfound.tpl.php'; return; } // Get the SignupEntry $this->objSignupEntry = SignupEntry::Load(QApplication::PathInfo(1)); // Ensure it is correct for the form and the signup person if (!$this->objSignupEntry || $this->objSignupEntry->SignupFormId != $this->objSignupForm->Id || $this->objSignupEntry->SignupByPersonId != QApplication::$PublicLogin->PersonId || $this->objSignupEntry->SignupEntryStatusTypeId != SignupEntryStatusType::Incomplete) { $this->strHtmlIncludeFilePath = '_notfound.tpl.php'; return; } switch ($this->objSignupForm->SignupFormTypeId) { case SignupFormType::Event: $this->objChild = $this->objSignupForm->EventSignupForm; break; case SignupFormType::Course: $this->objChild = $this->objSignupForm->ClassMeeting; break; } $this->dtgProducts = new QDataGrid($this); $this->dtgProducts->AddColumn(new QDataGridColumn('Product / Item', '<?= $_FORM->RenderProduct($_ITEM); ?>', 'HtmlEntities=false', 'Width=550px')); $this->dtgProducts->AddColumn(new QDataGridColumn('Quantity', '<?= $_FORM->RenderQuantity($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px')); $this->dtgProducts->AddColumn(new QDataGridColumn('Cost', '<?= $_FORM->RenderCost($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px')); $this->dtgProducts->AddColumn(new QDataGridColumn('Total', '<?= $_FORM->RenderTotal($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px')); $this->dtgProducts->SetDataBinder('dtgProducts_Bind'); // Remove All Product Selections $this->objSignupEntry->DeleteAllSignupProducts(); // Add Required Products foreach ($this->objSignupForm->GetFormProductArrayByType(FormProductType::Required, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objProduct) { if ($objProduct->IsAvailableRightNow()) { $objSignupProduct = SignupProduct::LoadBySignupEntryIdFormProductId($this->objSignupEntry->Id, $objProduct->Id); if (!$objSignupProduct) { $this->objSignupEntry->AddProduct($objProduct); } } } // Deposit vs. Full Amount Choice $this->rblDeposit = new QRadioButtonList($this); $this->rblDeposit->Name = 'Payment Option'; $this->rblDeposit->AddItem('Pay in Full', 1); $this->rblDeposit->AddItem('Deposit', 2); $this->rblDeposit->AddAction(new QClickEvent(), new QAjaxAction('rblDeposit_Click')); $this->btnRegister = new QButton($this); $this->btnRegister->CssClass = 'primary'; $this->btnRegister->Text = 'Submit Registration'; $this->btnRegister->AddAction(new QClickEvent(), new QAjaxAction('btnRegister_Click')); $this->btnRegister->CausesValidation = true; // Figure out which address to use $objAddress = $this->objSignupEntry->RetrieveAnyValidAddressObject(); if (!$objAddress) { $objAddress = QApplication::$PublicLogin->Person->DeducePrimaryAddress(); } // Create the Payment Panel $this->pnlPayment = new PaymentPanel($this, null, $objAddress, QApplication::$PublicLogin->Person->FirstName, QApplication::$PublicLogin->Person->LastName); $this->pnlPayment->SetButtonText('Submit Payment'); $this->objSignupEntry->RefreshAmounts(); $this->RefreshForm(); }