protected function lstInventoryLocation_Create() { $this->lstInventoryLocation = new QListBox($this); $this->lstInventoryLocation->Name = QApplication::Translate('Inventory Location'); $this->lstInventoryLocation->Required = true; if (!$this->blnEditMode) { $this->lstInventoryLocation->AddItem(QApplication::Translate('- Select One -'), null); } $objInventoryLocationArray = InventoryLocation::LoadAll(); if ($objInventoryLocationArray) { foreach ($objInventoryLocationArray as $objInventoryLocation) { $objListItem = new QListItem($objInventoryLocation->__toString(), $objInventoryLocation->InventoryLocationId); if ($this->objInventoryTransaction->InventoryLocation && $this->objInventoryTransaction->InventoryLocation->InventoryLocationId == $objInventoryLocation->InventoryLocationId) { $objListItem->Selected = true; } $this->lstInventoryLocation->AddItem($objListItem); } } }
protected function dtgInventoryLocation_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->dtgInventoryLocation->TotalItemCount = InventoryLocation::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->dtgInventoryLocation->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgInventoryLocation->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be the array of all InventoryLocation objects, given the clauses above $this->dtgInventoryLocation->DataSource = InventoryLocation::LoadAll($objClauses); }
/** * Refresh this MetaControl with Data from the local InventoryTransaction object. * @param boolean $blnReload reload InventoryTransaction from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objInventoryTransaction->Reload(); } if ($this->lblInventoryTransactionId) { if ($this->blnEditMode) { $this->lblInventoryTransactionId->Text = $this->objInventoryTransaction->InventoryTransactionId; } } if ($this->lstInventoryLocation) { $this->lstInventoryLocation->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstInventoryLocation->AddItem(QApplication::Translate('- Select One -'), null); } $objInventoryLocationArray = InventoryLocation::LoadAll(); if ($objInventoryLocationArray) { foreach ($objInventoryLocationArray as $objInventoryLocation) { $objListItem = new QListItem($objInventoryLocation->__toString(), $objInventoryLocation->InventoryLocationId); if ($this->objInventoryTransaction->InventoryLocation && $this->objInventoryTransaction->InventoryLocation->InventoryLocationId == $objInventoryLocation->InventoryLocationId) { $objListItem->Selected = true; } $this->lstInventoryLocation->AddItem($objListItem); } } } if ($this->lblInventoryLocationId) { $this->lblInventoryLocationId->Text = $this->objInventoryTransaction->InventoryLocation ? $this->objInventoryTransaction->InventoryLocation->__toString() : null; } if ($this->lstTransaction) { $this->lstTransaction->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstTransaction->AddItem(QApplication::Translate('- Select One -'), null); } $objTransactionArray = Transaction::LoadAll(); if ($objTransactionArray) { foreach ($objTransactionArray as $objTransaction) { $objListItem = new QListItem($objTransaction->__toString(), $objTransaction->TransactionId); if ($this->objInventoryTransaction->Transaction && $this->objInventoryTransaction->Transaction->TransactionId == $objTransaction->TransactionId) { $objListItem->Selected = true; } $this->lstTransaction->AddItem($objListItem); } } } if ($this->lblTransactionId) { $this->lblTransactionId->Text = $this->objInventoryTransaction->Transaction ? $this->objInventoryTransaction->Transaction->__toString() : null; } if ($this->txtQuantity) { $this->txtQuantity->Text = $this->objInventoryTransaction->Quantity; } if ($this->lblQuantity) { $this->lblQuantity->Text = $this->objInventoryTransaction->Quantity; } if ($this->lstSourceLocation) { $this->lstSourceLocation->RemoveAllItems(); $this->lstSourceLocation->AddItem(QApplication::Translate('- Select One -'), null); $objSourceLocationArray = Location::LoadAll(); if ($objSourceLocationArray) { foreach ($objSourceLocationArray as $objSourceLocation) { $objListItem = new QListItem($objSourceLocation->__toString(), $objSourceLocation->LocationId); if ($this->objInventoryTransaction->SourceLocation && $this->objInventoryTransaction->SourceLocation->LocationId == $objSourceLocation->LocationId) { $objListItem->Selected = true; } $this->lstSourceLocation->AddItem($objListItem); } } } if ($this->lblSourceLocationId) { $this->lblSourceLocationId->Text = $this->objInventoryTransaction->SourceLocation ? $this->objInventoryTransaction->SourceLocation->__toString() : null; } if ($this->lstDestinationLocation) { $this->lstDestinationLocation->RemoveAllItems(); $this->lstDestinationLocation->AddItem(QApplication::Translate('- Select One -'), null); $objDestinationLocationArray = Location::LoadAll(); if ($objDestinationLocationArray) { foreach ($objDestinationLocationArray as $objDestinationLocation) { $objListItem = new QListItem($objDestinationLocation->__toString(), $objDestinationLocation->LocationId); if ($this->objInventoryTransaction->DestinationLocation && $this->objInventoryTransaction->DestinationLocation->LocationId == $objDestinationLocation->LocationId) { $objListItem->Selected = true; } $this->lstDestinationLocation->AddItem($objListItem); } } } if ($this->lblDestinationLocationId) { $this->lblDestinationLocationId->Text = $this->objInventoryTransaction->DestinationLocation ? $this->objInventoryTransaction->DestinationLocation->__toString() : null; } 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->objInventoryTransaction->CreatedByObject && $this->objInventoryTransaction->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstCreatedByObject->AddItem($objListItem); } } } if ($this->lblCreatedBy) { $this->lblCreatedBy->Text = $this->objInventoryTransaction->CreatedByObject ? $this->objInventoryTransaction->CreatedByObject->__toString() : null; } if ($this->calCreationDate) { $this->calCreationDate->DateTime = $this->objInventoryTransaction->CreationDate; } if ($this->lblCreationDate) { $this->lblCreationDate->Text = sprintf($this->objInventoryTransaction->CreationDate) ? $this->objInventoryTransaction->__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->objInventoryTransaction->ModifiedByObject && $this->objInventoryTransaction->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstModifiedByObject->AddItem($objListItem); } } } if ($this->lblModifiedBy) { $this->lblModifiedBy->Text = $this->objInventoryTransaction->ModifiedByObject ? $this->objInventoryTransaction->ModifiedByObject->__toString() : null; } if ($this->lblModifiedDate) { if ($this->blnEditMode) { $this->lblModifiedDate->Text = $this->objInventoryTransaction->ModifiedDate; } } }
public function dtgInventoryLocation_Bind() { // Get Total Count b/c of Pagination $this->dtgInventoryLocation->TotalItemCount = InventoryLocation::CountAll(); $objClauses = array(); if ($objClause = $this->dtgInventoryLocation->OrderByClause) { array_push($objClauses, $objClause); } if ($objClause = $this->dtgInventoryLocation->LimitClause) { array_push($objClauses, $objClause); } $this->dtgInventoryLocation->DataSource = InventoryLocation::LoadAll($objClauses); }