Skip to main content

Posts

Showing posts with the label Inventory

Inventory Journal Import

1. Create a Movement Journal and go into the Lines screen. 2. Select Functions, Import Lines 3. Select a csv file with the columns: ItemId, Warehouse, Location, Batch, Qty, Cost. (you can mod the code to expand this) 4. The lines are added to the journal. You can download the xpo below, and here are some of the key bits of code. Create a class (mine is called inventJournalImport) extending runbase. Create a menu item (action) for the class and drop it on the InventJournalMovement form. The main method of the class is as follows: client static void main(Args args) { inventJournalImport inventJournalImport; Object formRunObject; JournalForm journalForm; InventJournalId inventJournalId; FormDataSource journalTrans_ds; ; inventJournalImport = new inventJournalImport(); inventJournalImport.getLast(); if (!args || !args.caller() || args.caller().name() != fo...

Inventory Turns Report

static void InventoryTurns(Args _args) { itemId itemId; inventTrans inventTrans; inventSum inventSum; qty thisQty, qtyOnHand, totalDailyQtyOnHand, avgDailyQtyOnHand, usageQty; Amount thisValue, valueOnHand, totalDailyValueOnHand, avgDailyValueOnHand, usageValue; Real turnsByQty, turnsByValue; date lastDate, fromDate, toDate; ; //set the itemID and date range itemId = '00001'; fromDate = mkDate(1,1,2010); toDate = mkDate(31,12,2010); //****average daily on-hand lastDate = systemDateGet(); //initialize with today. //inventSum contains today's values for qty and value while select inventSum where inventSum.ItemId == itemId && inventSum.Closed == NoYes::No { qtyOnHand += inventSum.PhysicalInvent; valueOnHand += (inventSum.PhysicalValue + inventSum.PostedValue); } //starting with today, we work backward to the from ...

Allow changing of Inventory UnitId

Dynamics Ax does not allow you to change the Inventory UnitId of an item if there is stock or if there are open transactions. We as a food business wanted to change the inventory unit of canola oil from 200L barrels to 1000L Pallecons (or even better to Ltrs, avoiding future changes of the Inventory Stock Item), but as nearly every one of our products use canola oil the will be no point in time without open transactions (production orders) and deleting and reentering all open orders is also a nuisance. Therefore I decided to make a mod which allows us to change to unitId with open transactions and existing stock. The modifications only need to be done in the update method of the InventTableModule table and are marked with //bw . IMPORTANT: The code here only updates InventTrans and InventSum. There are other tables with Quantities referring to the Inventory Unit such as InventJournalTrans which I do not update. This leads to inconsistencies which we can live with but you might not! vo...