protected function SetupInventoryModel()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intInventoryModelId = QApplication::QueryString('intInventoryModelId');
     if ($intInventoryModelId) {
         $this->objInventoryModel = InventoryModel::Load($intInventoryModelId);
         if (!$this->objInventoryModel) {
             throw new Exception('Could not find a InventoryModel object with PK arguments: ' . $intInventoryModelId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objInventoryModel = new InventoryModel();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
 public function btnAdd_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     // Assign the values from the user submitted form input
     $intNewInventoryLocationId = $this->lstSourceLocation->SelectedValue;
     $intTransactionQuantity = $this->txtQuantity->Text;
     // If transaction is a move or take out
     if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 5) {
         if ($intNewInventoryLocationId) {
             // Begin error checking
             if ($this->objInventoryLocationArray) {
                 foreach ($this->objInventoryLocationArray as $objInventoryLocation) {
                     if ($objInventoryLocation && $objInventoryLocation->InventoryLocationId == $intNewInventoryLocationId) {
                         $blnError = true;
                         $this->txtNewInventoryModelCode->Warning = "That Inventory has already been added.";
                     }
                 }
             }
             if (!$blnError) {
                 $objNewInventoryLocation = InventoryLocation::LoadLocations($intNewInventoryLocationId);
                 // This should not be possible because the list is populated with existing InventoryLocations
                 if (!$objNewInventoryLocation instanceof InventoryLocation) {
                     $this->txtNewInventoryModelCode->Warning = "That Inventory location does not exist.";
                     $blnError = true;
                 } elseif (!ctype_digit($intTransactionQuantity) || $intTransactionQuantity <= 0) {
                     $this->txtQuantity->Warning = "That is not a valid quantity.";
                     $blnError = true;
                 }
                 // Move
                 if ($this->intTransactionTypeId == 1) {
                     if ($objNewInventoryLocation->Quantity < $intTransactionQuantity) {
                         $this->txtQuantity->Warning = "Quantity moved cannot exceed quantity available.";
                         $blnError = true;
                     }
                 } elseif ($this->intTransactionTypeId == 5) {
                     if ($objNewInventoryLocation->Quantity < $intTransactionQuantity) {
                         $this->txtQuantity->Warning = "Quantity taken out cannot exceed quantity available.";
                         $blnError = true;
                     }
                 }
             }
         } elseif ($this->intTransactionTypeId != 4) {
             $this->txtNewInventoryModelCode->Warning = "Please select a source location.";
             $blnError = true;
         }
     } elseif ($this->intTransactionTypeId == 4) {
         // Check for duplicate inventory code
         $strNewInventoryModelCode = $this->txtNewInventoryModelCode->Text;
         if (!($objNewInventoryModel = InventoryModel::LoadByInventoryModelCode($strNewInventoryModelCode))) {
             $blnError = true;
             $this->txtNewInventoryModelCode->Warning = "That is an invalid Inventory Code.";
         } elseif ($this->objInventoryLocationArray) {
             foreach ($this->objInventoryLocationArray as $objInventoryLocation) {
                 if ($objInventoryLocation && $objInventoryLocation->InventoryModel->InventoryModelCode == $strNewInventoryModelCode) {
                     $blnError = true;
                     $this->txtNewInventoryModelCode->Warning = "That Inventory has already been added.";
                 }
             }
         }
         if (!$blnError) {
             // Create a new InventoryLocation for the time being
             // Before saving we will check to see if it already exists
             $objNewInventoryLocation = new InventoryLocation();
             $objNewInventoryLocation->InventoryModelId = $objNewInventoryModel->InventoryModelId;
             $objNewInventoryLocation->Quantity = 0;
             // LocationID = 4 is 'New Inventory' Location
             $objNewInventoryLocation->LocationId = 4;
         }
     }
     if (!$blnError && isset($objNewInventoryModel) && !QApplication::AuthorizeEntityBoolean($objNewInventoryModel, 2)) {
         $blnError = true;
         $this->txtNewInventoryModelCode->Warning = "You do not have authorization to perform a transaction on this inventory model.";
     }
     if (!$blnError && $objNewInventoryLocation instanceof InventoryLocation) {
         $objNewInventoryLocation->intTransactionQuantity = $intTransactionQuantity;
         $this->objInventoryLocationArray[] = $objNewInventoryLocation;
         $this->txtNewInventoryModelCode->Text = null;
         $this->lstSourceLocation->SelectedIndex = 0;
         $this->txtQuantity->Text = null;
         if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 5) {
             $this->lstSourceLocation->Enabled = false;
             $this->txtQuantity->Enabled = false;
         }
     }
 }
