public function dtgInventoryModel_Bind() { // Get Total Count b/c of Pagination $this->dtgInventoryModel->TotalItemCount = InventoryModel::CountAll(); $objClauses = array(); if ($objClause = $this->dtgInventoryModel->OrderByClause) { array_push($objClauses, $objClause); } if ($objClause = $this->dtgInventoryModel->LimitClause) { array_push($objClauses, $objClause); } $this->dtgInventoryModel->DataSource = InventoryModel::LoadAll($objClauses); }
protected function dtgInventoryModel_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->dtgInventoryModel->TotalItemCount = InventoryModel::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->dtgInventoryModel->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgInventoryModel->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be the array of all InventoryModel objects, given the clauses above $this->dtgInventoryModel->DataSource = InventoryModel::LoadAll($objClauses); }
protected function lstInventoryModel_Create() { $this->lstInventoryModel = new QListBox($this); $this->lstInventoryModel->Name = QApplication::Translate('Inventory Model'); $this->lstInventoryModel->Required = true; if (!$this->blnEditMode) { $this->lstInventoryModel->AddItem(QApplication::Translate('- Select One -'), null); } $objInventoryModelArray = InventoryModel::LoadAll(); if ($objInventoryModelArray) { foreach ($objInventoryModelArray as $objInventoryModel) { $objListItem = new QListItem($objInventoryModel->__toString(), $objInventoryModel->InventoryModelId); if ($this->objInventoryLocation->InventoryModel && $this->objInventoryLocation->InventoryModel->InventoryModelId == $objInventoryModel->InventoryModelId) { $objListItem->Selected = true; } $this->lstInventoryModel->AddItem($objListItem); } } }
/** * Refresh this MetaControl with Data from the local InventoryModelCustomFieldHelper object. * @param boolean $blnReload reload InventoryModelCustomFieldHelper from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objInventoryModelCustomFieldHelper->Reload(); } if ($this->lstInventoryModel) { $this->lstInventoryModel->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstInventoryModel->AddItem(QApplication::Translate('- Select One -'), null); } $objInventoryModelArray = InventoryModel::LoadAll(); if ($objInventoryModelArray) { foreach ($objInventoryModelArray as $objInventoryModel) { $objListItem = new QListItem($objInventoryModel->__toString(), $objInventoryModel->InventoryModelId); if ($this->objInventoryModelCustomFieldHelper->InventoryModel && $this->objInventoryModelCustomFieldHelper->InventoryModel->InventoryModelId == $objInventoryModel->InventoryModelId) { $objListItem->Selected = true; } $this->lstInventoryModel->AddItem($objListItem); } } } if ($this->lblInventoryModelId) { $this->lblInventoryModelId->Text = $this->objInventoryModelCustomFieldHelper->InventoryModel ? $this->objInventoryModelCustomFieldHelper->InventoryModel->__toString() : null; } }
/** * Refresh this MetaControl with Data from the local InventoryLocation object. * @param boolean $blnReload reload InventoryLocation from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objInventoryLocation->Reload(); } if ($this->lblInventoryLocationId) { if ($this->blnEditMode) { $this->lblInventoryLocationId->Text = $this->objInventoryLocation->InventoryLocationId; } } if ($this->lstInventoryModel) { $this->lstInventoryModel->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstInventoryModel->AddItem(QApplication::Translate('- Select One -'), null); } $objInventoryModelArray = InventoryModel::LoadAll(); if ($objInventoryModelArray) { foreach ($objInventoryModelArray as $objInventoryModel) { $objListItem = new QListItem($objInventoryModel->__toString(), $objInventoryModel->InventoryModelId); if ($this->objInventoryLocation->InventoryModel && $this->objInventoryLocation->InventoryModel->InventoryModelId == $objInventoryModel->InventoryModelId) { $objListItem->Selected = true; } $this->lstInventoryModel->AddItem($objListItem); } } } if ($this->lblInventoryModelId) { $this->lblInventoryModelId->Text = $this->objInventoryLocation->InventoryModel ? $this->objInventoryLocation->InventoryModel->__toString() : null; } if ($this->lstLocation) { $this->lstLocation->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstLocation->AddItem(QApplication::Translate('- Select One -'), null); } $objLocationArray = Location::LoadAll(); if ($objLocationArray) { foreach ($objLocationArray as $objLocation) { $objListItem = new QListItem($objLocation->__toString(), $objLocation->LocationId); if ($this->objInventoryLocation->Location && $this->objInventoryLocation->Location->LocationId == $objLocation->LocationId) { $objListItem->Selected = true; } $this->lstLocation->AddItem($objListItem); } } } if ($this->lblLocationId) { $this->lblLocationId->Text = $this->objInventoryLocation->Location ? $this->objInventoryLocation->Location->__toString() : null; } if ($this->txtQuantity) { $this->txtQuantity->Text = $this->objInventoryLocation->Quantity; } if ($this->lblQuantity) { $this->lblQuantity->Text = $this->objInventoryLocation->Quantity; } 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->objInventoryLocation->CreatedByObject && $this->objInventoryLocation->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstCreatedByObject->AddItem($objListItem); } } } if ($this->lblCreatedBy) { $this->lblCreatedBy->Text = $this->objInventoryLocation->CreatedByObject ? $this->objInventoryLocation->CreatedByObject->__toString() : null; } if ($this->calCreationDate) { $this->calCreationDate->DateTime = $this->objInventoryLocation->CreationDate; } if ($this->lblCreationDate) { $this->lblCreationDate->Text = sprintf($this->objInventoryLocation->CreationDate) ? $this->objInventoryLocation->__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->objInventoryLocation->ModifiedByObject && $this->objInventoryLocation->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstModifiedByObject->AddItem($objListItem); } } } if ($this->lblModifiedBy) { $this->lblModifiedBy->Text = $this->objInventoryLocation->ModifiedByObject ? $this->objInventoryLocation->ModifiedByObject->__toString() : null; } if ($this->lblModifiedDate) { if ($this->blnEditMode) { $this->lblModifiedDate->Text = $this->objInventoryLocation->ModifiedDate; } } }