protected function SetupShipment() { // Lookup Object PK information from Query String (if applicable) // Set mode to Edit or New depending on what's found $intShipmentId = QApplication::QueryString('intShipmentId'); if ($intShipmentId) { $this->objShipment = Shipment::Load($intShipmentId); if (!$this->objShipment) { throw new Exception('Could not find a Shipment object with PK arguments: ' . $intShipmentId); } $this->objFedexShipment = FedexShipment::LoadByShipmentId($this->objShipment->ShipmentId); if (!$this->objFedexShipment) { throw new Exception('Could not find a Fedex Shipment object with PK arguments: ' . $intShipmentId); } } }
protected function Form_Create() { // check rigths for the Inventory to Ship $this->blnShowInventory = true; $objRoleModule = RoleModule::LoadByRoleIdModuleId(QApplication::$objUserAccount->RoleId, 3); if ($objRoleModule->AccessFlag) { $objRoleModuleAuthorization = RoleModuleAuthorization::LoadByRoleModuleIdAuthorizationId($objRoleModule->RoleModuleId, 2); if ($objRoleModuleAuthorization->AuthorizationLevelId == 3) { $this->blnShowInventory = false; } } else { $this->blnShowInventory = false; } // Call SetupShipment to either Load/Edit Existing or Create New $this->SetupShipment(); // If the courier is FedEx, load the FedexShipment object if ($this->blnEditMode) { if ($this->objShipment->CourierId === 1) { $this->objFedexShipment = FedexShipment::LoadByShipmentId($this->objShipment->ShipmentId); } } $this->objCompanyArray = Company::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Company()->ShortDescription))); // Create the Header Menu $this->ctlHeaderMenu_Create(); // Create the Shortcut Menu $this->ctlShortcutMenu_Create(); // FedEx Shipment Panel $this->pnlFedExShipment_Create(); // Packing List Link $this->lblPackingListLink_Create(); $this->lblFedexShippingLabelLink_Create(); // Shipping Labels $this->lblShipmentNumber_Create(); $this->lblHeaderShipment_Create(); // $this->lblHeaderCompleteShipment_Create(); $this->lblShipDate_Create(); $this->lblFromCompany_Create(); $this->lblFromContact_Create(); $this->lblFromAddress_Create(); $this->lblFromAddressFull_Create(); $this->lblToCompany_Create(); $this->lblToContact_Create(); $this->lblToAddress_Create(); $this->lblToAddressFull_Create(); $this->lblCourier_Create(); $this->lblToPhone_Create(); $this->lblBillTransportationTo_Create(); $this->lblReference_Create(); $this->lblFedexNotifySenderEmail_Create(); $this->lblFedexNotifyRecipientEmail_Create(); $this->lblFedexNotifyOtherEmail_Create(); $this->lblHoldAtLocationAddress_Create(); $this->lblHoldAtLocationCity_Create(); $this->lblHoldAtLocationState_Create(); $this->lblHoldAtLocationPostalCode_Create(); $this->lblFedexLabelPrinterType_Create(); $this->lblFedexLabelFormatType_Create(); $this->lblFedexThermalPrinterPort_Create(); $this->pnlNote_Create(); $this->lblTrackingNumber_Create(); $this->lblSenderLabel_Create(); $this->lblPayerAccount_Create(); $this->lblFxServiceType_Create(); $this->lblPackageType_Create(); $this->lblPackageWeight_Create(); $this->lblPackageLength_Create(); $this->lblPackageWidth_Create(); $this->lblPackageHeight_Create(); $this->lblValue_Create(); $this->lblWeightUnit_Create(); $this->lblLengthUnit_Create(); $this->lblCurrencyUnit_Create(); // Shipping Inputs $this->dlgExchange_Create(); $this->dlgDueDate_Create(); $this->calShipDate_Create(); $this->lstFromCompany_Create(); $this->lblNewFromCompany_Create(); $this->lstFromContact_Create(); $this->lblNewFromContact_Create(); $this->lstFromAddress_Create(); $this->lblNewFromAddress_Create(); $this->lstToCompany_Create(); $this->lblNewToCompany_Create(); $this->lstToContact_Create(); $this->lblNewToContact_Create(); $this->txtToPhone_Create(); $this->lstBillTransportationTo_Create(); $this->lstShippingAccount_Create(); $this->txtReference_Create(); $this->txtFedexNotifySenderEmail_Create(); $this->txtFedexNotifyRecipientEmail_Create(); $this->txtFedexNotifyOtherEmail_Create(); $this->chkFedexNotifySenderShipFlag_Create(); $this->chkFedexNotifySenderExceptionFlag_Create(); $this->chkFedexNotifySenderDeliveryFlag_Create(); $this->chkFedexNotifyRecipientShipFlag_Create(); $this->chkFedexNotifyRecipientExceptionFlag_Create(); $this->chkFedexNotifyRecipientDeliveryFlag_Create(); $this->chkFedexNotifyOtherShipFlag_Create(); $this->chkFedexNotifyOtherExceptionFlag_Create(); $this->chkFedexNotifyOtherDeliveryFlag_Create(); $this->lstFxServiceType_Create(); $this->txtRecipientThirdPartyAccount_Create(); $this->lstPackageType_Create(); $this->txtPackageWeight_Create(); $this->lstWeightUnit_Create(); $this->txtPackageLength_Create(); $this->txtPackageWidth_Create(); $this->txtPackageHeight_Create(); $this->lstLengthUnit_Create(); $this->txtValue_Create(); $this->lstCurrencyUnit_Create(); $this->chkSaturdayDeliveryFlag_Create(); $this->chkHoldAtLocationFlag_Create(); $this->txtHoldAtLocationAddress_Create(); $this->txtHoldAtLocationCity_Create(); $this->lstHoldAtLocationState_Create(); $this->txtHoldAtLocationPostalCode_Create(); $this->lstFedexLabelPrinterType_Create(); $this->lstFedexLabelFormatType_Create(); $this->txtFedexThermalPrinterPort_Create(); $this->lstToAddress_Create(); $this->lblNewToAddress_Create(); if (QApplication::$TracmorSettings->CustomShipmentNumbers) { $this->txtShipmentNumber_Create(); } $this->lstCourier_Create(); $this->txtNote_Create(); $this->txtNewAssetCode_Create(); if ($this->blnShowInventory) { $this->txtNewInventoryModelCode_Create(); $this->btnLookup_Create(); $this->ctlInventorySearchTool_Create(); $this->lstSourceLocation_Create(); $this->txtQuantity_Create(); $this->btnAddInventory_Create(); } $this->txtTrackingNumber_Create(); //$this->lblAdvanced_Create(); $this->txtReceiptAssetCode_Create(); $this->chkAutoGenerateAssetCode_Create(); $this->dtpScheduleReceiptDueDate_Create(); $this->rblAssetType_Create(); $this->chkScheduleReceipt_Create(); $this->btnAddAsset_Create(); $this->ctlAssetSearchTool_Create(); $this->btnSaveExchange_Create(); $this->btnCancelExchange_Create(); $this->btnSaveDueDate_Create(); $this->btnCancelDueDate_Create(); $this->pnlAttachments_Create(); // Create all custom asset fields $this->customFields_Create(); //Set display logic of Built-In Fields $this->UpdateBuiltInFields(); $this->UpdateAddressAccess(); $this->UpdateCompanyAccess(); $this->UpdateContactAccess(); // New entities Dialog $this->dlgNew_Create(); if (!$this->objShipment->ShippedFlag) { // Shipping Buttons $this->btnDelete_Create(); } $this->btnSave_Create(); $this->btnCancel_Create(); $this->btnEdit_Create(); $this->atcAttach_Create(); // Complete Shipment Buttons $this->btnCompleteShipment_Create(); $this->btnCancelShipment_Create(); $this->btnCancelCompleteShipment_Create(); // Shipping Datagrids $this->dtgAssetTransact_Create(); $this->dtgInventoryTransact_Create(); // Load the objAssetTransactionArray and objInventoryTransactionArray for the first time if ($this->blnEditMode) { $objClauses = array(); if ($objClause = $this->dtgAssetTransact->OrderByClause) { array_push($objClauses, $objClause); } /*if ($objClause = $this->dtgAssetTransact->LimitClause) array_push($objClauses, $objClause);*/ if ($objClause = QQ::Expand(QQN::AssetTransaction()->Asset->AssetModel)) { array_push($objClauses, $objClause); } if ($objClause = QQ::Expand(QQN::AssetTransaction()->SourceLocation)) { } array_push($objClauses, $objClause); $this->objAssetTransactionArray = AssetTransaction::LoadArrayByTransactionId($this->objShipment->TransactionId, $objClauses); $objClauses = null; $objClauses = array(); if ($objClause = $this->dtgInventoryTransact->OrderByClause) { array_push($objClauses, $objClause); } /*if ($objClause = $this->dtgInventoryTransact->LimitClause) array_push($objClauses, $objClause);*/ if ($objClause = QQ::Expand(QQN::InventoryTransaction()->InventoryLocation->InventoryModel)) { } array_push($objClauses, $objClause); $this->objInventoryTransactionArray = InventoryTransaction::LoadArrayByTransactionId($this->objShipment->TransactionId, $objClauses); // If shipped, display labels. Otherwise, we don't need to call DisplayLabels because only labels are on the QPanel. $this->DisplayLabels(); } elseif (!$this->blnEditMode) { $this->DisplayInputs(); } // Check if there is an Asset or InventoryModel ID in the query string to automatically add them - they would be coming from AssetEdit or InventoryEdit if (!$this->blnEditMode) { $intAssetId = QApplication::QueryString('intAssetId'); // If an Asset was passed in the query string, load the txt in the Asset Code text box and click the add button if ($intAssetId) { $objAsset = Asset::Load($intAssetId); if ($objAsset) { $this->txtNewAssetCode->Text = $objAsset->AssetCode; $this->btnAddAsset_Click($this, null, null); } } $intInventoryModelId = QApplication::QueryString('intInventoryModelId'); // If an InventoryModel was passed in the query string, load the text in the InventoryModel text box and set the focus to the quantity box if ($intInventoryModelId) { $objInventoryModel = InventoryModel::Load($intInventoryModelId); if ($objInventoryModel) { $this->txtNewInventoryModelCode->Text = $objInventoryModel->InventoryModelCode; $this->btnLookup_Click($this, null, null); QApplication::ExecuteJavaScript(sprintf("document.getElementById('%s').focus()", $this->lstSourceLocation->ControlId)); } } } }