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


PHP Receipt::Load方法代码示例

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


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

示例1: SetupReceipt

 protected function SetupReceipt()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intReceiptId = QApplication::QueryString('intReceiptId');
     if ($intReceiptId) {
         $this->objReceipt = Receipt::Load($intReceiptId);
         if (!$this->objReceipt) {
             throw new Exception('Could not find a Receipt object with PK arguments: ' . $intReceiptId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objReceipt = new Receipt();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
开发者ID:heshuai64,项目名称:einv2,代码行数:18,代码来源:ReceiptEditFormBase.class.php

示例2: btnSave_Click

 public function btnSave_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->btnCancel->Warning = 'There are no assets nor inventory in this receipt.';
     }
     if (QApplication::$TracmorSettings->CustomReceiptNumbers) {
         if (trim($this->txtReceiptNumber->Text) == '') {
             $blnError = true;
             $this->txtReceiptNumber->Warning = 'Receipt number is a required field.';
         } else {
             if ($objReceipt = Receipt::LoadByReceiptNumber($this->txtReceiptNumber->Text)) {
                 if ($objReceipt->ReceiptId != $this->objReceipt->ReceiptId) {
                     $blnError = true;
                     $this->txtReceiptNumber->Warning = 'That is a duplicate receipt number.';
                 }
             }
         }
     }
     if (!$this->lstFromCompany->SelectedValue) {
         $blnError = true;
         $this->lstFromCompany->Warning = 'You must select a From Company';
     }
     if (!$this->lstFromContact->SelectedValue) {
         $blnError = true;
         $this->lstFromContact->Warning = 'You must select a From Contact';
     }
     if (!$this->lstToContact->SelectedValue) {
         $blnError = true;
         $this->lstToContact->Warning = 'You must select a To Contact';
     }
     if (!$this->lstToAddress->SelectedValue) {
         $blnError = true;
         $this->lstToAddress->Warning = 'You must select a To Address';
     }
     if (!$blnError) {
         if (!$this->blnEditMode) {
             try {
                 // Get an instance of the database
                 $objDatabase = QApplication::$Database[1];
                 // Begin a MySQL Transaction to be either committed or rolled back
                 $objDatabase->TransactionBegin();
                 // Create the new transaction object and save it
                 $this->objTransaction = new Transaction();
                 $this->objTransaction->EntityQtypeId = $intEntityQtypeId;
                 $this->objTransaction->TransactionTypeId = 7;
                 // Receive
                 $this->objTransaction->Note = $this->txtNote->Text;
                 $this->objTransaction->Save();
                 if ($intEntityQtypeId == EntityQtype::AssetInventory || $intEntityQtypeId == EntityQtype::Asset) {
                     // Assign different source and destinations depending on transaction type
                     foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
                         // Save the asset just to update the modified_date field so it can trigger an Optimistic Locking Exception when appropriate
                         if ($objAssetTransaction->Asset instanceof Asset) {
                             // Save the asset to update the modified_date field so it can trigger an Optimistic Locking Exception when appropriate
                             // Also set the location to 5 (TBR). This is in case the current LocationId is 2 (Shipped), because they can be received.
                             $objAssetTransaction->Asset->LocationId = 5;
                             // If the AssetId==0, then it is a newly created asset that hasn't been saved to the db yet
                             // We have to create a new asset object and assign it to the AssetTransaction
                             // Just resetting the values for the existing asset object won't work for some reason (not sure why).
                             if ($objAssetTransaction->Asset->AssetId == 0) {
                                 $objNewAsset = new Asset();
                                 $objNewAsset->AssetModelId = $objAssetTransaction->Asset->AssetModelId;
                                 $objNewAsset->TempId = $objAssetTransaction->Asset->TempId;
                                 $objNewAsset->LocationId = $objAssetTransaction->Asset->LocationId;
                                 // If the asset was selected for autogeneration, it will be blank, so create the asset code here (right before save)
                                 if ($objAssetTransaction->Asset->AssetCode == '') {
                                     $objAssetTransaction->Asset->AssetCode = Asset::GenerateAssetCode();
                                 }
                                 $objNewAsset->AssetCode = $objAssetTransaction->Asset->AssetCode;
                                 // Save the new asset
                                 $objNewAsset->Save();
                                 // Assign any default custom field values
                                 CustomField::AssignNewEntityDefaultValues(1, $objNewAsset->AssetId);
                                 // Assign the new asset to the AssetTransaction
                                 $objAssetTransaction->Asset = $objNewAsset;
                                 $objAssetTransaction->NewAssetFlag = true;
                             } else {
                                 $objAssetTransaction->NewAssetFlag = false;
                                 $objAssetTransaction->Asset->Save();
                             }
                             // Create the new assettransaction object and save it
                             $objAssetTransaction->TransactionId = $this->objTransaction->TransactionId;
                             $objAssetTransaction->Save();
                         }
                     }
                 }
                 if ($intEntityQtypeId == EntityQtype::AssetInventory || $intEntityQtypeId == EntityQtype::Inventory) {
                     // Assign different source and destinations depending on transaction type
                     foreach ($this->objInventoryTransactionArray as &$objInventoryTransaction) {
                         // Finish the InventoryTransaction and save it
                         $objInventoryTransaction->InventoryLocation->Quantity += $objInventoryTransaction->Quantity;
                         $objInventoryTransaction->InventoryLocation->Save();
//.........这里部分代码省略.........
开发者ID:proxymoron,项目名称:tracmor,代码行数:101,代码来源:receipt_edit.php

示例3: UpdateTransactionFields

 protected function UpdateTransactionFields()
 {
     $this->objTransaction->EntityQtypeId = $this->lstEntityQtype->SelectedValue;
     $this->objTransaction->TransactionTypeId = $this->lstTransactionType->SelectedValue;
     $this->objTransaction->Note = $this->txtNote->Text;
     $this->objTransaction->CreatedBy = $this->lstCreatedByObject->SelectedValue;
     $this->objTransaction->CreationDate = $this->calCreationDate->DateTime;
     $this->objTransaction->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
     $this->objTransaction->Receipt = Receipt::Load($this->lstReceipt->SelectedValue);
     $this->objTransaction->Shipment = Shipment::Load($this->lstShipment->SelectedValue);
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:11,代码来源:TransactionEditFormBase.class.php

示例4: Create

 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this ReceiptMetaControl
  * @param integer $intReceiptId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing Receipt object creation - defaults to CreateOrEdit
  * @return ReceiptMetaControl
  */
 public static function Create($objParentObject, $intReceiptId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intReceiptId)) {
         $objReceipt = Receipt::Load($intReceiptId);
         // Receipt was found -- return it!
         if ($objReceipt) {
             return new ReceiptMetaControl($objParentObject, $objReceipt);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a Receipt object with PK arguments: ' . $intReceiptId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new ReceiptMetaControl($objParentObject, new Receipt());
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:34,代码来源:ReceiptMetaControlGen.class.php

示例5: btnEdit_Click

 public function btnEdit_Click($strFormId, $strControlId, $strParameter)
 {
     $strParameterArray = explode(',', $strParameter);
     $objReceipt = Receipt::Load($strParameterArray[0]);
     $objEditPanel = new ReceiptEditPanel($this, $this->strCloseEditPanelMethod, $objReceipt);
     $strMethodName = $this->strSetEditPanelMethod;
     $this->objForm->{$strMethodName}($objEditPanel);
 }
开发者ID:heshuai64,项目名称:einv2,代码行数:8,代码来源:ReceiptListPanelBase.class.php

示例6: ReceiptComplete

 /**
  * Load an Reciept Object
  * The method should check for assets or inventory in reciept that is still 'To Be Received' (TBR)
  *
  * @param int $intReceiptId
  * @return Receipt
  */
 public function ReceiptComplete($intReceiptId)
 {
     $objClauses = null;
     $blnAllAssetsReceived = true;
     $blnAllInventoryReceived = true;
     $objReceipt = Receipt::Load($intReceiptId);
     if ($objReceipt) {
         if (!$objReceipt->ReceivedFlag) {
             $objInventoryTransactionArray = InventoryTransaction::LoadArrayByTransactionId($objReceipt->TransactionId, $objClauses);
             $objAssetTransactionArray = AssetTransaction::LoadArrayByTransactionId($objReceipt->TransactionId, $objClauses);
             foreach ($objAssetTransactionArray as &$objAssetTransaction) {
                 if (!$objAssetTransaction->DestinationLocationId) {
                     $blnAllAssetsReceived = false;
                 }
             }
             if ($blnAllAssetsReceived) {
                 if ($objInventoryTransactionArray) {
                     foreach ($objInventoryTransactionArray as $objInventoryTransaction) {
                         if (!$objInventoryTransaction->DestinationLocationId) {
                             $blnAllInventoryReceived = false;
                         }
                     }
                 }
                 // Set the entire receipt as received if assets and inventory have all been received
                 if ($blnAllInventoryReceived) {
                     $objReceipt->ReceivedFlag = true;
                     $objReceipt->ReceiptDate = new QDateTime(QDateTime::Now);
                     $objReceipt->Save();
                 }
             }
         }
         return $objReceipt;
     } else {
         return false;
     }
 }
开发者ID:brustj,项目名称:tracmor,代码行数:43,代码来源:Receipt.class.php

示例7: btnApply_Click

 public function btnApply_Click($strFormId, $strControlId, $strParameter)
 {
     $this->clearWarnings();
     $blnError = false;
     // Get an instance of the database
     $objDatabase = QApplication::$Database[1];
     // Begin a MySQL Transaction to be either committed or rolled back
     $objDatabase->TransactionBegin();
     if (count($this->arrCustomFields) > 0) {
         $customFieldIdArray = array();
         // preparing data to edit
         foreach ($this->arrCustomFields as $field) {
             if ($this->arrCheckboxes[$field['input']->strControlId]->Checked) {
                 if ($field['input'] instanceof QTextBox && $field['input']->Required && $field['input']->Text == null || $field['input'] instanceof QListBox && $field['input']->Required && $field['input']->SelectedValue == null) {
                     $blnError = true;
                     $field['input']->Warning = "Required.";
                 } else {
                     $this->arrCustomFieldsToEdit[] = $field;
                     $customFieldIdArray[] = (int) str_replace('cf', '', $field['input']->strControlId);
                 }
             }
         }
     }
     // Apply checked main_table fields
     $set = array(sprintf('`modified_by`= %s', QApplication::$objUserAccount->UserAccountId));
     if ($this->chkToCompany->Checked) {
         if ($this->lstToContact->SelectedValue) {
             $set[] = sprintf('`to_contact_id`="%s"', $this->lstToContact->SelectedValue);
         } else {
             $this->lstToContact->Warning = 'Contact name must be chosen';
             $blnError = true;
         }
         if ($this->lstToAddress->SelectedValue) {
             $set[] = sprintf('`to_address_id`="%s"', $this->lstToAddress->SelectedValue);
         } else {
             $this->lstToAddress->Warning = 'Address name must be chosen';
             $blnError = true;
         }
     }
     if ($this->chkFromCompany->Checked) {
         if ($this->lstFromCompany->SelectedValue) {
             $set[] = sprintf('`from_company_id`="%s"', $this->lstFromCompany->SelectedValue);
         } else {
             $this->lstFromCompany->Warning = 'Company name must be chosen';
             $blnError = true;
         }
         if ($this->lstFromContact->SelectedValue) {
             $set[] = sprintf('`from_contact_id`="%s"', $this->lstFromContact->SelectedValue);
         } else {
             $this->lstFromContact->Warning = 'Contact name must be chosen';
             $blnError = true;
         }
     }
     if ($this->chkDateReceived->Checked && $this->calDateReceived->DateTime) {
         // Check all receipts are completed
         if (Receipt::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Receipt()->ReceivedFlag, 0), QQ::In(QQN::Receipt()->ReceiptId, $this->arrReceiptToEdit))) > 0) {
             $this->calDateReceived->Warning = 'Can be set only for completed receipts';
             $blnError = true;
         } else {
             $set[] = sprintf('`receipt_date`="%s"', $this->calDateReceived->DateTime->__toString('YYYY-MM-DD'));
         }
     }
     if ($this->chkDateDue->Checked && $this->calDateDue->DateTime) {
         $set[] = sprintf('`due_date`="%s"', $this->calDateDue->DateTime->__toString('YYYY-MM-DD'));
     }
     if (!$blnError) {
         try {
             // Modifying transactions
             foreach ($this->arrReceiptToEdit as $intReceiptId) {
                 $objTransaction = Transaction::Load(Receipt::Load($intReceiptId)->Transaction->TransactionId);
                 $objTransaction->ModifiedBy = QApplication::$objUserAccount->UserAccountId;
                 if ($this->chkNote->Checked) {
                     $objTransaction->Note = $this->txtNote->Text;
                 }
                 $objTransaction->Save();
             }
             if (count($this->arrCustomFieldsToEdit) > 0) {
                 // Save the values from all of the custom field controls to save the asset
                 foreach ($this->arrReceiptToEdit as $intReceiptId) {
                     $objCustomFieldsArray = CustomField::LoadObjCustomFieldArray(EntityQtype::Receipt, false);
                     $selectedCustomFieldsArray = array();
                     foreach ($objCustomFieldsArray as $objCustomField) {
                         if (in_array($objCustomField->CustomFieldId, $customFieldIdArray)) {
                             $selectedCustomFieldsArray[] = $objCustomField;
                         }
                     }
                     CustomField::SaveControls($selectedCustomFieldsArray, true, $this->arrCustomFieldsToEdit, $intReceiptId, EntityQtype::Receipt);
                 }
                 $this->arrCustomFieldsToEdit = array();
             }
             // Update Transaction
             // Update main table
             $strQuery = sprintf("UPDATE `receipt`\n                                     SET " . implode(",", $set) . "\n                                     WHERE `receipt_id` IN (%s)", implode(",", $this->arrReceiptToEdit));
             $objDatabase->NonQuery($strQuery);
             $objDatabase->TransactionCommit();
             QApplication::Redirect('');
         } catch (QMySqliDatabaseException $objExc) {
             $objDatabase->TransactionRollback();
             throw new QDatabaseException();
         }
//.........这里部分代码省略.........
开发者ID:proxymoron,项目名称:tracmor,代码行数:101,代码来源:ReceiptMassEditPanel.class.php

示例8: btnMassDelete_Click

 protected function btnMassDelete_Click()
 {
     $items = $this->dtgReceipt->getSelected('ReceiptId');
     if (count($items) > 0) {
         $this->lblWarning->Text = "";
         $arrToSkip = array();
         // Separating items able to be deleted
         foreach ($items as $item) {
             $receiptToDelete = Receipt::Load($item);
             $objAssetTransactionArray = AssetTransaction::LoadArrayByTransactionId($receiptToDelete->TransactionId);
             $objInventoryTransactionArray = InventoryTransaction::LoadArrayByTransactionId($receiptToDelete->TransactionId);
             $blnError = false;
             if ($objAssetTransactionArray) {
                 foreach ($objAssetTransactionArray as $objAssetTransaction) {
                     if ($objAssetTransaction->blnReturnReceivedStatus()) {
                         $blnError = true;
                     }
                 }
             }
             if ($objInventoryTransactionArray) {
                 foreach ($objInventoryTransactionArray as $objInventoryTransaction) {
                     if ($objInventoryTransaction->blnReturnReceivedStatus()) {
                         $blnError = true;
                     }
                 }
             }
             if ($blnError) {
                 $arrToSkip[] = $receiptToDelete->ReceiptNumber;
             } else {
                 $this->arrToDelete[] = $receiptToDelete;
                 // objects stored in array!
             }
         }
         if (count($arrToSkip) > 0) {
             if (count($arrToSkip) == 1) {
                 $toBe = 'is';
                 $ending = '';
             } else {
                 $toBe = 'are';
                 $ending = 's';
             }
             $this->dlgMassDelete->Text = sprintf("There %s %s Receipt%s that %s not able to be deleted.\n                                                         Would you like to continue the deletion process,\n                                                         skipping these item%s?<br />", $toBe, count($arrToSkip), $ending, $toBe, $ending);
             $this->dlgMassDelete->ShowDialogBox();
         } else {
             if (count($this->arrToDelete) > 0) {
                 try {
                     // Get an instance of the database
                     $objDatabase = QApplication::$Database[1];
                     // Begin a MySQL Transaction to be either committed or rolled back
                     $objDatabase->TransactionBegin();
                     foreach ($this->arrToDelete as $receipt) {
                         $this->receiptDelete($receipt);
                     }
                     $objDatabase->TransactionCommit();
                     $this->arrToDelete = array();
                     QApplication::Redirect('');
                 } catch (QMySqliDatabaseException $objExc) {
                     $objDatabase->TransactionRollback();
                     throw new QDatabaseException();
                 }
             }
         }
     } else {
         $this->lblWarning->Text = "You haven't chosen any Receipt to Delete";
     }
 }
开发者ID:jdellinger,项目名称:tracmor,代码行数:66,代码来源:receipt_list.php

示例9: SaveTransaction

 /**
  * This will save this object's Transaction instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveTransaction()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstEntityQtype) {
             $this->objTransaction->EntityQtypeId = $this->lstEntityQtype->SelectedValue;
         }
         if ($this->lstTransactionType) {
             $this->objTransaction->TransactionTypeId = $this->lstTransactionType->SelectedValue;
         }
         if ($this->txtNote) {
             $this->objTransaction->Note = $this->txtNote->Text;
         }
         if ($this->lstCreatedByObject) {
             $this->objTransaction->CreatedBy = $this->lstCreatedByObject->SelectedValue;
         }
         if ($this->calCreationDate) {
             $this->objTransaction->CreationDate = $this->calCreationDate->DateTime;
         }
         if ($this->lstModifiedByObject) {
             $this->objTransaction->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstReceipt) {
             $this->objTransaction->Receipt = Receipt::Load($this->lstReceipt->SelectedValue);
         }
         if ($this->lstShipment) {
             $this->objTransaction->Shipment = Shipment::Load($this->lstShipment->SelectedValue);
         }
         // Save the Transaction object
         $this->objTransaction->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:41,代码来源:TransactionMetaControlGen.class.php

示例10: Reload

 /**
  * Reload this Receipt from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved Receipt object.');
     }
     // Reload the Object
     $objReloaded = Receipt::Load($this->intReceiptId);
     // Update $this's local variables to match
     $this->TransactionId = $objReloaded->TransactionId;
     $this->FromCompanyId = $objReloaded->FromCompanyId;
     $this->FromContactId = $objReloaded->FromContactId;
     $this->ToContactId = $objReloaded->ToContactId;
     $this->ToAddressId = $objReloaded->ToAddressId;
     $this->strReceiptNumber = $objReloaded->strReceiptNumber;
     $this->dttDueDate = $objReloaded->dttDueDate;
     $this->dttReceiptDate = $objReloaded->dttReceiptDate;
     $this->blnReceivedFlag = $objReloaded->blnReceivedFlag;
     $this->CreatedBy = $objReloaded->CreatedBy;
     $this->dttCreationDate = $objReloaded->dttCreationDate;
     $this->ModifiedBy = $objReloaded->ModifiedBy;
     $this->strModifiedDate = $objReloaded->strModifiedDate;
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:27,代码来源:ReceiptGen.class.php

示例11: __get

 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'ReceiptId':
             // Gets the value for intReceiptId (PK)
             // @return integer
             return $this->intReceiptId;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Receipt':
             // Gets the value for the Receipt object referenced by intReceiptId (PK)
             // @return Receipt
             try {
                 if (!$this->objReceipt && !is_null($this->intReceiptId)) {
                     $this->objReceipt = Receipt::Load($this->intReceiptId);
                 }
                 return $this->objReceipt;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:54,代码来源:ReceiptCustomFieldHelperGen.class.php


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