public function __construct($objParentObject, $strSetEditPanelMethod, $strCloseEditPanelMethod, $strControlId = null) { // Call the Parent try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // Record Method Callbacks $this->strSetEditPanelMethod = $strSetEditPanelMethod; $this->strCloseEditPanelMethod = $strCloseEditPanelMethod; // Setup DataGrid Columns $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_CONTROL->ParentControl->dtgAsset_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colAssetId = new QDataGridColumn(QApplication::Translate('Asset Id'), '<?= $_ITEM->AssetId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->AssetId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->AssetId, false))); $this->colAssetModelId = new QDataGridColumn(QApplication::Translate('Asset Model Id'), '<?= $_CONTROL->ParentControl->dtgAsset_AssetModel_Render($_ITEM); ?>'); $this->colLocationId = new QDataGridColumn(QApplication::Translate('Location Id'), '<?= $_CONTROL->ParentControl->dtgAsset_Location_Render($_ITEM); ?>'); $this->colAssetCode = new QDataGridColumn(QApplication::Translate('Asset Code'), '<?= QString::Truncate($_ITEM->AssetCode, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->AssetCode), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->AssetCode, false))); $this->colImagePath = new QDataGridColumn(QApplication::Translate('Image Path'), '<?= QString::Truncate($_ITEM->ImagePath, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->ImagePath), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->ImagePath, false))); $this->colCheckedOutFlag = new QDataGridColumn(QApplication::Translate('Checked Out Flag'), '<?= ($_ITEM->CheckedOutFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->CheckedOutFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->CheckedOutFlag, false))); $this->colReservedFlag = new QDataGridColumn(QApplication::Translate('Reserved Flag'), '<?= ($_ITEM->ReservedFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->ReservedFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->ReservedFlag, false))); $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_CONTROL->ParentControl->dtgAsset_CreatedByObject_Render($_ITEM); ?>'); $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_CONTROL->ParentControl->dtgAsset_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->CreationDate, false))); $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_CONTROL->ParentControl->dtgAsset_ModifiedByObject_Render($_ITEM); ?>'); $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->ModifiedDate, false))); // Setup DataGrid $this->dtgAsset = new QDataGrid($this); $this->dtgAsset->CellSpacing = 0; $this->dtgAsset->CellPadding = 4; $this->dtgAsset->BorderStyle = QBorderStyle::Solid; $this->dtgAsset->BorderWidth = 1; $this->dtgAsset->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgAsset->Paginator = new QPaginator($this->dtgAsset); $this->dtgAsset->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgAsset->UseAjax = true; // Specify the local databind method this datagrid will use $this->dtgAsset->SetDataBinder('dtgAsset_Bind', $this); $this->dtgAsset->AddColumn($this->colEditLinkColumn); $this->dtgAsset->AddColumn($this->colAssetId); $this->dtgAsset->AddColumn($this->colAssetModelId); $this->dtgAsset->AddColumn($this->colLocationId); $this->dtgAsset->AddColumn($this->colAssetCode); $this->dtgAsset->AddColumn($this->colImagePath); $this->dtgAsset->AddColumn($this->colCheckedOutFlag); $this->dtgAsset->AddColumn($this->colReservedFlag); $this->dtgAsset->AddColumn($this->colCreatedBy); $this->dtgAsset->AddColumn($this->colCreationDate); $this->dtgAsset->AddColumn($this->colModifiedBy); $this->dtgAsset->AddColumn($this->colModifiedDate); // Setup the Create New button $this->btnCreateNew = new QButton($this); $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('Asset'); $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click')); }
protected function Form_Create() { // Setup DataGrid Columns $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgAsset_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colAssetId = new QDataGridColumn(QApplication::Translate('Asset Id'), '<?= $_ITEM->AssetId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->AssetId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->AssetId, false))); $this->colParentAssetId = new QDataGridColumn(QApplication::Translate('Parent Asset Id'), '<?= $_FORM->dtgAsset_ParentAsset_Render($_ITEM); ?>'); $this->colAssetModelId = new QDataGridColumn(QApplication::Translate('Asset Model Id'), '<?= $_FORM->dtgAsset_AssetModel_Render($_ITEM); ?>'); $this->colLocationId = new QDataGridColumn(QApplication::Translate('Location Id'), '<?= $_FORM->dtgAsset_Location_Render($_ITEM); ?>'); $this->colAssetCode = new QDataGridColumn(QApplication::Translate('Asset Tag'), '<?= QString::Truncate($_ITEM->AssetCode, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->AssetCode), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->AssetCode, false))); $this->colImagePath = new QDataGridColumn(QApplication::Translate('Image Path'), '<?= QString::Truncate($_ITEM->ImagePath, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->ImagePath), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->ImagePath, false))); $this->colCheckedOutFlag = new QDataGridColumn(QApplication::Translate('Checked Out Flag'), '<?= ($_ITEM->CheckedOutFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->CheckedOutFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->CheckedOutFlag, false))); $this->colReservedFlag = new QDataGridColumn(QApplication::Translate('Reserved Flag'), '<?= ($_ITEM->ReservedFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->ReservedFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->ReservedFlag, false))); $this->colLinkedFlag = new QDataGridColumn(QApplication::Translate('Linked Flag'), '<?= ($_ITEM->LinkedFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->LinkedFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->LinkedFlag, false))); $this->colArchivedFlag = new QDataGridColumn(QApplication::Translate('Archived Flag'), '<?= ($_ITEM->ArchivedFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->ArchivedFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->ArchivedFlag, false))); $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_FORM->dtgAsset_CreatedByObject_Render($_ITEM); ?>'); $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_FORM->dtgAsset_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->CreationDate, false))); $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_FORM->dtgAsset_ModifiedByObject_Render($_ITEM); ?>'); $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->ModifiedDate, false))); $this->colAssetCustomFieldHelper = new QDataGridColumn(QApplication::Translate('Asset Custom Field Helper'), '<?= $_FORM->dtgAsset_AssetCustomFieldHelper_Render($_ITEM); ?>'); // Setup DataGrid $this->dtgAsset = new QDataGrid($this); $this->dtgAsset->CellSpacing = 0; $this->dtgAsset->CellPadding = 4; $this->dtgAsset->BorderStyle = QBorderStyle::Solid; $this->dtgAsset->BorderWidth = 1; $this->dtgAsset->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgAsset->Paginator = new QPaginator($this->dtgAsset); $this->dtgAsset->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgAsset->UseAjax = false; // Specify the local databind method this datagrid will use $this->dtgAsset->SetDataBinder('dtgAsset_Bind'); $this->dtgAsset->AddColumn($this->colEditLinkColumn); $this->dtgAsset->AddColumn($this->colAssetId); $this->dtgAsset->AddColumn($this->colParentAssetId); $this->dtgAsset->AddColumn($this->colAssetModelId); $this->dtgAsset->AddColumn($this->colLocationId); $this->dtgAsset->AddColumn($this->colAssetCode); $this->dtgAsset->AddColumn($this->colImagePath); $this->dtgAsset->AddColumn($this->colCheckedOutFlag); $this->dtgAsset->AddColumn($this->colReservedFlag); $this->dtgAsset->AddColumn($this->colLinkedFlag); $this->dtgAsset->AddColumn($this->colArchivedFlag); $this->dtgAsset->AddColumn($this->colCreatedBy); $this->dtgAsset->AddColumn($this->colCreationDate); $this->dtgAsset->AddColumn($this->colModifiedBy); $this->dtgAsset->AddColumn($this->colModifiedDate); $this->dtgAsset->AddColumn($this->colAssetCustomFieldHelper); }
public function btnAssetSearchToolAdd_Click() { $this->ctlAssetSearchTool->lblWarning->Text = ""; $intSelectedAssetId = $this->ctlAssetSearchTool->ctlAssetSearch->dtgAsset->GetSelected("AssetId"); if (count($intSelectedAssetId) < 1) { $this->ctlAssetSearchTool->lblWarning->Text = "No selected assets."; } else { $lblNewWarning = ""; foreach (Asset::QueryArray(QQ::In(QQN::Asset()->AssetId, $intSelectedAssetId)) as $objAsset) { $this->txtNewAssetCode->Text = $objAsset->AssetCode; $this->btnAddAsset_Click($this, null, null); if ($this->txtNewAssetCode->Warning) { $lblNewWarning .= sprintf("<br />%s - %s", $objAsset->AssetCode, $this->txtNewAssetCode->Warning); $this->txtNewAssetCode->Warning = ""; } } $this->txtNewAssetCode->Warning = $lblNewWarning; $this->ctlAssetSearchTool->dlgAssetSearchTool->HideDialogBox(); } // Uncheck all items but SelectAll checkbox $this->UncheckAllItems(); }
public function SetupAsset($objCaller = null) { // Lookup Object PK information from Query String (if applicable) // Set mode to Edit or New depending on what's found // Overridden from AssetEditFormBase to add the $objCaller parameter $intAssetId = QApplication::QueryString('intAssetId'); if ($intAssetId) { //$objCaller->objAsset = Asset::Load($intAssetId); // To minimize the count of queries $objClauses = array(); array_push($objClauses, QQ::Expand(QQN::Asset()->AssetModel)); array_push($objClauses, QQ::Expand(QQN::Asset()->AssetModel->Category)); array_push($objClauses, QQ::Expand(QQN::Asset()->AssetModel->Manufacturer)); array_push($objClauses, QQ::Expand(QQN::Asset()->ParentAsset)); array_push($objClauses, QQ::Expand(QQN::Asset()->Location)); array_push($objClauses, QQ::Expand(QQN::Asset()->CreatedByObject)); $objCaller->objAsset = Asset::QuerySingle(QQ::Equal(QQN::Asset()->AssetId, $intAssetId), $objClauses); if (!$objCaller->objAsset) { throw new Exception('Could not find a Asset object with PK arguments: ' . $intAssetId); } $objCaller->strTitleVerb = QApplication::Translate('Edit'); $objCaller->blnEditMode = true; $this->blnEditChild = true; } else { $objCaller->objAsset = new Asset(); $objCaller->strTitleVerb = QApplication::Translate('Create'); $objCaller->blnEditMode = false; } QApplication::AuthorizeEntity($objCaller->objAsset, $objCaller->blnEditMode); }
/** * Count Active (non-archived) Assets * @return int */ public static function CountActive() { // Call Asset:QueryCount to perform the Count query $intAssetCount = Asset::QueryCount(QQ::All()); $intArchivedCount = Asset::QueryCount(QQ::Equal(QQN::Asset()->ArchivedFlag, 1)); return $intAssetCount - $intArchivedCount; }
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->Asset = Asset::QuerySingle(QQ::Equal(QQN::Asset()->AssetId, $objAuditScan->EntityId), QQ::Clause(QQ::Expand(QQN::Asset()->AssetModel))); } } if (count($objAuditScanArray) == 0) { $this->dtgAudit->ShowHeader = false; } else { $this->dtgAudit->ShowHeader = true; } $this->dtgAudit->DataSource = $objAuditScanArray; }
public function btnAssetSearchToolAdd_Click() { $intSelectedAssetId = $this->ctlAssetSearchTool->ctlAssetSearch->dtgAsset->GetSelected("AssetId"); if (count($intSelectedAssetId) < 1) { $this->ctlAssetSearchTool->lblWarning->Text = "No selected assets."; } else { $lblNewWarning = ""; if (count($intSelectedAssetId) > 100) { $currentLimit = ini_get('max_execution_time'); set_time_limit(0); $this->ctlAssetSearchTool->lblWarning->Text = "This may take several minutes."; } foreach (Asset::QueryArray(QQ::In(QQN::Asset()->AssetId, $intSelectedAssetId)) as $objAsset) { $this->txtNewAssetCode->Text = $objAsset->AssetCode; $this->btnAdd_Click($this, null, null); if ($this->txtNewAssetCode->Warning) { $lblNewWarning .= sprintf("<br />%s - %s", $objAsset->AssetCode, $this->txtNewAssetCode->Warning); $this->txtNewAssetCode->Warning = ""; } } if (count($intSelectedAssetId) > 100) { set_time_limit($currentLimit); $this->ctlAssetSearchTool->lblWarning->Text = ""; } $this->txtNewAssetCode->Warning = $lblNewWarning; $this->UncheckAllItems(); $this->ctlAssetSearchTool->dlgAssetSearchTool->HideDialogBox(); } // Uncheck all items but SelectAll checkbox }
/** * Count Assets * by ModifiedBy Index(es) * @param integer $intModifiedBy * @return int */ public static function CountByModifiedBy($intModifiedBy) { // Call Asset::QueryCount to perform the CountByModifiedBy query return Asset::QueryCount(QQ::Equal(QQN::Asset()->ModifiedBy, $intModifiedBy)); }
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 = '';"); }
public function __construct($objParentObject, $strControlId = null, $blnShowCheckboxes = false, $blnUseAjax = false, $blnRemoveAllLinks = false) { // First, call the parent to do most of the basic setup try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } $this->objParentObject = $objParentObject; $this->blnUseAjax = $blnUseAjax; $this->blnRemoveAllLinks = $blnRemoveAllLinks; $this->dtgAsset = new QDataGrid($this); $this->dtgAsset->Name = 'asset_list'; $this->dtgAsset->CellPadding = 5; $this->dtgAsset->CellSpacing = 0; $this->dtgAsset->CssClass = "datagrid"; // Enable/Disable AJAX for the datagrid $this->dtgAsset->UseAjax = $this->blnUseAjax; $this->dtgAsset->ShowColumnToggle = true; $this->dtgAsset->ShowExportCsv = true; /*if (!$blnRemoveAllLinks) { // Allow for column toggling $this->dtgAsset->ShowColumnToggle = true; // Allow for CSV Export $this->dtgAsset->ShowExportCsv = true; } else { // Disallow for column toggling $this->dtgAsset->ShowColumnToggle = false; // Disallow for CSV Export $this->dtgAsset->ShowExportCsv = false; }*/ // Add a 'Select All' checkbox $this->dtgAsset->ShowCheckboxes = false; // Enable Pagination $objPaginator = new QPaginator($this->dtgAsset); $this->dtgAsset->Paginator = $objPaginator; $this->dtgAsset->ItemsPerPage = QApplication::$TracmorSettings->SearchResultsPerPage; // If the user wants the checkboxes column if ($blnShowCheckboxes) { // This will render all of the necessary controls and actions. chkSelected_Render expects a unique ID for each row of the database. $this->dtgAsset->AddColumn(new QDataGridColumnExt('<?= $_CONTROL->chkSelectAll_Render() ?>', '<?=$_CONTROL->chkSelected_Render($_ITEM->AssetId) ?>', 'CssClass="dtg_column"', 'HtmlEntities=false')); } $this->dtgAsset->AddColumn(new QDataGridColumnExt('ID', '<?= $_ITEM->AssetId ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->AssetId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->AssetId, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false))); $this->dtgAsset->AddColumn(new QDataGridColumnExt('<img src=../images/icons/attachment_gray.gif border=0 title=Attachments alt=Attachments>', '<?= Attachment::toStringIcon($_ITEM->GetVirtualAttribute(\'attachment_count\')); ?>', 'SortByCommand="__attachment_count ASC"', 'ReverseSortByCommand="__attachment_count DESC"', 'CssClass="dtg_column"', 'HtmlEntities="false"')); // Removing any links in the column data if ($this->blnRemoveAllLinks) { $this->dtgAsset->AddColumn(new QDataGridColumnExt('Asset Tag', '<?= $_ITEM->AssetCode ?> <?= $_ITEM->ToStringHoverTips($_CONTROL) ?>', 'SortByCommand="asset_code ASC"', 'ReverseSortByCommand="asset_code DESC"', 'CssClass="dtg_column"', 'HtmlEntities="false"')); $this->dtgAsset->AddColumn(new QDataGridColumnExt('Model', '<?= $_ITEM->AssetModel->ShortDescription ?>', 'SortByCommand="asset__asset_model_id__short_description ASC"', 'ReverseSortByCommand="asset__asset_model_id__short_description DESC"', 'CssClass="dtg_column"', 'HtmlEntities="false"')); } else { $this->dtgAsset->AddColumn(new QDataGridColumnExt('Asset Tag', '<?= $_ITEM->__toStringWithLink("bluelink") ?> <?= $_ITEM->ToStringHoverTips($_CONTROL) ?>', 'SortByCommand="asset_code ASC"', 'ReverseSortByCommand="asset_code DESC"', 'CssClass="dtg_column"', 'HtmlEntities="false"')); $this->dtgAsset->AddColumn(new QDataGridColumnExt('Model', '<?= $_ITEM->AssetModel->__toStringWithLink("bluelink") ?>', 'SortByCommand="asset__asset_model_id__short_description ASC"', 'ReverseSortByCommand="asset__asset_model_id__short_description DESC"', 'CssClass="dtg_column"', 'HtmlEntities="false"')); } $this->dtgAsset->AddColumn(new QDataGridColumnExt('Category', '<?= $_ITEM->AssetModel->Category->__toString() ?>', 'SortByCommand="asset__asset_model_id__category_id__short_description ASC"', 'ReverseSortByCommand="asset__asset_model_id__category_id__short_description DESC"', 'CssClass="dtg_column"')); $this->dtgAsset->AddColumn(new QDataGridColumnExt('Manufacturer', '<?= $_ITEM->AssetModel->Manufacturer->__toString() ?>', 'SortByCommand="asset__asset_model_id__manufacturer_id__short_description ASC"', 'ReverseSortByCommand="asset__asset_model_id__manufacturer_id__short_description DESC"', 'CssClass="dtg_column"')); $this->dtgAsset->AddColumn(new QDataGridColumnExt('Location', '<?= $_ITEM->GetLocation() ?>', 'SortByCommand="asset__location_id__short_description ASC"', 'ReverseSortByCommand="asset__location_id__short_description DESC"', 'CssClass="dtg_column"')); $this->dtgAsset->AddColumn(new QDataGridColumnExt('Model Number', '<?= $_ITEM->AssetModel->AssetModelCode ?>', 'SortByCommand="asset__asset_model_id__asset_model_code"', 'ReverseSortByCommand="asset__asset_model_id__asset_model_code DESC"', 'CssClass="dtg_column"', 'Display="false"')); $this->dtgAsset->AddColumn(new QDataGridColumnExt('Parent Asset Tag', '<?= $_CONTROL->objParentControl->ParentAsset__toString($_ITEM) ?>', 'SortByCommand="asset__parent_asset_id__asset_code ASC"', 'ReverseSortByCommand="asset__parent_asset_id__asset_code DESC"', 'CssClass="dtg_column"', 'Display="false"', 'HtmlEntities="false"')); $this->dtgAsset->AddColumn(new QDataGridColumnExt('Check In Due', '<?= $_ITEM->CheckoutDueDate() ?>', 'CssClass="dtg_column"', 'Display="false"', 'HtmlEntities="false"')); // Add Asset Model Depreciation class if Enabled within application if (QApplication::$TracmorSettings->DepreciationFlag == '1') { $this->dtgAsset->AddColumn(new QDataGridColumnExt('Depreciation Class', '<?= $_ITEM->AssetModel->DepreciationClass ?>', 'SortByCommand="asset__asset_model_id__depreciation_class_id__short_description ASC"', 'ReverseSortByCommand="asset__asset_model_id__depreciation_class_id__short_description DESC"', 'CssClass="dtg_column"')); $this->dtgAsset->addColumn(new QDataGridColumnExt('Purchase Cost', '<?= $_ITEM->getPurchaseCost() ?>', 'SortByCommand="purchase_cost ASC"', 'ReverseSortByCommand="purchase_cost DESC"', 'CssClass="dtg_column"')); $this->dtgAsset->addColumn(new QDataGridColumnExt('Purchase Date', '<?= $_ITEM->PurchaseDate ?>', 'SortByCommand="purchase_date ASC"', 'ReverseSortByCommand="purchase_date DESC"', 'CssClass="dtg_column"')); $this->dtgAsset->addColumn(new QDataGridColumnExt('Book Value', '<?= $_ITEM->getBookValue() ?>', 'CssClass="dtg_column"')); } // Add the custom field columns with Display set to false. These can be shown by using the column toggle menu. $objCustomFieldArray = CustomField::LoadObjCustomFieldArray(1, false); if ($objCustomFieldArray) { foreach ($objCustomFieldArray as $objCustomField) { //Only add the custom field column if the role has authorization to view it. if ($objCustomField->objRoleAuthView && $objCustomField->objRoleAuthView->AuthorizedFlag) { $this->dtgAsset->AddColumn(new QDataGridColumnExt($objCustomField->ShortDescription, '<?= $_ITEM->GetVirtualAttribute(\'' . $objCustomField->CustomFieldId . '\') ?>', 'SortByCommand="__' . $objCustomField->CustomFieldId . ' ASC"', 'ReverseSortByCommand="__' . $objCustomField->CustomFieldId . ' DESC"', 'HtmlEntities="false"', 'CssClass="dtg_column"', 'Display="false"')); } } } // Column to originally sort by (Asset Model) $this->dtgAsset->SortColumnIndex = $blnShowCheckboxes ? 4 : 3; $this->dtgAsset->SortDirection = 0; $objStyle = $this->dtgAsset->RowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#FFFFFF'; $objStyle->FontSize = 12; $objStyle = $this->dtgAsset->AlternateRowStyle; $objStyle->BackColor = '#EFEFEF'; $objStyle = $this->dtgAsset->HeaderRowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#EFEFEF'; $objStyle->CssClass = 'dtg_header'; $this->dtgAsset->SetDataBinder('dtgAsset_Bind', $this); $this->lstCategory_Create(); $this->lstManufacturer_Create(); $this->lstLocation_Create(); $this->txtShortDescription_Create(); $this->txtAssetCode_Create(); $this->lblAssetModelId_Create(); $this->btnSearch_Create(); $this->btnClear_Create(); $this->ctlAdvanced_Create(); $this->lblAdvanced_Create(); }
protected function dtgAssetTransact_Create() { $this->dtgAssetTransact = new QDataGrid($this); $this->dtgAssetTransact->CellPadding = 5; $this->dtgAssetTransact->CellSpacing = 0; $this->dtgAssetTransact->CssClass = "datagrid"; // Enable AJAX - this won't work while using the DB profiler $this->dtgAssetTransact->UseAjax = true; // Enable Pagination, and set to 20 items per page $objPaginator = new QPaginator($this->dtgAssetTransact); $this->dtgAssetTransact->Paginator = $objPaginator; $this->dtgAssetTransact->ItemsPerPage = 20; $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Asset Code', '<?= $_ITEM->__toStringWithLink("bluelink") ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->AssetCode), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->AssetCode, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false))); $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Model', '<?= $_ITEM->AssetModel->__toStringWithLink("bluelink") ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->AssetModel->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->AssetModel->ShortDescription, false), 'Width' => 200, 'CssClass' => "dtg_column", 'HtmlEntities' => false))); $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Current Location', '<?= $_ITEM->Location->__toString() ?>', array('OrderByClause' => QQ::OrderBy(QQN::Asset()->Location->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Asset()->Location->ShortDescription, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false))); $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Action', '<?= $_FORM->RemoveColumn_Render($_ITEM) ?>', array('CssClass' => "dtg_column", 'HtmlEntities' => false))); /* $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Asset Code', '<?= $_ITEM->__toStringWithLink("bluelink") ?>', 'SortByCommand="asset_code ASC"', 'ReverseSortByCommand="asset_code DESC"', 'CssClass="dtg_column"', 'HtmlEntities=false"')); $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Model', '<?= $_ITEM->AssetModel->__toStringWithLink("bluelink") ?>', 'Width=200', 'SortByCommand="asset__asset_model_id__short_description ASC"', 'ReverseSortByCommand="asset__asset_model_id__short_description DESC"', 'CssClass="dtg_column"', 'HtmlEntities=false"')); $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Current Location', '<?= $_ITEM->Location->__toString() ?>', 'SortByCommand="asset__location_id__short_description ASC"', 'ReverseSortByCommand="asset__location_id__short_description DESC"', 'CssClass=dtg_column', 'HtmlEntities=false"')); $this->dtgAssetTransact->AddColumn(new QDataGridColumn('Action', '<?= $_FORM->RemoveColumn_Render($_ITEM) ?>', 'CssClass=dtg_column', 'HtmlEntities=false"')); */ $objStyle = $this->dtgAssetTransact->RowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#FFFFFF'; $objStyle->FontSize = 12; $objStyle = $this->dtgAssetTransact->AlternateRowStyle; $objStyle->BackColor = '#EFEFEF'; $objStyle = $this->dtgAssetTransact->HeaderRowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#EFEFEF'; $objStyle->CssClass = 'dtg_header'; $this->blnTransactionModified = true; }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a Asset-based QQNode. * It will also verify that it is a proper Asset-based QQNode, and will throw an exception otherwise. * * @param mixed $mixContent * @return QQNode */ protected function ResolveContentItem($mixContent) { if ($mixContent instanceof QQNode) { if (!$mixContent->_ParentNode) { throw new QCallerException('Content QQNode cannot be a Top Level Node'); } if ($mixContent->_RootTableName == 'asset') { if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } $objCurrentNode = $mixContent; while ($objCurrentNode = $objCurrentNode->_ParentNode) { if (!$objCurrentNode instanceof QQNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } } return $mixContent; } else { throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "asset".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'AssetId': return QQN::Asset()->AssetId; case 'ParentAssetId': return QQN::Asset()->ParentAssetId; case 'ParentAsset': return QQN::Asset()->ParentAsset; case 'AssetModelId': return QQN::Asset()->AssetModelId; case 'AssetModel': return QQN::Asset()->AssetModel; case 'LocationId': return QQN::Asset()->LocationId; case 'Location': return QQN::Asset()->Location; case 'AssetCode': return QQN::Asset()->AssetCode; case 'ImagePath': return QQN::Asset()->ImagePath; case 'CheckedOutFlag': return QQN::Asset()->CheckedOutFlag; case 'ReservedFlag': return QQN::Asset()->ReservedFlag; case 'LinkedFlag': return QQN::Asset()->LinkedFlag; case 'ArchivedFlag': return QQN::Asset()->ArchivedFlag; case 'CreatedBy': return QQN::Asset()->CreatedBy; case 'CreatedByObject': return QQN::Asset()->CreatedByObject; case 'CreationDate': return QQN::Asset()->CreationDate; case 'ModifiedBy': return QQN::Asset()->ModifiedBy; case 'ModifiedByObject': return QQN::Asset()->ModifiedByObject; case 'ModifiedDate': return QQN::Asset()->ModifiedDate; case 'DepreciationFlag': return QQN::Asset()->DepreciationFlag; case 'PurchaseDate': return QQN::Asset()->PurchaseDate; case 'PurchaseCost': return QQN::Asset()->PurchaseCost; case 'AssetCustomFieldHelper': return QQN::Asset()->AssetCustomFieldHelper; default: throw new QCallerException('Simple Property not found in AssetDataGrid content: ' . $mixContent); } } else { if ($mixContent instanceof QQAssociationNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } else { throw new QCallerException('Invalid Content type'); } } } }
/** * Count Assets * by ParentAssetId, LinkedFlag Index(es) * @param integer $intParentAssetId * @param boolean $blnLinkedFlag * @return int */ public static function CountByParentAssetIdLinkedFlag($intParentAssetId, $blnLinkedFlag, $objOptionalClauses = null) { // Call Asset::QueryCount to perform the CountByParentAssetIdLinkedFlag query return Asset::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Asset()->ParentAssetId, $intParentAssetId), QQ::Equal(QQN::Asset()->LinkedFlag, $blnLinkedFlag)), $objOptionalClauses); }