Exemple #1
0
 public function lstLocationAssetReceived_Render(AssetTransaction $objAssetTransaction)
 {
     if (!$objAssetTransaction->blnReturnReceivedStatus()) {
         $strControlId = 'lstLocationAssetReceived' . $objAssetTransaction->AssetTransactionId;
         $lstLocationAssetReceived = $this->GetControl($strControlId);
         if (!$lstLocationAssetReceived) {
             // Create the drop down list for this row in the datagrid
             // Use ActionParameter to specify the Id of the AssetTransaction
             $lstLocationAssetReceived = new QListBox($this->dtgAssetTransact, $strControlId);
             $lstLocationAssetReceived->Name = 'Location To Receive';
             $lstLocationAssetReceived->ActionParameter = $objAssetTransaction->AssetTransactionId;
             $lstLocationAssetReceived->AddItem('- Select One -', null);
             $objLocationArray = Location::LoadAllLocations(false, false, 'short_description', null, null, false, false, true, false);
             if ($objLocationArray) {
                 // Get assets last location if the admin setting is enabled, otherwise set to null
                 $objLastLocation = QApplication::$TracmorSettings->ReceiveToLastLocation ? $objAssetTransaction->Asset->GetLastShippedFromLocation() : null;
                 foreach ($objLocationArray as $objLocation) {
                     // Default to the assets last location,  if it had one
                     $blnSelected = $objLastLocation != null && $objLocation->LocationId == $objLastLocation->LocationId;
                     $lstLocationAssetReceived->AddItem($objLocation->__toString(), $objLocation->LocationId, $blnSelected);
                 }
             }
             $lstLocationAssetReceived->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnReceiveAssetTransaction_Click'));
             $lstLocationAssetReceived->AddAction(new QEnterKeyEvent(), new QTerminateAction());
             if ($objAssetTransaction->Asset->LinkedFlag) {
                 $lstLocationAssetReceived->Enabled = false;
             }
         }
         QApplication::AuthorizeControl($this->objReceipt, $lstLocationAssetReceived, 2);
         return $lstLocationAssetReceived->Render(false);
     }
 }