Пример #3
0
 protected function dtgAudit_Bind()
 {
     if ($this->rblDiscrepancy->SelectedValue == 'discrepancies') {
         $objConditions = QQ::AndCondition(QQ::Equal(QQN::AuditScan()->AuditId, $_GET['intAuditId']), QQ::NotEqual(QQN::AuditScan()->Count, QQN::AuditScan()->SystemCount));
     } else {
         $objConditions = QQ::Equal(QQN::AuditScan()->AuditId, $_GET['intAuditId']);
     }
     $objAuditScanArray = AuditScan::QueryArray($objConditions, QQ::Clause(QQ::Expand(QQN::AuditScan()->Location), $this->dtgAudit->OrderByClause));
     if ($objAuditScanArray) {
         foreach ($objAuditScanArray as $objAuditScan) {
             $objAuditScan->InventoryModel = InventoryModel::QuerySingle(QQ::Equal(QQN::InventoryModel()->InventoryModelId, $objAuditScan->EntityId), QQ::Clause(QQ::Expand(QQN::InventoryModel()->InventoryModelCode)));
         }
     }
     if (count($objAuditScanArray) == 0) {
         $this->dtgAudit->ShowHeader = false;
     } else {
         $this->dtgAudit->ShowHeader = true;
     }
     $this->dtgAudit->DataSource = $objAuditScanArray;
 }
Пример #4
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, InventoryModel::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
Пример #5
0
    /**
     * Deletes all associated InventoryModels
     * @return void
     */
    public function DeleteAllInventoryModels()
    {
        if (is_null($this->intManufacturerId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryModel on this unsaved Manufacturer.');
        }
        // Get the Database Object for this Class
        $objDatabase = Manufacturer::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (InventoryModel::LoadArrayByManufacturerId($this->intManufacturerId) as $objInventoryModel) {
                $objInventoryModel->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`inventory_model`
				WHERE
					`manufacturer_id` = ' . $objDatabase->SqlVariable($this->intManufacturerId) . '
			');
    }
 public function dtgInventoryModel_Bind()
 {
     // If the search button has been pressed
     if ($this->blnSearch) {
         $this->assignSearchValues();
     }
     $strInventoryModelCode = $this->strInventoryModelCode;
     $intLocationId = $this->intLocationId;
     $intInventoryModelId = $this->intInventoryModelId;
     $intCategoryId = $this->intCategoryId;
     $intManufacturerId = $this->intManufacturerId;
     $strShortDescription = $this->strShortDescription;
     $strDateModifiedFirst = $this->strDateModifiedFirst;
     $strDateModifiedLast = $this->strDateModifiedLast;
     $strDateModified = $this->strDateModified;
     $blnAttachment = $this->blnAttachment;
     $arrCustomFields = $this->arrCustomFields;
     // Enable Profiling
     // QApplication::$Database[1]->EnableProfiling();
     // Expand the Asset object to include the AssetModel, Category, Manufacturer, and Location Objects
     $objExpansionMap[InventoryModel::ExpandCategory] = true;
     $objExpansionMap[InventoryModel::ExpandManufacturer] = true;
     // If the search form has been posted
     $this->dtgInventoryModel->TotalItemCount = InventoryModel::CountBySearchHelper($strInventoryModelCode, $intLocationId, $intInventoryModelId, $intCategoryId, $intManufacturerId, $strShortDescription, $arrCustomFields, $strDateModified, $strDateModifiedFirst, $strDateModifiedLast, $blnAttachment, $objExpansionMap);
     if ($this->dtgInventoryModel->TotalItemCount == 0) {
         $this->dtgInventoryModel->ShowHeader = false;
     } else {
         $this->dtgInventoryModel->ShowHeader = true;
         $this->dtgInventoryModel->DataSource = InventoryModel::LoadArrayBySearchHelper($strInventoryModelCode, $intLocationId, $intInventoryModelId, $intCategoryId, $intManufacturerId, $strShortDescription, $arrCustomFields, $strDateModified, $strDateModifiedFirst, $strDateModifiedLast, $blnAttachment, $this->dtgInventoryModel->SortInfo, $this->dtgInventoryModel->LimitInfo, $objExpansionMap);
     }
     $this->blnSearch = false;
 }
 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);
 }
