public function MoveDown() { $blnFound = false; foreach (FormProduct::LoadArrayBySignupFormIdFormProductTypeId($this->intSignupFormId, $this->intFormProductTypeId, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objFormProduct) { if ($blnFound) { break; } if ($objFormProduct->Id == $this->Id) { $blnFound = true; } } $this->OrderNumber++; $this->Save(); if ($objFormProduct) { $objFormProduct->OrderNumber--; $objFormProduct->Save(); } self::RefreshOrderNumber($this->intSignupFormId, $this->intFormProductTypeId); }
public function dtgProducts_Bind() { $arrDataSource = array(); // First add any required products foreach ($this->objSignupForm->GetFormProductArrayByType(FormProductType::Required, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objProduct) { if ($objProduct->IsAvailableRightNow()) { $arrDataSource[] = $objProduct; } } // If there are any valid "Required with Choice" products, add the row for it foreach ($this->objSignupForm->GetFormProductArrayByType(FormProductType::RequiredWithChoice, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objProduct) { if ($objProduct->IsAvailableRightNow()) { $arrDataSource[] = -1; break; } } // Add any optional products foreach ($this->objSignupForm->GetFormProductArrayByType(FormProductType::Optional, QQ::OrderBy(QQN::FormProduct()->OrderNumber)) as $objProduct) { if ($objProduct->IsAvailableRightNow()) { $arrDataSource[] = $objProduct; } } // Add any payments $arrDataSource = array_merge($arrDataSource, $this->objSignupEntry->GetSignupPaymentArray(QQ::OrderBy(QQN::SignupPayment()->TransactionDate))); // Add "Balance Due" $arrDataSource[] = null; $this->dtgProducts->DataSource = $arrDataSource; }
protected function dtgFormProducts_Bind() { $this->dtgFormProducts->DataSource = $this->objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)); }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a FormProduct-based QQNode. * It will also verify that it is a proper FormProduct-based QQNode, and will throw an exception otherwise. * * @param mixed $mixContent * @return QQNode */ protected function ResolveContentItem($mixContent) { if ($mixContent instanceof QQNode) { if (!$mixContent->_ParentNode) { throw new QCallerException('Content QQNode cannot be a Top Level Node'); } if ($mixContent->_RootTableName == 'form_product') { if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } $objCurrentNode = $mixContent; while ($objCurrentNode = $objCurrentNode->_ParentNode) { if (!$objCurrentNode instanceof QQNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } } return $mixContent; } else { throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "form_product".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'Id': return QQN::FormProduct()->Id; case 'SignupFormId': return QQN::FormProduct()->SignupFormId; case 'SignupForm': return QQN::FormProduct()->SignupForm; case 'OrderNumber': return QQN::FormProduct()->OrderNumber; case 'FormProductTypeId': return QQN::FormProduct()->FormProductTypeId; case 'FormPaymentTypeId': return QQN::FormProduct()->FormPaymentTypeId; case 'Name': return QQN::FormProduct()->Name; case 'Description': return QQN::FormProduct()->Description; case 'DateStart': return QQN::FormProduct()->DateStart; case 'DateEnd': return QQN::FormProduct()->DateEnd; case 'MinimumQuantity': return QQN::FormProduct()->MinimumQuantity; case 'MaximumQuantity': return QQN::FormProduct()->MaximumQuantity; case 'Cost': return QQN::FormProduct()->Cost; case 'Deposit': return QQN::FormProduct()->Deposit; case 'ViewFlag': return QQN::FormProduct()->ViewFlag; default: throw new QCallerException('Simple Property not found in FormProductDataGrid content: ' . $mixContent); } } else { if ($mixContent instanceof QQAssociationNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } else { throw new QCallerException('Invalid Content type'); } } } }
break; case FormQuestionType::Number: case FormQuestionType::Age: print $objAnswer->IntegerValue; break; case FormQuestionType::DateofBirth: if ($objAnswer->DateValue) { print $objAnswer->DateValue->ToString('M/D/YYYY'); } break; } } print ","; } if ($objSignupForm->CountFormProducts() > 0) { foreach ($objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)) as $objFormProduct) { if ($objFormProduct->ViewFlag) { $objSignupProduct = SignupProduct::LoadBySignupEntryIdFormProductId($objSignupEntry->Id, $objFormProduct->Id); if ($objSignupProduct) { print QApplication::DisplayCurrency($objSignupProduct->Amount); } else { print " "; } print ","; } } print QApplication::DisplayCurrency($objSignupEntry->AmountTotal); print ","; print QApplication::DisplayCurrency($objSignupEntry->AmountPaid); print ","; print QApplication::DisplayCurrency($objSignupEntry->AmountBalance);
public function dtgSignupEntries_SetupColumns() { $this->dtgSignupEntries->RemoveAllColumns(); $this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->Person->LastName, 'Name=Name', 'Html=<?= $_FORM->RenderName($_ITEM); ?>', 'HtmlEntities=false'); // $this->dtgSignupEntries->MetaAddTypeColumn('SignupEntryStatusTypeId', 'SignupEntryStatusType', 'Name=Status'); foreach ($this->objSignupForm->GetFormQuestionArray(QQ::OrderBy(QQN::FormQuestion()->OrderNumber)) as $objFormQuestion) { if ($objFormQuestion->ViewFlag) { $this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormQuestion->ShortDescription, '<?= $_FORM->RenderAnswer($_ITEM, ' . $objFormQuestion->Id . ',' . $objFormQuestion->FormQuestionTypeId . '); ?>', 'HtmlEntities=false')); } } foreach ($this->objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)) as $objFormProduct) { if ($objFormProduct->ViewFlag) { /* $this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormProduct->Name. ' Quantity', '<?= $_FORM->RenderProductQuantity($_ITEM, ' . $objFormProduct->Id . '); ?>', 'HtmlEntities=false'));*/ $this->dtgSignupEntries->AddColumn(new QDataGridColumn($objFormProduct->Name, '<?= $_FORM->RenderProductAmount($_ITEM, ' . $objFormProduct->Id . '); ?>', 'HtmlEntities=false')); } } if ($this->objSignupForm->CountFormProducts()) { $this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->AmountPaid, 'Name=Paid', 'Html=<?= $_FORM->RenderAmount($_ITEM->AmountPaid); ?>'); $this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->AmountBalance, 'Name=Balance', 'Html=<?= $_FORM->RenderAmount($_ITEM->AmountBalance); ?>'); $this->dtgSignupEntries->AddColumn(new QDataGridColumn('Payment Type', '<?= $_FORM->RenderPaymentType($_ITEM); ?>', 'HtmlEntities=false')); } $this->dtgSignupEntries->MetaAddColumn(QQN::SignupEntry()->DateSubmitted, 'Name=Submitted', 'Html=<?= $_ITEM->DateSubmitted ? $_ITEM->DateSubmitted->ToString("MMM D YYYY") : null; ?>'); }
public function dtgProducts_Bind(QDataGrid $dtgProducts) { $intFormProductTypeId = $dtgProducts->Name; $dtgProducts->DataSource = FormProduct::LoadArrayBySignupFormIdFormProductTypeId($this->objSignupForm->Id, $intFormProductTypeId, QQ::OrderBy(QQN::FormProduct()->OrderNumber)); }
/** * @param integer $intFormProductTypeId * @param QClause[] $objClauses * @return integer */ public function CountFormProductsByType($intFormProductTypeId, $objClauses = array()) { return FormProduct::QueryCount(QQ::AndCondition(QQ::Equal(QQN::FormProduct()->SignupFormId, $this->Id), QQ::Equal(QQN::FormProduct()->FormProductTypeId, $intFormProductTypeId)), $objClauses); }
/** * Count FormProducts * by FormPaymentTypeId Index(es) * @param integer $intFormPaymentTypeId * @return int */ public static function CountByFormPaymentTypeId($intFormPaymentTypeId, $objOptionalClauses = null) { // Call FormProduct::QueryCount to perform the CountByFormPaymentTypeId query return FormProduct::QueryCount(QQ::Equal(QQN::FormProduct()->FormPaymentTypeId, $intFormPaymentTypeId), $objOptionalClauses); }