The module type for Inventory is 0, not 1.
--- In Axapta-Knowledge-Village@yahoogroups.com, "new_it_guy_ar"
<anthony.mcchrist...@...> wrote:
>
> We are running AX 3.0 SP6. We have recently decided to write off a number of
> items from our spare parts inventory. I have created a movement journal to
> zero out the cost for the inventory value and a temporary table that contains
> all of the item numbers that should be affected. I have created the job
> below to zero out the Inventory cost on the Price/Discount tab of the item.
> The job runs and shows activity but when I look at the items there is still a
> cost price. Any suggestions?
>
> static void ItemWriteOff(Args _args)
> {
> InventTableModule inventTableModule;
> TmpExcelData tmpExcelData;
> ;
> while select tmpExcelData
> {
> ttsbegin;
> select forupdate InventTableModule
> where InventTableModule.ItemId == tmpExcelData.AccountNum &&
> InventTableModule.ModuleType == 1;
>
> if (InventTableModule)
> {
> inventtableModule.price = 0.00 ;
>
> inventTableModule.update();
> }
> ttscommit;
> }
> }
>