Пример #8
0
 public function btnLookup_Click($strFormId, $strControlId, $strParameter)
 {
     // Clear if warning from previous attempt exists
     $this->txtNewInventoryModelCode->Warning = '';
     // Assign the value submitted from the form
     $strInventoryModelCode = $this->txtNewInventoryModelCode->Text;
     if ($strInventoryModelCode) {
         // Load the inventory model object based on the inventory_model_code submitted
         $objInventoryModel = InventoryModel::LoadByInventoryModelCode($strInventoryModelCode);
         if ($objInventoryModel) {
             // Load the array of InventoryLocations based on the InventoryModelId of the InventoryModel object
             $InventorySourceLocationArray = InventoryLocation::LoadArrayByInventoryModelIdLocations($objInventoryModel->InventoryModelId);
             $this->lstSourceLocation->RemoveAllItems();
             $this->lstSourceLocation->AddItem('- Select One -', null);
             if ($InventorySourceLocationArray) {
                 // Populate the Source Location list box
                 foreach ($InventorySourceLocationArray as $InventoryLocation) {
                     // Do not display locations where the quantity is 0
                     if ($InventoryLocation->Quantity != 0) {
                         $this->lstSourceLocation->AddItem($InventoryLocation->__toStringWithQuantity(), $InventoryLocation->InventoryLocationId);
                     }
                 }
                 $this->lstSourceLocation->Enabled = true;
                 $this->txtQuantity->Enabled = true;
             } else {
                 $this->txtNewInventoryModelCode->Warning = 'There is no inventory for that inventory code';
                 $this->lstSourceLocation->Enabled = false;
                 $this->txtQuantity->Enabled = false;
             }
         } else {
             $this->txtNewInventoryModelCode->Warning = 'That is not a valid inventory code.';
         }
     } else {
         $this->txtNewInventoryModelCode->Warning = 'Please enter an inventory code.';
     }
 }
 /**
  * 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;
     }
 }
 /**
  * This method controls what happens when you move to /inventory/delete(/XX) in your app.
  * Deletes a product. In a real application a deletion via GET/URL is not recommended, but for demo purposes it's
  * totally okay.
  * @param int $product_id id of the note
  */
 public function delete($product_id)
 {
     InventoryModel::deleteProduct($product_id);
     Redirect::to('inventory');
 }
Пример #11
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objInventoryModel) {
         $objObject->objInventoryModel = InventoryModel::GetSoapObjectFromObject($objObject->objInventoryModel, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intInventoryModelId = null;
         }
     }
     if ($objObject->objLocation) {
         $objObject->objLocation = Location::GetSoapObjectFromObject($objObject->objLocation, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intLocationId = null;
         }
     }
     if ($objObject->objCreatedByObject) {
         $objObject->objCreatedByObject = UserAccount::GetSoapObjectFromObject($objObject->objCreatedByObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCreatedBy = null;
         }
     }
     if ($objObject->dttCreationDate) {
         $objObject->dttCreationDate = $objObject->dttCreationDate->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->objModifiedByObject) {
         $objObject->objModifiedByObject = UserAccount::GetSoapObjectFromObject($objObject->objModifiedByObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intModifiedBy = null;
         }
     }
     return $objObject;
 }
Пример #12
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $inventory = InventoryModel::find($id);
     $inventory->delete();
     // notif
     Session::flash('message', 'data di hapus');
     // redirect
     return Redirect::to('inventory');
 }
