/** * Refresh this MetaControl with Data from the local AssetTransaction object. * @param boolean $blnReload reload AssetTransaction from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objAssetTransaction->Reload(); } if ($this->lblAssetTransactionId) { if ($this->blnEditMode) { $this->lblAssetTransactionId->Text = $this->objAssetTransaction->AssetTransactionId; } } if ($this->lstAsset) { $this->lstAsset->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstAsset->AddItem(QApplication::Translate('- Select One -'), null); } $objAssetArray = Asset::LoadAll(); if ($objAssetArray) { foreach ($objAssetArray as $objAsset) { $objListItem = new QListItem($objAsset->__toString(), $objAsset->AssetId); if ($this->objAssetTransaction->Asset && $this->objAssetTransaction->Asset->AssetId == $objAsset->AssetId) { $objListItem->Selected = true; } $this->lstAsset->AddItem($objListItem); } } } if ($this->lblAssetId) { $this->lblAssetId->Text = $this->objAssetTransaction->Asset ? $this->objAssetTransaction->Asset->__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->objAssetTransaction->Transaction && $this->objAssetTransaction->Transaction->TransactionId == $objTransaction->TransactionId) { $objListItem->Selected = true; } $this->lstTransaction->AddItem($objListItem); } } } if ($this->lblTransactionId) { $this->lblTransactionId->Text = $this->objAssetTransaction->Transaction ? $this->objAssetTransaction->Transaction->__toString() : null; } if ($this->lstParentAssetTransaction) { $this->lstParentAssetTransaction->RemoveAllItems(); $this->lstParentAssetTransaction->AddItem(QApplication::Translate('- Select One -'), null); $objParentAssetTransactionArray = AssetTransaction::LoadAll(); if ($objParentAssetTransactionArray) { foreach ($objParentAssetTransactionArray as $objParentAssetTransaction) { $objListItem = new QListItem($objParentAssetTransaction->__toString(), $objParentAssetTransaction->AssetTransactionId); if ($this->objAssetTransaction->ParentAssetTransaction && $this->objAssetTransaction->ParentAssetTransaction->AssetTransactionId == $objParentAssetTransaction->AssetTransactionId) { $objListItem->Selected = true; } $this->lstParentAssetTransaction->AddItem($objListItem); } } } if ($this->lblParentAssetTransactionId) { $this->lblParentAssetTransactionId->Text = $this->objAssetTransaction->ParentAssetTransaction ? $this->objAssetTransaction->ParentAssetTransaction->__toString() : null; } 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->objAssetTransaction->SourceLocation && $this->objAssetTransaction->SourceLocation->LocationId == $objSourceLocation->LocationId) { $objListItem->Selected = true; } $this->lstSourceLocation->AddItem($objListItem); } } } if ($this->lblSourceLocationId) { $this->lblSourceLocationId->Text = $this->objAssetTransaction->SourceLocation ? $this->objAssetTransaction->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->objAssetTransaction->DestinationLocation && $this->objAssetTransaction->DestinationLocation->LocationId == $objDestinationLocation->LocationId) { $objListItem->Selected = true; } $this->lstDestinationLocation->AddItem($objListItem); } } } if ($this->lblDestinationLocationId) { $this->lblDestinationLocationId->Text = $this->objAssetTransaction->DestinationLocation ? $this->objAssetTransaction->DestinationLocation->__toString() : null; } if ($this->chkNewAssetFlag) { $this->chkNewAssetFlag->Checked = $this->objAssetTransaction->NewAssetFlag; } if ($this->lblNewAssetFlag) { $this->lblNewAssetFlag->Text = $this->objAssetTransaction->NewAssetFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->lstNewAsset) { $this->lstNewAsset->RemoveAllItems(); $this->lstNewAsset->AddItem(QApplication::Translate('- Select One -'), null); $objNewAssetArray = Asset::LoadAll(); if ($objNewAssetArray) { foreach ($objNewAssetArray as $objNewAsset) { $objListItem = new QListItem($objNewAsset->__toString(), $objNewAsset->AssetId); if ($this->objAssetTransaction->NewAsset && $this->objAssetTransaction->NewAsset->AssetId == $objNewAsset->AssetId) { $objListItem->Selected = true; } $this->lstNewAsset->AddItem($objListItem); } } } if ($this->lblNewAssetId) { $this->lblNewAssetId->Text = $this->objAssetTransaction->NewAsset ? $this->objAssetTransaction->NewAsset->__toString() : null; } if ($this->chkScheduleReceiptFlag) { $this->chkScheduleReceiptFlag->Checked = $this->objAssetTransaction->ScheduleReceiptFlag; } if ($this->lblScheduleReceiptFlag) { $this->lblScheduleReceiptFlag->Text = $this->objAssetTransaction->ScheduleReceiptFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->calScheduleReceiptDueDate) { $this->calScheduleReceiptDueDate->DateTime = $this->objAssetTransaction->ScheduleReceiptDueDate; } if ($this->lblScheduleReceiptDueDate) { $this->lblScheduleReceiptDueDate->Text = sprintf($this->objAssetTransaction->ScheduleReceiptDueDate) ? $this->objAssetTransaction->__toString($this->strScheduleReceiptDueDateDateTimeFormat) : 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->objAssetTransaction->CreatedByObject && $this->objAssetTransaction->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstCreatedByObject->AddItem($objListItem); } } } if ($this->lblCreatedBy) { $this->lblCreatedBy->Text = $this->objAssetTransaction->CreatedByObject ? $this->objAssetTransaction->CreatedByObject->__toString() : null; } if ($this->calCreationDate) { $this->calCreationDate->DateTime = $this->objAssetTransaction->CreationDate; } if ($this->lblCreationDate) { $this->lblCreationDate->Text = sprintf($this->objAssetTransaction->CreationDate) ? $this->objAssetTransaction->__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->objAssetTransaction->ModifiedByObject && $this->objAssetTransaction->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstModifiedByObject->AddItem($objListItem); } } } if ($this->lblModifiedBy) { $this->lblModifiedBy->Text = $this->objAssetTransaction->ModifiedByObject ? $this->objAssetTransaction->ModifiedByObject->__toString() : null; } if ($this->lblModifiedDate) { if ($this->blnEditMode) { $this->lblModifiedDate->Text = $this->objAssetTransaction->ModifiedDate; } } if ($this->lstAssetTransactionCheckout) { $this->lstAssetTransactionCheckout->RemoveAllItems(); $this->lstAssetTransactionCheckout->AddItem(QApplication::Translate('- Select One -'), null); $objAssetTransactionCheckoutArray = AssetTransactionCheckout::LoadAll(); if ($objAssetTransactionCheckoutArray) { foreach ($objAssetTransactionCheckoutArray as $objAssetTransactionCheckout) { $objListItem = new QListItem($objAssetTransactionCheckout->__toString(), $objAssetTransactionCheckout->AssetTransactionCheckoutId); if ($objAssetTransactionCheckout->AssetTransactionId == $this->objAssetTransaction->AssetTransactionId) { $objListItem->Selected = true; } $this->lstAssetTransactionCheckout->AddItem($objListItem); } } // Because AssetTransactionCheckout's AssetTransactionCheckout is not null, if a value is already selected, it cannot be changed. if ($this->lstAssetTransactionCheckout->SelectedValue) { $this->lstAssetTransactionCheckout->Enabled = false; } else { $this->lstAssetTransactionCheckout->Enabled = true; } } if ($this->lblAssetTransactionCheckout) { $this->lblAssetTransactionCheckout->Text = $this->objAssetTransaction->AssetTransactionCheckout ? $this->objAssetTransaction->AssetTransactionCheckout->__toString() : null; } }