Skip to main content

Posts

Showing posts from March, 2015

Calculating easter sunday in different ways

Once a long time ago I found an interesting document on the inter web, describing different calendar systems. From that I made a php-class for my website that can calculate easter sunday in the gregorian calendar. Then it is easy to calculate the rest of the danish holidays as they are offset according to easter sunday (except of course those that have a fixed date). I translated that class in to x++. You can find it here: https://onedrive.live.com/redir?resid=9B63D38F981FFD1B!39710&authkey=!ABv0yYPULV3ReIE&ithint=file%2cxpo Today I got talking with a colleague about calculating easter sunday so he mentioned that he had also made a version of the calculation: http://stackoverflow.com/questions/11048524/how-to-calculate-easter-sunday-in-x So of course - being a bit nerdy - we just *had* to check if the routines arrived at the same result. So we came up with: static void EasterTest(Args _args) {     Yr x;     date easter(Yr yr) // Påskedag / påske sønd

Forcing the Name field of a salesline to be synchronized to the purchline when using Drop shipment

Using non-stock items in the daily business can be handled in Dynamics AX 2012 by using Direct delivery. You can use the Button "Direct delivery" from a sales order you have created, to create a matching purchase order. However if you use the Name field on the salesline to describe the specifications of the item you want to the vendor, the standard functionality does create the matching purchase order lines so that the name of the originating sales line is also used on the sales lines. Direct deliveries are handled so that the inventory transactions of the salesline are marked against the purchline, so I wrote this small script to be able to get the hang of how to find the direct delivery purchaselines from the saleslines records of a sales order. static void Job235(Args _args) {     SalesLine   salesLine;     PurchLine   purchLine;     InventTransOriginSalesLine itosl;     InventTransOriginPurchLine itopl;     InventTrans it,it1;     InventTable iTbl;     InventHandl