protected function lstReceipt_Create() { $this->lstReceipt = new QListBox($this); $this->lstReceipt->Name = QApplication::Translate('Receipt'); $this->lstReceipt->AddItem(QApplication::Translate('- Select One -'), null); $objReceiptArray = Receipt::LoadAll(); if ($objReceiptArray) { foreach ($objReceiptArray as $objReceipt) { $objListItem = new QListItem($objReceipt->__toString(), $objReceipt->ReceiptId); if ($objReceipt->TransactionId == $this->objTransaction->TransactionId) { $objListItem->Selected = true; } $this->lstReceipt->AddItem($objListItem); } } // Because Receipt's Receipt is not null, if a value is already selected, it cannot be changed. if ($this->lstReceipt->SelectedValue) { $this->lstReceipt->Enabled = false; } }
public function dtgReceipt_Bind() { // Get Total Count b/c of Pagination $this->dtgReceipt->TotalItemCount = Receipt::CountAll(); $objClauses = array(); if ($objClause = $this->dtgReceipt->OrderByClause) { array_push($objClauses, $objClause); } if ($objClause = $this->dtgReceipt->LimitClause) { array_push($objClauses, $objClause); } $this->dtgReceipt->DataSource = Receipt::LoadAll($objClauses); }
/** * Refresh this MetaControl with Data from the local Transaction object. * @param boolean $blnReload reload Transaction from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objTransaction->Reload(); } if ($this->lblTransactionId) { if ($this->blnEditMode) { $this->lblTransactionId->Text = $this->objTransaction->TransactionId; } } if ($this->lstEntityQtype) { $this->lstEntityQtype->SelectedValue = $this->objTransaction->EntityQtypeId; } if ($this->lblEntityQtypeId) { $this->lblEntityQtypeId->Text = $this->objTransaction->EntityQtypeId ? EntityQtype::$NameArray[$this->objTransaction->EntityQtypeId] : null; } if ($this->lstTransactionType) { $this->lstTransactionType->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstTransactionType->AddItem(QApplication::Translate('- Select One -'), null); } $objTransactionTypeArray = TransactionType::LoadAll(); if ($objTransactionTypeArray) { foreach ($objTransactionTypeArray as $objTransactionType) { $objListItem = new QListItem($objTransactionType->__toString(), $objTransactionType->TransactionTypeId); if ($this->objTransaction->TransactionType && $this->objTransaction->TransactionType->TransactionTypeId == $objTransactionType->TransactionTypeId) { $objListItem->Selected = true; } $this->lstTransactionType->AddItem($objListItem); } } } if ($this->lblTransactionTypeId) { $this->lblTransactionTypeId->Text = $this->objTransaction->TransactionType ? $this->objTransaction->TransactionType->__toString() : null; } if ($this->txtNote) { $this->txtNote->Text = $this->objTransaction->Note; } if ($this->lblNote) { $this->lblNote->Text = $this->objTransaction->Note; } if ($this->lstCreatedByObject) { $this->lstCreatedByObject->RemoveAllItems(); $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null); $objCreatedByObjectArray = UserAccount::LoadAll(); if ($objCreatedByObjectArray) { foreach ($objCreatedByObjectArray as $objCreatedByObject) { $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId); if ($this->objTransaction->CreatedByObject && $this->objTransaction->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstCreatedByObject->AddItem($objListItem); } } } if ($this->lblCreatedBy) { $this->lblCreatedBy->Text = $this->objTransaction->CreatedByObject ? $this->objTransaction->CreatedByObject->__toString() : null; } if ($this->calCreationDate) { $this->calCreationDate->DateTime = $this->objTransaction->CreationDate; } if ($this->lblCreationDate) { $this->lblCreationDate->Text = sprintf($this->objTransaction->CreationDate) ? $this->objTransaction->__toString($this->strCreationDateDateTimeFormat) : null; } if ($this->lstModifiedByObject) { $this->lstModifiedByObject->RemoveAllItems(); $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null); $objModifiedByObjectArray = UserAccount::LoadAll(); if ($objModifiedByObjectArray) { foreach ($objModifiedByObjectArray as $objModifiedByObject) { $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId); if ($this->objTransaction->ModifiedByObject && $this->objTransaction->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstModifiedByObject->AddItem($objListItem); } } } if ($this->lblModifiedBy) { $this->lblModifiedBy->Text = $this->objTransaction->ModifiedByObject ? $this->objTransaction->ModifiedByObject->__toString() : null; } if ($this->lblModifiedDate) { if ($this->blnEditMode) { $this->lblModifiedDate->Text = $this->objTransaction->ModifiedDate; } } if ($this->lstReceipt) { $this->lstReceipt->RemoveAllItems(); $this->lstReceipt->AddItem(QApplication::Translate('- Select One -'), null); $objReceiptArray = Receipt::LoadAll(); if ($objReceiptArray) { foreach ($objReceiptArray as $objReceipt) { $objListItem = new QListItem($objReceipt->__toString(), $objReceipt->ReceiptId); if ($objReceipt->TransactionId == $this->objTransaction->TransactionId) { $objListItem->Selected = true; } $this->lstReceipt->AddItem($objListItem); } } // Because Receipt's Receipt is not null, if a value is already selected, it cannot be changed. if ($this->lstReceipt->SelectedValue) { $this->lstReceipt->Enabled = false; } else { $this->lstReceipt->Enabled = true; } } if ($this->lblReceipt) { $this->lblReceipt->Text = $this->objTransaction->Receipt ? $this->objTransaction->Receipt->__toString() : null; } if ($this->lstShipment) { $this->lstShipment->RemoveAllItems(); $this->lstShipment->AddItem(QApplication::Translate('- Select One -'), null); $objShipmentArray = Shipment::LoadAll(); if ($objShipmentArray) { foreach ($objShipmentArray as $objShipment) { $objListItem = new QListItem($objShipment->__toString(), $objShipment->ShipmentId); if ($objShipment->TransactionId == $this->objTransaction->TransactionId) { $objListItem->Selected = true; } $this->lstShipment->AddItem($objListItem); } } // Because Shipment's Shipment is not null, if a value is already selected, it cannot be changed. if ($this->lstShipment->SelectedValue) { $this->lstShipment->Enabled = false; } else { $this->lstShipment->Enabled = true; } } if ($this->lblShipment) { $this->lblShipment->Text = $this->objTransaction->Shipment ? $this->objTransaction->Shipment->__toString() : null; } }
protected function dtgReceipt_Bind() { // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll() // Remember! We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below $this->dtgReceipt->TotalItemCount = Receipt::CountAll(); // Setup the $objClauses Array $objClauses = array(); // 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->dtgReceipt->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgReceipt->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be the array of all Receipt objects, given the clauses above $this->dtgReceipt->DataSource = Receipt::LoadAll($objClauses); }
/** * Refresh this MetaControl with Data from the local ReceiptCustomFieldHelper object. * @param boolean $blnReload reload ReceiptCustomFieldHelper from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objReceiptCustomFieldHelper->Reload(); } if ($this->lstReceipt) { $this->lstReceipt->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstReceipt->AddItem(QApplication::Translate('- Select One -'), null); } $objReceiptArray = Receipt::LoadAll(); if ($objReceiptArray) { foreach ($objReceiptArray as $objReceipt) { $objListItem = new QListItem($objReceipt->__toString(), $objReceipt->ReceiptId); if ($this->objReceiptCustomFieldHelper->Receipt && $this->objReceiptCustomFieldHelper->Receipt->ReceiptId == $objReceipt->ReceiptId) { $objListItem->Selected = true; } $this->lstReceipt->AddItem($objListItem); } } } if ($this->lblReceiptId) { $this->lblReceiptId->Text = $this->objReceiptCustomFieldHelper->Receipt ? $this->objReceiptCustomFieldHelper->Receipt->__toString() : null; } }