Capacity Ledger Entries

Belias
Member Posts: 2,998
I couldn't find a function to translate capacity unit of measures in standard nav, so I developed it by myself and i want to share it with you if you need it. It's a really stupid function that takes as parameters the value to translate, the code of the "from" and "to" unit of measures. The function translate the value in minutes, and than translate the minutes in the resulting unit of measure.
As I said, really stupid.
P.S.: If there's a standard function for this, please suggest it to me.
PARAMETERS
Var Name DataType Subtype Length
No DECValue Decimal
No CDFromUOM Code 10
No CDToUOM Code 10
RETURN VALUE
Decimal type
VARIABLES
Name DataType Subtype Length
TBFromCapUoM Record Capacity Unit of Measure
TBToCapUoM Record Capacity Unit of Measure
FUNCTION:
FNTTranslateCapacity(DECValue : Decimal;CDFromUOM : Code[10];CDToUOM : Code[10]) : Decimal
As I said, really stupid.

P.S.: If there's a standard function for this, please suggest it to me.
PARAMETERS
Var Name DataType Subtype Length
No DECValue Decimal
No CDFromUOM Code 10
No CDToUOM Code 10
RETURN VALUE
Decimal type
VARIABLES
Name DataType Subtype Length
TBFromCapUoM Record Capacity Unit of Measure
TBToCapUoM Record Capacity Unit of Measure
FUNCTION:
FNTTranslateCapacity(DECValue : Decimal;CDFromUOM : Code[10];CDToUOM : Code[10]) : Decimal
TBFromCapUoM.GET(CDFromUOM); TBToCapUoM.GET(CDToUOM); IF TBFromCapUoM.Type <> TBToCapUoM.Type THEN BEGIN CASE TBFromCapUoM.Type OF TBFromCapUoM.Type::"100/Hour": BEGIN DECValue := DECValue * 0.6; END; TBFromCapUoM.Type::Minutes: BEGIN DECValue := DECValue * 1; END; TBFromCapUoM.Type::Hours: BEGIN DECValue := DECValue * 60; END; TBFromCapUoM.Type::Days: BEGIN DECValue := DECValue * 60 * 24; END; END; CASE TBToCapUoM.Type OF TBFromCapUoM.Type::"100/Hour": BEGIN DECValue := DECValue / 0.6; END; TBFromCapUoM.Type::Minutes: BEGIN DECValue := DECValue / 1; END; TBFromCapUoM.Type::Hours: BEGIN DECValue := DECValue / 60; END; TBFromCapUoM.Type::Days: BEGIN DECValue := DECValue / 60 / 24; END; END; END; EXIT(DECValue);
0
Comments
-
A similar function is in CU 99000755 CalendarManagement.
It takes WorkCenter and another UOM and returns a decimal.QtyperTimeUnitofMeasure(WorkCenterNo : Code[20] ;UnitOfMeasureCode : Code[10]) : Return : Decimal Procedure 4 WorkCenter.GET(WorkCenterNo); EXIT( ROUND( TimeFactor(UnitOfMeasureCode) / TimeFactor(WorkCenter."Unit of Measure Code"), 0.00001));
0 -
[Topic moved from 'NAV/Navision' forum to 'NAV Tips & Tricks' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions