Price disc agreement
PriceGroupType
PriceType
Class
GOPPriceDiscAdmTransTable_Extension
GOPPriceDiscTableDSForm_Extension
GOPPriceTypeConverter_Extension
GOPPriceGroupTypeTradeAgreementMappingSalesQtyPromo
GOPPriceTypeTradeAgreementMappingSalesQtyPromoDisc
Table
CustTable - PriceDiscGroup_LineDisc
InventTableModule - InventLineDiscountGroup
PriceDiscAdmTrans - CustLineGroup
PriceDiscTable - CustLineGroup
SalesLine -
Relation
dataEntity
SalesOpenSalesLineDiscountJournalLineEntity
/// <summary>
/// Extension class for table : PriceDiscAdmTrans
/// </summary>
[ExtensionOf(tableStr(PriceDiscAdmTrans))]
internal final class GOPPriceDiscAdmTransTable_Extension
{
/// <summary>
/// Validate weite extension before writng to DB
/// </summary>
/// <returns>Return true if pass</returns>
public boolean validateWrite()
{
boolean ret;
ret = next validateWrite();
if (this.relation == PriceType::GOPPromotionalItemSales)
{
if (this.GOPQuantity <= 0)
{
warning(strFmt("@GOP:ValidateNegativeParenetItemQuantity", this.GOPQuantity));
ret = 0 * ret;
}
if (this.GOPPromotionalItemCode == '')
{
warning("@GOP:ValidateBlankPromotionalItemCode");
ret = 0 * ret;
}
if (this.GOPPromotionalItemQuantity <= 0)
{
warning(strFmt("@GOP:ValidateNegativePromotionalItemQuantity", this.GOPPromotionalItemQuantity));
ret = 0 * ret;
}
}
return ret;
}
}
*./// <summary>
/// Form EventHandler for trade agreement Journal lines(PriceDiscTable - Datasource)
/// </summary>
[ExtensionOf(formDataSourceStr(PriceDiscTable, PriceDiscTable))]
final class GOPPriceDiscTableDSForm_Extension
{
/// <summary>
/// COC to enable & hide the controls based on the Trade agrement PriceType(Promotional item (Sales))
/// </summary>
/// <returns>boolean true or fasle</returns>
public int active()
{
PriceDiscAdmTable priceDiscAdmTableLoc;
priceDiscAdmTrans priceDiscAdmTransLoc;
PriceDiscTable PriceDiscTableLoc;
//FormDataSource priceDiscAdmTrans_ds = this;
//PriceDiscTable PriceDiscTableBuff = this.cursor();
FormRun formrun = this.formRun();
FalseTrue fasleTrue = FalseTrue::False;
select firstonly JournalNum, DefaultRelation from priceDiscAdmTableLoc
join recid, JournalNum from priceDiscAdmTransLoc
where priceDiscAdmTableLoc.JournalNum == priceDiscAdmTransLoc.JournalNum
join OriginalPriceDiscAdmTransRecId from PriceDiscTableLoc
where PriceDiscTableLoc.OriginalPriceDiscAdmTransRecId == priceDiscAdmTransLoc.recid
&& priceDiscAdmTableLoc.DefaultRelation == PriceType::GOPPromotionalItemSales;
if (priceDiscAdmTableLoc.JournalNum && PriceDiscTableLoc.OriginalPriceDiscAdmTransRecId)
{
fasleTrue = FalseTrue::True;
formRun.control(FormRun.controlId(formControlStr(PriceDiscTable, GOPQuantity))).visible(fasleTrue);
formRun.control(FormRun.controlId(formControlStr(PriceDiscTable, GOPPromotionalItemCode))).visible(fasleTrue);
formRun.control(FormRun.controlId(formControlStr(PriceDiscTable, GOPPromotionalItemQuantity))).visible(fasleTrue);
formRun.control(FormRun.controlId(formControlStr(PriceDiscTable, PriceDiscTable_QuantityAmountFrom))).visible(!fasleTrue);
formRun.control(FormRun.controlId(formControlStr(PriceDiscTable, PriceDiscTable_QuantityAmountTo))).visible(!fasleTrue);
//formRun.control(FormRun.controlId(formControlStr(PriceDiscTable, PriceDiscTable_GOPTransferCost))).visible(!fasleTrue);
formRun.control(FormRun.controlId(formControlStr(PriceDiscTable, PriceDiscTable_Amount))).visible(!fasleTrue);
formRun.control(FormRun.controlId(formControlStr(PriceDiscTable, PriceDiscTable_Currency))).visible(!fasleTrue);
}
return next active();
}
}
/// <summary>
/// The <c>GOPPriceGroupTypeTradeAgreementMappingSalesQtyPromo</c> class is handling the mapping of fields, module and other types for <c>PriceGroupType</c> line discount.
/// </summary>
[PriceGroupTypeFactory(PriceGroupType::GOPPromotionalItemSalesLineDisc)]
class GOPPriceGroupTypeTradeAgreementMappingSalesQtyPromo extends PriceGroupTypeTradeAgreementMapping
{
public PriceType priceDiscType(ModuleInventCustVend _module)
{
PriceType PriceType;
switch (_module)
{
case ModuleInventCustVend::Cust:
PriceType = PriceType::GOPPromotionalItemSales;
}
return PriceType;
}
}
/// <summary>
/// The <c>PriceTypeConverter</c> class provides method for conversion price type to price group type.
/// </summary>
[ExtensionOf(classStr(PriceTypeConverter))]
final class MMMPriceTypeConverter_Extension
{
/// <summary>
/// Converts a price type value to its corresponding price group type value.
/// </summary>
/// <param name = "_priceType">A price type.</param>
/// <returns>Price group type which corresponds to price type.</returns>
public static PriceGroupType priceTypeToPriceGroupType(PriceType _priceType)
{
PriceGroupType priceGroupType;
priceGroupType = next priceTypeToPriceGroupType(_priceType);
switch (_priceType)
{
case PriceType::MMMPromotionalItemSales:
priceGroupType = PriceGroupType::MMMPromotionalItemSalesLineDisc;
}
return priceGroupType;
}
/// <summary>
/// Repalced to avoid the error
/// Performs the default conversion from a price type value to its corresponding price group type value.
/// </summary>
/// <param name = "_priceType">A price type.</param>
/// <returns>Price group type which corresponds to price type.</returns>
protected static PriceGroupType defaultPriceTypeToPriceGroupTypeConversion(PriceType _priceType)
{
PriceGroupType PriceGroupType;
if (_priceType != PriceType::MMMPromotionalItemSales)
{
next defaultPriceTypeToPriceGroupTypeConversion(_priceType);
}
return PriceGroupType;
}
}
/// <summary>
/// The <c>GOPPriceTypeTradeAgreementMappingSalesQtyPromoDisc</c> class is responsible for handling mapping of the price type <c>GOPPromotionalItemSalesLineDisc</c>.
/// </summary>
[PriceTypeFactory(PriceType::GOPPromotionalItemSales)]
final class GOPPriceTypeTradeAgreementMappingSalesQtyPromoDisc extends PriceTypeTradeAgreementMappingSales
{
/// <summary>
/// Retrun table group
/// </summary>
/// <returns>TableGroupAll</returns>
public TableGroupAll tableGroupAll()
{
return TableGroupAll::Table;
}
/// <summary>
/// Retrun table group
/// </summary>
/// <returns>TableGroupAll</returns>
public PriceDiscProductCodeType priceDiscProductCodeType()
{
return PriceDiscProductCodeType::Table;
}
/// <summary>
/// CustTable Promotional Item Sales Line Disc
/// </summary>
/// <returns>Promotional Item Sales Line </returns>
public FieldId custVendTableField()
{
return fieldNum(CustTable, GOPPromotionalItemSalesLineDisc);
}
/// <summary>
/// InventTableModule Promotional Item Sales Line Disc
/// </summary>
/// <returns>Promotional Item Sales Line </returns>
public FieldId inventTableModuleField()
{
return fieldNum(InventTableModule, GOPPromotionalItemSalesLineDisc);
}
/// <summary>
/// Promotional Item Sales Line Disc
/// </summary>
/// <returns>Promotional Item Sales Line Disc</returns>
public PriceGroupType priceGroupType()
{
return PriceGroupType::GOPPromotionalItemSalesLineDisc;
}
/// <summary>
/// MCR LineDisc
/// </summary>
/// <returns>MCR LineDisc</returns>
public MCRPriceHistoryType mcrPriceHistoryType()
{
return MCRPriceHistoryType::LineDisc;
}
/// <summary>
/// Retrun table Disc group Applicable
/// </summary>
/// <returns>boolean</returns>
public boolean isDiscGroupApplicable()
{
return true;
}
/// <summary>
/// check for active table group
/// </summary>
/// <param name = "_accountCode">TableGroupAll Account relation</param>
/// <param name = "_itemCode">TableGroupAll Item relation</param>
/// <param name = "_priceParameters">Price Parameters</param>
/// <returns>Yes If active</returns>
public NoYes isActivated(
TableGroupAll _accountCode,
TableGroupAll _itemCode,
PriceParameters _priceParameters = PriceParameters::find())
{
return this.isPartyCodeProductCodeActivated(
PriceDiscPartyCodeTypeTableGroupAllMapping::tableGroupAllToPriceDiscPartyCodeType(_accountCode),
PriceDiscProductCodeTypeTableGroupAllMapping::tableGroupAllToPriceDiscProductCodeType(_itemCode),
_priceParameters);
}
/// <summary>
/// check for active account relation table group
/// </summary>
/// <param name = "_partyCode">TableGroupAll Account relation</param>
/// <param name = "_productCode">TableGroupAll Item relation</param>
/// <param name = "_priceParameters">Price Parameters</param>
/// <returns>Yes If active</returns>
public NoYes isPartyCodeProductCodeActivated(
PriceDiscPartyCodeType _partyCode,
PriceDiscProductCodeType _productCode,
PriceParameters _priceParameters = PriceParameters::find())
{
switch (_partyCode)
{
case PriceDiscPartyCodeType::Table:
switch (_productCode)
{
case PriceDiscProductCodeType::Table:
return _priceParameters.SalesLineAccountItem;
case PriceDiscProductCodeType::GroupId:
return _priceParameters.SalesLineAccountGroup;
case PriceDiscProductCodeType::All:
return _priceParameters.SalesLineAccountAll;
}
break;
case PriceDiscPartyCodeType::GroupId:
switch (_productCode)
{
case PriceDiscProductCodeType::Table:
return _priceParameters.SalesLineGroupItem;
case PriceDiscProductCodeType::GroupId:
return _priceParameters.SalesLineGroupGroup;
case PriceDiscProductCodeType::All:
return _priceParameters.SalesLineGroupAll;
}
break;
case PriceDiscPartyCodeType::All:
switch (_productCode)
{
case PriceDiscProductCodeType::Table:
return _priceParameters.SalesLineAllItem;
case PriceDiscProductCodeType::GroupId:
return _priceParameters.SalesLineAllGroup;
case PriceDiscProductCodeType::All:
return _priceParameters.SalesLineAllAll;
}
break;
}
return NoYes::No;
}
/// <summary>
/// is Relation Activation Possible
/// </summary>
/// <param name = "_accountCode">accountCode</param>
/// <param name = "_itemCode">itemCode</param>
/// <returns>Yes or No</returns>
public NoYes isActivationPossible(TableGroupAll _accountCode, TableGroupAll _itemCode)
{
return this.isActivationPossibleForPartyCodeProductCode(
PriceDiscPartyCodeTypeTableGroupAllMapping::tableGroupAllToPriceDiscPartyCodeType(_accountCode),
PriceDiscProductCodeTypeTableGroupAllMapping::tableGroupAllToPriceDiscProductCodeType(_itemCode));
}
/// <summary>
/// Activation possible for Item and Account code
/// </summary>
/// <param name = "_partyCode">Account code</param>
/// <param name = "_productCode">Item Code</param>
/// <returns>No Yes based on activation </returns>
public NoYes isActivationPossibleForPartyCodeProductCode(PriceDiscPartyCodeType _partyCode, PriceDiscProductCodeType _productCode)
{
return NoYes::Yes;
}
}
form
<?xml version="1.0" encoding="utf-8"?>
<AxForm xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Microsoft.Dynamics.AX.Metadata.V6">
<Name>GOPPromotionItemPartyCodeTypeCombination</Name>
<SourceCode>
<Methods xmlns="">
<Method>
<Name>classDeclaration</Name>
<Source><![CDATA[
[Form]
public class GOPPromotionItemPartyCodeTypeCombination extends FormRun
{
}
]]></Source>
</Method>
</Methods>
<DataSources xmlns="" />
<DataControls xmlns="" />
<Members xmlns="" />
</SourceCode>
<DataSources>
<AxFormDataSource xmlns="">
<Name>GOPPromotionItemPartyCodeTypeCombination</Name>
<Table>GOPPromotionItemPartyCodeTypeCombination</Table>
<Fields>
<AxFormDataSourceField>
<DataField>DataAreaId</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>LineNum</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>Partition</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>PriceDiscPartyCodeType</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>PriceDiscProductCodeType</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>RecId</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>SysRowVersionNumber</DataField>
</AxFormDataSourceField>
<AxFormDataSourceField>
<DataField>TableId</DataField>
</AxFormDataSourceField>
</Fields>
<ReferencedDataSources />
<InsertIfEmpty>No</InsertIfEmpty>
<DataSourceLinks />
<DerivedDataSources />
</AxFormDataSource>
</DataSources>
<Design>
<Caption xmlns="">@GOP:GOPPromotionItemPartyCodeTypeCombinationSetup</Caption>
<HideIfEmpty xmlns="">No</HideIfEmpty>
<Pattern xmlns="">SimpleList</Pattern>
<PatternVersion xmlns="">1.1</PatternVersion>
<StatusBarStyle xmlns="">Simple</StatusBarStyle>
<Style xmlns="">SimpleList</Style>
<TitleDataSource xmlns="">GOPPromotionItemPartyCodeTypeCombination</TitleDataSource>
<Controls xmlns="">
<AxFormControl xmlns=""
i:type="AxFormActionPaneControl">
<Name>ActionPane</Name>
<ElementPosition>715827882</ElementPosition>
<FilterExpression>%1</FilterExpression>
<Type>ActionPane</Type>
<VerticalSpacing>-1</VerticalSpacing>
<FormControlExtension
i:nil="true" />
<Controls />
<AlignChild>No</AlignChild>
<AlignChildren>No</AlignChildren>
<ArrangeMethod>Vertical</ArrangeMethod>
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormGroupControl">
<Name>FilterGroup</Name>
<Pattern>CustomAndQuickFilters</Pattern>
<PatternVersion>1.1</PatternVersion>
<Type>Group</Type>
<WidthMode>SizeToAvailable</WidthMode>
<FormControlExtension
i:nil="true" />
<Controls>
<AxFormControl>
<Name>QuickFilterControl</Name>
<FormControlExtension>
<Name>QuickFilterControl</Name>
<ExtensionComponents />
<ExtensionProperties>
<AxFormControlExtensionProperty>
<Name>targetControlName</Name>
<Type>String</Type>
<Value>Grid</Value>
</AxFormControlExtensionProperty>
<AxFormControlExtensionProperty>
<Name>defaultColumnName</Name>
<Type>String</Type>
</AxFormControlExtensionProperty>
<AxFormControlExtensionProperty>
<Name>placeholderText</Name>
<Type>String</Type>
</AxFormControlExtensionProperty>
</ExtensionProperties>
</FormControlExtension>
</AxFormControl>
</Controls>
<ArrangeMethod>HorizontalLeft</ArrangeMethod>
<FrameType>None</FrameType>
<Style>CustomFilter</Style>
<ViewEditMode>Edit</ViewEditMode>
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormGridControl">
<Name>Grid</Name>
<ElementPosition>1431655764</ElementPosition>
<FilterExpression>%1</FilterExpression>
<Type>Grid</Type>
<VerticalSpacing>-1</VerticalSpacing>
<FormControlExtension
i:nil="true" />
<Controls>
<AxFormControl xmlns=""
i:type="AxFormComboBoxControl">
<Name>GOPPromotionItemPartyCodeTypeCombination_PriceDiscPartyCodeType</Name>
<Type>ComboBox</Type>
<FormControlExtension
i:nil="true" />
<DataField>PriceDiscPartyCodeType</DataField>
<DataSource>GOPPromotionItemPartyCodeTypeCombination</DataSource>
<Items />
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormComboBoxControl">
<Name>GOPPromotionItemPartyCodeTypeCombination_PriceDiscProductCodeType</Name>
<Type>ComboBox</Type>
<FormControlExtension
i:nil="true" />
<DataField>PriceDiscProductCodeType</DataField>
<DataSource>GOPPromotionItemPartyCodeTypeCombination</DataSource>
<Items />
</AxFormControl>
<AxFormControl xmlns=""
i:type="AxFormIntegerControl">
<Name>GOPPromotionItemPartyCodeTypeCombination_LineNum</Name>
<Type>Integer</Type>
<FormControlExtension
i:nil="true" />
<DataField>LineNum</DataField>
<DataSource>GOPPromotionItemPartyCodeTypeCombination</DataSource>
</AxFormControl>
</Controls>
<AlternateRowShading>No</AlternateRowShading>
<DataSource>GOPPromotionItemPartyCodeTypeCombination</DataSource>
<MultiSelect>No</MultiSelect>
<ShowRowLabels>No</ShowRowLabels>
<Style>Tabular</Style>
</AxFormControl>
</Controls>
</Design>
<Parts />
</AxForm>
<?xml version="1.0" encoding="utf-8"?>
<AxTable xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Name>GOPPromotionItemPartyCodeTypeCombination</Name>
<SourceCode>
<Declaration><![CDATA[
public class GOPPromotionItemPartyCodeTypeCombination extends common
{
}
]]></Declaration>
<Methods>
<Method>
<Name>find</Name>
<Source><![CDATA[
/// <summary>
/// Find method to
/// </summary>
/// <param name = "_PriceDiscProductCodeType"></param>
/// <param name = "_PriceDiscPartyCodeType"></param>
/// <returns>return GOPPromotionItemPartyCodeTypeCombinationtable buffer</returns>
static GOPPromotionItemPartyCodeTypeCombination find(PriceDiscProductCodeType _PriceDiscProductCodeType, PriceDiscPartyCodeType _PriceDiscPartyCodeType)
{
GOPPromotionItemPartyCodeTypeCombination promotionItemPratyCodeTypeCombination;
select firstonly promotionItemPratyCodeTypeCombination
index hint AccountIAndItemPratyCodeTypeCombinationIdx
where promotionItemPratyCodeTypeCombination.PriceDiscPartyCodeType == _PriceDiscPartyCodeType
&& promotionItemPratyCodeTypeCombination.PriceDiscProductCodeType == _PriceDiscProductCodeType;
return promotionItemPratyCodeTypeCombination;
}
]]></Source>
</Method>
<Method>
<Name>incrementLineNumber</Name>
<Source><![CDATA[
/// <summary>
/// to increment the number and to maintain the product & party code sequency
/// </summary>
private void incrementLineNumber()
{
GOPPromotionItemPartyCodeTypeCombination incrementLineNum;
select firstonly LineNum from incrementLineNum
order by incrementLineNum.lineNum desc;
this.LineNum = incrementLineNum.LineNum+1;
}
]]></Source>
</Method>
<Method>
<Name>initValue</Name>
<Source><![CDATA[
/// <summary>
/// to increment the number and to maintain the product & party code sequency
/// </summary>
public void initValue()
{
super();
this.incrementLineNumber();
}
]]></Source>
</Method>
</Methods>
</SourceCode>
<DeveloperDocumentation>@GOP:GOPPromotionItemPartyCodeTypeCombinationSetup</DeveloperDocumentation>
<FormRef>GOPPromotionItemPartyCodeTypeCombination</FormRef>
<Label>@GOP:GOPPromotionItemPartyCodeTypeCombinationSetup</Label>
<TableGroup>Group</TableGroup>
<TitleField1>PriceDiscPartyCodeType</TitleField1>
<TitleField2>PriceDiscProductCodeType</TitleField2>
<CacheLookup>EntireTable</CacheLookup>
<ClusteredIndex></ClusteredIndex>
<CreateRecIdIndex>No</CreateRecIdIndex>
<Modules>SalesAndMarketing</Modules>
<PrimaryIndex>AccountIAndItemPratyCodeTypeCombinationIdx</PrimaryIndex>
<DeleteActions>
<AxTableDeleteAction>
<Name>PriceDiscAdmTable</Name>
<DeleteAction>Restricted</DeleteAction>
<Relation></Relation>
<Table>PriceDiscAdmTable</Table>
</AxTableDeleteAction>
</DeleteActions>
<FieldGroups>
<AxTableFieldGroup>
<Name>AutoReport</Name>
<Fields>
<AxTableFieldGroupField>
<DataField>PriceDiscPartyCodeType</DataField>
</AxTableFieldGroupField>
<AxTableFieldGroupField>
<DataField>PriceDiscProductCodeType</DataField>
</AxTableFieldGroupField>
<AxTableFieldGroupField>
<DataField>LineNum</DataField>
</AxTableFieldGroupField>
</Fields>
</AxTableFieldGroup>
<AxTableFieldGroup>
<Name>AutoLookup</Name>
<Fields />
</AxTableFieldGroup>
<AxTableFieldGroup>
<Name>AutoIdentification</Name>
<AutoPopulate>Yes</AutoPopulate>
<Fields />
</AxTableFieldGroup>
<AxTableFieldGroup>
<Name>AutoSummary</Name>
<Fields />
</AxTableFieldGroup>
<AxTableFieldGroup>
<Name>AutoBrowse</Name>
<Fields />
</AxTableFieldGroup>
<AxTableFieldGroup>
<Name>Defaults</Name>
<Label>@SYS334126</Label>
<Fields />
</AxTableFieldGroup>
<AxTableFieldGroup>
<Name>Identification</Name>
<Label>@SYS5711</Label>
<Fields>
<AxTableFieldGroupField>
<DataField>PriceDiscPartyCodeType</DataField>
</AxTableFieldGroupField>
<AxTableFieldGroupField>
<DataField>PriceDiscProductCodeType</DataField>
</AxTableFieldGroupField>
</Fields>
</AxTableFieldGroup>
</FieldGroups>
<Fields>
<AxTableField xmlns=""
i:type="AxTableFieldEnum">
<Name>PriceDiscPartyCodeType</Name>
<AllowEdit>No</AllowEdit>
<Mandatory>Yes</Mandatory>
<EnumType>PriceDiscPartyCodeType</EnumType>
</AxTableField>
<AxTableField xmlns=""
i:type="AxTableFieldEnum">
<Name>PriceDiscProductCodeType</Name>
<AllowEdit>No</AllowEdit>
<Mandatory>Yes</Mandatory>
<EnumType>PriceDiscProductCodeType</EnumType>
</AxTableField>
<AxTableField xmlns=""
i:type="AxTableFieldInt">
<Name>LineNum</Name>
<AllowEdit>No</AllowEdit>
<AllowEditOnCreate>No</AllowEditOnCreate>
<ExtendedDataType>Integer</ExtendedDataType>
<IgnoreEDTRelation>Yes</IgnoreEDTRelation>
<Label>@SYS101704</Label>
</AxTableField>
</Fields>
<FullTextIndexes />
<Indexes>
<AxTableIndex>
<Name>AccountIAndItemPratyCodeTypeCombinationIdx</Name>
<AlternateKey>Yes</AlternateKey>
<Fields>
<AxTableIndexField>
<DataField>PriceDiscPartyCodeType</DataField>
</AxTableIndexField>
<AxTableIndexField>
<DataField>PriceDiscProductCodeType</DataField>
</AxTableIndexField>
</Fields>
</AxTableIndex>
</Indexes>
<Mappings />
<Relations />
<StateMachines />
</AxTable>
Comments
Post a Comment