当前位置: 首页>>代码示例>>PHP>>正文


PHP Receipt::LoadNewReceiptNumber方法代码示例

本文整理汇总了PHP中Receipt::LoadNewReceiptNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Receipt::LoadNewReceiptNumber方法的具体用法?PHP Receipt::LoadNewReceiptNumber怎么用?PHP Receipt::LoadNewReceiptNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Receipt的用法示例。


在下文中一共展示了Receipt::LoadNewReceiptNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
//.........这里部分代码省略.........
开发者ID:proxymoron,项目名称:tracmor,代码行数:101,代码来源:shipment_edit.php

示例2: UpdateReceiptFields

 protected function UpdateReceiptFields()
 {
     $this->objReceipt->TransactionId = $this->objTransaction->TransactionId;
     if (QApplication::$TracmorSettings->CustomReceiptNumbers) {
         $this->objReceipt->ReceiptNumber = $this->txtReceiptNumber->Text;
     } elseif (!$this->blnEditMode) {
         $this->objReceipt->ReceiptNumber = Receipt::LoadNewReceiptNumber();
     }
     $this->objReceipt->FromCompanyId = $this->lstFromCompany->SelectedValue;
     $this->objReceipt->FromContactId = $this->lstFromContact->SelectedValue;
     $this->objReceipt->ToContactId = $this->lstToContact->SelectedValue;
     $this->objReceipt->ToAddressId = $this->lstToAddress->SelectedValue;
     $this->objReceipt->DueDate = $this->calDueDate->DateTime;
     $this->objReceipt->ReceiptDate = $this->calDateReceived->DateTime;
     //!
     $this->objTransaction->Note = $this->txtNote->Text;
     // Reload the Assets and inventory locations so that they don't trigger an OLE if edit/save adding assets or inventory multiple times
     if ($this->objAssetTransactionArray) {
         foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
             $objAssetTransaction->Asset = Asset::Load($objAssetTransaction->AssetId);
         }
     }
     if ($this->objInventoryTransactionArray) {
         foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
             $objInventoryTransaction->InventoryLocation = InventoryLocation::Load($objInventoryTransaction->InventoryLocationId);
         }
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:28,代码来源:receipt_edit.php

示例3: btnCompleteShipment_Click


//.........这里部分代码省略.........
                                     $objReceiptAsset->AssetCode = $objAssetTransaction->NewAsset->AssetCode;
                                 }
                                 $objReceiptAsset->Save();
                                 // Assign any default custom field values
                                 CustomField::AssignNewEntityDefaultValues(1, $objReceiptAsset->AssetId);
                                 // Associate the new Asset with the AssetTransaction
                                 $objAssetTransaction->NewAsset = $objReceiptAsset;
                             }
                             // If it doesn't exist, create a new transaction object and receipt object
                             if (!$objTransaction instanceof Transaction && !$objReceipt instanceof Receipt) {
                                 $objTransaction = new Transaction();
                                 // Transaction is asset only
                                 $objTransaction->EntityQtypeId = 1;
                                 // Transaction is a receipt
                                 $objTransaction->TransactionTypeId = 7;
                                 // Set a note showing how this receipt was created
                                 if (!$objAssetTransaction->NewAssetId) {
                                     $strTransactionType = 'return';
                                 } else {
                                     $strTransactionType = 'exchange';
                                 }
                                 $objTransaction->Note = sprintf('This %s receipt was automatically created when creating Shipment Number %s.', $strTransactionType, $this->objShipment->ShipmentNumber);
                                 // Save the transaction
                                 $objTransaction->Save();
                                 // Create a new receipt
                                 $objReceipt = new Receipt();
                                 $objReceipt->TransactionId = $objTransaction->TransactionId;
                                 // The receipt will be coming from the company that was shipped to
                                 $objReceipt->FromCompanyId = $this->objShipment->ToCompanyId;
                                 $objReceipt->FromContactId = $this->objShipment->ToContactId;
                                 $objReceipt->ToContactId = $this->objShipment->FromContactId;
                                 $objReceipt->ToAddressId = $this->objShipment->FromAddressId;
                                 $objReceipt->ReceivedFlag = 0;
                                 $objReceipt->ReceiptNumber = Receipt::LoadNewReceiptNumber();
                                 if ($objAssetTransaction->ScheduleReceiptDueDate) {
                                     $objReceipt->DueDate = $objAssetTransaction->ScheduleReceiptDueDate;
                                 }
                                 $objReceipt->Save();
                             }
                             $objReceiptAssetTransaction = new AssetTransaction();
                             // If this is a return
                             if (!$objAssetTransaction->NewAssetId) {
                                 $objReceiptAssetTransaction->AssetId = $objAssetTransaction->AssetId;
                             } else {
                                 // Both the shipmentAssetTranscation (objAssetTransaction and the objReceiptAssetTransaction were involved in creating a new asset
                                 // Asset Transactions where NewAssetFlag = true but AssetId is NULL are receipt asset transactions for exchanges.
                                 $objReceiptAssetTransaction->AssetId = $objAssetTransaction->NewAssetId;
                                 $objReceiptAssetTransaction->NewAssetFlag = true;
                                 $objAssetTransaction->NewAssetFlag = true;
                                 $objAssetTransaction->Save();
                             }
                             $objReceiptAssetTransaction->TransactionId = $objTransaction->TransactionId;
                             $objReceiptAssetTransaction->SourceLocationId = $objAssetTransaction->DestinationLocationId;
                             // This is not right. NewAssetFlag should be set only if a new asset was created when creating this AssetTransaction
                             // It should not be true on the new AssetTransaction, but only on the AssetTransaction that caused the new asset to be created.
                             // $objReceiptAssetTransaction->NewAssetFlag = true;
                             $objReceiptAssetTransaction->Save();
                             // Load all child assets
                             if ($objLinkedAssetCodeArray = Asset::LoadChildLinkedArrayByParentAssetId($objAssetTransaction->Asset->AssetId)) {
                                 foreach ($objLinkedAssetCodeArray as $objLinkedAssetCode) {
                                     $objLinkedAssetTransaction = $objNewAssetTransactionArray[$objLinkedAssetCode->AssetCode];
                                     $objLinkedReceiptAssetTransaction = new AssetTransaction();
                                     // If this is a return
                                     if (!$objAssetTransaction->NewAssetId) {
                                         $objLinkedReceiptAssetTransaction->AssetId = $objLinkedAssetTransaction->AssetId;
                                         $objLinkedReceiptAssetTransaction->TransactionId = $objTransaction->TransactionId;
开发者ID:brustj,项目名称:tracmor,代码行数:67,代码来源:shipment_edit.php


注:本文中的Receipt::LoadNewReceiptNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。