protected function lstAddress_Create()
 {
     $this->lstAddress = new QListBox($this);
     $this->lstAddress->Name = QApplication::Translate('Address');
     $this->lstAddress->AddItem(QApplication::Translate('- Select One -'), null);
     if ($this->lstCompany->SelectedValue) {
         $objAddressArray = Address::LoadArrayByCompanyId($this->lstCompany->SelectedValue);
     } else {
         $objAddressArray = Address::LoadAll();
     }
     if ($objAddressArray) {
         foreach ($objAddressArray as $objAddress) {
             $objListItem = new QListItem($objAddress->__toString(), $objAddress->AddressId);
             if ($this->objContact->Address && $this->objContact->Address->AddressId == $objAddress->AddressId) {
                 $objListItem->Selected = true;
             }
             $this->lstAddress->AddItem($objListItem);
         }
     }
 }
示例#2
0
 protected function lstToAddress_Create()
 {
     $this->lstToAddress = new QListBox($this);
     $this->lstToAddress->Name = QApplication::Translate('To Address');
     $this->lstToAddress->Required = true;
     if (!$this->blnEditMode) {
         $this->lstToAddress->AddItem('- Select One -', null);
     }
     $objToAddressArray = Address::LoadArrayByCompanyId(QApplication::$TracmorSettings->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription)));
     if ($objToAddressArray) {
         foreach ($objToAddressArray as $objToAddress) {
             $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId);
             if ($this->objReceipt->ToAddress && $this->objReceipt->ToAddress->AddressId == $objToAddress->AddressId) {
                 $objListItem->Selected = true;
             }
             $this->lstToAddress->AddItem($objListItem);
         }
     }
     $this->lstToAddress->TabIndex = 4;
     $this->intNextTabIndex++;
 }
示例#3
0
 public function lstToCompany_Select()
 {
     if ($this->pnlShipmentMassEdit->lstToCompany->SelectedValue) {
         $objCompany = Company::Load($this->pnlShipmentMassEdit->lstToCompany->SelectedValue);
         if ($objCompany) {
             // Load the values for the 'To Contact' List
             if ($this->pnlShipmentMassEdit->lstToContact) {
                 $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName)));
                 $this->pnlShipmentMassEdit->lstToContact->RemoveAllItems();
                 if ($objToContactArray) {
                     foreach ($objToContactArray as $objToContact) {
                         $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId);
                         $this->pnlShipmentMassEdit->lstToContact->AddItem($objListItem);
                     }
                     $this->pnlShipmentMassEdit->lstToContact->Enabled = true;
                 }
             }
             // Load the values for the 'To Address' List
             if ($this->pnlShipmentMassEdit->lstToAddress) {
                 $objToAddressArray = Address::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription)));
                 $this->pnlShipmentMassEdit->lstToAddress->RemoveAllItems();
                 if ($objToAddressArray) {
                     foreach ($objToAddressArray as $objToAddress) {
                         $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId);
                         $this->pnlShipmentMassEdit->lstToAddress->AddItem($objListItem);
                     }
                     $this->pnlShipmentMassEdit->lstToAddress->Enabled = true;
                     //$this->lstToAddress_Select();
                 }
             }
         }
     }
 }
示例#4
0
 protected function Form_PreRender()
 {
     $this->dtgContact->TotalItemCount = Contact::CountByCompanyId($this->objCompany->CompanyId);
     if ($this->dtgContact->TotalItemCount == 0) {
         $this->dtgContact->ShowHeader = false;
     } else {
         $objClauses = array();
         if ($objClause = $this->dtgContact->OrderByClause) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = $this->dtgContact->LimitClause) {
             array_push($objClauses, $objClause);
         }
         $this->dtgContact->DataSource = Contact::LoadArrayByCompanyId($this->objCompany->CompanyId, $objClauses);
         $this->dtgContact->ShowHeader = true;
     }
     $this->dtgAddress->TotalItemCount = Address::CountByCompanyId($this->objCompany->CompanyId);
     if ($this->dtgAddress->TotalItemCount == 0) {
         $this->dtgAddress->ShowHeader = false;
     } else {
         $objClauses = array();
         if ($objClause = $this->dtgAddress->OrderByClause) {
             array_push($objClauses, $objClause);
         }
         if ($objClause = $this->dtgAddress->LimitClause) {
             array_push($objClauses, $objClause);
         }
         $this->dtgAddress->DataSource = Address::LoadArrayByCompanyId($this->objCompany->CompanyId, $objClauses);
         $this->dtgAddress->ShowHeader = true;
     }
     // Do not show the datagrids or 'Create New' buttons if creating a new company
     if (!$this->blnEditMode) {
         $this->btnCreateContact->Visible = false;
         $this->dtgContact->Visible = false;
         $this->btnCreateAddress->Visible = false;
         $this->dtgAddress->Visible = false;
     }
 }
