protected function SetupTransaction()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intTransactionId = QApplication::QueryString('intTransactionId');
     if ($intTransactionId) {
         $this->objTransaction = Transaction::Load($intTransactionId);
         if (!$this->objTransaction) {
             throw new Exception('Could not find a Transaction object with PK arguments: ' . $intTransactionId);
         }
         //$this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objTransaction = new Transaction();
         //$this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
Exemple #2
0
 /**
  * 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 (Read-Only PK)
              * @return integer
              */
             return $this->intReceiptId;
         case 'TransactionId':
             /**
              * Gets the value for intTransactionId (Unique)
              * @return integer
              */
             return $this->intTransactionId;
         case 'FromCompanyId':
             /**
              * Gets the value for intFromCompanyId (Not Null)
              * @return integer
              */
             return $this->intFromCompanyId;
         case 'FromContactId':
             /**
              * Gets the value for intFromContactId (Not Null)
              * @return integer
              */
             return $this->intFromContactId;
         case 'ToContactId':
             /**
              * Gets the value for intToContactId (Not Null)
              * @return integer
              */
             return $this->intToContactId;
         case 'ToAddressId':
             /**
              * Gets the value for intToAddressId (Not Null)
              * @return integer
              */
             return $this->intToAddressId;
         case 'ReceiptNumber':
             /**
              * Gets the value for strReceiptNumber (Unique)
              * @return string
              */
             return $this->strReceiptNumber;
         case 'DueDate':
             /**
              * Gets the value for dttDueDate 
              * @return QDateTime
              */
             return $this->dttDueDate;
         case 'ReceiptDate':
             /**
              * Gets the value for dttReceiptDate 
              * @return QDateTime
              */
             return $this->dttReceiptDate;
         case 'ReceivedFlag':
             /**
              * Gets the value for blnReceivedFlag 
              * @return boolean
              */
             return $this->blnReceivedFlag;
         case 'CreatedBy':
             /**
              * Gets the value for intCreatedBy 
              * @return integer
              */
             return $this->intCreatedBy;
         case 'CreationDate':
             /**
              * Gets the value for dttCreationDate 
              * @return QDateTime
              */
             return $this->dttCreationDate;
         case 'ModifiedBy':
             /**
              * Gets the value for intModifiedBy 
              * @return integer
              */
             return $this->intModifiedBy;
         case 'ModifiedDate':
             /**
              * Gets the value for strModifiedDate (Read-Only Timestamp)
              * @return string
              */
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Transaction':
             /**
              * Gets the value for the Transaction object referenced by intTransactionId (Unique)
              * @return Transaction
              */
             try {
                 if (!$this->objTransaction && !is_null($this->intTransactionId)) {
                     $this->objTransaction = Transaction::Load($this->intTransactionId);
                 }
                 return $this->objTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'FromCompany':
             /**
              * Gets the value for the Company object referenced by intFromCompanyId (Not Null)
              * @return Company
              */
             try {
                 if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) {
                     $this->objFromCompany = Company::Load($this->intFromCompanyId);
                 }
                 return $this->objFromCompany;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'FromContact':
             /**
              * Gets the value for the Contact object referenced by intFromContactId (Not Null)
              * @return Contact
              */
             try {
                 if (!$this->objFromContact && !is_null($this->intFromContactId)) {
                     $this->objFromContact = Contact::Load($this->intFromContactId);
                 }
                 return $this->objFromContact;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ToContact':
             /**
              * Gets the value for the Contact object referenced by intToContactId (Not Null)
              * @return Contact
              */
             try {
                 if (!$this->objToContact && !is_null($this->intToContactId)) {
                     $this->objToContact = Contact::Load($this->intToContactId);
                 }
                 return $this->objToContact;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ToAddress':
             /**
              * Gets the value for the Address object referenced by intToAddressId (Not Null)
              * @return Address
              */
             try {
                 if (!$this->objToAddress && !is_null($this->intToAddressId)) {
                     $this->objToAddress = Address::Load($this->intToAddressId);
                 }
                 return $this->objToAddress;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intCreatedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intModifiedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } 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)
         ////////////////////////////
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Exemple #3
0
 protected function UpdateShipmentFields()
 {
     if (!$this->blnEditMode) {
         //$this->objShipment->TransactionId = $this->objTransaction->TransactionId;
         $this->objShipment->Transaction = $this->objTransaction;
     }
     if ($this->blnEditMode) {
         if (!$this->objTransaction) {
             $this->objTransaction = Transaction::Load($this->objShipment->TransactionId);
         }
         $this->objShipment->Transaction = $this->objTransaction;
         $this->objShipment->ShipmentNumber = $this->lblShipmentNumber->Text;
     } elseif (QApplication::$TracmorSettings->CustomShipmentNumbers) {
         $this->objShipment->ShipmentNumber = $this->txtShipmentNumber->Text;
     } else {
         $this->objShipment->ShipmentNumber = Shipment::LoadNewShipmentNumber();
     }
     $this->objShipment->ToContactId = $this->lstToContact->SelectedValue;
     $this->objShipment->FromCompanyId = $this->lstFromCompany->SelectedValue;
     $this->objShipment->FromContactId = $this->lstFromContact->SelectedValue;
     $this->objShipment->ShipDate = $this->calShipDate->DateTime;
     $this->objShipment->FromAddressId = $this->lstFromAddress->SelectedValue;
     $this->objShipment->ToCompanyId = $this->lstToCompany->SelectedValue;
     $this->objShipment->ToAddressId = $this->lstToAddress->SelectedValue;
     $this->objShipment->CourierId = $this->lstCourier->SelectedValue;
     //if (!$this->lstCourier->SelectedValue) {
     $this->objShipment->TrackingNumber = $this->txtTrackingNumber->Text;
     //}
     // Reload the Assets and inventory locations so that they don't trigger an OLE if completing the shipment without reloading after adding an asset or inventory.
     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);
         }
     }
 }
