ben_coder
August 20th, 2009, 04:46 AM
Am working on an medical arrears submodule in my HR & Payroll system.The Board has
decided that all the staff in salary scales 10 to 15 will have their new medical
allowance increased from the current $112 to $130 per month.the payments are to be
backdated to last year july(Ist July 2008).staff in the mentioned scales are 388.
I have filtered staff to scales 10 to 15(of course with sql statements).
the months difference between now and last year is also well catered for(no issue
here).
The following code calculates medical arrears backdating it to last year.
private void MedAllowanceArrears()
{
decimal currentMedallowance,newMedallowance,Medarrears,totalMedarrears;
int MedMonths;
currentMedallowance=int.Parse(txtMedAllowance.Text);// textbox to hold $112
newMedallowance=int.Parse(txtNewMedAllowance.Text);// textbox to hold $130
MedMonths=int.Parse(txtMedMonths.Text);// textbox to hold months difference
Medarrears=(newMedallowance-currentMedallowance);// variable to store
// arrears difference
totalMedarrears=(Medarrears*MedMonths); //variable to store total arrears.
txtMedArrears.Text=totalMedarrears.ToString(); //textbox to store total arrears
}
Am calling this function when navigating the Personnel master table (Has 388 records)
with this code:
this.BindingContext[pm1,"PERSONNEL_MASTER"].Position++;
//calling function
MedAllowanceArrears();
QUESTION:
The only problem with navigation code is that its computing the arrears for my staff
one record at at time as you navigate forward the personnel master table which has 388
records.
So can anyone out there help me with code to compute(process) the arrears for all my
staff with only one click instead of 388 clicks which is tiresome.
-- Don't worry of the long narration.meant to make your understanding easy.
decided that all the staff in salary scales 10 to 15 will have their new medical
allowance increased from the current $112 to $130 per month.the payments are to be
backdated to last year july(Ist July 2008).staff in the mentioned scales are 388.
I have filtered staff to scales 10 to 15(of course with sql statements).
the months difference between now and last year is also well catered for(no issue
here).
The following code calculates medical arrears backdating it to last year.
private void MedAllowanceArrears()
{
decimal currentMedallowance,newMedallowance,Medarrears,totalMedarrears;
int MedMonths;
currentMedallowance=int.Parse(txtMedAllowance.Text);// textbox to hold $112
newMedallowance=int.Parse(txtNewMedAllowance.Text);// textbox to hold $130
MedMonths=int.Parse(txtMedMonths.Text);// textbox to hold months difference
Medarrears=(newMedallowance-currentMedallowance);// variable to store
// arrears difference
totalMedarrears=(Medarrears*MedMonths); //variable to store total arrears.
txtMedArrears.Text=totalMedarrears.ToString(); //textbox to store total arrears
}
Am calling this function when navigating the Personnel master table (Has 388 records)
with this code:
this.BindingContext[pm1,"PERSONNEL_MASTER"].Position++;
//calling function
MedAllowanceArrears();
QUESTION:
The only problem with navigation code is that its computing the arrears for my staff
one record at at time as you navigate forward the personnel master table which has 388
records.
So can anyone out there help me with code to compute(process) the arrears for all my
staff with only one click instead of 388 clicks which is tiresome.
-- Don't worry of the long narration.meant to make your understanding easy.