Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class for transforming paires into dozens & vice versa
Message
From
21/10/1998 14:55:19
 
 
To
21/10/1998 14:45:26
Pierre Sauve
Micro-Fox Canada Inc.
Montréal, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00149030
Message ID:
00149039
Views:
19
>Hi everyone,
> I am trying my best to learn VFP . But I have a problem that I dont seem to be able to solve. I would need guidlines on this if possible .
>I am writing an application where quantities for a Unit of Measure = "DZS" are kept on disk in pairs , but when one look at them on the screen or on a report , these quantities are shown in dozens and pairs. Example a field containing 138 on disk as a quantity would show 11.06 on a screen or a report . That is read by the user as 11 dzs and 6 pairs.(int(138/12) = 11 and mod(138,12) = 6 wich is formatted to show 06). This is typical of the hosiery industry. So , I would need 2 class's . One to go from the disk to the screen and on to go from to screen (after user change or not) to the disk. I know how to write the code , wich is very simple . But what I seem to be missing is Where to create the class , wich property do I need to create and where , in the form or in the class. No matter what I have tried so far do not work .
> Can someone give general guidelines on this please ?
>
>
> Thanks in advance.
>
> Pierre Sauve

Probably, you just need in one function/method to be added to your app. Surely, you can build custom class with just this method.
***cstCalculation.dozentonumbers
LPARAMETER nValue,nMode
IF nMode=1 && numbers to dozen/pairs
RETURN FLOOR(nValue/12)+MOD(nValue,12)/100
ELSE && dozen/pairs to numbers
RETURN FLOOR(nValue)*12+(nValue-FLOOR(nValue))*100
ENDIF
Now you can instanciate the object:
oApp.oCalculations=createobject("cstCalculation")
and call when necessary:
oApp.oCalculations.DozenToNumbers(245,1)
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform