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->dtgInventoryModel_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colInventoryModelId = new QDataGridColumn(QApplication::Translate('Inventory Model Id'), '<?= $_ITEM->InventoryModelId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->InventoryModelId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->InventoryModelId, false)));
     $this->colCategoryId = new QDataGridColumn(QApplication::Translate('Category Id'), '<?= $_CONTROL->ParentControl->dtgInventoryModel_Category_Render($_ITEM); ?>');
     $this->colManufacturerId = new QDataGridColumn(QApplication::Translate('Manufacturer Id'), '<?= $_CONTROL->ParentControl->dtgInventoryModel_Manufacturer_Render($_ITEM); ?>');
     $this->colInventoryModelCode = new QDataGridColumn(QApplication::Translate('Inventory Model Code'), '<?= QString::Truncate($_ITEM->InventoryModelCode, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->InventoryModelCode), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->InventoryModelCode, false)));
     $this->colShortDescription = new QDataGridColumn(QApplication::Translate('Short Description'), '<?= QString::Truncate($_ITEM->ShortDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ShortDescription, false)));
     $this->colLongDescription = new QDataGridColumn(QApplication::Translate('Long Description'), '<?= QString::Truncate($_ITEM->LongDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->LongDescription, false)));
     $this->colImagePath = new QDataGridColumn(QApplication::Translate('Image Path'), '<?= QString::Truncate($_ITEM->ImagePath, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ImagePath), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ImagePath, false)));
     $this->colPrice = new QDataGridColumn(QApplication::Translate('Price'), '<?= $_ITEM->Price; ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->Price), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->Price, false)));
     $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_CONTROL->ParentControl->dtgInventoryModel_CreatedByObject_Render($_ITEM); ?>');
     $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_CONTROL->ParentControl->dtgInventoryModel_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->CreationDate, false)));
     $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_CONTROL->ParentControl->dtgInventoryModel_ModifiedByObject_Render($_ITEM); ?>');
     $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ModifiedDate, false)));
     // Setup DataGrid
     $this->dtgInventoryModel = new QDataGrid($this);
     $this->dtgInventoryModel->CellSpacing = 0;
     $this->dtgInventoryModel->CellPadding = 4;
     $this->dtgInventoryModel->BorderStyle = QBorderStyle::Solid;
     $this->dtgInventoryModel->BorderWidth = 1;
     $this->dtgInventoryModel->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgInventoryModel->Paginator = new QPaginator($this->dtgInventoryModel);
     $this->dtgInventoryModel->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgInventoryModel->UseAjax = true;
     // Specify the local databind method this datagrid will use
     $this->dtgInventoryModel->SetDataBinder('dtgInventoryModel_Bind', $this);
     $this->dtgInventoryModel->AddColumn($this->colEditLinkColumn);
     $this->dtgInventoryModel->AddColumn($this->colInventoryModelId);
     $this->dtgInventoryModel->AddColumn($this->colCategoryId);
     $this->dtgInventoryModel->AddColumn($this->colManufacturerId);
     $this->dtgInventoryModel->AddColumn($this->colInventoryModelCode);
     $this->dtgInventoryModel->AddColumn($this->colShortDescription);
     $this->dtgInventoryModel->AddColumn($this->colLongDescription);
     $this->dtgInventoryModel->AddColumn($this->colImagePath);
     $this->dtgInventoryModel->AddColumn($this->colPrice);
     $this->dtgInventoryModel->AddColumn($this->colCreatedBy);
     $this->dtgInventoryModel->AddColumn($this->colCreationDate);
     $this->dtgInventoryModel->AddColumn($this->colModifiedBy);
     $this->dtgInventoryModel->AddColumn($this->colModifiedDate);
     // Setup the Create New button
     $this->btnCreateNew = new QButton($this);
     $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('InventoryModel');
     $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->dtgInventoryModel_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colInventoryModelId = new QDataGridColumn(QApplication::Translate('Inventory Model Id'), '<?= $_ITEM->InventoryModelId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->InventoryModelId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->InventoryModelId, false)));
     $this->colCategoryId = new QDataGridColumn(QApplication::Translate('Category Id'), '<?= $_FORM->dtgInventoryModel_Category_Render($_ITEM); ?>');
     $this->colManufacturerId = new QDataGridColumn(QApplication::Translate('Manufacturer Id'), '<?= $_FORM->dtgInventoryModel_Manufacturer_Render($_ITEM); ?>');
     $this->colInventoryModelCode = new QDataGridColumn(QApplication::Translate('Inventory Model Code'), '<?= QString::Truncate($_ITEM->InventoryModelCode, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->InventoryModelCode), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->InventoryModelCode, false)));
     $this->colShortDescription = new QDataGridColumn(QApplication::Translate('Short Description'), '<?= QString::Truncate($_ITEM->ShortDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ShortDescription, false)));
     $this->colLongDescription = new QDataGridColumn(QApplication::Translate('Long Description'), '<?= QString::Truncate($_ITEM->LongDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->LongDescription, false)));
     $this->colImagePath = new QDataGridColumn(QApplication::Translate('Image Path'), '<?= QString::Truncate($_ITEM->ImagePath, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ImagePath), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ImagePath, false)));
     $this->colPrice = new QDataGridColumn(QApplication::Translate('Price'), '<?= $_ITEM->Price; ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->Price), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->Price, false)));
     $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_FORM->dtgInventoryModel_CreatedByObject_Render($_ITEM); ?>');
     $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_FORM->dtgInventoryModel_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->CreationDate, false)));
     $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_FORM->dtgInventoryModel_ModifiedByObject_Render($_ITEM); ?>');
     $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::InventoryModel()->ModifiedDate, false)));
     $this->colInventoryModelCustomFieldHelper = new QDataGridColumn(QApplication::Translate('Inventory Model Custom Field Helper'), '<?= $_FORM->dtgInventoryModel_InventoryModelCustomFieldHelper_Render($_ITEM); ?>');
     // Setup DataGrid
     $this->dtgInventoryModel = new QDataGrid($this);
     $this->dtgInventoryModel->CellSpacing = 0;
     $this->dtgInventoryModel->CellPadding = 4;
     $this->dtgInventoryModel->BorderStyle = QBorderStyle::Solid;
     $this->dtgInventoryModel->BorderWidth = 1;
     $this->dtgInventoryModel->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgInventoryModel->Paginator = new QPaginator($this->dtgInventoryModel);
     $this->dtgInventoryModel->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgInventoryModel->UseAjax = false;
     // Specify the local databind method this datagrid will use
     $this->dtgInventoryModel->SetDataBinder('dtgInventoryModel_Bind');
     $this->dtgInventoryModel->AddColumn($this->colEditLinkColumn);
     $this->dtgInventoryModel->AddColumn($this->colInventoryModelId);
     $this->dtgInventoryModel->AddColumn($this->colCategoryId);
     $this->dtgInventoryModel->AddColumn($this->colManufacturerId);
     $this->dtgInventoryModel->AddColumn($this->colInventoryModelCode);
     $this->dtgInventoryModel->AddColumn($this->colShortDescription);
     $this->dtgInventoryModel->AddColumn($this->colLongDescription);
     $this->dtgInventoryModel->AddColumn($this->colImagePath);
     $this->dtgInventoryModel->AddColumn($this->colPrice);
     $this->dtgInventoryModel->AddColumn($this->colCreatedBy);
     $this->dtgInventoryModel->AddColumn($this->colCreationDate);
     $this->dtgInventoryModel->AddColumn($this->colModifiedBy);
     $this->dtgInventoryModel->AddColumn($this->colModifiedDate);
     $this->dtgInventoryModel->AddColumn($this->colInventoryModelCustomFieldHelper);
 }
 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 InventoryModel-based QQNode.
  * It will also verify that it is a proper InventoryModel-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 == 'inventory_model') {
             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 "inventory_model".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'InventoryModelId':
                     return QQN::InventoryModel()->InventoryModelId;
                 case 'CategoryId':
                     return QQN::InventoryModel()->CategoryId;
                 case 'Category':
                     return QQN::InventoryModel()->Category;
                 case 'ManufacturerId':
                     return QQN::InventoryModel()->ManufacturerId;
                 case 'Manufacturer':
                     return QQN::InventoryModel()->Manufacturer;
                 case 'InventoryModelCode':
                     return QQN::InventoryModel()->InventoryModelCode;
                 case 'ShortDescription':
                     return QQN::InventoryModel()->ShortDescription;
                 case 'LongDescription':
                     return QQN::InventoryModel()->LongDescription;
                 case 'ImagePath':
                     return QQN::InventoryModel()->ImagePath;
                 case 'Price':
                     return QQN::InventoryModel()->Price;
                 case 'CreatedBy':
                     return QQN::InventoryModel()->CreatedBy;
                 case 'CreatedByObject':
                     return QQN::InventoryModel()->CreatedByObject;
                 case 'CreationDate':
                     return QQN::InventoryModel()->CreationDate;
                 case 'ModifiedBy':
                     return QQN::InventoryModel()->ModifiedBy;
                 case 'ModifiedByObject':
                     return QQN::InventoryModel()->ModifiedByObject;
                 case 'ModifiedDate':
                     return QQN::InventoryModel()->ModifiedDate;
                 case 'InventoryModelCustomFieldHelper':
                     return QQN::InventoryModel()->InventoryModelCustomFieldHelper;
                 default:
                     throw new QCallerException('Simple Property not found in InventoryModelDataGrid 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 InventoryModels
  * by ModifiedBy Index(es)
  * @param integer $intModifiedBy
  * @return int
  */
 public static function CountByModifiedBy($intModifiedBy)
 {
     // Call InventoryModel::QueryCount to perform the CountByModifiedBy query
     return InventoryModel::QueryCount(QQ::Equal(QQN::InventoryModel()->ModifiedBy, $intModifiedBy));
 }
Exemple #6
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 = '';");
 }