Exemple #4
0
 protected function btnMassDeleteConfirm_Click()
 {
     if (count($this->arrToDelete) > 0) {
         foreach ($this->arrToDelete as $shipment) {
             $objTransaction = Transaction::Load($shipment->TransactionId);
             $objTransaction->Delete();
         }
         $this->arrToDelete = array();
     }
     $this->dlgMassDelete->HideDialogBox();
     QApplication::Redirect('');
 }
 /**
  * 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 'AssetTransactionId':
             // Gets the value for intAssetTransactionId (Read-Only PK)
             // @return integer
             return $this->intAssetTransactionId;
         case 'AssetId':
             // Gets the value for intAssetId (Not Null)
             // @return integer
             return $this->intAssetId;
         case 'TransactionId':
             // Gets the value for intTransactionId (Not Null)
             // @return integer
             return $this->intTransactionId;
         case 'ParentAssetTransactionId':
             // Gets the value for intParentAssetTransactionId
             // @return integer
             return $this->intParentAssetTransactionId;
         case 'SourceLocationId':
             // Gets the value for intSourceLocationId
             // @return integer
             return $this->intSourceLocationId;
         case 'DestinationLocationId':
             // Gets the value for intDestinationLocationId
             // @return integer
             return $this->intDestinationLocationId;
         case 'NewAssetFlag':
             // Gets the value for blnNewAssetFlag
             // @return boolean
             return $this->blnNewAssetFlag;
         case 'NewAssetId':
             // Gets the value for intNewAssetId
             // @return integer
             return $this->intNewAssetId;
         case 'ScheduleReceiptFlag':
             // Gets the value for blnScheduleReceiptFlag
             // @return boolean
             return $this->blnScheduleReceiptFlag;
         case 'ScheduleReceiptDueDate':
             // Gets the value for dttScheduleReceiptDueDate
             // @return QDateTime
             return $this->dttScheduleReceiptDueDate;
         case 'CreatedBy':
             // Gets the value for intCreatedBy
             // @return integer
             return $this->intCreatedBy;
         case 'CreationDate':
             // Gets the value for dttCreationDate
             // @return QDateTime
             return $this->dttCreationDate;
         case 'ModifiedBy':
             // Gets the value for intModifiedBy
             // @return integer
             return $this->intModifiedBy;
         case 'ModifiedDate':
             // Gets the value for strModifiedDate (Read-Only Timestamp)
             // @return string
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Asset':
             // Gets the value for the Asset object referenced by intAssetId (Not Null)
             // @return Asset
             try {
                 if (!$this->objAsset && !is_null($this->intAssetId)) {
                     $this->objAsset = Asset::Load($this->intAssetId);
                 }
                 return $this->objAsset;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Transaction':
             // Gets the value for the Transaction object referenced by intTransactionId (Not Null)
             // @return Transaction
             try {
                 if (!$this->objTransaction && !is_null($this->intTransactionId)) {
                     $this->objTransaction = Transaction::Load($this->intTransactionId);
                 }
                 return $this->objTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ParentAssetTransaction':
             // Gets the value for the AssetTransaction object referenced by intParentAssetTransactionId
             // @return AssetTransaction
             try {
                 if (!$this->objParentAssetTransaction && !is_null($this->intParentAssetTransactionId)) {
                     $this->objParentAssetTransaction = AssetTransaction::Load($this->intParentAssetTransactionId);
                 }
                 return $this->objParentAssetTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'SourceLocation':
             // Gets the value for the Location object referenced by intSourceLocationId
             // @return Location
             try {
                 if (!$this->objSourceLocation && !is_null($this->intSourceLocationId)) {
                     $this->objSourceLocation = Location::Load($this->intSourceLocationId);
                 }
                 return $this->objSourceLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DestinationLocation':
             // Gets the value for the Location object referenced by intDestinationLocationId
             // @return Location
             try {
                 if (!$this->objDestinationLocation && !is_null($this->intDestinationLocationId)) {
                     $this->objDestinationLocation = Location::Load($this->intDestinationLocationId);
                 }
                 return $this->objDestinationLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'NewAsset':
             // Gets the value for the Asset object referenced by intNewAssetId
             // @return Asset
             try {
                 if (!$this->objNewAsset && !is_null($this->intNewAssetId)) {
                     $this->objNewAsset = Asset::Load($this->intNewAssetId);
                 }
                 return $this->objNewAsset;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             // Gets the value for the UserAccount object referenced by intCreatedBy
             // @return UserAccount
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             // Gets the value for the UserAccount object referenced by intModifiedBy
             // @return UserAccount
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'AssetTransactionCheckout':
             // Gets the value for the AssetTransactionCheckout object that uniquely references this AssetTransaction
             // by objAssetTransactionCheckout (Unique)
             // @return AssetTransactionCheckout
             try {
                 if ($this->objAssetTransactionCheckout === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objAssetTransactionCheckout) {
                     $this->objAssetTransactionCheckout = AssetTransactionCheckout::LoadByAssetTransactionId($this->intAssetTransactionId);
                 }
                 return $this->objAssetTransactionCheckout;
             } 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 '_ChildAssetTransaction':
             // Gets the value for the private _objChildAssetTransaction (Read-Only)
             // if set due to an expansion on the asset_transaction.parent_asset_transaction_id reverse relationship
             // @return AssetTransaction
             return $this->_objChildAssetTransaction;
         case '_ChildAssetTransactionArray':
             // Gets the value for the private _objChildAssetTransactionArray (Read-Only)
             // if set due to an ExpandAsArray on the asset_transaction.parent_asset_transaction_id reverse relationship
             // @return AssetTransaction[]
             return (array) $this->_objChildAssetTransactionArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * 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 'ShipmentId':
             // Gets the value for intShipmentId (Read-Only PK)
             // @return integer
             return $this->intShipmentId;
         case 'ShipmentNumber':
             // Gets the value for strShipmentNumber (Unique)
             // @return string
             return $this->strShipmentNumber;
         case 'TransactionId':
             // Gets the value for intTransactionId (Unique)
             // @return integer
             return $this->intTransactionId;
         case 'FromCompanyId':
             // Gets the value for intFromCompanyId (Not Null)
             // @return integer
             return $this->intFromCompanyId;
         case 'FromContactId':
             // Gets the value for intFromContactId (Not Null)
             // @return integer
             return $this->intFromContactId;
         case 'FromAddressId':
             // Gets the value for intFromAddressId (Not Null)
             // @return integer
             return $this->intFromAddressId;
         case 'ToCompanyId':
             // Gets the value for intToCompanyId (Not Null)
             // @return integer
             return $this->intToCompanyId;
         case 'ToContactId':
             // Gets the value for intToContactId (Not Null)
             // @return integer
             return $this->intToContactId;
         case 'ToAddressId':
             // Gets the value for intToAddressId (Not Null)
             // @return integer
             return $this->intToAddressId;
         case 'CourierId':
             // Gets the value for intCourierId
             // @return integer
             return $this->intCourierId;
         case 'TrackingNumber':
             // Gets the value for strTrackingNumber
             // @return string
             return $this->strTrackingNumber;
         case 'ShipDate':
             // Gets the value for dttShipDate (Not Null)
             // @return QDateTime
             return $this->dttShipDate;
         case 'ShippedFlag':
             // Gets the value for blnShippedFlag
             // @return boolean
             return $this->blnShippedFlag;
         case 'CreatedBy':
             // Gets the value for intCreatedBy
             // @return integer
             return $this->intCreatedBy;
         case 'CreationDate':
             // Gets the value for dttCreationDate
             // @return QDateTime
             return $this->dttCreationDate;
         case 'ModifiedBy':
             // Gets the value for intModifiedBy
             // @return integer
             return $this->intModifiedBy;
         case 'ModifiedDate':
             // Gets the value for strModifiedDate (Read-Only Timestamp)
             // @return string
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Transaction':
             // Gets the value for the Transaction object referenced by intTransactionId (Unique)
             // @return Transaction
             try {
                 if (!$this->objTransaction && !is_null($this->intTransactionId)) {
                     $this->objTransaction = Transaction::Load($this->intTransactionId);
                 }
                 return $this->objTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'FromCompany':
             // Gets the value for the Company object referenced by intFromCompanyId (Not Null)
             // @return Company
             try {
                 if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) {
                     $this->objFromCompany = Company::Load($this->intFromCompanyId);
                 }
                 return $this->objFromCompany;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'FromContact':
             // Gets the value for the Contact object referenced by intFromContactId (Not Null)
             // @return Contact
             try {
                 if (!$this->objFromContact && !is_null($this->intFromContactId)) {
                     $this->objFromContact = Contact::Load($this->intFromContactId);
                 }
                 return $this->objFromContact;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'FromAddress':
             // Gets the value for the Address object referenced by intFromAddressId (Not Null)
             // @return Address
             try {
                 if (!$this->objFromAddress && !is_null($this->intFromAddressId)) {
                     $this->objFromAddress = Address::Load($this->intFromAddressId);
                 }
                 return $this->objFromAddress;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ToCompany':
             // Gets the value for the Company object referenced by intToCompanyId (Not Null)
             // @return Company
             try {
                 if (!$this->objToCompany && !is_null($this->intToCompanyId)) {
                     $this->objToCompany = Company::Load($this->intToCompanyId);
                 }
                 return $this->objToCompany;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ToContact':
             // Gets the value for the Contact object referenced by intToContactId (Not Null)
             // @return Contact
             try {
                 if (!$this->objToContact && !is_null($this->intToContactId)) {
                     $this->objToContact = Contact::Load($this->intToContactId);
                 }
                 return $this->objToContact;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ToAddress':
             // Gets the value for the Address object referenced by intToAddressId (Not Null)
             // @return Address
             try {
                 if (!$this->objToAddress && !is_null($this->intToAddressId)) {
                     $this->objToAddress = Address::Load($this->intToAddressId);
                 }
                 return $this->objToAddress;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Courier':
             // Gets the value for the Courier object referenced by intCourierId
             // @return Courier
             try {
                 if (!$this->objCourier && !is_null($this->intCourierId)) {
                     $this->objCourier = Courier::Load($this->intCourierId);
                 }
                 return $this->objCourier;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             // Gets the value for the UserAccount object referenced by intCreatedBy
             // @return UserAccount
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             // Gets the value for the UserAccount object referenced by intModifiedBy
             // @return UserAccount
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ShipmentCustomFieldHelper':
             // Gets the value for the ShipmentCustomFieldHelper object that uniquely references this Shipment
             // by objShipmentCustomFieldHelper (Unique)
             // @return ShipmentCustomFieldHelper
             try {
                 if ($this->objShipmentCustomFieldHelper === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objShipmentCustomFieldHelper) {
                     $this->objShipmentCustomFieldHelper = ShipmentCustomFieldHelper::LoadByShipmentId($this->intShipmentId);
                 }
                 return $this->objShipmentCustomFieldHelper;
             } 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;
             }
     }
 }
 public function btnEdit_Click($strFormId, $strControlId, $strParameter)
 {
     $strParameterArray = explode(',', $strParameter);
     $objTransaction = Transaction::Load($strParameterArray[0]);
     $objEditPanel = new TransactionEditPanel($this, $this->strCloseEditPanelMethod, $objTransaction);
     $strMethodName = $this->strSetEditPanelMethod;
     $this->objForm->{$strMethodName}($objEditPanel);
 }
 /**
  * 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 'AssetTransactionId':
             /**
              * Gets the value for intAssetTransactionId (Read-Only PK)
              * @return integer
              */
             return $this->intAssetTransactionId;
         case 'AssetId':
             /**
              * Gets the value for intAssetId (Not Null)
              * @return integer
              */
             return $this->intAssetId;
         case 'TransactionId':
             /**
              * Gets the value for intTransactionId (Not Null)
              * @return integer
              */
             return $this->intTransactionId;
         case 'ParentAssetTransactionId':
             /**
              * Gets the value for intParentAssetTransactionId 
              * @return integer
              */
             return $this->intParentAssetTransactionId;
         case 'SourceLocationId':
             /**
              * Gets the value for intSourceLocationId 
              * @return integer
              */
             return $this->intSourceLocationId;
         case 'DestinationLocationId':
             /**
              * Gets the value for intDestinationLocationId 
              * @return integer
              */
             return $this->intDestinationLocationId;
         case 'NewAssetFlag':
             /**
              * Gets the value for blnNewAssetFlag 
              * @return boolean
              */
             return $this->blnNewAssetFlag;
         case 'NewAssetId':
             /**
              * Gets the value for intNewAssetId 
              * @return integer
              */
             return $this->intNewAssetId;
         case 'ScheduleReceiptFlag':
             /**
              * Gets the value for blnScheduleReceiptFlag 
              * @return boolean
              */
             return $this->blnScheduleReceiptFlag;
         case 'ScheduleReceiptDueDate':
             /**
              * Gets the value for dttScheduleReceiptDueDate 
              * @return QDateTime
              */
             return $this->dttScheduleReceiptDueDate;
         case 'CreatedBy':
             /**
              * Gets the value for intCreatedBy 
              * @return integer
              */
             return $this->intCreatedBy;
         case 'CreationDate':
             /**
              * Gets the value for dttCreationDate 
              * @return QDateTime
              */
             return $this->dttCreationDate;
         case 'ModifiedBy':
             /**
              * Gets the value for intModifiedBy 
              * @return integer
              */
             return $this->intModifiedBy;
         case 'ModifiedDate':
             /**
              * Gets the value for strModifiedDate (Read-Only Timestamp)
              * @return string
              */
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Asset':
             /**
              * Gets the value for the Asset object referenced by intAssetId (Not Null)
              * @return Asset
              */
             try {
                 if (!$this->objAsset && !is_null($this->intAssetId)) {
                     $this->objAsset = Asset::Load($this->intAssetId);
                 }
                 return $this->objAsset;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Transaction':
             /**
              * Gets the value for the Transaction object referenced by intTransactionId (Not Null)
              * @return Transaction
              */
             try {
                 if (!$this->objTransaction && !is_null($this->intTransactionId)) {
                     $this->objTransaction = Transaction::Load($this->intTransactionId);
                 }
                 return $this->objTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ParentAssetTransaction':
             /**
              * Gets the value for the AssetTransaction object referenced by intParentAssetTransactionId 
              * @return AssetTransaction
              */
             try {
                 if (!$this->objParentAssetTransaction && !is_null($this->intParentAssetTransactionId)) {
                     $this->objParentAssetTransaction = AssetTransaction::Load($this->intParentAssetTransactionId);
                 }
                 return $this->objParentAssetTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'SourceLocation':
             /**
              * Gets the value for the Location object referenced by intSourceLocationId 
              * @return Location
              */
             try {
                 if (!$this->objSourceLocation && !is_null($this->intSourceLocationId)) {
                     $this->objSourceLocation = Location::Load($this->intSourceLocationId);
                 }
                 return $this->objSourceLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DestinationLocation':
             /**
              * Gets the value for the Location object referenced by intDestinationLocationId 
              * @return Location
              */
             try {
                 if (!$this->objDestinationLocation && !is_null($this->intDestinationLocationId)) {
                     $this->objDestinationLocation = Location::Load($this->intDestinationLocationId);
                 }
                 return $this->objDestinationLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'NewAsset':
             /**
              * Gets the value for the Asset object referenced by intNewAssetId 
              * @return Asset
              */
             try {
                 if (!$this->objNewAsset && !is_null($this->intNewAssetId)) {
                     $this->objNewAsset = Asset::Load($this->intNewAssetId);
                 }
                 return $this->objNewAsset;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intCreatedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intModifiedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } 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 '_ChildAssetTransaction':
             /**
              * Gets the value for the private _objChildAssetTransaction (Read-Only)
              * if set due to an expansion on the asset_transaction.parent_asset_transaction_id reverse relationship
              * @return AssetTransaction
              */
             return $this->_objChildAssetTransaction;
         case '_ChildAssetTransactionArray':
             /**
              * Gets the value for the private _objChildAssetTransactionArray (Read-Only)
              * if set due to an ExpandAsArray on the asset_transaction.parent_asset_transaction_id reverse relationship
              * @return AssetTransaction[]
              */
             return (array) $this->_objChildAssetTransactionArray;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * 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 'InventoryTransactionId':
             /**
              * Gets the value for intInventoryTransactionId (Read-Only PK)
              * @return integer
              */
             return $this->intInventoryTransactionId;
         case 'InventoryLocationId':
             /**
              * Gets the value for intInventoryLocationId (Not Null)
              * @return integer
              */
             return $this->intInventoryLocationId;
         case 'TransactionId':
             /**
              * Gets the value for intTransactionId (Not Null)
              * @return integer
              */
             return $this->intTransactionId;
         case 'Quantity':
             /**
              * Gets the value for intQuantity (Not Null)
              * @return integer
              */
             return $this->intQuantity;
         case 'SourceLocationId':
             /**
              * Gets the value for intSourceLocationId 
              * @return integer
              */
             return $this->intSourceLocationId;
         case 'DestinationLocationId':
             /**
              * Gets the value for intDestinationLocationId 
              * @return integer
              */
             return $this->intDestinationLocationId;
         case 'CreatedBy':
             /**
              * Gets the value for intCreatedBy 
              * @return integer
              */
             return $this->intCreatedBy;
         case 'CreationDate':
             /**
              * Gets the value for dttCreationDate 
              * @return QDateTime
              */
             return $this->dttCreationDate;
         case 'ModifiedBy':
             /**
              * Gets the value for intModifiedBy 
              * @return integer
              */
             return $this->intModifiedBy;
         case 'ModifiedDate':
             /**
              * Gets the value for strModifiedDate (Read-Only Timestamp)
              * @return string
              */
             return $this->strModifiedDate;
         case 'LocalWarehouseStock':
             /**
              * Gets the value for Local_warehouse_stock 
              * @return integer
              */
             return $this->intLocalWarehouseStock;
         case 'BadProductsWarehouseStock':
             /**
              * Gets the value for bad_products_warehouse_stock 
              * @return integer
              */
             return $this->intBadProductsWarehouseStock;
         case 'SampleWarehouseStock':
             /**
              * Gets the value for sample_warehouse_stock 
              * @return integer
              */
             return $this->intSampleWarehouseStock;
         case 'RepairWarehouseStock':
             /**
              * Gets the value for repair_warehouse_stock 
              * @return integer
              */
             return $this->intRepairWarehouseStock;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'InventoryLocation':
             /**
              * Gets the value for the InventoryLocation object referenced by intInventoryLocationId (Not Null)
              * @return InventoryLocation
              */
             try {
                 if (!$this->objInventoryLocation && !is_null($this->intInventoryLocationId)) {
                     $this->objInventoryLocation = InventoryLocation::Load($this->intInventoryLocationId);
                 }
                 return $this->objInventoryLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Transaction':
             /**
              * Gets the value for the Transaction object referenced by intTransactionId (Not Null)
              * @return Transaction
              */
             try {
                 if (!$this->objTransaction && !is_null($this->intTransactionId)) {
                     $this->objTransaction = Transaction::Load($this->intTransactionId);
                 }
                 return $this->objTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'SourceLocation':
             /**
              * Gets the value for the Location object referenced by intSourceLocationId 
              * @return Location
              */
             try {
                 if (!$this->objSourceLocation && !is_null($this->intSourceLocationId)) {
                     $this->objSourceLocation = Location::Load($this->intSourceLocationId);
                 }
                 return $this->objSourceLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DestinationLocation':
             /**
              * Gets the value for the Location object referenced by intDestinationLocationId 
              * @return Location
              */
             try {
                 if (!$this->objDestinationLocation && !is_null($this->intDestinationLocationId)) {
                     $this->objDestinationLocation = Location::Load($this->intDestinationLocationId);
                 }
                 return $this->objDestinationLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intCreatedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intModifiedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } 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)
         ////////////////////////////
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 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();
         }
     } else {
         $objDatabase->TransactionRollback();
         $this->arrCustomFieldsToEdit = array();
         $this->uncheck();
     }
 }
Exemple #11
0
 public function receiptDelete(Receipt $receipt)
 {
     $objAssetTransactionArray = AssetTransaction::LoadArrayByTransactionId($receipt->TransactionId);
     $objInventoryTransactionArray = InventoryTransaction::LoadArrayByTransactionId($receipt->TransactionId);
     // Take out the inventory from the TBR InventoryLocation
     if ($objInventoryTransactionArray) {
         foreach ($objInventoryTransactionArray as $objInventoryTransaction) {
             $objInventoryTransaction->InventoryLocation->Quantity -= $objInventoryTransaction->Quantity;
             $objInventoryTransaction->InventoryLocation->Save();
         }
     }
     // Delete any assets that were created while scheduling this receipt
     if ($objAssetTransactionArray) {
         foreach ($objAssetTransactionArray as $objAssetTransaction) {
             if ($objAssetTransaction->NewAssetFlag) {
                 $objAssetTransaction->Asset->Delete();
             }
         }
     }
     // Load the Transaction
     $objTransaction = Transaction::Load($receipt->TransactionId);
     // Delete the Transaction Object and let it MySQL CASCADE down to asset_transaction, inventory_transaction, and receipt
     $objTransaction->Delete();
 }
 /**
  * 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 TransactionMetaControl
  * @param integer $intTransactionId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing Transaction object creation - defaults to CreateOrEdit
  * @return TransactionMetaControl
  */
 public static function Create($objParentObject, $intTransactionId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intTransactionId)) {
         $objTransaction = Transaction::Load($intTransactionId);
         // Transaction was found -- return it!
         if ($objTransaction) {
             return new TransactionMetaControl($objParentObject, $objTransaction);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a Transaction object with PK arguments: ' . $intTransactionId);
             }
         }
         // 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 TransactionMetaControl($objParentObject, new Transaction());
 }
 public function btnApply_Click($strFormId, $strControlId, $strParameter)
 {
     $this->clearWarnings();
     $blnError = false;
     $objDatabase = QApplication::$Database[1];
     // Begin a MySQL Transaction to be either committed or rolled back
     $objDatabase->TransactionBegin();
     // Check "Contact To", "Contact From", "Coutrier" wasn't changed for shipped items
     if (Shipment::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Shipment()->ShippedFlag, 1), QQ::In(QQN::Shipment()->ShipmentId, $this->arrShipmentToEdit))) > 0 && ($this->chkToCompany->Checked || $this->chkFromCompany->Checked || $this->chkCourier->Checked)) {
         $this->lblWarning->Text = '"To Company", "From Company", "Courier" shouldn\'t be changed for already
                                     Shipped items';
         $blnError = true;
     }
     if (!$blnError) {
         // Apply checked main_table fields
         $set = array(sprintf('`modified_by`= %s', QApplication::$objUserAccount->UserAccountId));
         if ($this->chkToCompany->Checked) {
             if ($this->lstToCompany->SelectedValue) {
                 $set[] = sprintf('`to_company_id`="%s"', $this->lstToCompany->SelectedValue);
             } else {
                 $this->lstToCompany->Warning = 'Company name must be chosen';
                 $blnError = true;
             }
             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->lstToContact->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->lstFromAddress->SelectedValue) {
                 $set[] = sprintf('`from_address_id`="%s"', $this->lstFromAddress->SelectedValue);
             } else {
                 $this->lstFromAddress->Warning = 'Address name must be chosen';
                 $blnError = true;
             }
         }
         if ($this->chkCourier->Checked) {
             $set[] = sprintf('`courier_id`="%s"', $this->lstCourier->SelectedValue);
         }
         if ($this->chkShipDate->Checked && $this->calShipDate->DateTime) {
             $set[] = sprintf('`ship_date`="%s"', $this->calShipDate->DateTime->__toString('YYYY-MM-DD'));
         }
     }
     if (count($this->arrCustomFields) > 0) {
         $customFieldIdArray = array();
         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);
                 }
             }
         }
     }
     // Apdate main table
     if (!$blnError) {
         try {
             // Edit Transactions
             foreach ($this->arrShipmentToEdit as $intShipmetId) {
                 $objTransaction = Transaction::Load(Shipment::Load($intShipmetId)->Transaction->TransactionId);
                 $objTransaction->ModifiedBy = QApplication::$objUserAccount->UserAccountId;
                 if ($this->chkNote->Checked) {
                     $objTransaction->Note = $this->txtNote->Text;
                 }
                 $objTransaction->Save();
             }
             if (count($this->arrCustomFieldsToEdit) > 0) {
                 // preparing data to edit
                 // Save the values from all of the custom field controls to save the asset
                 foreach ($this->arrShipmentToEdit as $intShipmentId) {
                     $objCustomFieldsArray = CustomField::LoadObjCustomFieldArray(EntityQtype::Shipment, false);
                     $selectedCustomFieldsArray = array();
                     foreach ($objCustomFieldsArray as $objCustomField) {
                         if (in_array($objCustomField->CustomFieldId, $customFieldIdArray)) {
                             $selectedCustomFieldsArray[] = $objCustomField;
                         }
                     }
                     CustomField::SaveControls($selectedCustomFieldsArray, true, $this->arrCustomFieldsToEdit, $intShipmentId, EntityQtype::Shipment);
                 }
             }
             $strQuery = sprintf("UPDATE `shipment`\n                                     SET " . implode(",", $set) . "\n                                     WHERE `shipment_id` IN (%s)", implode(",", $this->arrShipmentToEdit));
             $objDatabase->NonQuery($strQuery);
             $objDatabase->TransactionCommit();
             $this->ParentControl->HideDialogBox();
             QApplication::Redirect('');
         } catch (QMySqliDatabaseException $objExc) {
             $objDatabase->TransactionRollback();
             throw new QDatabaseException();
         }
     } else {
         $objDatabase->TransactionRollback();
         $this->arrCustomFieldsToEdit = array();
         $this->uncheck();
     }
 }
