/// <summary> /// Extension class for the class <c>EcoResProductReleaseManager</c>. /// </summary> [ExtensionOf(classStr(EcoResProductReleaseManager))] final class VKEcoResProductReleaseManager_Extension { RetailProductPropertyManager getRetailProductPropertyManager() { return retailProductPropertyManager; } RetailAttributesLegalEntityLookup getRetailAttributesLegalEntityLookup() { return attributesLegalEntityLookup; } } /// <summary> /// Event handler for RetailEcoResProductReleaseManager_Extension class /// </summary> class VKRetailEcoResProductReleaseManagerEventHandler { /// <summary> /// Post event handler for RetailEcoResProductReleaseManager_Extension.setRetailProductProperties /// </summary> /// <param name = "args">arguments</param> [PostHandlerFor(classStr(RetailEcoResProductReleaseManager_Extension), methodStr(RetailEcoResProductReleaseManager_Extension, setRetailProductProperties))] public static void RetailEcoResProductReleaseManager_Extension_Post_setRetailProductProperties(XppPrePostArgs args) { EcoResProductReleaseManager manager = args.getThis(); RetailAttributesLegalEntityLookup retailAttributesLegalEntityLookup = manager.getRetailAttributesLegalEntityLookup(); RetailProductPropertyManager retailProductPropertyManager = manager.getRetailProductPropertyManager(); retailProductPropertyManager.parmDropShipment(retailAttributesLegalEntityLookup.VKDropShipment); retailProductPropertyManager.parmDefaultDropShipmentWarehouse(retailAttributesLegalEntityLookup.VKDefaultDropShipmentWarehouse); } } /// <summary> /// Extension of RetailProductPropertyManager class /// </summary> [ExtensionOf(classStr(RetailProductPropertyManager))] final class VKRetailProductPropertyManager_Extension { public VKDropShipment dropShipment; public VKDefaultDropShipmentWarehouse defaultDropShipmentWarehouse; public VKDropShipment parmDropShipment(VKDropShipment _dropShipment = dropShipment) { dropShipment = _dropShipment; return dropShipment; } public VKDefaultDropShipmentWarehouse parmDefaultDropShipmentWarehouse(VKDefaultDropShipmentWarehouse _defaultDropShipmentWarehouse = defaultDropShipmentWarehouse) { defaultDropShipmentWarehouse = _defaultDropShipmentWarehouse; return defaultDropShipmentWarehouse; } /// <summary> /// CoC for canWriteMCRInventTable method /// </summary> /// <param name = "_canWrite">canWrite</param> /// <returns>boolean</returns> protected boolean canWriteMCRInventTable(boolean _canWrite) { boolean canWrite = next canWriteMCRInventTable(_canWrite); canWrite = canWrite && this.VKTrySetAndValidateFieldValue( mcrInventTable, fieldNum(MCRInventTable, DefaultDropShipmentWarehouse), fieldStr(MCRInventTable, DefaultDropShipmentWarehouse), defaultDropShipmentWarehouse); if (primaryVendorId) { canWrite = canWrite && this.VKTrySetAndValidateFieldValue( mcrInventTable, fieldNum(MCRInventTable, DropShipment), fieldStr(MCRInventTable, DropShipment), dropShipment); } return canWrite; } /// <summary> /// Copy of stadard method trySetAndValidateFieldValue as it is private and not possible to call from extension /// </summary> /// <param name = "_table">table</param> /// <param name = "_fieldId">field id</param> /// <param name = "_fieldName">field name</param> /// <param name = "_value">value</param> /// <returns>boolean</returns> public boolean VKTrySetAndValidateFieldValue(Common _table, FieldId _fieldId, FieldName _fieldName, anytype _value) { boolean ret; _table.setFieldValue(_fieldName, _value); if (_table.validateFieldValue(_fieldName)) { _table.modifiedField(_fieldId); ret = true; } return ret; } }
/// <summary> /// Extension class for RetailCategory form /// </summary> [ExtensionOf(formstr(RetailCategory))] final class VKRetailCategoryForm_Extension { /// <summary> /// CoC for initializeFormElements method /// </summary> protected void initializeFormElements() { next initializeFormElements(); if (this.getHierarchyRole() == EcoResCategoryNamedHierarchyRole::Retail) { VKDirectDeliveryProperties.enabled(true); VKDirectDeliveryProperties.visible(true); } } /// <summary> /// CoC for task method /// </summary> /// <param name = "_taskId">task</param> /// <returns>return</returns> public int task(int _taskId) { int ret; #Task ret = next task(_taskId); // when view mode changes to view/edit, set the ViewMode buttons if (_taskId == #taskEditRecord || _taskId == #taskDoneEditRecord) { this.VKSetViewModeButtonText(VKDDToggleViewMode, VKDDLegalEntityView); } return ret; } /// <summary> /// Copy of standard form setViewModeButtonText method, as it is private and cannot be called /// </summary> /// <param name = "button">button</param> /// <param name = "LETabPage">tab page</param> public void VKSetViewModeButtonText(FormButtonControl button, FormGroupControl LETabPage) { if (this.inViewMode()) { if (LETabPage.visible()) { button.text("@Retail:ViewInGrid"); } else { button.text("@Retail:ViewByLegalEntity"); } } else { if (LETabPage.visible()) { button.text("@Retail:EditInGrid"); } else { button.text("@Retail:EditByLegalEntity"); } } } /// <summary> /// Copy of standard form LEModified method, as it is private and cannot be called /// </summary> /// <param name = "_control">control</param> public void VKLEModified(FormStringControl _control) { RetailAttributesLegalEntityLookup selectedDataArea; select firstonly selectedDataArea where selectedDataArea.LegalEntity == CompanyInfo::findDataArea(_control.text()).RecId && selectedDataArea.Category == ecoResCategory.RecId; RetailAttributesLegalEntityLookup_ds.positionToRecord(selectedDataArea); LELookupStringEdit.text(_control.text()); purchaseLELookupStringEdit.text(_control.text()); salesLELookupStringEdit.text(_control.text()); inventoryLELookupStringEdit.text(_control.text()); costLELookupStringEdit.text(_control.text()); generalLELookupStringEdit.text(_control.text()); retailLELookupStringEdit.text(_control.text()); categoryLELookupStringEdit.text(_control.text()); VKDDLELookupStringEdit.text(_control.text()); this.setAltItemProductDimensionFields(); } /// <summary> /// To modify Direct Delivery legal entity control /// </summary> /// <param name = "_control">control</param> public void VKModifyLEText(FormStringControl _control) { VKDDLELookupStringEdit.text(_control.text()); } }
/// <summary> /// Event handlers for RetailCategory form /// </summary> class VKRetailCategoryFormEventHandler { /// <summary> /// Lookup for VKDirectDeliveryGroup_VKDefaultDropShipmentWarehouse control /// </summary> /// <param name="sender">sender</param> /// <param name="e">event</param> [FormControlEventHandler(formControlStr(RetailCategory, VKDirectDeliveryGroup_VKDefaultDropShipmentWarehouse), FormControlEventType::Lookup)] public static void VKDirectDeliveryGroup_VKDefaultDropShipmentWarehouse_OnLookup(FormControl sender, FormControlEventArgs e) { VKRetailCategoryFormEventHandler::performWarehouseLookup(sender, e); } /// <summary> /// Lookup for GridVKDirectDelivery_VKDefaultDropShipmentWarehouse control /// </summary> /// <param name="sender">sender</param> /// <param name="e">event</param> [FormControlEventHandler(formControlStr(RetailCategory, GridVKDirectDelivery_VKDefaultDropShipmentWarehouse), FormControlEventType::Lookup)] public static void GridVKDirectDelivery_VKDefaultDropShipmentWarehouse_OnLookup(FormControl sender, FormControlEventArgs e) { VKRetailCategoryFormEventHandler::performWarehouseLookup(sender, e); } public static void performWarehouseLookup(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); FormDataSource retailAttributesLegalEntityLookup_ds = formRun.dataSource(formDataSourceStr(RetailCategory, RetailAttributesLegalEntityLookup)); RetailAttributesLegalEntityLookup retailAttributesLegalEntityLookup = retailAttributesLegalEntityLookup_ds.cursor(); FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs; DataAreaId dataAreaId = CompanyInfo::findRecId(retailAttributesLegalEntityLookup.LegalEntity).DataArea; changecompany(dataAreaId) { SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventLocation), sender); sysTableLookup.addLookupField(fieldNum(InventLocation, InventLocationId)); sysTableLookup.addLookupField(fieldNum(InventLocation, Name)); sysTableLookup.addLookupField(fieldNum(InventLocation, InventSiteId)); sysTableLookup.performFormLookup(); } ce.CancelSuperCall(); } /// <summary> /// Validating for VKDropShipment field /// </summary> /// <param name="sender">sender</param> /// <param name="e">event</param> [FormDataFieldEventHandler(formDataFieldStr(RetailCategory, RetailAttributesLegalEntityLookup, VKDropShipment), FormDataFieldEventType::Validating)] public static void VKDropShipment_OnValidating(FormDataObject sender, FormDataFieldEventArgs e) { RetailAttributesLegalEntityLookup retailAttributesLegalEntityLookup = sender.datasource().cursor(); if (sender.getValue() && !retailAttributesLegalEntityLookup.PrimaryVendorId) { FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs; checkFailed(strFmt("Supplier must be specified for legal entity %1 to set direct delivery defaults", CompanyInfo::findRecId(retailAttributesLegalEntityLookup.LegalEntity).DataArea)); args.cancel(true); } } /// <summary> /// OnActivated for RetailAttributesLegalEntityLookup datasource /// </summary> /// <param name="sender">sender</param> /// <param name="e">event</param> [FormDataSourceEventHandler(formDataSourceStr(RetailCategory, RetailAttributesLegalEntityLookup), FormDataSourceEventType::Activated)] public static void RetailAttributesLegalEntityLookup_OnActivated(FormDataSource sender, FormDataSourceEventArgs e) { RetailAttributesLegalEntityLookup retailAttributesLegalEntityLookup = sender.cursor(); FormStringControl VKDDWarehouse = sender.formRun().design(0).controlName(formControlStr(RetailCategory, VKDirectDeliveryGroup_VKDefaultDropShipmentWarehouse)); if (retailAttributesLegalEntityLookup.VKDropShipment) { VKDDWarehouse.mandatory(true); } else { VKDDWarehouse.mandatory(false); } } /// <summary> /// Modified for VKDropShipment field /// </summary> /// <param name="sender">sender</param> /// <param name="e">event</param> [FormDataFieldEventHandler(formDataFieldStr(RetailCategory, RetailAttributesLegalEntityLookup, VKDropShipment), FormDataFieldEventType::Modified)] public static void VKDropShipment_OnModified(FormDataObject sender, FormDataFieldEventArgs e) { FormStringControl VKDDWarehouse = sender.datasource().formRun().design(0).controlName(formControlStr(RetailCategory, VKDirectDeliveryGroup_VKDefaultDropShipmentWarehouse)); if (sender.getValue()) { VKDDWarehouse.mandatory(true); } else { VKDDWarehouse.mandatory(false); } } /// <summary> /// Clicked action /// </summary> /// <param name="sender">sender</param> /// <param name="e">event</param> [FormControlEventHandler(formControlStr(RetailCategory, VKDDToggleViewMode), FormControlEventType::Clicked)] public static void VKDDToggleViewMode_OnClicked(FormControl sender, FormControlEventArgs e) { FormButtonControl switchButton = sender as FormButtonControl; FormRun formRun = sender.formRun(); FormGroupControl VKDDLegalEntityView = formRun.design(0).controlName(formControlStr(RetailCategory, VKDDLegalEntityView)); FormGroupControl VKDDGroupView = formRun.design(0).controlName(formControlStr(RetailCategory, VKDDGroupView)); VKDDLegalEntityView.visible(!VKDDLegalEntityView.visible()); VKDDGroupView.visible(!VKDDGroupView.visible()); formRun.VKSetViewModeButtonText(switchButton, VKDDLegalEntityView); } /// <summary> /// Lookup method for VKDDLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, VKDDLELookupStringEdit), FormControlEventType::Lookup)] public static void VKDDLELookupStringEdit_OnLookup(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.LELookup(sender); } /// <summary> /// Modified method for VKDDLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, VKDDLELookupStringEdit), FormControlEventType::Modified)] public static void VKDDLELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKLEModified(sender); } /// <summary> /// Modified method for LELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, LELookupStringEdit), FormControlEventType::Modified)] public static void LELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKModifyLEText(sender); } /// <summary> /// Modified method for purchaseLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, purchaseLELookupStringEdit), FormControlEventType::Modified)] public static void purchaseLELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKModifyLEText(sender); } /// <summary> /// Modified method for salesLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, salesLELookupStringEdit), FormControlEventType::Modified)] public static void salesLELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKModifyLEText(sender); } /// <summary> /// Modified method for inventoryLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, inventoryLELookupStringEdit), FormControlEventType::Modified)] public static void inventoryLELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKModifyLEText(sender); } /// <summary> /// Modified method for costLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, costLELookupStringEdit), FormControlEventType::Modified)] public static void costLELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKModifyLEText(sender); } /// <summary> /// Modified method for generalLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, generalLELookupStringEdit), FormControlEventType::Modified)] public static void generalLELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKModifyLEText(sender); } /// <summary> /// Modified method for retailLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, retailLELookupStringEdit), FormControlEventType::Modified)] public static void retailLELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKModifyLEText(sender); } /// <summary> /// Modified method for categoryLELookupStringEdit control /// </summary> /// <param name="sender">sender</param> /// <param name="e">e</param> [FormControlEventHandler(formControlStr(RetailCategory, categoryLELookupStringEdit), FormControlEventType::Modified)] public static void categoryLELookupStringEdit_OnModified(FormControl sender, FormControlEventArgs e) { FormRun formRun = sender.formRun(); formRun.VKModifyLEText(sender); } }
/// <summary> /// Extension class for RetailAttributesLegalEntityLookup table /// </summary> [ExtensionOf(tablestr(RetailAttributesLegalEntityLookup))] final class VKRetailAttributesLegalEntityLookup_Extension { public boolean validateWrite() { boolean ret = true; ret = next validateWrite(); if (this.VKDropShipment) { if (!this.PrimaryVendorId) { ret = checkFailed(strFmt("Supplier must be specified for legal entity %1 to set direct delivery defaults", CompanyInfo::findRecId(this.LegalEntity).DataArea)); } if (!this.VKDefaultDropShipmentWarehouse) { ret = checkFailed(strFmt("Warehouse must be specified for legal entity %1 to set direct delivery defaults", CompanyInfo::findRecId(this.LegalEntity).DataArea)); } } return ret; } }
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units.
Join us.