protected function Form_Create() { // Setup DataGrid Columns $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgAuditScan_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colAuditScanId = new QDataGridColumn(QApplication::Translate('Audit Scan Id'), '<?= $_ITEM->AuditScanId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AuditScan()->AuditScanId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AuditScan()->AuditScanId, false))); $this->colAuditId = new QDataGridColumn(QApplication::Translate('Audit Id'), '<?= $_FORM->dtgAuditScan_Audit_Render($_ITEM); ?>'); $this->colLocationId = new QDataGridColumn(QApplication::Translate('Location Id'), '<?= $_FORM->dtgAuditScan_Location_Render($_ITEM); ?>'); $this->colEntityId = new QDataGridColumn(QApplication::Translate('Entity Id'), '<?= $_ITEM->EntityId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AuditScan()->EntityId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AuditScan()->EntityId, false))); $this->colCount = new QDataGridColumn(QApplication::Translate('Count'), '<?= $_ITEM->Count; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AuditScan()->Count), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AuditScan()->Count, false))); $this->colSystemCount = new QDataGridColumn(QApplication::Translate('System Count'), '<?= $_ITEM->SystemCount; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AuditScan()->SystemCount), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AuditScan()->SystemCount, false))); // Setup DataGrid $this->dtgAuditScan = new QDataGrid($this); $this->dtgAuditScan->CellSpacing = 0; $this->dtgAuditScan->CellPadding = 4; $this->dtgAuditScan->BorderStyle = QBorderStyle::Solid; $this->dtgAuditScan->BorderWidth = 1; $this->dtgAuditScan->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgAuditScan->Paginator = new QPaginator($this->dtgAuditScan); $this->dtgAuditScan->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgAuditScan->UseAjax = false; // Specify the local databind method this datagrid will use $this->dtgAuditScan->SetDataBinder('dtgAuditScan_Bind'); $this->dtgAuditScan->AddColumn($this->colEditLinkColumn); $this->dtgAuditScan->AddColumn($this->colAuditScanId); $this->dtgAuditScan->AddColumn($this->colAuditId); $this->dtgAuditScan->AddColumn($this->colLocationId); $this->dtgAuditScan->AddColumn($this->colEntityId); $this->dtgAuditScan->AddColumn($this->colCount); $this->dtgAuditScan->AddColumn($this->colSystemCount); }
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->dtgAuditScan_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colAuditScanId = new QDataGridColumn(QApplication::Translate('Audit Scan Id'), '<?= $_ITEM->AuditScanId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AuditScan()->AuditScanId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AuditScan()->AuditScanId, false))); $this->colAuditId = new QDataGridColumn(QApplication::Translate('Audit Id'), '<?= $_CONTROL->ParentControl->dtgAuditScan_Audit_Render($_ITEM); ?>'); $this->colLocationId = new QDataGridColumn(QApplication::Translate('Location Id'), '<?= $_CONTROL->ParentControl->dtgAuditScan_Location_Render($_ITEM); ?>'); $this->colEntityId = new QDataGridColumn(QApplication::Translate('Entity Id'), '<?= $_ITEM->EntityId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AuditScan()->EntityId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AuditScan()->EntityId, false))); $this->colCount = new QDataGridColumn(QApplication::Translate('Count'), '<?= $_ITEM->Count; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AuditScan()->Count), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AuditScan()->Count, false))); $this->colSystemCount = new QDataGridColumn(QApplication::Translate('System Count'), '<?= $_ITEM->SystemCount; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AuditScan()->SystemCount), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AuditScan()->SystemCount, false))); // Setup DataGrid $this->dtgAuditScan = new QDataGrid($this); $this->dtgAuditScan->CellSpacing = 0; $this->dtgAuditScan->CellPadding = 4; $this->dtgAuditScan->BorderStyle = QBorderStyle::Solid; $this->dtgAuditScan->BorderWidth = 1; $this->dtgAuditScan->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgAuditScan->Paginator = new QPaginator($this->dtgAuditScan); $this->dtgAuditScan->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgAuditScan->UseAjax = true; // Specify the local databind method this datagrid will use $this->dtgAuditScan->SetDataBinder('dtgAuditScan_Bind', $this); $this->dtgAuditScan->AddColumn($this->colEditLinkColumn); $this->dtgAuditScan->AddColumn($this->colAuditScanId); $this->dtgAuditScan->AddColumn($this->colAuditId); $this->dtgAuditScan->AddColumn($this->colLocationId); $this->dtgAuditScan->AddColumn($this->colEntityId); $this->dtgAuditScan->AddColumn($this->colCount); $this->dtgAuditScan->AddColumn($this->colSystemCount); // Setup the Create New button $this->btnCreateNew = new QButton($this); $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('AuditScan'); $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click')); }
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; }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a AuditScan-based QQNode. * It will also verify that it is a proper AuditScan-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 == 'audit_scan') { 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 "audit_scan".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'AuditScanId': return QQN::AuditScan()->AuditScanId; case 'AuditId': return QQN::AuditScan()->AuditId; case 'Audit': return QQN::AuditScan()->Audit; case 'LocationId': return QQN::AuditScan()->LocationId; case 'Location': return QQN::AuditScan()->Location; case 'EntityId': return QQN::AuditScan()->EntityId; case 'Count': return QQN::AuditScan()->Count; case 'SystemCount': return QQN::AuditScan()->SystemCount; default: throw new QCallerException('Simple Property not found in AuditScanDataGrid 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 AuditScans * by LocationId Index(es) * @param integer $intLocationId * @return int */ public static function CountByLocationId($intLocationId, $objOptionalClauses = null) { // Call AuditScan::QueryCount to perform the CountByLocationId query return AuditScan::QueryCount(QQ::Equal(QQN::AuditScan()->LocationId, $intLocationId), $objOptionalClauses); }
/** * Count AuditScans * by LocationId Index(es) * @param integer $intLocationId * @return int */ public static function CountByLocationId($intLocationId) { // Call AuditScan::QueryCount to perform the CountByLocationId query return AuditScan::QueryCount(QQ::Equal(QQN::AuditScan()->LocationId, $intLocationId)); }