I hope we can bring help, only for reference, mainly the 11 steps of computing see explanatory notes.
. 1
/// <Summary> 2 /// wage calculation algorithm . 3 /// </ Summary> . 4 /// <param name = "DepartmentID"> sector primary key </ param> . 5 /// <param name = "targetYearMonth "> the target date </ param> . 6 /// <Returns> number of rows affected </ Returns> . 7 public int the Calculate (DepartmentID String, String targetYearMonth) . 8 { . 9 int the returnValue = 0 ;10 BaseParameterDao parameterDao =new BaseParameterDao(
this .DbHelper, this .UserInfo);
11 String qiZhengE = parameterDao.GetParameter( " System " , " SalaryPersonalIncomeTax " , " QiZhengE " );
12 String year = targetYearMonth.Substring( 0 , 4 );
13 String month = targetYearMonth.Substring( 5 );
14 DataTable dataTable = this .SearchByDepartment(departmentID, year, month, false );
15 // 01 checks whether the amount of personal income tax would impose the empty? 16 the this .CheckPersonalIncomeTax (dataTable, qiZhengE); 17 // 02 total pre-tax items should be added to 18 the this .GetSum (dataTable, " before tax should be added to the project " , BaseSalaryTable.FieldShuiQianYingJiaXiang); 19 // 03 Subtotal before tax should be withheld 20 the this .GetSum (dataTable, " tax should be withheld project " , BaseSalaryTable.FieldShuiQianYingKouXiang); 21 // 04 total insurance fund subsidies, for example, three gold 22 the this .GetSum (dataTable, " fund insurance subsidies class "
, BaseSalaryTable.FieldJiJinBaoXianBuTieLei);
23 // 05 tax items in total [remember tax wages, whether the project to calculate the tax] 24- the this .GetSalaryTax (dataTable); 25 // 06 calculation of personal income tax-related data 26 the this .GetPersonalIncomeTax (dataTable); 27 // 07 calculate wages should be 28 the this .GetSalary (dataTable); 29 // 08 to calculate the after-tax should be withheld project 30 the this .GetSum (dataTable, " tax increase on behalf of the project " , BaseSalaryTable.FieldShuiHouDaiJiaXiang); 31 // 09 tax calculation after the project should be added to 32 the this .GetSum (dataTable, " after-tax withholding project
" , BaseSalaryTable.FieldShuiHouDaiKouXiang);
33 is // 10 calculates real wages 34 is the this .GetRealSalary (the dataTable); 35 // . 11 The calculated result is stored in the database 36 BaseSalaryEntity salaryEntity = null ; 37 [ BaseSalaryDao salaryDao = new new BaseSalaryDao ( the this .DbHelper, the this .UserInfo); 38 is the foreach (DataRow the DataRow in DataTable.Rows) 39 { 40 IF (dataRow.RowState == DataRowState.Modified) 41 is
{
42 salaryEntity = new BaseSalaryEntity(dataRow);
43 returnValue += salaryDao.UpdateEntity(salaryEntity);
44 }
45 }
46 return returnValue;
47 }
48
this .DbHelper, this .UserInfo);
11 String qiZhengE = parameterDao.GetParameter( " System " , " SalaryPersonalIncomeTax " , " QiZhengE " );
12 String year = targetYearMonth.Substring( 0 , 4 );
13 String month = targetYearMonth.Substring( 5 );
14 DataTable dataTable = this .SearchByDepartment(departmentID, year, month, false );
15 // 01 checks whether the amount of personal income tax would impose the empty? 16 the this .CheckPersonalIncomeTax (dataTable, qiZhengE); 17 // 02 total pre-tax items should be added to 18 the this .GetSum (dataTable, " before tax should be added to the project " , BaseSalaryTable.FieldShuiQianYingJiaXiang); 19 // 03 Subtotal before tax should be withheld 20 the this .GetSum (dataTable, " tax should be withheld project " , BaseSalaryTable.FieldShuiQianYingKouXiang); 21 // 04 total insurance fund subsidies, for example, three gold 22 the this .GetSum (dataTable, " fund insurance subsidies class "
, BaseSalaryTable.FieldJiJinBaoXianBuTieLei);
23 // 05 tax items in total [remember tax wages, whether the project to calculate the tax] 24- the this .GetSalaryTax (dataTable); 25 // 06 calculation of personal income tax-related data 26 the this .GetPersonalIncomeTax (dataTable); 27 // 07 calculate wages should be 28 the this .GetSalary (dataTable); 29 // 08 to calculate the after-tax should be withheld project 30 the this .GetSum (dataTable, " tax increase on behalf of the project " , BaseSalaryTable.FieldShuiHouDaiJiaXiang); 31 // 09 tax calculation after the project should be added to 32 the this .GetSum (dataTable, " after-tax withholding project
" , BaseSalaryTable.FieldShuiHouDaiKouXiang);
33 is // 10 calculates real wages 34 is the this .GetRealSalary (the dataTable); 35 // . 11 The calculated result is stored in the database 36 BaseSalaryEntity salaryEntity = null ; 37 [ BaseSalaryDao salaryDao = new new BaseSalaryDao ( the this .DbHelper, the this .UserInfo); 38 is the foreach (DataRow the DataRow in DataTable.Rows) 39 { 40 IF (dataRow.RowState == DataRowState.Modified) 41 is
{
42 salaryEntity = new BaseSalaryEntity(dataRow);
43 returnValue += salaryDao.UpdateEntity(salaryEntity);
44 }
45 }
46 return returnValue;
47 }
48
Reproduced in: https: //my.oschina.net/iwenr/blog/227689