protected function SetupShippingAccount()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intShippingAccountId = QApplication::QueryString('intShippingAccountId');
     if ($intShippingAccountId) {
         $this->objShippingAccount = ShippingAccount::Load($intShippingAccountId);
         if (!$this->objShippingAccount) {
             throw new Exception('Could not find a ShippingAccount object with PK arguments: ' . $intShippingAccountId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objShippingAccount = new ShippingAccount();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
예제 #2
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ShippingAccount::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 protected function lstShippingAccount_Create()
 {
     $this->lstShippingAccount = new QListBox($this);
     $this->lstShippingAccount->Name = QApplication::Translate('Shipping Account');
     $this->lstShippingAccount->AddItem(QApplication::Translate('- Select One -'), null);
     $objShippingAccountArray = ShippingAccount::LoadAll();
     if ($objShippingAccountArray) {
         foreach ($objShippingAccountArray as $objShippingAccount) {
             $objListItem = new QListItem($objShippingAccount->__toString(), $objShippingAccount->ShippingAccountId);
             if ($this->objFedexShipment->ShippingAccount && $this->objFedexShipment->ShippingAccount->ShippingAccountId == $objShippingAccount->ShippingAccountId) {
                 $objListItem->Selected = true;
             }
             $this->lstShippingAccount->AddItem($objListItem);
         }
     }
 }
예제 #4
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objShipment) {
         $objObject->objShipment = Shipment::GetSoapObjectFromObject($objObject->objShipment, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intShipmentId = null;
         }
     }
     if ($objObject->objPackageType) {
         $objObject->objPackageType = PackageType::GetSoapObjectFromObject($objObject->objPackageType, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPackageTypeId = null;
         }
     }
     if ($objObject->objShippingAccount) {
         $objObject->objShippingAccount = ShippingAccount::GetSoapObjectFromObject($objObject->objShippingAccount, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intShippingAccountId = null;
         }
     }
     if ($objObject->objFedexServiceType) {
         $objObject->objFedexServiceType = FedexServiceType::GetSoapObjectFromObject($objObject->objFedexServiceType, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intFedexServiceTypeId = null;
         }
     }
     if ($objObject->objCurrencyUnit) {
         $objObject->objCurrencyUnit = CurrencyUnit::GetSoapObjectFromObject($objObject->objCurrencyUnit, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCurrencyUnitId = null;
         }
     }
     if ($objObject->objWeightUnit) {
         $objObject->objWeightUnit = WeightUnit::GetSoapObjectFromObject($objObject->objWeightUnit, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intWeightUnitId = null;
         }
     }
     if ($objObject->objLengthUnit) {
         $objObject->objLengthUnit = LengthUnit::GetSoapObjectFromObject($objObject->objLengthUnit, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intLengthUnitId = null;
         }
     }
     if ($objObject->objHoldAtLocationStateObject) {
         $objObject->objHoldAtLocationStateObject = StateProvince::GetSoapObjectFromObject($objObject->objHoldAtLocationStateObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intHoldAtLocationState = null;
         }
     }
     return $objObject;
 }
 protected function dtgShippingAccount_Bind()
 {
     // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll()
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     $this->dtgShippingAccount->TotalItemCount = ShippingAccount::CountAll();
     // Setup the $objClauses Array
     $objClauses = array();
     // 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->dtgShippingAccount->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgShippingAccount->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all ShippingAccount objects, given the clauses above
     $this->dtgShippingAccount->DataSource = ShippingAccount::LoadAll($objClauses);
 }
예제 #6
0
 protected function FedExCancel()
 {
     // Create the new Fedex object
     if ($this->objFedexShipment->ShippingAccountId) {
         $fed = new FedExDC($this->objFedexShipment->ShippingAccount->AccessId, $this->objFedexShipment->ShippingAccount->AccessCode);
     } else {
         // if not billing to a sender account, use the default fedex account from admin_setting for FedEx communication
         $objFedexAccount = ShippingAccount::Load(QApplication::$TracmorSettings->FedexAccountId);
         $fed = new FedExDC($objFedexAccount->AccessId, $objFedexAccount->AccessCode);
     }
     // create new FedExDC object
     //$fed = new FedExDC($this->objShipment->ShippingAccount->Value, QApplication::$TracmorSettings->FedexMeterNumber);
     // Populate an array with the necessary information
     $fdx_arr = array(1 => $this->objShipment->ShipmentNumber, 29 => $this->objShipment->TrackingNumber);
     // If ground service
     // if($this->objShipment->FedexServiceType->Value	== '92')
     if ($this->objFedexShipment->FedexServiceType->Value == '92') {
         $cancel_Ret = $fed->ground_cancel($fdx_arr);
     } else {
         $cancel_Ret = $fed->express_cancel($fdx_arr);
     }
     // If there is an error, display it and return false
     if ($error = $fed->getError()) {
         $this->btnCancelCompleteShipment->Warning = $error;
         return false;
     } else {
         return true;
     }
 }
예제 #7
0
 protected function btnSave_Click()
 {
     $intCompanyId = $this->lstCompany->SelectedValue;
     $objCompany = Company::Load($intCompanyId);
     $intAccountId = $this->lstFedexAccount->SelectedValue;
     $objAccount = ShippingAccount::Load($intAccountId);
     if ($objCompany && !$objCompany->Telephone) {
         $this->lstCompany->Warning = "The Shipping/Receiving company must have a valid telephone number.";
     } elseif ($objAccount && (!$objAccount->AccessId || !$objAccount->AccessCode)) {
         $this->lstFedexAccount->Warning = "The FedEx Account must have a valid account number and meter number.";
     } else {
         // Altered $TracmorSettings __set() method so that just setting a value will save it in the database.
         QApplication::$TracmorSettings->CompanyId = $intCompanyId;
         QApplication::$TracmorSettings->FedexAccountId = $intAccountId;
         QApplication::$TracmorSettings->FedexGatewayUri = $this->txtFedexGatewayUri->Text;
         QApplication::$TracmorSettings->PackingListTerms = $this->fckPackingListTerms->Text;
         QApplication::$TracmorSettings->AutodetectTrackingNumbers = $this->chkAutoDetectTrackingNumbers->Checked;
         QApplication::$TracmorSettings->ReceiveToLastLocation = $this->chkReceiveToLastLocation->Checked;
         // Show saved notification
         $this->pnlSaveNotification->Display = true;
     }
 }
 public function dtgShippingAccount_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgShippingAccount->TotalItemCount = ShippingAccount::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgShippingAccount->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgShippingAccount->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgShippingAccount->DataSource = ShippingAccount::LoadAll($objClauses);
 }
예제 #9
0
 /**
  * Counts all associated ShippingAccounts
  * @return int
  */
 public function CountShippingAccounts()
 {
     if (is_null($this->intCourierId)) {
         return 0;
     }
     return ShippingAccount::CountByCourierId($this->intCourierId);
 }
예제 #10
0
 /**
  * Counts all associated ShippingAccountsAsModifiedBy
  * @return int
  */
 public function CountShippingAccountsAsModifiedBy()
 {
     if (is_null($this->intUserAccountId)) {
         return 0;
     }
     return ShippingAccount::CountByModifiedBy($this->intUserAccountId);
 }