protected function SetupPackageType()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intPackageTypeId = QApplication::QueryString('intPackageTypeId');
     if ($intPackageTypeId) {
         $this->objPackageType = PackageType::Load($intPackageTypeId);
         if (!$this->objPackageType) {
             throw new Exception('Could not find a PackageType object with PK arguments: ' . $intPackageTypeId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objPackageType = new PackageType();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
 protected function dtgPackageType_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->dtgPackageType->TotalItemCount = PackageType::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->dtgPackageType->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgPackageType->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all PackageType objects, given the clauses above
     $this->dtgPackageType->DataSource = PackageType::LoadAll($objClauses);
 }
 protected function lstPackageType_Create()
 {
     $this->lstPackageType = new QListBox($this);
     $this->lstPackageType->Name = QApplication::Translate('Package Type');
     $this->lstPackageType->AddItem(QApplication::Translate('- Select One -'), null);
     $objPackageTypeArray = PackageType::LoadAll();
     if ($objPackageTypeArray) {
         foreach ($objPackageTypeArray as $objPackageType) {
             $objListItem = new QListItem($objPackageType->__toString(), $objPackageType->PackageTypeId);
             if ($this->objFedexShipment->PackageType && $this->objFedexShipment->PackageType->PackageTypeId == $objPackageType->PackageTypeId) {
                 $objListItem->Selected = true;
             }
             $this->lstPackageType->AddItem($objListItem);
         }
     }
 }
 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;
 }
Example #5
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, PackageType::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
Example #6
0
 protected function FedEx()
 {
     // create new FedExDC object
     // $fed = new FedExDC($this->objShipment->ShippingAccount->Value);
     $fxWeightUnit = WeightUnit::Load($this->lstWeightUnit->SelectedValue);
     $fxLengthUnit = LengthUnit::Load($this->lstLengthUnit->SelectedValue);
     if ($fxLengthUnit) {
         $fxLengthUnitShortDescription = $fxLengthUnit->ShortDescription;
     } else {
         $fxLengthUnitShortDescription = '';
     }
     // Package Type
     $fxPackageType = PackageType::Load($this->lstPackageType->SelectedValue);
     //$fxPackageCount // Not implemented yet - FIXME
     $shipdate = $this->FxStrip($this->calShipDate->DateTime->__toString(QDateTime::FormatSoap));
     $shipdate = substr($shipdate, 0, 8);
     // create new FedExDC object
     // $fed = new FedExDC($this->objShipment->ShippingAccount->Value, $this->objShipment->FedexMeterNumber);
     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);
     }
     if ($this->objFedexShipment->ToPhone) {
         $strRecipientPhone = $this->objFedexShipment->ToPhone;
     } else {
         $strRecipientPhone = '';
     }
     if ($this->objShipment->FromAddress->__toStringCountryAbbreviation() != $this->objShipment->ToAddress->__toStringCountryAbbreviation() && ($this->objShipment->FromAddress->__toStringCountryAbbreviation() != 'US' || $this->objShipment->ToAddress->__toStringCountryAbbreviation() != 'CA') && ($this->objShipment->ToAddress->__toStringCountryAbbreviation() != 'US' || $this->objShipment->FromAddress->__toStringCountryAbbreviation() != 'CA')) {
         $fxIntlSSN = '';
         //$this->objShipment->FromContact->Social								//Sender's SSN
         $fxCurrencyUnit = CurrencyUnit::Load($this->lstCurrencyUnit->SelectedValue);
         $fxIntlCurrencyUnit = $fxCurrencyUnit->ShortDescription;
         //Recipient Currency
         $fxIntlCustomsValue = number_format(round($this->txtValue->Text, 2), 2, '.', '');
         //Total Customs Value
         $fxIntlDutiesPayType = '1';
         //Duties Pay Type
         $fxIntlTermsofSale = '1';
         //Terms of Sale
         $fxIntlPartiestoTransation = 'N';
         //Parties to Transaction
     } else {
         $fxIntlSSN = '';
         //Sender's SSN
         $fxIntlCurrencyUnit = '';
         //Recipient Currency
         $fxIntlCustomsValue = '';
         //Total Customs Value
         $fxIntlDutiesPayType = '';
         //Duties Pay Type
         $fxIntlTermsofSale = '';
         //Terms of Sale
         $fxIntlPartiestoTransation = '';
         //Parties to Transaction
     }
     $fdx_arr = array(1 => $this->lblShipmentNumber->Text, 4 => $this->objShipment->FromCompany->__toString(), 32 => $this->objShipment->FromContact->__toString(), 5 => $this->objShipment->FromAddress->Address1, 6 => $this->objShipment->FromAddress->Address2, 7 => $this->objShipment->FromAddress->City, 8 => $this->objShipment->FromAddress->__toStringStateProvinceAbbreviation(), 9 => $this->objShipment->FromAddress->PostalCode, 117 => $this->objShipment->FromAddress->__toStringCountryAbbreviation(), 183 => $this->FxStrip($this->objShipment->FromCompany->Telephone), 11 => $this->objShipment->ToCompany->__toString(), 12 => $this->objShipment->ToContact->__toString(), 13 => $this->objShipment->ToAddress->Address1, 14 => $this->objShipment->ToAddress->Address2, 15 => $this->objShipment->ToAddress->City, 16 => $this->objShipment->ToAddress->__toStringStateProvinceAbbreviation(), 17 => $this->objShipment->ToAddress->PostalCode, 18 => $this->FxStrip($strRecipientPhone), 50 => $this->objShipment->ToAddress->__toStringCountryAbbreviation(), 57 => round($this->txtPackageHeight->Text, 0), 58 => round($this->txtPackageWidth->Text, 0), 59 => round($this->txtPackageLength->Text, 0), 23 => $this->lstBillTransportationTo->SelectedValue, 20 => $this->lstBillTransportationTo->SelectedValue !== 1 ? $this->txtRecipientThirdPartyAccount->Text : '', 75 => strtoupper($fxWeightUnit->ShortDescription), 1116 => strtoupper(substr($fxLengthUnitShortDescription, 0, 1)), 1273 => $fxPackageType->Value, 1274 => $this->objFedexShipment->FedexServiceType->Value, 1333 => '1', 1368 => 2, 1369 => $this->lstFedexLabelPrinterType->SelectedValue, 1370 => $this->lstFedexLabelPrinterType->SelectedValue === 1 ? 5 : $this->lstFedexLabelFormatType->SelectedValue, 2973 => 1, 1607 => 'SHIPPING', 1608 => 'SPECIAL', 1609 => 'HANDLING', 1610 => 'DISCOUNT', 1611 => 'TOTAL', 1624 => '1416', 1625 => '1417', 1626 => '3107', 1627 => '1418', 1628 => '1419', 1401 => number_format(round($this->txtPackageWeight->Text, 1), 1, '.', ''), 1201 => $this->txtFedexNotifySenderEmail->Text, 1202 => $this->txtFedexNotifyRecipientEmail->Text, 1204 => $this->txtFedexNotifyOtherEmail->Text, 1554 => $this->chkFedexNotifySenderShipFlag->Checked ? 'Y' : 'N', 1961 => $this->chkFedexNotifySenderExceptionFlag->Checked ? 'Y' : 'N', 1553 => $this->chkFedexNotifySenderDeliveryFlag->Checked ? 'Y' : 'N', 1557 => $this->chkFedexNotifyRecipientShipFlag->Checked ? 'Y' : 'N', 1962 => $this->chkFedexNotifyRecipientExceptionFlag->Checked ? 'Y' : 'N', 1556 => $this->chkFedexNotifyRecipientDeliveryFlag->Checked ? 'Y' : 'N', 1206 => $this->chkFedexNotifyOtherShipFlag->Checked ? 'Y' : 'N', 1960 => $this->chkFedexNotifyOtherExceptionFlag->Checked ? 'Y' : 'N', 1551 => $this->chkFedexNotifyOtherDeliveryFlag->Checked ? 'Y' : 'N', 1139 => $fxIntlSSN, 68 => $fxIntlCurrencyUnit, 1266 => $this->chkSaturdayDeliveryFlag->Checked ? 'Y' : 'N', 1200 => $this->chkHoldAtLocationFlag->Checked ? 'Y' : 'N', 44 => $this->chkHoldAtLocationFlag->Checked ? $this->txtHoldAtLocationAddress->Text : '', 46 => $this->chkHoldAtLocationFlag->Checked ? $this->txtHoldAtLocationCity->Text : '', 47 => $this->chkHoldAtLocationFlag->Checked && $this->objFedexShipment->HoldAtLocationStateObject ? $this->objFedexShipment->HoldAtLocationStateObject->Abbreviation : '', 48 => $this->chkHoldAtLocationFlag->Checked ? $this->txtHoldAtLocationPostalCode->Text : '', 1411 => $fxIntlCustomsValue, 70 => $fxIntlDutiesPayType, 72 => $fxIntlTermsofSale, 73 => $fxIntlPartiestoTransation, 79 => '', 80 => '', 24 => $shipdate, 1119 => 'Y', 25 => $this->objFedexShipment->Reference);
     if ($this->objFedexShipment->FedexServiceType->Value == '92') {
         $ship_Ret = $fed->ground_ship($fdx_arr);
     } else {
         $ship_Ret = $fed->express_ship($fdx_arr);
     }
     if ($error = $fed->getError()) {
         $blnError = true;
         $this->btnCompleteShipment->Warning = $error;
         return false;
     } else {
         // decode and save label
         $this->txtTrackingNumber->Text = $ship_Ret[29];
         $strLabelExtension = '.png';
         if ($this->objFedexShipment->LabelPrinterType == '2') {
             $strLabelExtension = '.epl';
         } else {
             if ($this->objFedexShipment->LabelPrinterType == '5') {
                 $strLabelExtension = '.zpl';
             }
         }
         $strLabelMimeType = $this->objFedexShipment->LabelPrinterType == '2' || $this->objFedexShipment->LabelPrinterType == '5' ? 'text/plain' : 'image/png';
         $fed->label('../images/shipping_labels/fedex/' . QApplication::$TracmorSettings->ImageUploadPrefix . $this->objShipment->ShipmentNumber . $strLabelExtension);
         if (AWS_S3) {
             QApplication::MoveToS3(__DOCROOT__ . __IMAGE_ASSETS__ . '/shipping_labels/fedex', QApplication::$TracmorSettings->ImageUploadPrefix . $this->objShipment->ShipmentNumber . $strLabelExtension, $strLabelMimeType, '/images/shipping_labels/fedex');
         }
         return true;
     }
 }
Example #7
0
 /**
  * Counts all associated PackageTypes
  * @return int
  */
 public function CountPackageTypes()
 {
     if (is_null($this->intCourierId)) {
         return 0;
     }
     return PackageType::CountByCourierId($this->intCourierId);
 }