Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Program for getting denomination
Message
From
09/12/1998 07:25:10
 
 
To
09/12/1998 03:24:08
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordan
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00164962
Message ID:
00165471
Views:
47
>>>Thanks for your reply... Actually I'll make it more clear,
>>>
>>>We've around 400 labours in our company & I'm making a Payroll program, For eg. one labour's salary is say 356 Dirhams (Currency Used in UAE), so the program should return this :-
>>>
>>>100x3=300
>>>50x1=50
>>>5x1=5
>>>1x1=1 Total is 356
>>>
>>>Same way the loop will scan all the 400 records and update a dbf or cursor for all the employees.
>>>
>>>Finally I can take the total report and give it to bank (as we are paying salary by cash ), so they can arrange the amount accordingly...
>>>
>>>Can you pls tell me if there is already a program made for this thing...

This should do the trick:

PARAMETERS tiAmount
LOCAL laDenominations, liCount, liRest, i
DIMENSION laDenominations[4]
laDenominations[1] = 100
laDenominations[2] = 50
laDenominations[3] = 5
laDenominations[4] = 1
liRest = tiAmount
FOR i = 1 TO ALEN(laDenominations, 1)
liCount = INT(liRest/laDenominations[i])
liRest = MOD(liRest, laDenominations[i])
IF liCount > 0
? laDenominations[i], liCount, liCount * laDenominations[i]
* Or insert into cursor
* INSERT INTO Denominations (Denomination, Count) ;
VALUES laDenominations[i], liCount
ENDIF
ENDFOR

Arne
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform