Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Operations in a query with two tables
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00655257
Message ID:
00655388
Vues:
21
Hi, Edgar!

Some ideas (IMPORTANT NOTE: The code is not really tested yet!!!!!):

- Create a UDF CalcDays( tBegin, tEnd ) which searches the Holliday.DBF to find out how many days are working days nWorkingDays:
LPARA ttBegin, ttEnd
LOCAL ARRAY laAnswer(1)
SELECT cnt(*) FROM HolliDays where BETWEEN( HolliDate, TTOD(ttBegin), TTOD(ttEnd) INTO ARRAY laAnswer )
RETURN laAnswer(1)
- Now use the formula ((nWorkingDays-2)*9)+(RestTimeOfFirstDay)+(RestTimeOfLastDay) to calculate the working time in hours.

Here the related pseudo code:
SELECT ;
   CalcDays(callopen,callclose) AS WorkingDays, ;
   ((CalcDays(callopen,callclose)-2)*9)+(RestTimeOfFirstDay)+(RestTimeOfLastDay) AS WorkingTime ;
FROM...
- BTW: If you want to use this idea within a view place the CalcDays function in the DBCs stored procedures!
SeBaFlu
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform