Tuesday, July 28, 2015

Cek Product yang sudah di-Release di Company yang berbeda - AX 2012

static void Test_Product_Find_CrossCompany(Args _args)
{
    InventTable             _inventTable;
    ItemId                  itemidx;
    SelectableDataArea      dataAreaId1,dataAreaId2;
    Dialog                              d;
    DialogField                         df1;
    CommaTextIo                         file;
    container                           rec;

    ;

    //info('Current company '+curext());

    dataAreaId1 = curext();

    d = new Dialog(strFmt("Find Exist Product",curext()));
    df1 = d.addField(ExtendedTypeStr("ProductNumber"));

    itemidx = df1.value();

    if (d.run())
    {
        if(!df1.value())
        {return;}

            changeCompany('CMP1')
            {
                if(InventTable::exist(df1.value())==true)
                { info('Exist in: '+curext()+', ItemGroupId: '
                  +InventItemGroupItem::findByItemIdLegalEntity(df1.value(),curext()).ItemGroupId); }
                else
                { info('NOT Exist in '+curext()); }
            }

            changeCompany('CMP2')
            {
                if(InventTable::exist(df1.value())==true)
                { info('Exist in: '+curext()+', ItemGroupId: '
                  +InventItemGroupItem::findByItemIdLegalEntity(df1.value(),curext()).ItemGroupId); }
                else
                { info('NOT Exist in '+curext()); }
            }

            changeCompany('CMP3')
            {
                if(InventTable::exist(df1.value())==true)
                { info('Exist in: '+curext()+', ItemGroupId: '
                  +InventItemGroupItem::findByItemIdLegalEntity(df1.value(),curext()).ItemGroupId); }
                else
                { info('NOT Exist in '+curext()); }
            }
    }

}

No comments:

Post a Comment