Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Saturday, January 24, 2015

To get the latest Purch price and sale price of an Item in AX 2012

Hi,

static void AlfasithInventDimInventTableRelation(Args _args)
{
    InventTable             InventTable;
    InventDim               InventDim;
    InventDimCombination    InventDimCombination;
    PriceDiscTable          PriceDiscTable;

    while select InventDimId from InventDim where InventDim.InventColorId == " "
                       &&   InventDim.InventStyleId == " "
                       &&   InventDim.configId == " "
                       &&   InventDim.InventSizeId == " "
        {
            select InventDimCombination where InventDimCombination.InventDimId == InventDim.inventDimId
                                        && InventDimCombination.ItemId == "1035";
            if(InventDimCombination)
            {
                select PriceDiscTable where PriceDiscTable.ItemCode == 0
                                &&  PriceDiscTable.ItemRelation == "1035" // Item Id
                                &&  PriceDiscTable.InventDimId  == InventDimCombination.InventDimId
                                &&  PriceDiscTable.FromDate     <= today()
                                &&  PriceDiscTable.ToDate       >= today()
                                &&  PriceDiscTable.relation     == PriceType::PricePurch // for Purch pirce
                                //&&  PriceDiscTable.relation     == PriceType::PriceSales // for Sales pirce
                ;
                print PriceDiscTable.Amount; // when
            }
        }
}

Regards,

No comments:

Post a Comment

Get a table ID in SQL - D365

Hi select ID from SysTableIdView where  SysTableIdView .Name = 'CustTable' Regards,