Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Salary code
Message
De
25/09/2008 08:51:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
25/09/2008 08:46:17
Muthu Vel
Sty Company
Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2008 Server
Database:
Visual FoxPro
Divers
Thread ID:
01350491
Message ID:
01350494
Vues:
17
>I have create a Employee Salary.dbf with six fields namely 1. Basic pay 2. Special Pay 3. Dearnes pay 4. House rent allowance 5. Transport allowance 6. Gross pay .
>
>For every year July The "Basic pay" (Field) will automatically increased by 3% for every Epmloyees.
>
>Let assume the "Basic pay" of a employee now is =7500, next year july it will automatically increased by 3%. The formula is 7500*0.03 = 225. so the basic pay of employee for next year july is 7500+225 = 7725.
>
>How to write source code?

This is the same as multiplying by 1.03: the 100% of the original salary plus the 3% increase makes a total of 103% of the original salary.
use SalaryTable
replace all base_salary with base_salary * 1.03
use
Be careful that you don't replace twice in the same year.

Also, you may want to review the structure of your table, so that you have base pay stored for different years (dividing by 1.03 is less accurate). This would require a secondary table, with one record for each employee and year. In this case, you would not only have to replace, but also create the new salary records. Lookup up the information would be more complicated, too; but the first priority should be to have sensible data structures, that allow the information to be consistent, complete, flexible, etc.

Oh, and also, you may want to replace only active employees. If you have a logical field IsActive:
replace all base_salary with base_salary * 1.03 for IsActive
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform