mibuso.com

Microsoft Business Solutions online community
It is currently Sun May 19, 2013 4:51 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Capacity Ledger Entries
PostPosted: Fri Apr 17, 2009 11:38 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Mon Dec 11, 2006 10:34 am
Posts: 2863
Location: Bergamo
Country: Italy (it)
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. :mrgreen:

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
Code: Select all
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);


Top
 Profile  
 
 Post subject: Re: Capacity Ledger Entries
PostPosted: Thu Apr 23, 2009 2:40 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Wed Dec 15, 2004 6:11 pm
Posts: 8699
Location: 3rd rock from sun
Country: United States (us)
A similar function is in CU 99000755 CalendarManagement.

It takes WorkCenter and another UOM and returns a decimal.

Code: Select all
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));

_________________
Rashed.

blog: http://mibuso.com/blogs/ara3n/


Top
 Profile  
 
 Post subject: Re: Capacity Ledger Entries
PostPosted: Mon Apr 27, 2009 1:53 pm 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7493
Location: Milan
Country: Italy (it)
[Topic moved from 'NAV/Navision' forum to 'NAV Tips & Tricks' forum]

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: