14.10.2014, 11:11 | #1 |
Участник
|
kurthatlevik: Dynamics AX 2012 R3: Global recommended retail price
Источник: http://kurthatlevik.wordpress.com/20...-retail-price/
============== Maintaining retail prices in a multi company and franchise scenario can be a challenge in Dynamics AX 2012 R3. Let say we have a retailer with stores in many countries. We often also see owner structures that makes us model the retail chain with many companies. I’m currently in an implementation to an international retailer present in 22 countries, and it keeps growing every day. To model this we need to create one Dynamics AX company per country and per partner. The ability to maintain and control prices in such a scenario is a challenge, because prices is a property of a released item. (PriceDiscTable) So we decided to create very small customization so that we could keep track of prices and item barcodes on the product instead of the released product level. By doing this, the product managers have one screen where they can create and maintain product prices. The prices can be specified per currency, country and company/partner. But this is not just a simple table, but a two-way frontend for populating the standard AX price tables. We therefore have a shared table: The code for publishing prices into standard AX, using the price journal posting looks like this: void publishProductRetailPrices(){ #Admin #Zebra DataArea dataArea; PriceDiscTable priceDiscTable; PriceDiscAdmTable priceDiscAdmTable; PriceDiscAdmTrans priceDiscAdmTrans; PriceDiscAdmCheckPost priceDiscAdmCheckPost; InventDimId inventDimId; Ledger ledger; CompanyInfo legalEntity; LogisticsAddressCountryRegionId countryRegionId; #define.ImportPriceDiscJournalName("Prices") PriceDiscAdmName priceDiscAdmName; ttsbegin; while select Id from dataArea where dataArea.Id != #DATCompany { changecompany(dataArea.Id) { legalEntity = CompanyInfo::find(); ledger = Ledger::findByLegalEntity(legalEntity.RecId); countryRegionId = CompanyInfo::find().postalAddress().CountryRegionId; this.createOrUpdatePriceGroup(); if (this.RefCompanyId == dataArea.Id || this.CountryRegionId == countryRegionId || (this.RefCompanyId == "" && this.CountryRegionId == "" && this.CurrencyCode == ledger.AccountingCurrency)) { if (InventTable::exist(this.ProductNumber)) { priceDiscAdmName = this.findOrCreatePriceDiscAdmName(#ImportPriceDiscJournalName,"@SYS342509"); priceDiscAdmTable.clear(); priceDiscAdmTable.JournalName = priceDiscAdmName.JournalName; priceDiscAdmTable.Name = priceDiscAdmName.Name; priceDiscAdmTable.insert(); priceDiscAdmTrans.clear(); priceDiscAdmTrans.initValue(); inventDimId = InventDim::findOrCreateBlank().InventDimId; while select firstonly priceDiscTable where priceDiscTable.Relation == PriceType::PriceSales && priceDiscTable.ItemCode == TableGroupAll::Table && priceDiscTable.ItemRelation == this.ProductNumber && priceDiscTable.AccountCode == TableGroupAll::GroupId && priceDiscTable.AccountRelation == #RRP && priceDiscTable.Currency == this.CurrencyCode && priceDiscTable.InventDimId == inventDimId && priceDiscTable.PriceUnit == this.PriceUnit { priceDiscAdmTrans.initFromPriceDiscTable(priceDiscTable); } priceDiscAdmTrans.Relation = PriceType::PriceSales; priceDiscAdmTrans.ItemCode = TableGroupAll::Table; priceDiscAdmTrans.ItemRelation = this.ProductNumber; priceDiscAdmTrans.AccountCode = TableGroupAll::GroupId; priceDiscAdmTrans.AccountRelation = #RRP; priceDiscAdmTrans.Currency = this.CurrencyCode; priceDiscAdmTrans.InventDimId = inventDimId; priceDiscAdmTrans.PriceUnit = this.PriceUnit; priceDiscAdmTrans.JournalNum = priceDiscAdmTable.JournalNum; priceDiscAdmTrans.QuantityAmountFrom = 0; priceDiscAdmTrans.Amount = this.Amount; priceDiscAdmTrans.UnitId = InventTable::find(this.ProductNumber).salesUnitId(); priceDiscAdmTrans.SearchAgain = NoYes::Yes; priceDiscAdmTrans.insert(); if(priceDiscAdmTable.RecId) { priceDiscAdmCheckPost = new PriceDiscAdmCheckPost(false); priceDiscAdmCheckPost.initJournalNum(priceDiscAdmTable.JournalNum); priceDiscAdmCheckPost.run(); infolog.clear(); } } } } } ttscommit;} Источник: http://kurthatlevik.wordpress.com/20...-retail-price/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|