本文整理汇总了PHP中QQN::AssetTransaction方法的典型用法代码示例。如果您正苦于以下问题:PHP QQN::AssetTransaction方法的具体用法?PHP QQN::AssetTransaction怎么用?PHP QQN::AssetTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQN
的用法示例。
在下文中一共展示了QQN::AssetTransaction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoadAssetTransactionCheckoutByAssetId
/**
* Load a single AssetTransactionCheckout object,
* by AssetId
* @param integer $intAssetId
* @return object $objAssetTransactionCheckout
*/
public function LoadAssetTransactionCheckoutByAssetId($intAssetId = null)
{
// Loads objAssetTransaction
$objClauses = array();
$objOrderByClause = QQ::OrderBy(QQN::AssetTransaction()->Transaction->CreationDate, false);
$objLimitClause = QQ::LimitInfo(1, 0);
array_push($objClauses, $objOrderByClause);
array_push($objClauses, $objLimitClause);
$AssetTransactionArray = AssetTransaction::LoadArrayByAssetId($this->AssetId, $objClauses);
$intLastAssetTransactionId = $AssetTransactionArray[0]->AssetTransactionId;
$objAssetTransactionCheckout = AssetTransactionCheckout::LoadByAssetTransactionId($intAssetLastTransactionId);
return $objAssetTransactionCheckout;
}
示例2: Form_Create
protected function Form_Create()
{
// Setup DataGrid Columns
$this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgAssetTransaction_EditLinkColumn_Render($_ITEM) ?>');
$this->colEditLinkColumn->HtmlEntities = false;
$this->colAssetTransactionId = new QDataGridColumn(QApplication::Translate('Asset Transaction Id'), '<?= $_ITEM->AssetTransactionId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->AssetTransactionId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->AssetTransactionId, false)));
$this->colAssetId = new QDataGridColumn(QApplication::Translate('Asset Id'), '<?= $_FORM->dtgAssetTransaction_Asset_Render($_ITEM); ?>');
$this->colTransactionId = new QDataGridColumn(QApplication::Translate('Transaction Id'), '<?= $_FORM->dtgAssetTransaction_Transaction_Render($_ITEM); ?>');
$this->colParentAssetTransactionId = new QDataGridColumn(QApplication::Translate('Parent Asset Transaction Id'), '<?= $_FORM->dtgAssetTransaction_ParentAssetTransaction_Render($_ITEM); ?>');
$this->colSourceLocationId = new QDataGridColumn(QApplication::Translate('Source Location Id'), '<?= $_FORM->dtgAssetTransaction_SourceLocation_Render($_ITEM); ?>');
$this->colDestinationLocationId = new QDataGridColumn(QApplication::Translate('Destination Location Id'), '<?= $_FORM->dtgAssetTransaction_DestinationLocation_Render($_ITEM); ?>');
$this->colNewAssetFlag = new QDataGridColumn(QApplication::Translate('New Asset Flag'), '<?= ($_ITEM->NewAssetFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->NewAssetFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->NewAssetFlag, false)));
$this->colNewAssetId = new QDataGridColumn(QApplication::Translate('New Asset Id'), '<?= $_FORM->dtgAssetTransaction_NewAsset_Render($_ITEM); ?>');
$this->colScheduleReceiptFlag = new QDataGridColumn(QApplication::Translate('Schedule Receipt Flag'), '<?= ($_ITEM->ScheduleReceiptFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ScheduleReceiptFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ScheduleReceiptFlag, false)));
$this->colScheduleReceiptDueDate = new QDataGridColumn(QApplication::Translate('Schedule Receipt Due Date'), '<?= $_FORM->dtgAssetTransaction_ScheduleReceiptDueDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ScheduleReceiptDueDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ScheduleReceiptDueDate, false)));
$this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_FORM->dtgAssetTransaction_CreatedByObject_Render($_ITEM); ?>');
$this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_FORM->dtgAssetTransaction_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->CreationDate, false)));
$this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_FORM->dtgAssetTransaction_ModifiedByObject_Render($_ITEM); ?>');
$this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ModifiedDate, false)));
// Setup DataGrid
$this->dtgAssetTransaction = new QDataGrid($this);
$this->dtgAssetTransaction->CellSpacing = 0;
$this->dtgAssetTransaction->CellPadding = 4;
$this->dtgAssetTransaction->BorderStyle = QBorderStyle::Solid;
$this->dtgAssetTransaction->BorderWidth = 1;
$this->dtgAssetTransaction->GridLines = QGridLines::Both;
// Datagrid Paginator
$this->dtgAssetTransaction->Paginator = new QPaginator($this->dtgAssetTransaction);
$this->dtgAssetTransaction->ItemsPerPage = 10;
// Specify Whether or Not to Refresh using Ajax
$this->dtgAssetTransaction->UseAjax = false;
// Specify the local databind method this datagrid will use
$this->dtgAssetTransaction->SetDataBinder('dtgAssetTransaction_Bind');
$this->dtgAssetTransaction->AddColumn($this->colEditLinkColumn);
$this->dtgAssetTransaction->AddColumn($this->colAssetTransactionId);
$this->dtgAssetTransaction->AddColumn($this->colAssetId);
$this->dtgAssetTransaction->AddColumn($this->colTransactionId);
$this->dtgAssetTransaction->AddColumn($this->colParentAssetTransactionId);
$this->dtgAssetTransaction->AddColumn($this->colSourceLocationId);
$this->dtgAssetTransaction->AddColumn($this->colDestinationLocationId);
$this->dtgAssetTransaction->AddColumn($this->colNewAssetFlag);
$this->dtgAssetTransaction->AddColumn($this->colNewAssetId);
$this->dtgAssetTransaction->AddColumn($this->colScheduleReceiptFlag);
$this->dtgAssetTransaction->AddColumn($this->colScheduleReceiptDueDate);
$this->dtgAssetTransaction->AddColumn($this->colCreatedBy);
$this->dtgAssetTransaction->AddColumn($this->colCreationDate);
$this->dtgAssetTransaction->AddColumn($this->colModifiedBy);
$this->dtgAssetTransaction->AddColumn($this->colModifiedDate);
}
示例3: btnAddAsset_Click
public function btnAddAsset_Click($strFormId, $strControlId, $strParameter)
{
if ($this->rblAssetType->SelectedValue == 'new') {
$blnError = false;
// Do not allow creation of an asset if asset limit will be exceeded
$intAssetLimit = is_numeric(QApplication::$TracmorSettings->AssetLimit) ? QApplication::$TracmorSettings->AssetLimit : false;
if ($intAssetLimit && Asset::CountActive() >= $intAssetLimit) {
$blnError = true;
$this->txtNewAssetCode->Warning = "Your asset limit has been reached.";
}
// Assign an empty string to the asset code for now (NULL won't work to render properly in the datagrid
if ($this->chkAutoGenerateAssetCode->Checked == true) {
$strAssetCode = '';
} else {
$strAssetCode = $this->txtNewAssetCode->Text;
if (!$strAssetCode) {
$blnError = true;
$this->txtNewAssetCode->Warning = 'You must enter an asset tag.';
}
}
// Generate an error if that asset code already exists
if ($objDuplicate = Asset::LoadByAssetCode($strAssetCode)) {
$blnError = true;
$this->txtNewAssetCode->Warning = 'That asset tag already exists. Choose another.';
} elseif (!$this->lstAssetModel->SelectedValue) {
$blnError = true;
$this->txtNewAssetCode->Warning = 'You must select one model.';
}
if (!$blnError) {
$objNewAsset = new Asset();
$objNewAsset->AssetModelId = $this->lstAssetModel->SelectedValue;
$objNewAsset->LocationId = 5;
// To Be Received
$objNewAsset->AssetCode = $strAssetCode;
// Set the AssetId to 0. This is so that it can be assigned to an AssetTransaction object without being saved to the db
// We don't want to save this until btnSave_Click, because we don't want to create new assets that could get orphaned
$objNewAsset->AssetId = 0;
// This can be combined with the code below it
$this->txtNewAssetCode->Text = null;
$this->txtNewAssetCode->Enabled = true;
$this->chkAutoGenerateAssetCode->Checked = false;
$this->lstAssetModel->SelectedValue = null;
$objNewAssetTransaction = new AssetTransaction();
// The source location can either be 'Shipped'(2) or 'To Be Received'(5)
$objNewAssetTransaction->SourceLocationId = $objNewAsset->LocationId;
// $objNewAssetTransaction->AssetId = $objNewAsset->AssetId;
$objNewAssetTransaction->Asset = $objNewAsset;
$this->objAssetTransactionArray[] = $objNewAssetTransaction;
// Set this boolean to true so that the datagrid updates
$this->blnModifyAssets = true;
}
} elseif ($this->rblAssetType->SelectedValue == 'existing') {
$strAssetCode = $this->txtNewAssetCode->Text;
$blnDuplicate = false;
$blnError = false;
if ($strAssetCode) {
// Begin error checking
if ($this->objAssetTransactionArray) {
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
if ($objAssetTransaction && $objAssetTransaction->Asset->AssetCode == $strAssetCode) {
$blnError = true;
$this->txtNewAssetCode->Warning = "That asset has already been added.";
}
}
}
if (!$blnError) {
$objNewAsset = Asset::LoadByAssetCode($this->txtNewAssetCode->Text);
if (!$objNewAsset instanceof Asset) {
$blnError = true;
$this->txtNewAssetCode->Warning = "That asset tag does not exist.";
} elseif ($objNewAsset->LinkedFlag) {
$blnError = true;
$this->txtNewAssetCode->Warning = "That asset is locked to a parent asset.";
} elseif ($objNewAsset->ArchivedFlag) {
$blnError = true;
$this->txtNewAssetCode->Warning = "That asset is archived.";
} elseif ($objNewAsset->CheckedOutFlag) {
$blnError = true;
$this->txtNewAssetCode->Warning = "That asset is checked out.";
} elseif ($objNewAsset->ReservedFlag) {
$blnError = true;
$this->txtNewAssetCode->Warning = "That asset is reserved.";
} elseif (!($objNewAsset->LocationId == 5 || $objNewAsset->LocationId == 2)) {
$blnError = true;
$this->txtNewAssetCode->Warning = "That asset has already been received.";
} elseif (!QApplication::AuthorizeEntityBoolean($objNewAsset, 2)) {
$blnError = true;
$this->txtNewAssetCode->Warning = "You do not have authorization to perform a transaction on this asset.";
} elseif ($objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objNewAsset->AssetId)) {
$strAssetCodeArray = array();
$objCheckedLinkedAssetArray = array();
foreach ($objLinkedAssetArray as $objLinkedAsset) {
if (!QApplication::AuthorizeEntityBoolean($objLinkedAsset, 2)) {
$blnError = true;
$this->txtNewAssetCode->Warning = sprintf("You do not have authorization to perform a transaction on locked asset %s.", $objLinkedAsset->AssetCode);
break;
} else {
$objCheckedLinkedAssetArray[] = $objLinkedAsset;
$strAssetCodeArray[] = $objLinkedAsset->AssetCode;
}
//.........这里部分代码省略.........
示例4: dtrAssetHistory_Bind
protected function dtrAssetHistory_Bind()
{
// Get Total Count for Pagination
$this->dtrAssetHistory->TotalItemCount = AssetTransaction::CountAssetTransaction($this->ctlAssetEdit->objAsset->AssetId);
$objClauses = array();
$objClause = QQ::OrderBy(QQN::AssetTransaction()->Transaction->CreationDate, false);
array_push($objClauses, $objClause);
$objCondition = QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $this->ctlAssetEdit->objAsset->AssetId), QQ::OrCondition(QQ::In(QQN::AssetTransaction()->Transaction->TransactionTypeId, array(1, 2, 3, 6, 7, 8, 9, 10, 11))));
$intItemsPerPage = $this->dtrAssetHistory->ItemsPerPage;
$intItemOffset = ($this->dtrAssetHistory->PageNumber - 1) * $intItemsPerPage;
$arrDataSource = array_slice(AssetTransaction::QueryArray($objCondition, $objClauses), $intItemOffset, $intItemsPerPage);
$this->dtrAssetHistory->DataSource = $arrDataSource;
}
示例5: GetLastShippedFromLocation
/**
* Returns a Location object from the most recent shipment transaction for this asset
*
* @return Object Location
*/
public function GetLastShippedFromLocation()
{
$objCondition = QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $this->AssetId), QQ::Equal(QQN::AssetTransaction()->Transaction->TransactionTypeId, 6));
$objClauses = array();
$objExpansionClause = QQ::Expand(QQN::AssetTransaction()->SourceLocation);
$objOrderByClause = QQ::OrderBy(QQN::AssetTransaction()->Transaction->CreationDate, false);
$objLimitClause = QQ::LimitInfo(1, 0);
array_push($objClauses, $objExpansionClause);
array_push($objClauses, $objOrderByClause);
array_push($objClauses, $objLimitClause);
$AssetTransactionArray = AssetTransaction::QueryArray($objCondition, $objClauses);
if (count($AssetTransactionArray) > 0) {
$Location = $AssetTransactionArray[0]->SourceLocation;
} else {
$Location = null;
}
return $Location;
}
示例6: dtgAssetTransaction_Create
protected function dtgAssetTransaction_Create()
{
$this->dtgAssetTransaction = new QDataGrid($this);
$this->dtgAssetTransaction->Name = 'Transactions';
$this->dtgAssetTransaction->CellPadding = 5;
$this->dtgAssetTransaction->CellSpacing = 0;
$this->dtgAssetTransaction->CssClass = "datagrid";
// Enable AJAX - this won't work while using the DB profiler
$this->dtgAssetTransaction->UseAjax = true;
// Enable Pagination, and set to 20 items per page
$objPaginator = new QPaginator($this->dtgAssetTransaction);
$this->dtgAssetTransaction->Paginator = $objPaginator;
$this->dtgAssetTransaction->ItemsPerPage = 20;
$this->dtgAssetTransaction->AddColumn(new QDataGridColumn('Transaction Type', '<?= $_ITEM->Transaction->__toStringWithLink() ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->Transaction->TransactionType->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->Transaction->TransactionType->ShortDescription, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false)));
$this->dtgAssetTransaction->AddColumn(new QDataGridColumn('From', '<?= $_ITEM->__toStringSourceLocation() ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->SourceLocation->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->SourceLocation->ShortDescription, false), 'CssClass' => "dtg_column")));
$this->dtgAssetTransaction->AddColumn(new QDataGridColumn('To', '<?= $_ITEM->__toStringDestinationLocation() ?>', array('OrderByClause' => QQ::Orderby(QQN::AssetTransaction()->DestinationLocation->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->DestinationLocation->ShortDescription, false), 'CssClass' => "dtg_column")));
$this->dtgAssetTransaction->AddColumn(new QDataGridColumn('User', '<?= $_ITEM->Transaction->CreatedByObject->__toStringFullName() ?>', array('OrderByClause' => QQ::Orderby(QQN::AssetTransaction()->CreatedByObject->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->CreatedByObject->LastName, false), 'CssClass' => "dtg_column")));
$this->dtgAssetTransaction->AddColumn(new QDataGridColumn('Date', '<?= $_ITEM->Transaction->CreationDate->PHPDate("Y-m-d H:i:s"); ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->Transaction->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->Transaction->CreationDate, false), 'CssClass' => "dtg_column")));
$this->dtgAssetTransaction->SortColumnIndex = 4;
$this->dtgAssetTransaction->SortDirection = 1;
$objStyle = $this->dtgAssetTransaction->RowStyle;
$objStyle->ForeColor = '#000000';
$objStyle->BackColor = '#FFFFFF';
$objStyle->FontSize = 12;
$objStyle = $this->dtgAssetTransaction->AlternateRowStyle;
$objStyle->BackColor = '#EFEFEF';
$objStyle = $this->dtgAssetTransaction->HeaderRowStyle;
$objStyle->ForeColor = '#000000';
$objStyle->BackColor = '#EFEFEF';
$objStyle->CssClass = 'dtg_header';
}
示例7: dtgShipmentReceipt_Bind
protected function dtgShipmentReceipt_Bind()
{
// Get Total Count for Pagination
$objClauses = array();
$this->ctlAssetEdit->dtgShipmentReceipt->TotalItemCount = AssetTransaction::CountShipmentReceiptByAssetId($this->ctlAssetEdit->objAsset->AssetId);
if ($this->ctlAssetEdit->dtgShipmentReceipt->TotalItemCount === 0) {
$this->ctlAssetEdit->lblShipmentReceipt->Display = false;
$this->ctlAssetEdit->dtgShipmentReceipt->ShowHeader = false;
} else {
$objClauses = array();
if ($objClause = QQ::OrderBy(QQN::AssetTransaction()->Transaction->CreationDate, false)) {
array_push($objClauses, $objClause);
}
if ($objClause = $this->ctlAssetEdit->dtgShipmentReceipt->LimitClause) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::AssetTransaction()->Transaction->Shipment)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::AssetTransaction()->Transaction->Receipt)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::AssetTransaction()->SourceLocation)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::AssetTransaction()->DestinationLocation)) {
array_push($objClauses, $objClause);
}
$objCondition = QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $this->ctlAssetEdit->objAsset->AssetId), QQ::OrCondition(QQ::Equal(QQN::AssetTransaction()->Transaction->TransactionTypeId, 6), QQ::Equal(QQN::AssetTransaction()->Transaction->TransactionTypeId, 7)));
$this->ctlAssetEdit->dtgShipmentReceipt->DataSource = AssetTransaction::QueryArray($objCondition, $objClauses);
}
}
示例8: btnCompleteShipment_Click
protected function btnCompleteShipment_Click($strFormId, $strControlId, $strParameter)
{
$blnError = false;
if ($this->objAssetTransactionArray && $this->objInventoryTransactionArray) {
$intEntityQtypeId = EntityQtype::AssetInventory;
} elseif ($this->objAssetTransactionArray) {
$intEntityQtypeId = EntityQtype::Asset;
} elseif ($this->objInventoryTransactionArray) {
$intEntityQtypeId = EntityQtype::Inventory;
} else {
$blnError = true;
$this->btnCompleteShipment->Warning = 'There are no assets or inventory in this shipment.';
}
if ($this->objAssetTransactionArray) {
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
if ($objAssetTransaction->Asset instanceof Asset) {
$arrAssetTransactions = AssetTransaction::LoadArrayByAssetId($objAssetTransaction->Asset->AssetId, array(QQ::OrderBy(QQN::AssetTransaction()->CreationDate, false)));
if (count($arrAssetTransactions) > 0) {
$intLastTransactionId = $arrAssetTransactions[0]->TransactionId;
$transaction = Transaction::load($intLastTransactionId);
if ($transaction->TransactionTypeId == 6 && $transaction->Shipment->ShippedFlag) {
$blnError = true;
$this->btnCompleteShipment->Warning = $objAssetTransaction->Asset->__toStringWithLink() . ' already shipped.';
}
}
}
}
}
if (!$blnError) {
try {
// Get an instance of the database
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
if (!$this->blnEditMode) {
// this is a new shipment so save the transaction & shipment before completing
// Create the new transaction object and save it
$this->objTransaction = new Transaction();
$this->objTransaction->EntityQtypeId = $intEntityQtypeId;
$this->objTransaction->TransactionTypeId = 6;
$this->objTransaction->Note = $this->txtNote->Text;
$this->objTransaction->Save();
$this->UpdateShipmentFields();
$this->objShipment->Save(true);
if ($this->arrCustomFields) {
// Save the values from all of the custom field controls to save the shipment
CustomField::SaveControls($this->objShipment->objCustomFieldArray, $this->blnEditMode, $this->arrCustomFields, $this->objShipment->ShipmentId, 10);
}
}
// Create receipt transaction for internal shipment
if ($this->objShipment->ToCompanyId == $this->objShipment->FromCompanyId) {
$this->receiveInternalShipmentTransaction = new Transaction();
$this->receiveInternalShipmentTransaction->EntityQtypeId = $intEntityQtypeId;
$this->receiveInternalShipmentTransaction->TransactionTypeId = 7;
$note = sprintf('This receipt was automatically created when creating internal shipment Number %s. ', $this->objShipment->ShipmentNumber);
$this->receiveInternalShipmentTransaction->Note = $note . $this->txtNote->Text;
$this->receiveInternalShipmentTransaction->Save();
// Create a new receipt
$objInternalReceipt = new Receipt();
$objInternalReceipt->TransactionId = $this->receiveInternalShipmentTransaction->TransactionId;
// The receipt will mimic the shipment information
$objInternalReceipt->FromCompanyId = $this->objShipment->FromCompanyId;
$objInternalReceipt->FromContactId = $this->objShipment->FromContactId;
$objInternalReceipt->ToContactId = $this->objShipment->ToContactId;
$objInternalReceipt->ToAddressId = $this->objShipment->ToAddressId;
$objInternalReceipt->ReceivedFlag = 0;
$objInternalReceipt->ReceiptNumber = Receipt::LoadNewReceiptNumber();
$objInternalReceipt->Save();
}
if ($intEntityQtypeId == EntityQtype::AssetInventory || $intEntityQtypeId == EntityQtype::Asset) {
$objTransaction = '';
$objReceipt = '';
$objNewAssetTransactionArray = array();
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
$objNewAssetTransactionArray[$objAssetTransaction->Asset->AssetCode] = $objAssetTransaction;
}
// Assign a destinationLocation to the AssetTransaction, and change the Location of the asset
foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
if ($objAssetTransaction->Asset instanceof Asset) {
// LocationId #2 == Shipped
$DestinationLocationId = 2;
if ($objAssetTransaction->ScheduleReceiptFlag && $objAssetTransaction->Asset->LinkedFlag) {
$objAssetTransaction = $objNewAssetTransactionArray[$objAssetTransaction->Asset->AssetCode];
}
$objAssetTransaction->Asset->LocationId = $DestinationLocationId;
$objAssetTransaction->Asset->Save();
if (!$this->blnEditMode) {
// Assign the TransactionId
$objAssetTransaction->TransactionId = $this->objTransaction->TransactionId;
}
$objAssetTransaction->DestinationLocationId = $DestinationLocationId;
// No any actions with linked items (LinkedFlag = 1) which have been scheduled for receipt
if ($objAssetTransaction->ScheduleReceiptFlag && !$objAssetTransaction->Asset->LinkedFlag) {
if ($objAssetTransaction->NewAsset && $objAssetTransaction->NewAsset instanceof Asset && $objAssetTransaction->NewAsset->AssetId == null) {
// We have to create the new asset before we can
$objReceiptAsset = new Asset();
$objReceiptAsset->AssetModelId = $objAssetTransaction->NewAsset->AssetModelId;
$objReceiptAsset->LocationId = $objAssetTransaction->NewAsset->LocationId;
if ($objAssetTransaction->NewAsset->AssetCode == '') {
$objReceiptAsset->AssetCode = Asset::GenerateAssetCode();
//.........这里部分代码省略.........
示例9: CountByParentAssetTransactionId
/**
* Count AssetTransactions
* by ParentAssetTransactionId Index(es)
* @param integer $intParentAssetTransactionId
* @return int
*/
public static function CountByParentAssetTransactionId($intParentAssetTransactionId, $objOptionalClauses = null)
{
// Call AssetTransaction::QueryCount to perform the CountByParentAssetTransactionId query
return AssetTransaction::QueryCount(QQ::Equal(QQN::AssetTransaction()->ParentAssetTransactionId, $intParentAssetTransactionId), $objOptionalClauses);
}
示例10: __toStringHoverTips
/**
* Returns the HTML needed for a receipt datagrid to show asset and inventory icons, with hovertips.
*
* @param QDatagrid Object $objControl
* @return string
*/
public function __toStringHoverTips($objControl)
{
// Create the Asset Image label, with corresponding assets hovertip
if ($this->Transaction->EntityQtypeId == EntityQtype::AssetInventory || $this->Transaction->EntityQtypeId == EntityQtype::Asset) {
$lblAssetImage = new QLabelExt($objControl);
$lblAssetImage->HtmlEntities = false;
$lblAssetImage->Text = sprintf('<img src="%s/icons/asset_datagrid.png" style="vertical-align:middle;">', __IMAGE_ASSETS__);
// create
$objHoverTip = new QHoverTip($lblAssetImage);
$objHoverTip->Template = __DOCROOT__ . __SUBDIRECTORY__ . '/receiving/hovertip_assets.tpl.php';
$lblAssetImage->HoverTip = $objHoverTip;
// Load the AssetTransaction Array on the form so that it can be used by the hovertip panel
$objClauses = array();
if ($objClause = QQ::LimitInfo(11, 0)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::AssetTransaction()->Asset->AssetModel)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::AssetTransaction()->SourceLocation)) {
}
array_push($objClauses, $objClause);
$objControl->Form->objAssetTransactionArray = AssetTransaction::LoadArrayByTransactionId($this->TransactionId, $objClauses);
$objClauses = null;
}
// Create the Inventory Image label with corresponding inventory hovertip
if ($this->Transaction->EntityQtypeId == EntityQtype::AssetInventory || $this->Transaction->EntityQtypeId == EntityQtype::Inventory) {
$lblInventoryImage = new QLabelExt($objControl);
$lblInventoryImage->HtmlEntities = false;
$lblInventoryImage->Text = sprintf('<img src="%s/icons/inventory_datagrid.png" style="vertical-align:middle;"', __IMAGE_ASSETS__);
// Create the inventory hovertip
$objHoverTip = new QHoverTip($lblInventoryImage);
$objHoverTip->Template = __DOCROOT__ . __SUBDIRECTORY__ . '/receiving/hovertip_inventory.tpl.php';
$lblInventoryImage->HoverTip = $objHoverTip;
// Load the InventoryTransaction Array on the form so that it can be used by the hovertip panel
$objClauses = array();
if ($objClause = QQ::LimitInfo(11, 0)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::InventoryTransaction()->InventoryLocation->InventoryModel)) {
}
array_push($objClauses, $objClause);
$objControl->Form->objInventoryTransactionArray = InventoryTransaction::LoadArrayByTransactionId($this->TransactionId, $objClauses);
$objClauses = null;
}
// Display the appropriate images
if ($this->Transaction->EntityQtypeId == EntityQtype::AssetInventory) {
$strToReturn = $lblAssetImage->Render(false) . ' ' . $lblInventoryImage->Render(false);
} elseif ($this->Transaction->EntityQtypeId == EntityQtype::Asset) {
$strToReturn = $lblAssetImage->Render(false);
} elseif ($this->Transaction->EntityQtypeId == EntityQtype::Inventory) {
$strToReturn = $lblInventoryImage->Render(false);
}
return $strToReturn;
}
示例11: CountShipmentReceiptByAssetId
/**
* Count AssetTransactions
* by AssetId Index(es), but only those transactions that are Shipments or Receipts
* @param integer $intAssetId
* @param boolean $blnInclude - include only shipments and receipts or all other transactions
* @return int
*/
public static function CountShipmentReceiptByAssetId($intAssetId, $blnInclude = true)
{
// Call AssetTransaction::QueryCount to perform the CountByAssetId query
if ($blnInclude) {
$arrToReturn = AssetTransaction::QueryCount(QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $intAssetId), QQ::OrCondition(QQ::Equal(QQN::AssetTransaction()->Transaction->TransactionTypeId, 6), QQ::Equal(QQN::AssetTransaction()->Transaction->TransactionTypeId, 7))));
} else {
$arrToReturn = AssetTransaction::QueryCount(QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $intAssetId), QQ::NotEqual(QQN::AssetTransaction()->Transaction->TransactionTypeId, 6), QQ::NotEqual(QQN::AssetTransaction()->Transaction->TransactionTypeId, 7)));
}
return $arrToReturn;
}
示例12: CountByTransactionIdLinkedFlag
/**
* Count AssetTransactions (excluding transactions for linked assets)
* by TransactionId Index(es)
* @param integer $intTransactionId
* @return int
*/
public static function CountByTransactionIdLinkedFlag($intTransactionId)
{
// Call AssetTransaction::QueryCount to perform the CountByTransactionId query
return AssetTransaction::QueryCount(QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->TransactionId, $intTransactionId), QQ::NotEqual(QQN::AssetTransaction()->Asset->LinkedFlag, true)));
}
示例13: __construct
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->dtgAssetTransaction_EditLinkColumn_Render($_ITEM) ?>');
$this->colEditLinkColumn->HtmlEntities = false;
$this->colAssetTransactionId = new QDataGridColumn(QApplication::Translate('Asset Transaction Id'), '<?= $_ITEM->AssetTransactionId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->AssetTransactionId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->AssetTransactionId, false)));
$this->colAssetId = new QDataGridColumn(QApplication::Translate('Asset Id'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_Asset_Render($_ITEM); ?>');
$this->colTransactionId = new QDataGridColumn(QApplication::Translate('Transaction Id'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_Transaction_Render($_ITEM); ?>');
$this->colParentAssetTransactionId = new QDataGridColumn(QApplication::Translate('Parent Asset Transaction Id'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_ParentAssetTransaction_Render($_ITEM); ?>');
$this->colSourceLocationId = new QDataGridColumn(QApplication::Translate('Source Location Id'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_SourceLocation_Render($_ITEM); ?>');
$this->colDestinationLocationId = new QDataGridColumn(QApplication::Translate('Destination Location Id'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_DestinationLocation_Render($_ITEM); ?>');
$this->colNewAssetFlag = new QDataGridColumn(QApplication::Translate('New Asset Flag'), '<?= ($_ITEM->NewAssetFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->NewAssetFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->NewAssetFlag, false)));
$this->colNewAssetId = new QDataGridColumn(QApplication::Translate('New Asset Id'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_NewAsset_Render($_ITEM); ?>');
$this->colScheduleReceiptFlag = new QDataGridColumn(QApplication::Translate('Schedule Receipt Flag'), '<?= ($_ITEM->ScheduleReceiptFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ScheduleReceiptFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ScheduleReceiptFlag, false)));
$this->colScheduleReceiptDueDate = new QDataGridColumn(QApplication::Translate('Schedule Receipt Due Date'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_ScheduleReceiptDueDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ScheduleReceiptDueDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ScheduleReceiptDueDate, false)));
$this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_CreatedByObject_Render($_ITEM); ?>');
$this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->CreationDate, false)));
$this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_CONTROL->ParentControl->dtgAssetTransaction_ModifiedByObject_Render($_ITEM); ?>');
$this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::AssetTransaction()->ModifiedDate, false)));
// Setup DataGrid
$this->dtgAssetTransaction = new QDataGrid($this);
$this->dtgAssetTransaction->CellSpacing = 0;
$this->dtgAssetTransaction->CellPadding = 4;
$this->dtgAssetTransaction->BorderStyle = QBorderStyle::Solid;
$this->dtgAssetTransaction->BorderWidth = 1;
$this->dtgAssetTransaction->GridLines = QGridLines::Both;
// Datagrid Paginator
$this->dtgAssetTransaction->Paginator = new QPaginator($this->dtgAssetTransaction);
$this->dtgAssetTransaction->ItemsPerPage = 10;
// Specify Whether or Not to Refresh using Ajax
$this->dtgAssetTransaction->UseAjax = true;
// Specify the local databind method this datagrid will use
$this->dtgAssetTransaction->SetDataBinder('dtgAssetTransaction_Bind', $this);
$this->dtgAssetTransaction->AddColumn($this->colEditLinkColumn);
$this->dtgAssetTransaction->AddColumn($this->colAssetTransactionId);
$this->dtgAssetTransaction->AddColumn($this->colAssetId);
$this->dtgAssetTransaction->AddColumn($this->colTransactionId);
$this->dtgAssetTransaction->AddColumn($this->colParentAssetTransactionId);
$this->dtgAssetTransaction->AddColumn($this->colSourceLocationId);
$this->dtgAssetTransaction->AddColumn($this->colDestinationLocationId);
$this->dtgAssetTransaction->AddColumn($this->colNewAssetFlag);
$this->dtgAssetTransaction->AddColumn($this->colNewAssetId);
$this->dtgAssetTransaction->AddColumn($this->colScheduleReceiptFlag);
$this->dtgAssetTransaction->AddColumn($this->colScheduleReceiptDueDate);
$this->dtgAssetTransaction->AddColumn($this->colCreatedBy);
$this->dtgAssetTransaction->AddColumn($this->colCreationDate);
$this->dtgAssetTransaction->AddColumn($this->colModifiedBy);
$this->dtgAssetTransaction->AddColumn($this->colModifiedDate);
// Setup the Create New button
$this->btnCreateNew = new QButton($this);
$this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('AssetTransaction');
$this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click'));
}
示例14: Form_Create
//.........这里部分代码省略.........
if ($this->blnShowInventory) {
$this->txtNewInventoryModelCode_Create();
$this->btnLookup_Create();
$this->ctlInventorySearchTool_Create();
$this->lstSourceLocation_Create();
$this->txtQuantity_Create();
$this->btnAddInventory_Create();
}
$this->txtTrackingNumber_Create();
//$this->lblAdvanced_Create();
$this->txtReceiptAssetCode_Create();
$this->chkAutoGenerateAssetCode_Create();
$this->dtpScheduleReceiptDueDate_Create();
$this->rblAssetType_Create();
$this->chkScheduleReceipt_Create();
$this->btnAddAsset_Create();
$this->ctlAssetSearchTool_Create();
$this->btnSaveExchange_Create();
$this->btnCancelExchange_Create();
$this->btnSaveDueDate_Create();
$this->btnCancelDueDate_Create();
$this->pnlAttachments_Create();
// Create all custom asset fields
$this->customFields_Create();
//Set display logic of Built-In Fields
$this->UpdateBuiltInFields();
$this->UpdateAddressAccess();
$this->UpdateCompanyAccess();
$this->UpdateContactAccess();
// New entities Dialog
$this->dlgNew_Create();
if (!$this->objShipment->ShippedFlag) {
// Shipping Buttons
$this->btnDelete_Create();
}
$this->btnSave_Create();
$this->btnCancel_Create();
$this->btnEdit_Create();
$this->atcAttach_Create();
// Complete Shipment Buttons
$this->btnCompleteShipment_Create();
$this->btnCancelShipment_Create();
$this->btnCancelCompleteShipment_Create();
// Shipping Datagrids
$this->dtgAssetTransact_Create();
$this->dtgInventoryTransact_Create();
// Load the objAssetTransactionArray and objInventoryTransactionArray for the first time
if ($this->blnEditMode) {
$objClauses = array();
if ($objClause = $this->dtgAssetTransact->OrderByClause) {
array_push($objClauses, $objClause);
}
/*if ($objClause = $this->dtgAssetTransact->LimitClause)
array_push($objClauses, $objClause);*/
if ($objClause = QQ::Expand(QQN::AssetTransaction()->Asset->AssetModel)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::AssetTransaction()->SourceLocation)) {
}
array_push($objClauses, $objClause);
$this->objAssetTransactionArray = AssetTransaction::LoadArrayByTransactionId($this->objShipment->TransactionId, $objClauses);
$objClauses = null;
$objClauses = array();
if ($objClause = $this->dtgInventoryTransact->OrderByClause) {
array_push($objClauses, $objClause);
}
/*if ($objClause = $this->dtgInventoryTransact->LimitClause)
array_push($objClauses, $objClause);*/
if ($objClause = QQ::Expand(QQN::InventoryTransaction()->InventoryLocation->InventoryModel)) {
}
array_push($objClauses, $objClause);
$this->objInventoryTransactionArray = InventoryTransaction::LoadArrayByTransactionId($this->objShipment->TransactionId, $objClauses);
// If shipped, display labels. Otherwise, we don't need to call DisplayLabels because only labels are on the QPanel.
$this->DisplayLabels();
} elseif (!$this->blnEditMode) {
$this->DisplayInputs();
}
// Check if there is an Asset or InventoryModel ID in the query string to automatically add them - they would be coming from AssetEdit or InventoryEdit
if (!$this->blnEditMode) {
$intAssetId = QApplication::QueryString('intAssetId');
// If an Asset was passed in the query string, load the txt in the Asset Code text box and click the add button
if ($intAssetId) {
$objAsset = Asset::Load($intAssetId);
if ($objAsset) {
$this->txtNewAssetCode->Text = $objAsset->AssetCode;
$this->btnAddAsset_Click($this, null, null);
}
}
$intInventoryModelId = QApplication::QueryString('intInventoryModelId');
// If an InventoryModel was passed in the query string, load the text in the InventoryModel text box and set the focus to the quantity box
if ($intInventoryModelId) {
$objInventoryModel = InventoryModel::Load($intInventoryModelId);
if ($objInventoryModel) {
$this->txtNewInventoryModelCode->Text = $objInventoryModel->InventoryModelCode;
$this->btnLookup_Click($this, null, null);
QApplication::ExecuteJavaScript(sprintf("document.getElementById('%s').focus()", $this->lstSourceLocation->ControlId));
}
}
}
}
示例15: ResolveContentItem
/**
* Used internally by the Meta-based Add Column tools.
*
* Given a QQNode or a Text String, this will return a AssetTransaction-based QQNode.
* It will also verify that it is a proper AssetTransaction-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_transaction') {
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_transaction".');
}
} else {
if (is_string($mixContent)) {
switch ($mixContent) {
case 'AssetTransactionId':
return QQN::AssetTransaction()->AssetTransactionId;
case 'AssetId':
return QQN::AssetTransaction()->AssetId;
case 'Asset':
return QQN::AssetTransaction()->Asset;
case 'TransactionId':
return QQN::AssetTransaction()->TransactionId;
case 'Transaction':
return QQN::AssetTransaction()->Transaction;
case 'ParentAssetTransactionId':
return QQN::AssetTransaction()->ParentAssetTransactionId;
case 'ParentAssetTransaction':
return QQN::AssetTransaction()->ParentAssetTransaction;
case 'SourceLocationId':
return QQN::AssetTransaction()->SourceLocationId;
case 'SourceLocation':
return QQN::AssetTransaction()->SourceLocation;
case 'DestinationLocationId':
return QQN::AssetTransaction()->DestinationLocationId;
case 'DestinationLocation':
return QQN::AssetTransaction()->DestinationLocation;
case 'NewAssetFlag':
return QQN::AssetTransaction()->NewAssetFlag;
case 'NewAssetId':
return QQN::AssetTransaction()->NewAssetId;
case 'NewAsset':
return QQN::AssetTransaction()->NewAsset;
case 'ScheduleReceiptFlag':
return QQN::AssetTransaction()->ScheduleReceiptFlag;
case 'ScheduleReceiptDueDate':
return QQN::AssetTransaction()->ScheduleReceiptDueDate;
case 'CreatedBy':
return QQN::AssetTransaction()->CreatedBy;
case 'CreatedByObject':
return QQN::AssetTransaction()->CreatedByObject;
case 'CreationDate':
return QQN::AssetTransaction()->CreationDate;
case 'ModifiedBy':
return QQN::AssetTransaction()->ModifiedBy;
case 'ModifiedByObject':
return QQN::AssetTransaction()->ModifiedByObject;
case 'ModifiedDate':
return QQN::AssetTransaction()->ModifiedDate;
case 'AssetTransactionCheckout':
return QQN::AssetTransaction()->AssetTransactionCheckout;
default:
throw new QCallerException('Simple Property not found in AssetTransactionDataGrid 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');
}
}
}
}