Exemple #14
0
 /**
  * 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 'ShipmentId':
             /**
              * Gets the value for intShipmentId (Read-Only PK)
              * @return integer
              */
             return $this->intShipmentId;
         case 'ShipmentNumber':
             /**
              * Gets the value for strShipmentNumber (Unique)
              * @return string
              */
             return $this->strShipmentNumber;
         case 'TransactionId':
             /**
              * Gets the value for intTransactionId (Unique)
              * @return integer
              */
             return $this->intTransactionId;
         case 'FromCompanyId':
             /**
              * Gets the value for intFromCompanyId (Not Null)
              * @return integer
              */
             return $this->intFromCompanyId;
         case 'FromContactId':
             /**
              * Gets the value for intFromContactId (Not Null)
              * @return integer
              */
             return $this->intFromContactId;
         case 'FromAddressId':
             /**
              * Gets the value for intFromAddressId (Not Null)
              * @return integer
              */
             return $this->intFromAddressId;
         case 'ToCompanyId':
             /**
              * Gets the value for intToCompanyId (Not Null)
              * @return integer
              */
             return $this->intToCompanyId;
         case 'ToContactId':
             /**
              * Gets the value for intToContactId (Not Null)
              * @return integer
              */
             return $this->intToContactId;
         case 'ToAddressId':
             /**
              * Gets the value for intToAddressId (Not Null)
              * @return integer
              */
             return $this->intToAddressId;
         case 'CourierId':
             /**
              * Gets the value for intCourierId 
              * @return integer
              */
             return $this->intCourierId;
         case 'TrackingNumber':
             /**
              * Gets the value for strTrackingNumber 
              * @return string
              */
             return $this->strTrackingNumber;
         case 'ShipDate':
             /**
              * Gets the value for dttShipDate (Not Null)
              * @return QDateTime
              */
             return $this->dttShipDate;
         case 'ShippedFlag':
             /**
              * Gets the value for blnShippedFlag 
              * @return boolean
              */
             return $this->blnShippedFlag;
         case 'CreatedBy':
             /**
              * Gets the value for intCreatedBy 
              * @return integer
              */
             return $this->intCreatedBy;
         case 'CreationDate':
             /**
              * Gets the value for dttCreationDate 
              * @return QDateTime
              */
             return $this->dttCreationDate;
         case 'ModifiedBy':
             /**
              * Gets the value for intModifiedBy 
              * @return integer
              */
             return $this->intModifiedBy;
         case 'ModifiedDate':
             /**
              * Gets the value for strModifiedDate (Read-Only Timestamp)
              * @return string
              */
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Transaction':
             /**
              * Gets the value for the Transaction object referenced by intTransactionId (Unique)
              * @return Transaction
              */
             try {
                 if (!$this->objTransaction && !is_null($this->intTransactionId)) {
                     $this->objTransaction = Transaction::Load($this->intTransactionId);
                 }
                 return $this->objTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'FromCompany':
             /**
              * Gets the value for the Company object referenced by intFromCompanyId (Not Null)
              * @return Company
              */
             try {
                 if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) {
                     $this->objFromCompany = Company::Load($this->intFromCompanyId);
                 }
                 return $this->objFromCompany;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'FromContact':
             /**
              * Gets the value for the Contact object referenced by intFromContactId (Not Null)
              * @return Contact
              */
             try {
                 if (!$this->objFromContact && !is_null($this->intFromContactId)) {
                     $this->objFromContact = Contact::Load($this->intFromContactId);
                 }
                 return $this->objFromContact;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'FromAddress':
             /**
              * Gets the value for the Address object referenced by intFromAddressId (Not Null)
              * @return Address
              */
             try {
                 if (!$this->objFromAddress && !is_null($this->intFromAddressId)) {
                     $this->objFromAddress = Address::Load($this->intFromAddressId);
                 }
                 return $this->objFromAddress;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ToCompany':
             /**
              * Gets the value for the Company object referenced by intToCompanyId (Not Null)
              * @return Company
              */
             try {
                 if (!$this->objToCompany && !is_null($this->intToCompanyId)) {
                     $this->objToCompany = Company::Load($this->intToCompanyId);
                 }
                 return $this->objToCompany;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ToContact':
             /**
              * Gets the value for the Contact object referenced by intToContactId (Not Null)
              * @return Contact
              */
             try {
                 if (!$this->objToContact && !is_null($this->intToContactId)) {
                     $this->objToContact = Contact::Load($this->intToContactId);
                 }
                 return $this->objToContact;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ToAddress':
             /**
              * Gets the value for the Address object referenced by intToAddressId (Not Null)
              * @return Address
              */
             try {
                 if (!$this->objToAddress && !is_null($this->intToAddressId)) {
                     $this->objToAddress = Address::Load($this->intToAddressId);
                 }
                 return $this->objToAddress;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Courier':
             /**
              * Gets the value for the Courier object referenced by intCourierId 
              * @return Courier
              */
             try {
                 if (!$this->objCourier && !is_null($this->intCourierId)) {
                     $this->objCourier = Courier::Load($this->intCourierId);
                 }
                 return $this->objCourier;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intCreatedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intModifiedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } 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 '_FedexShipment':
             /**
              * Gets the value for the private _objFedexShipment (Read-Only)
              * if set due to an expansion on the fedex_shipment.shipment_id reverse relationship
              * @return FedexShipment
              */
             return $this->_objFedexShipment;
         case '_FedexShipmentArray':
             /**
              * Gets the value for the private _objFedexShipmentArray (Read-Only)
              * if set due to an ExpandAsArray on the fedex_shipment.shipment_id reverse relationship
              * @return FedexShipment[]
              */
             return (array) $this->_objFedexShipmentArray;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * Reload this Transaction 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 Transaction object.');
     }
     // Reload the Object
     $objReloaded = Transaction::Load($this->intTransactionId);
     // Update $this's local variables to match
     $this->EntityQtypeId = $objReloaded->EntityQtypeId;
     $this->TransactionTypeId = $objReloaded->TransactionTypeId;
     $this->strNote = $objReloaded->strNote;
     $this->CreatedBy = $objReloaded->CreatedBy;
     $this->dttCreationDate = $objReloaded->dttCreationDate;
     $this->ModifiedBy = $objReloaded->ModifiedBy;
     $this->strModifiedDate = $objReloaded->strModifiedDate;
 }
Exemple #16
0
 protected function btnDelete_Click($strFormId, $strControlId, $strParameter)
 {
     $objCustomFieldArray = $this->objReceipt->objCustomFieldArray;
     $blnError = false;
     if ($this->objAssetTransactionArray) {
         foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
             if ($objAssetTransaction->blnReturnReceivedStatus()) {
                 $blnError = true;
                 $this->btnDelete->Warning = 'All Assets and Inventory must be Pending to delete this receipt.';
             }
         }
     }
     if ($this->objInventoryTransactionArray) {
         foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
             if ($objInventoryTransaction->blnReturnReceivedStatus()) {
                 $blnError = true;
                 $this->btnDelete->Warning = 'All Assets and Inventory must be Pending to delete this receipt.';
             }
         }
     }
     if (!$blnError) {
         // Take out the inventory from the TBR InventoryLocation
         if ($this->objInventoryTransactionArray) {
             foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
                 $objInventoryTransaction->InventoryLocation->Quantity -= $objInventoryTransaction->Quantity;
                 $objInventoryTransaction->InventoryLocation->Save();
             }
         }
         // Delete any assets that were created while scheduling this receipt
         if ($this->objAssetTransactionArray) {
             foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
                 if ($objAssetTransaction->NewAssetFlag) {
                     $objAssetTransaction->Asset->Delete();
                 }
             }
         }
         // Load the Transaction
         $this->objTransaction = Transaction::Load($this->objReceipt->TransactionId);
         // Delete the Transaction Object and let it MySQL CASCADE down to asset_transaction, inventory_transaction, and receipt
         $this->objTransaction->Delete();
         // CustomField::DeleteTextValues($objCustomFieldArray);
         $this->RedirectToListPage();
     }
 }
 /**
  * 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 'InventoryTransactionId':
             // Gets the value for intInventoryTransactionId (Read-Only PK)
             // @return integer
             return $this->intInventoryTransactionId;
         case 'InventoryLocationId':
             // Gets the value for intInventoryLocationId (Not Null)
             // @return integer
             return $this->intInventoryLocationId;
         case 'TransactionId':
             // Gets the value for intTransactionId (Not Null)
             // @return integer
             return $this->intTransactionId;
         case 'Quantity':
             // Gets the value for intQuantity (Not Null)
             // @return integer
             return $this->intQuantity;
         case 'SourceLocationId':
             // Gets the value for intSourceLocationId
             // @return integer
             return $this->intSourceLocationId;
         case 'DestinationLocationId':
             // Gets the value for intDestinationLocationId
             // @return integer
             return $this->intDestinationLocationId;
         case 'CreatedBy':
             // Gets the value for intCreatedBy
             // @return integer
             return $this->intCreatedBy;
         case 'CreationDate':
             // Gets the value for dttCreationDate
             // @return QDateTime
             return $this->dttCreationDate;
         case 'ModifiedBy':
             // Gets the value for intModifiedBy
             // @return integer
             return $this->intModifiedBy;
         case 'ModifiedDate':
             // Gets the value for strModifiedDate (Read-Only Timestamp)
             // @return string
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'InventoryLocation':
             // Gets the value for the InventoryLocation object referenced by intInventoryLocationId (Not Null)
             // @return InventoryLocation
             try {
                 if (!$this->objInventoryLocation && !is_null($this->intInventoryLocationId)) {
                     $this->objInventoryLocation = InventoryLocation::Load($this->intInventoryLocationId);
                 }
                 return $this->objInventoryLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Transaction':
             // Gets the value for the Transaction object referenced by intTransactionId (Not Null)
             // @return Transaction
             try {
                 if (!$this->objTransaction && !is_null($this->intTransactionId)) {
                     $this->objTransaction = Transaction::Load($this->intTransactionId);
                 }
                 return $this->objTransaction;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'SourceLocation':
             // Gets the value for the Location object referenced by intSourceLocationId
             // @return Location
             try {
                 if (!$this->objSourceLocation && !is_null($this->intSourceLocationId)) {
                     $this->objSourceLocation = Location::Load($this->intSourceLocationId);
                 }
                 return $this->objSourceLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'DestinationLocation':
             // Gets the value for the Location object referenced by intDestinationLocationId
             // @return Location
             try {
                 if (!$this->objDestinationLocation && !is_null($this->intDestinationLocationId)) {
                     $this->objDestinationLocation = Location::Load($this->intDestinationLocationId);
                 }
                 return $this->objDestinationLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             // Gets the value for the UserAccount object referenced by intCreatedBy
             // @return UserAccount
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             // Gets the value for the UserAccount object referenced by intModifiedBy
             // @return UserAccount
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } 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;
             }
     }
 }