Пример #13
0
 /**
  * Counts all associated InventoryModels
  * @return int
  */
 public function CountInventoryModels()
 {
     if (is_null($this->intCategoryId)) {
         return 0;
     }
     return InventoryModel::CountByCategoryId($this->intCategoryId);
 }
 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);
         }
     }
 }
 /**
  * Internally called method to assist with early binding of objects
  * on load methods.  Can only early-bind references that this class owns in the database.
  * @param string $strParentAlias the alias of the parent (if any)
  * @param string $strAlias the alias of this object
  * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
  * @param QueryExpansion an already instantiated QueryExpansion object (used as a utility object to assist with object expansion)
  */
 public static function ExpandQuery($strParentAlias, $strAlias, $objExpansionMap, QQueryExpansion $objQueryExpansion)
 {
     if ($strAlias) {
         $objQueryExpansion->AddFromItem(sprintf('LEFT JOIN `inventory_model_custom_field_helper` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`inventory_model_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`inventory_model_id` AS `%s__%s__inventory_model_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $strParentAlias = $strParentAlias . '__' . $strAlias;
     }
     if (is_array($objExpansionMap)) {
         foreach ($objExpansionMap as $strKey => $objValue) {
             switch ($strKey) {
                 case 'inventory_model_id':
                     try {
                         InventoryModel::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 default:
                     throw new QCallerException(sprintf('Unknown Object to Expand in %s: %s', $strParentAlias, $strKey));
             }
         }
     }
 }
 public function btnApply_Click($strFormId, $strControlId, $strParameter)
 {
     $this->EnableSelectedControls();
     $this->ClearWarnings();
     $blnError = false;
     // Make sure at least one checkbox is checked
     if (!$this->chkCategory->Checked && !$this->chkManufacturer->Checked && !$this->chkLongDescription->Checked) {
         $blnChecked = false;
         foreach ($this->arrCheckboxes as $objCheckBox) {
             if ($objCheckBox->Checked) {
                 $blnChecked = true;
                 break;
             }
         }
         if (!$blnChecked) {
             $blnError = true;
             $this->btnCancel->Warning = 'You must select at least one field to edit.';
             return;
         }
     }
     // Get an instance of the database
     $objDatabase = QApplication::$Database[1];
     // Begin a MySQL Transaction to be either committed or rolled back
     $objDatabase->TransactionBegin();
     if (count($this->arrCustomFields) > 0) {
         $customFieldIdArray = array();
         foreach ($this->arrCustomFields as $field) {
             if ($this->arrCheckboxes[$field['input']->strControlId]->Checked) {
                 if ($field['input'] instanceof QTextBox && $field['input']->Required && $field['input']->Text == null || $field['input'] instanceof QListBox && $field['input']->Required && $field['input']->SelectedValue == null) {
                     $blnError = true;
                     $field['input']->Warning = "Required.";
                 } else {
                     $this->arrCustomFieldsToEdit[] = $field;
                     $customFieldIdArray[] = (int) str_replace('cf', '', $field['input']->strControlId);
                 }
             }
         }
     }
     // Apply checked main_table fields
     $set = array(sprintf('`modified_by`= %s', QApplication::$objUserAccount->UserAccountId));
     // Force modified_date timestamp update
     $set[] = '`modified_date` = NOW()';
     if ($this->chkLongDescription->Checked) {
         $set[] = sprintf('`long_description`="%s"', $this->txtLongDescription->Text);
     }
     if ($this->chkManufacturer->Checked) {
         if ($this->lstManufacturer->SelectedValue !== null) {
             $set[] = sprintf('`manufacturer_id`=%s', $this->lstManufacturer->SelectedValue);
         } else {
             $blnError = true;
             $this->lstManufacturer->Warning = 'You must select a Manufacturer.';
         }
     }
     if ($this->chkCategory->Checked) {
         if ($this->lstCategory->SelectedValue !== null) {
             $set[] = sprintf('`category_id`= %s', $this->lstCategory->SelectedValue);
         } else {
             $blnError = true;
             $this->lstCategory->Warning = 'You must select a Category.';
         }
     }
     // First check that the user is authorized to edit this inventory
     foreach ($this->arrInventoryToEdit as $intInventoryId) {
         $objInventoryModel = InventoryModel::Load($intInventoryId);
         if (!QApplication::AuthorizeEntityBoolean($objInventoryModel, 2)) {
             $blnError = true;
             $this->btnCancel->Warning = 'You are not authorized to edit one or more of the selected inventory models.';
             break;
         }
     }
     // Save
     if (!$blnError) {
         try {
             if (count($this->arrCustomFieldsToEdit) > 0) {
                 // preparing data to edit
                 // Save the values from all of the custom field controls to save the asset
                 foreach ($this->arrInventoryToEdit as $intInventoryId) {
                     $objCustomFieldsArray = CustomField::LoadObjCustomFieldArray(EntityQtype::Inventory, false);
                     $selectedCustomFieldsArray = array();
                     foreach ($objCustomFieldsArray as $objCustomField) {
                         if (in_array($objCustomField->CustomFieldId, $customFieldIdArray)) {
                             $selectedCustomFieldsArray[] = $objCustomField;
                         }
                     }
                     CustomField::SaveControls($selectedCustomFieldsArray, true, $this->arrCustomFieldsToEdit, $intInventoryId, EntityQtype::Inventory);
                 }
             }
             $strQuery = sprintf("UPDATE `inventory_model`\n\t\t\t\t\t\t\t\t\t SET " . implode(",", $set) . "\n\t\t\t\t\t\t\t\t\t WHERE `inventory_model_id` IN (%s)", implode(",", $this->arrInventoryToEdit));
             $objDatabase = QApplication::$Database[1];
             $objDatabase->NonQuery($strQuery);
             $objDatabase->TransactionCommit();
             QApplication::Redirect('');
         } catch (QMySqliDatabaseException $objExc) {
             $objDatabase->TransactionRollback();
             throw new QDatabaseException();
         }
     } else {
         $objDatabase->TransactionRollback();
     }
 }
Пример #17
0
 public function SetupInventoryModel($objCaller = null)
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     // Overridden from InventoryModelEditForm to add the $objCaller parameter
     $intInventoryModelId = QApplication::QueryString('intInventoryModelId');
     if ($intInventoryModelId) {
         $objCaller->objInventoryModel = InventoryModel::Load($intInventoryModelId);
         if (!$objCaller->objInventoryModel) {
             throw new Exception('Could not find a InventoryModel object with PK arguments: ' . $intInventoryModelId);
         }
         $objCaller->strTitleVerb = QApplication::Translate('Edit');
         $objCaller->blnEditMode = true;
     } else {
         $objCaller->objInventoryModel = new InventoryModel();
         $objCaller->strTitleVerb = QApplication::Translate('Create');
         $objCaller->blnEditMode = false;
     }
     QApplication::AuthorizeEntity($objCaller->objInventoryModel, $objCaller->blnEditMode);
 }
Пример #18
0
 protected function btnPrintLabels_Click()
 {
     //if ($this->blnPrintLabels) {
     $this->strBarCodeArray = array();
     $this->strTablesBufferArray = array();
     $this->intCurrentBarCodeLabel = 0;
     // Set start value for PDF generation progress bar
     $_SESSION["intGeneratingStatus"] = 0;
     set_time_limit(0);
     $blnError = false;
     // Array[0] - DataGrid Object name; array[1] - Id; array[2] - used for Bar Code Label Generation
     $arrDataGridObjectNameId = $this->ctlSearchMenu->GetDataGridObjectNameId();
     $this->intObjectIdArray = $this->ctlSearchMenu->{$arrDataGridObjectNameId}[0]->GetSelected($arrDataGridObjectNameId[1]);
     $objCheckedArray = array();
     if (count($this->intObjectIdArray)) {
         // Switch statement for all four entity types
         switch ($this->lstLabelTypeControl->SelectedValue) {
             case 1:
                 // Load an array of Assets by AssetId
                 $objCheckedArray = Asset::QueryArray(QQ::In(QQN::Asset()->AssetId, $this->intObjectIdArray));
                 break;
             case 2:
                 // Load an array of Inventories by InventoryModelId
                 $objCheckedArray = InventoryModel::QueryArray(QQ::In(QQN::InventoryModel()->InventoryModelId, $this->intObjectIdArray));
                 break;
             case 3:
                 // Load an array of Locations by LocationId
                 $objCheckedArray = Location::QueryArray(QQ::In(QQN::Location()->LocationId, $this->intObjectIdArray));
                 break;
             case 4:
                 $objCheckedArray = UserAccount::QueryArray(QQ::In(QQN::UserAccount()->UserAccountId, $this->intObjectIdArray));
                 break;
             default:
                 $this->btnPrintLabels->Warning = "Please select Label Type.<br/>";
                 $this->intObjectIdArray = array();
                 $blnError = true;
                 break;
         }
         $objArrayById = array();
         // Create array of objects where the key is Id
         foreach ($objCheckedArray as $objChecked) {
             $objArrayById[$objChecked->{$arrDataGridObjectNameId}[1]] = $objChecked;
         }
         // Fill the BarCodeArray in the order items sorted in the datagrid
         foreach ($this->intObjectIdArray as $intObjectId) {
             $this->strBarCodeArray[] = $objArrayById[$intObjectId]->{$arrDataGridObjectNameId}[2];
         }
     } else {
         $blnError = true;
     }
     if (!$blnError) {
         $this->btnPrintLabels->Warning = "";
         $this->lstLabelStock->SelectedValue = 0;
         $this->lstLabelOffset->RemoveAllItems();
         $this->lstLabelOffset->AddItem(new QListItem('None', 0, 1));
         $this->lstLabelStock->Enabled = true;
         $this->lstLabelOffset->Enabled = true;
         $this->dlgPrintLabels->ShowDialogBox();
     } else {
         // If we have no checked items
         $this->btnPrintLabels->Warning .= "You must check at least one item.";
     }
     // Enable Print Labels button
     $this->btnPrintLabels->Enabled = true;
     //$this->blnPrintLabels = false;
     /*}
     		else {
     		  $this->btnPrintLabels->Warning = "Please wait... loading.";
     		  $this->blnPrintLabels = true;
     		  QApplication::ExecuteJavaScript("document.getElementById('".$this->btnPrintLabels->ControlId."').click(); document.getElementById('warning_loading').innerHTML = '';");
     		}*/
     QApplication::ExecuteJavaScript("document.getElementById('warning_loading').innerHTML = '';");
 }
 /**
  * Internally called method to assist with early binding of objects
  * on load methods.  Can only early-bind references that this class owns in the database.
  * @param string $strParentAlias the alias of the parent (if any)
  * @param string $strAlias the alias of this object
  * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
  * @param QueryExpansion an already instantiated QueryExpansion object (used as a utility object to assist with object expansion)
  */
 public static function ExpandQuery($strParentAlias, $strAlias, $objExpansionMap, QQueryExpansion $objQueryExpansion)
 {
     if ($strAlias) {
         $objQueryExpansion->AddFromItem(sprintf('LEFT JOIN `inventory_location` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`inventory_location_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`inventory_location_id` AS `%s__%s__inventory_location_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`inventory_model_id` AS `%s__%s__inventory_model_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`location_id` AS `%s__%s__location_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`quantity` AS `%s__%s__quantity`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`created_by` AS `%s__%s__created_by`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`creation_date` AS `%s__%s__creation_date`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`modified_by` AS `%s__%s__modified_by`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`modified_date` AS `%s__%s__modified_date`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $strParentAlias = $strParentAlias . '__' . $strAlias;
     }
     if (is_array($objExpansionMap)) {
         foreach ($objExpansionMap as $strKey => $objValue) {
             switch ($strKey) {
                 case 'inventory_model_id':
                     try {
                         InventoryModel::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'location_id':
                     try {
                         Location::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'created_by':
                     try {
                         UserAccount::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'modified_by':
                     try {
                         UserAccount::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 default:
                     throw new QCallerException(sprintf('Unknown Object to Expand in %s: %s', $strParentAlias, $strKey));
             }
         }
     }
 }
 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);
 }
Пример #21
0
 Run error checking on the array of asset codes and the destination location
 If there are no errors, then you will add the transaction to the database.
 	That will include an entry in the Transaction and Asset Transaction table.
 	You will also have to change the asset.location_id to the destination location
 */
 $arrInventoryCodeLocationQuantity = array_unique(explode('#', $_POST['result']));
 $blnError = false;
 $arrCheckedInventoryCodeLocationQuantity = array();
 foreach ($arrInventoryCodeLocationQuantity as $strInventoryCodeLocationQuantity) {
     $blnErrorCurrentInventory = false;
     list($strInventoryModelCode, $strSourceLocation, $intQuantity) = explode('|', $strInventoryCodeLocationQuantity, 3);
     if ($strInventoryModelCode && $strSourceLocation && $intQuantity) {
         $intNewInventoryLocationId = 0;
         // Begin error checking
         // Load the inventory model object based on the inventory_model_code submitted
         $objInventoryModel = InventoryModel::LoadByInventoryModelCode($strInventoryModelCode);
         if ($objInventoryModel) {
             // Load the array of InventoryLocations based on the InventoryModelId of the InventoryModel object
             $InventorySourceLocationArray = InventoryLocation::LoadArrayByInventoryModelIdLocations($objInventoryModel->InventoryModelId);
             if ($InventorySourceLocationArray) {
                 $blnErrorCurrentInventory = true;
                 foreach ($InventorySourceLocationArray as $InventoryLocation) {
                     if ($InventoryLocation->Quantity != 0) {
                         if (strtoupper($InventoryLocation->__toString()) == strtoupper($strSourceLocation)) {
                             $blnErrorCurrentInventory = false;
                             $intNewInventoryLocationId = $InventoryLocation->InventoryLocationId;
                             $objNewInventoryLocation = $InventoryLocation;
                         }
                     }
                 }
                 if ($blnErrorCurrentInventory) {
Пример #22
0
 /**
  * Counts all associated InventoryModels
  * @return int
  */
 public function CountInventoryModels()
 {
     if (is_null($this->intManufacturerId)) {
         return 0;
     }
     return InventoryModel::CountByManufacturerId($this->intManufacturerId);
 }
Пример #23
0
    public static function LoadAllWithQuantity($strOrderBy = null, $strLimit = null, $objExpansionMap = null)
    {
        // Call to ArrayQueryHelper to Get Database Object and Get SQL Clauses
        InventoryModel::ArrayQueryHelper($strOrderBy, $strLimit, $strLimitPrefix, $strLimitSuffix, $strExpandSelect, $strExpandFrom, $objExpansionMap, $objDatabase);
        // Setup the SQL Query
        $strQuery = sprintf('
				SELECT
				%s
					SUM( `inventory_location`.`quantity` ) AS `inventory_model_quantity`,
					`inventory_model`.`inventory_model_id` AS `inventory_model_id`,
					`inventory_model`.`category_id` AS `category_id`,
					`inventory_model`.`manufacturer_id` AS `manufacturer_id`,
					`inventory_model`.`inventory_model_code` AS `inventory_model_code`,
					`inventory_model`.`short_description` AS `short_description`,
					`inventory_model`.`long_description` AS `long_description`,
					`inventory_model`.`image_path` AS `image_path`,
					`inventory_model`.`price` AS `price`,
					`inventory_model`.`created_by` AS `created_by`,
					`inventory_model`.`creation_date` AS `creation_date`,
					`inventory_model`.`modified_by` AS `modified_by`,
					`inventory_model`.`modified_date` AS `modified_date`
					%s
				FROM
					`inventory_model` AS `inventory_model`
					LEFT JOIN `inventory_location` AS `inventory_location` ON `inventory_model` . `inventory_model_id` = `inventory_location` . `inventory_model_id`
					%s
				GROUP BY `inventory_model_id`
				%s
				%s', $strLimitPrefix, $strExpandSelect, $strExpandFrom, $strOrderBy, $strLimitSuffix);
        // Perform the Query and Instantiate the Result
        $objDbResult = $objDatabase->Query($strQuery);
        return InventoryModel::InstantiateDbResult($objDbResult);
    }
						`%s`.`%s_id` AS `%s_id`
						%s
					FROM
						`%s` AS `%s`
						%s
					WHERE
					1=1
				', $strTableName, $strTableName, $strTableName, $arrCustomFieldSql['strSelect'], $strTableName, $strTableName, $arrCustomFieldSql['strFrom']);
    $objDatabase = QApplication::$Database[1];
    $objDbResult = $objDatabase->Query($strQuery);
    switch ($intEntityQtypeId) {
        case 1:
            $objArray = Asset::InstantiateDbResult($objDbResult);
            break;
        case 2:
            $objArray = InventoryModel::InstantiateDbResult($objDbResult);
            break;
        case 4:
            $objArray = AssetModel::InstantiateDbResult($objDbResult);
            break;
        case 5:
            $objArray = Manufacturer::InstantiateDbResult($objDbResult);
            break;
        case 6:
            $objArray = Category::InstantiateDbResult($objDbResult);
            break;
        case 7:
            $objArray = Company::InstantiateDbResult($objDbResult);
            break;
        case 8:
            $objArray = Contact::InstantiateDbResult($objDbResult);
 public function btnInventorySearchToolAdd_Click()
 {
     $intSelectedInventoryModelId = $this->ctlInventorySearchTool->ctlInventorySearch->dtgInventoryModel->GetSelected("InventoryId");
     if (count($intSelectedInventoryModelId) > 1) {
         $this->ctlInventorySearchTool->lblWarning->Text = "You must select only one inventory.";
     } elseif (count($intSelectedInventoryModelId) != 1) {
         $this->ctlInventorySearchTool->lblWarning->Text = "No selected inventories.";
     } elseif ($objInventoryModel = InventoryModel::LoadByInventoryModelId($intSelectedInventoryModelId[0])) {
         $this->txtNewInventoryModelCode->Text = $objInventoryModel->InventoryModelCode;
         $this->ctlInventorySearchTool->dlgInventorySearchTool->HideDialogBox();
         $this->btnLookup_Click($this);
     }
     // Uncheck all items but SelectAll checkbox
     $this->UncheckAllItems();
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this InventoryModelMetaControl
  * @param integer $intInventoryModelId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing InventoryModel object creation - defaults to CreateOrEdit
  * @return InventoryModelMetaControl
  */
 public static function Create($objParentObject, $intInventoryModelId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intInventoryModelId)) {
         $objInventoryModel = InventoryModel::Load($intInventoryModelId);
         // InventoryModel was found -- return it!
         if ($objInventoryModel) {
             return new InventoryModelMetaControl($objParentObject, $objInventoryModel);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a InventoryModel object with PK arguments: ' . $intInventoryModelId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new InventoryModelMetaControl($objParentObject, new InventoryModel());
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = InventoryModel::QueryCount($objCondition, $objClauses);
     }
     // 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->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from InventoryModel, given the clauses above
     $this->DataSource = InventoryModel::QueryArray($objCondition, $objClauses);
 }
 public function UpdateInventoryLabels()
 {
     $this->lblHeaderInventoryModelCode->Text = $this->objInventoryModel->InventoryModelCode;
     $this->lblShortDescription->Text = $this->objInventoryModel->ShortDescription;
     if ($this->objInventoryModel->CategoryId) {
         $this->lblCategory->Text = $this->objInventoryModel->Category->__toString();
     }
     if ($this->objInventoryModel->ManufacturerId) {
         $this->lblManufacturer->Text = $this->objInventoryModel->Manufacturer->__toString();
     }
     $this->pnlLongDescription->Text = nl2br($this->objInventoryModel->LongDescription);
     $this->lblInventoryModelCode->Text = $this->objInventoryModel->InventoryModelCode;
     $this->lblTotalQuantity->Text = InventoryModel::GetTotalQuantityByInventoryModelId($this->objInventoryModel->InventoryModelId);
     if ($this->objInventoryModel->ModifiedDate) {
         $this->lblModifiedDate->Text = $this->objInventoryModel->ModifiedDate . ' by ' . $this->objInventoryModel->ModifiedByObject->__toStringFullName();
     }
     // Update custom labels
     if ($this->arrCustomFields) {
         CustomField::UpdateLabels($this->arrCustomFields);
     }
 }
Пример #29
0
 public function btnAddInventory_Click($strFormId, $strControlId, $strParameter)
 {
     // Clearing warning on previous attempt
     $this->txtNewInventoryModelCode->Warning = '';
     $this->txtQuantity->Warning = '';
     $blnError = false;
     // Assign the values from the user submitted form input
     $strInventoryModelCode = $this->txtNewInventoryModelCode->Text;
     $intTransactionQuantity = $this->txtQuantity->Text;
     // Check that the quantity is valid
     if (!$intTransactionQuantity || !ctype_digit($intTransactionQuantity) || $intTransactionQuantity <= 0) {
         $this->txtQuantity->Warning = "That is not a valid quantity.";
         $blnError = true;
     } elseif ($strInventoryModelCode) {
         $objNewInventoryModel = InventoryModel::LoadByInventoryModelCode($strInventoryModelCode);
         if ($objNewInventoryModel) {
             if ($this->objInventoryTransactionArray) {
                 foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
                     if ($objInventoryTransaction && $objInventoryTransaction->InventoryLocation->InventoryModelId == $objNewInventoryModel->InventoryModelId) {
                         $blnError = true;
                         $this->txtNewInventoryModelCode->Warning = "That inventory has already been added.";
                     }
                 }
             }
             if (!$blnError && !QApplication::AuthorizeEntityBoolean($objNewInventoryModel, 2)) {
                 $blnError = true;
                 $this->txtNewInventoryModelCode->Warning = "You do not have authorization to perform a transaction on this inventory model.";
             }
             if (!$blnError) {
                 $objNewInventoryLocation = InventoryLocation::LoadByLocationIdInventoryModelId(5, $objNewInventoryModel->InventoryModelId);
                 // If the 'To Be Received' inventory location for this InventoryModelId does not exist
                 // Create a new InventoryLocation with a quantity of 0. The quantity will be added to this location when the receipt is saved
                 if (!$objNewInventoryLocation) {
                     $objNewInventoryLocation = new InventoryLocation();
                     $objNewInventoryLocation->InventoryModelId = $objNewInventoryModel->InventoryModelId;
                     $objNewInventoryLocation->LocationId = 5;
                     $objNewInventoryLocation->Quantity = 0;
                     $objNewInventoryLocation->Save();
                 }
                 // Create the new Inventory Transaction
                 $objNewInventoryTransaction = new InventoryTransaction();
                 $objNewInventoryTransaction->InventoryLocationId = $objNewInventoryLocation->InventoryLocationId;
                 $objNewInventoryTransaction->Quantity = $intTransactionQuantity;
                 $objNewInventoryTransaction->SourceLocationId = 5;
                 $this->objInventoryTransactionArray[] = $objNewInventoryTransaction;
                 // Reset the input values
                 $this->txtNewInventoryModelCode->Text = null;
                 $this->txtQuantity->Text = null;
                 // This is so the datagrid knows to reload
                 $this->blnModifyInventory = true;
             }
         } else {
             $blnError = true;
             $this->txtNewInventoryModelCode->Warning = "That is not a valid inventory code.";
         }
     } else {
         $blnError = true;
         $this->txtNewInventoryModelCode->Warning = "Please enter an inventory code.";
     }
     $this->dtgInventoryTransact->Refresh();
 }
 /**
  * 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;
         }
     }
 }