/**
  * This will save this object's Receipt instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveReceipt()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstTransaction) {
             $this->objReceipt->TransactionId = $this->lstTransaction->SelectedValue;
         }
         if ($this->lstFromCompany) {
             $this->objReceipt->FromCompanyId = $this->lstFromCompany->SelectedValue;
         }
         if ($this->lstFromContact) {
             $this->objReceipt->FromContactId = $this->lstFromContact->SelectedValue;
         }
         if ($this->lstToContact) {
             $this->objReceipt->ToContactId = $this->lstToContact->SelectedValue;
         }
         if ($this->lstToAddress) {
             $this->objReceipt->ToAddressId = $this->lstToAddress->SelectedValue;
         }
         if ($this->txtReceiptNumber) {
             $this->objReceipt->ReceiptNumber = $this->txtReceiptNumber->Text;
         }
         if ($this->calDueDate) {
             $this->objReceipt->DueDate = $this->calDueDate->DateTime;
         }
         if ($this->calReceiptDate) {
             $this->objReceipt->ReceiptDate = $this->calReceiptDate->DateTime;
         }
         if ($this->chkReceivedFlag) {
             $this->objReceipt->ReceivedFlag = $this->chkReceivedFlag->Checked;
         }
         if ($this->lstCreatedByObject) {
             $this->objReceipt->CreatedBy = $this->lstCreatedByObject->SelectedValue;
         }
         if ($this->calCreationDate) {
             $this->objReceipt->CreationDate = $this->calCreationDate->DateTime;
         }
         if ($this->lstModifiedByObject) {
             $this->objReceipt->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstReceiptCustomFieldHelper) {
             $this->objReceipt->ReceiptCustomFieldHelper = ReceiptCustomFieldHelper::Load($this->lstReceiptCustomFieldHelper->SelectedValue);
         }
         // Save the Receipt object
         $this->objReceipt->Save();
         // Finally, update any ManyToManyReferences (if any)
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
 /**
  * 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 ReceiptCustomFieldHelperMetaControl
  * @param integer $intReceiptId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ReceiptCustomFieldHelper object creation - defaults to CreateOrEdit
  * @return ReceiptCustomFieldHelperMetaControl
  */
 public static function Create($objParentObject, $intReceiptId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intReceiptId)) {
         $objReceiptCustomFieldHelper = ReceiptCustomFieldHelper::Load($intReceiptId);
         // ReceiptCustomFieldHelper was found -- return it!
         if ($objReceiptCustomFieldHelper) {
             return new ReceiptCustomFieldHelperMetaControl($objParentObject, $objReceiptCustomFieldHelper);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ReceiptCustomFieldHelper 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 ReceiptCustomFieldHelperMetaControl($objParentObject, new ReceiptCustomFieldHelper());
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = ReceiptCustomFieldHelper::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from ReceiptCustomFieldHelper, given the clauses above
     $this->DataSource = ReceiptCustomFieldHelper::QueryArray($objCondition, $objClauses);
 }
Ejemplo n.º 4
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;
             }
         case 'ReceiptCustomFieldHelper':
             // Gets the value for the ReceiptCustomFieldHelper object that uniquely references this Receipt
             // by objReceiptCustomFieldHelper (Unique)
             // @return ReceiptCustomFieldHelper
             try {
                 if ($this->objReceiptCustomFieldHelper === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objReceiptCustomFieldHelper) {
                     $this->objReceiptCustomFieldHelper = ReceiptCustomFieldHelper::LoadByReceiptId($this->intReceiptId);
                 }
                 return $this->objReceiptCustomFieldHelper;
             } 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;
             }
     }
 }
Ejemplo n.º 5
0
 protected function UpdateReceiptFields()
 {
     $this->objReceipt->TransactionId = $this->lstTransaction->SelectedValue;
     $this->objReceipt->FromCompanyId = $this->lstFromCompany->SelectedValue;
     $this->objReceipt->FromContactId = $this->lstFromContact->SelectedValue;
     $this->objReceipt->ToContactId = $this->lstToContact->SelectedValue;
     $this->objReceipt->ToAddressId = $this->lstToAddress->SelectedValue;
     $this->objReceipt->ReceiptNumber = $this->txtReceiptNumber->Text;
     $this->objReceipt->DueDate = $this->calDueDate->DateTime;
     $this->objReceipt->ReceiptDate = $this->calReceiptDate->DateTime;
     $this->objReceipt->ReceivedFlag = $this->chkReceivedFlag->Checked;
     $this->objReceipt->CreatedBy = $this->lstCreatedByObject->SelectedValue;
     $this->objReceipt->CreationDate = $this->calCreationDate->DateTime;
     $this->objReceipt->ModifiedBy = $this->lstModifiedByObject->SelectedValue;
     $this->objReceipt->ReceiptCustomFieldHelper = ReceiptCustomFieldHelper::Load($this->lstReceiptCustomFieldHelper->SelectedValue);
 }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ReceiptCustomFieldHelper::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }