Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I don't like this Code, I call on the UT brain power
Message
De
31/12/1999 02:00:03
 
 
À
30/12/1999 10:46:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00310399
Message ID:
00310835
Vues:
15
>Hi all,
>
>I have a little problem and would like some insight. The following Code is for a payroll system. I have a table (TIMESCHL) with the fields MON1STRT, MON1END etc. which I use, to find the amount of hours scheduled. As you can tell, I was heading down the DO CASE road when I decided that probably isn't the best way to go, Primarily for maintenance reasons. So I guess my question would be how would some of you go about doing something like this.


Jon, your instincts are correct. 18 different cases are almost certainly not a general answer to your problem. I wasn't sure where the "magic number" of 18 came from. Is this a biweekly payroll?

Some general suggestions based on my personal biases.

1) I dislike temporary files and work files. There is no audit trail that can be examined at a later time and they generally require batch rather than real-time processing.

2) I never reference record numbers. You should use a SCAN statement instead of the FOR R loop.

3) I take it that TIMESCHL has a number of repeating groups of fields. It needs to be normalized. You would probably need to create a table of begin and end times:

Table BEGINEND
iBEGINEND integer && primary key (always use a primary key :)
iEmpId integer && employee table key
dPeriod date && identifies the payroll period
tStart datetime && starting time
tEnd datetime && ending time

Something like this.


4) Look into using SQL rather than set relation.


These suggestions are based on a cursory look at your code.

Peter Robinson
Peter Robinson ** Rodes Design ** Virginia
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform