Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Program for getting denomination
Message
From
20/12/1998 08:05:40
Vinod Parwani
United Creations L.L.C.
Ad-Dulayl, Jordan
 
 
To
09/12/1998 07:25:10
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00164962
Message ID:
00169227
Views:
42
>>>>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


Thanks.. This is working.. But problem is in Dirhams (Currency used here), we have currency of

1000, 500, 200, 100, 50, 20, 10, 5, 1, 0.50, 0.25

How I can change the routine to support all these...

Pls advs.
Previous
Reply
Map
View

Click here to load this message in the networking platform