示例#5
0
 protected function lstToCompany_Select()
 {
     $this->disableAdvancedIfInternal();
     // Clear any displayed warnings
     if ($this->lblNewToContact) {
         $this->lblNewToContact->Warning = '';
         $this->lblNewToAddress->Warning = '';
     }
     if ($this->lstToCompany->SelectedValue) {
         $objCompany = Company::Load($this->lstToCompany->SelectedValue);
         if ($objCompany) {
             // Load the values for the 'To Contact' List
             if ($this->lstToContact) {
                 $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName)));
                 if ($this->lstToContact->SelectedValue) {
                     $SelectedContactId = $this->lstToContact->SelectedValue;
                 } elseif ($this->objShipment->ToContactId) {
                     $SelectedContactId = $this->objShipment->ToContactId;
                 } else {
                     $SelectedContactId = null;
                 }
                 $this->lstToContact->RemoveAllItems();
                 $this->lstToContact->AddItem('- Select One -', null);
                 if ($objToContactArray) {
                     foreach ($objToContactArray as $objToContact) {
                         $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId);
                         if ($SelectedContactId == $objToContact->ContactId) {
                             $objListItem->Selected = true;
                         }
                         $this->lstToContact->AddItem($objListItem);
                     }
                     $this->lstToContact->Enabled = true;
                 }
             }
             // Load the values for the 'To Address' List
             if ($this->lstToAddress) {
                 $objToAddressArray = Address::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription)));
                 if ($this->lstToAddress->SelectedValue) {
                     $SelectedAddressId = $this->lstToAddress->SelectedValue;
                 } elseif ($this->objShipment->ToAddressId) {
                     $SelectedAddressId = $this->objShipment->ToAddressId;
                 } else {
                     $SelectedAddressId = null;
                 }
                 $this->lstToAddress->RemoveAllItems();
                 $this->lstToAddress->AddItem('- Select One -', null);
                 if ($objToAddressArray) {
                     foreach ($objToAddressArray as $objToAddress) {
                         $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId);
                         if ($SelectedAddressId == $objToAddress->AddressId) {
                             $objListItem->Selected = true;
                         }
                         $this->lstToAddress->AddItem($objListItem);
                     }
                     $this->lstToAddress->Enabled = true;
                     $this->lstToAddress_Select();
                 }
             }
         }
     }
 }
示例#6
0
    /**
     * Deletes all associated Addresses
     * @return void
     */
    public function DeleteAllAddresses()
    {
        if (is_null($this->intCompanyId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAddress on this unsaved Company.');
        }
        // Get the Database Object for this Class
        $objDatabase = Company::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (Address::LoadArrayByCompanyId($this->intCompanyId) as $objAddress) {
                $objAddress->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`address`
				WHERE
					`company_id` = ' . $objDatabase->SqlVariable($this->intCompanyId) . '
			');
    }
示例#7
0
 /**
  * Gets all associated Addresses as an array of Address objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return Address[]
  */
 public function GetAddressArray($objOptionalClauses = null)
 {
     if (is_null($this->intCompanyId)) {
         return array();
     }
     try {
         return Address::LoadArrayByCompanyId($this->intCompanyId, $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
 public function lstFromAddress_Create()
 {
     $this->lstFromAddress = new QListBox($this, 'FromAddress');
     $this->lstFromAddress->Name = 'From Address';
     $objFromAddressArray = Address::LoadArrayByCompanyId(QApplication::$TracmorSettings->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription)));
     if (is_array($objFromAddressArray) && count($objFromAddressArray) > 0) {
         foreach ($objFromAddressArray as $objFromAddress) {
             $objListItem = new QListItem($objFromAddress->__toString(), $objFromAddress->AddressId);
             $this->lstFromAddress->AddItem($objListItem);
         }
     }
 }