/// <summary> /// 计算员工的个人所得税 /// </summary> /// <param name="dtEmplInfo">员工信息</param> /// <param name="salaryMonth">工资年月</param> /// <returns></returns> //public static DataTable CalculateEmployeeTax(DataTable dtEmplInfo, string salaryMonth, EmployeeSearchModel searchModel) //{ // //人员信息不存在时,查询员工信息 // if (dtEmplInfo == null || dtEmplInfo.Rows.Count < 1) // { // //查询员工信息 // dtEmplInfo = EmployeeInfoBus.SearchEmplInfo(searchModel); // //员工信息仍然不存在时,返回NULL // if (dtEmplInfo == null || dtEmplInfo.Rows.Count < 1) // { // return null; // } // } // //获取登陆用户信息 // UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; // //获取员工固定工资 // DataTable dtFixedSalary = SalaryEmployeeDBHelper.SearchSalaryEmployeeInfo(userInfo.CompanyCD); // //获取员工计件工资 // DataTable dtPeiceSalary = PieceworkSalaryDBHelper.GetMonthPieceworkSalary(userInfo.CompanyCD, salaryMonth); // //获取员工计时工资 // DataTable dtTimeSalary = TimeSalaryDBHelper.GetMonthTimeSalary(userInfo.CompanyCD, salaryMonth); // //获取员工提成工资 // DataTable dtCommSalary = CommissionSalaryDBHelper.GetMonthCommSalary(userInfo.CompanyCD, salaryMonth); // //工资总额 // dtEmplInfo.Columns.Add(new DataColumn("TotalSalary", System.Type.GetType("System.String"))); // //税率 // dtEmplInfo.Columns.Add(new DataColumn("TaxRate", System.Type.GetType("System.String"))); // //税额 // dtEmplInfo.Columns.Add(new DataColumn("TotalTax", System.Type.GetType("System.String"))); // //遍历所有的员工信息,获取工资总额 // for (int i = 0; i < dtEmplInfo.Rows.Count; i++ ) // { // //变量定义 // decimal totalSalary = 0; // //获取员工ID // string employeeID = GetSafeData.GetStringFromInt(dtEmplInfo.Rows[i], "ID"); // //固定工资 // DataRow[] drFixedSalary = dtFixedSalary.Select("EmployeeID=" + employeeID); // //遍历所有固定工资项,计算工资额 // for (int j = 0; j < drFixedSalary.Length; j++) // { // //该项工资额为DBNull时,增加该工资项 // if (drFixedSalary[j]["SalaryMoney"] != DBNull.Value) // { // //增加工资额 // totalSalary += Convert.ToDecimal(drFixedSalary[j]["SalaryMoney"]); // } // } // //计件工资 // DataRow[] drPeiceSalary = dtPeiceSalary.Select("EmployeeID=" + employeeID); // if (drPeiceSalary.Length > 0) // { // totalSalary += Convert.ToDecimal(drPeiceSalary[0]["TotalSalary"]); // } // //计时工资 // DataRow[] drTimeSalary = dtTimeSalary.Select("EmployeeID=" + employeeID); // if (drTimeSalary.Length > 0) // { // totalSalary += Convert.ToDecimal(drTimeSalary[0]["TotalSalary"]); // } // //提成工资 // DataRow[] drCommSalary = dtCommSalary.Select("EmployeeID=" + employeeID); // if (drCommSalary.Length > 0) // { // totalSalary += Convert.ToDecimal(drCommSalary[0]["TotalSalary"]); // } // //工资总额 // dtEmplInfo.Rows[i]["TotalSalary"] = totalSalary.ToString(); // decimal[] taxInfo = CalculateTax(totalSalary); // //税率 // dtEmplInfo.Rows[i]["TaxRate"] = StringUtil.TrimZero(taxInfo[0].ToString()); // //税额 // dtEmplInfo.Rows[i]["TotalTax"] = StringUtil.TrimZero(taxInfo[1].ToString()); // } // return dtEmplInfo; //} #endregion #region 计算个人所得税 /// <summary> /// 计算个人所得税 /// </summary> /// <param name="totalSalary">工资总额</param> /// <returns></returns> public static decimal[] CalculateTax(decimal totalSalary) { //定义税率 decimal taxRate = 0; decimal totalTax = 0; //获取缴税起征点 decimal taxStartMoney = Convert.ToDecimal(ConfigurationManager.AppSettings["TAX_START_MONEY"]); //缴税金额 decimal calTaxMoney = totalSalary - taxStartMoney; //需要缴税时,获取缴税税率资料 if (calTaxMoney > 0) { //获取缴税信息 DataTable dtTaxInfo = IncomeTaxPercentDBHelper.GetTaxRate(calTaxMoney.ToString()); //个人所得税信息存在时 if (dtTaxInfo != null && dtTaxInfo.Rows.Count > 0) { //税率 taxRate = GetSafeData.ValidateDataRow_Decimal(dtTaxInfo.Rows[0], "TaxPercent"); //速算扣除数 decimal minusMoney = GetSafeData.ValidateDataRow_Decimal(dtTaxInfo.Rows[0], "MinusMoney"); //计算税额 totalTax = calTaxMoney * taxRate / 100 - minusMoney; } } decimal[] taxInfo = { taxRate, totalTax }; return(taxInfo); }
/// <summary> /// 设置工资内容 /// </summary> private string InitSalaryDetailInfo(string DeptID) { //定义变量 StringBuilder sbSalaryInfo = new StringBuilder(); //获取数据 DataTable dtSalaryInfo = SalaryCompanyRoyaltySetBus.GetInfoTable(DeptID); //数据存在时 if (dtSalaryInfo != null && dtSalaryInfo.Rows.Count > 0) { //遍历显示所有数据 for (int i = 0; i < dtSalaryInfo.Rows.Count; i++) { //插入行开始标识 sbSalaryInfo.AppendLine("<tr>"); //选择框 if (i == dtSalaryInfo.Rows.Count - 1) { //选择 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='hidden' id='txtSalaryID_" + (i + 1).ToString() + "' value='" + GetSafeData.GetStringFromInt(dtSalaryInfo.Rows[i], "ID") + "' /><input type='hidden' id='txtEditFlag_" + (i + 1).ToString() + "' value='1' />" + "<input type='checkbox' onclick='SetCheckAll(this);' id='chkSelect_" + (i + 1).ToString() + "' /></td>"); //公司名称 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' onclick=\"getsubcompany(this.id,'Hid'+this.id);\" readonly=\"readonly\" style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "DeptName") + "' class='tdinput' id='txtDept_" + (i + 1).ToString() + "' />" + "<input type='hidden' id='HidtxtDept_" + (i + 1).ToString() + "' value='" + GetSafeData.ValidateDataRow_Int(dtSalaryInfo.Rows[i], "DeptID") + "'></td>"); //业绩上限 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' maxlength = '12' onkeydown='Numeric_OnKeyDown();' onchange='Number_round(this,\"0\");' readonly=\"readonly\" style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MiniMoney") + "' class='tdinput' id='txtMiniMoney_" + (i + 1).ToString() + "' /></td>"); //业绩下限 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' maxlength = '12' onkeydown='Numeric_OnKeyDown();' onchange='Number_round(this,\"0\");' style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MaxMoney") + "' class='tdinput' id='txtMaxMoney_" + (i + 1).ToString() + "' /></td>"); //提成率 sbSalaryInfo.AppendLine("<td class='tdColInput'>" + "<input type='text' maxlength = '3' style='width:98%;' onkeydown='Numeric_OnKeyDown();' onchange='Number_round(this,\"2\");' onblur='CalculateTotalSalary(this,\"" + (i + 1).ToString() + "\");' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "TaxPercent") + "' class='tdinput' id='txtTaxPercent_" + (i + 1).ToString() + "' /></td>"); } else { sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='hidden' id='txtSalaryID_" + (i + 1).ToString() + "' value='" + GetSafeData.GetStringFromInt(dtSalaryInfo.Rows[i], "ID") + "' /><input type='hidden' id='txtEditFlag_" + (i + 1).ToString() + "' value='1' />" + "<input type='checkbox' onclick='SetCheckAll(this);' id='chkSelect_" + (i + 1).ToString() + "' style=\"display:none \" /></td>"); //公司名称 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' onclick=\"getsubcompany(this.id,'Hid'+this.id);\" readonly=\"readonly\" style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "DeptName") + "' class='tdinput' id='txtDept_" + (i + 1).ToString() + "' /><input type='hidden' id='HidtxtDept_" + (i + 1).ToString() + "'></td>"); //业绩上限 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' maxlength = '12' onkeydown='Numeric_OnKeyDown();' readonly=\"readonly\" onchange='Number_round(this,\"0\");' style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MiniMoney") + "' class='tdinput' id='txtMiniMoney_" + (i + 1).ToString() + "' /></td>"); //业绩下限 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' maxlength = '12' onkeydown='Numeric_OnKeyDown();' readonly=\"readonly\" onchange='Number_round(this,\"0\");' style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MaxMoney") + "' class='tdinput' id='txtMaxMoney_" + (i + 1).ToString() + "' /></td>"); //提成率 sbSalaryInfo.AppendLine("<td class='tdColInput'>" + "<input type='text' maxlength = '3' style='width:98%;' onkeydown='Numeric_OnKeyDown();' onchange='Number_round(this,\"2\");' readonly=\"readonly\" onblur='CalculateTotalSalary(this,\"" + (i + 1).ToString() + "\");' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "TaxPercent") + "' class='tdinput' id='txtTaxPercent_" + (i + 1).ToString() + "' /></td>"); } //插入行结束标识 sbSalaryInfo.AppendLine("</tr>"); } } //返回信息 return(sbSalaryInfo.ToString()); }
/// <summary> /// 设置工资内容 /// </summary> private string InitSalaryDetailInfo() { //定义变量 StringBuilder sbSalaryInfo = new StringBuilder(); //获取数据 DataTable dtSalaryInfo = InsuPersonaIncomeTaxBus.GetInsuPersonalTaxInfo(); //数据存在时 if (dtSalaryInfo != null && dtSalaryInfo.Rows.Count > 0) { //遍历显示所有数据 for (int i = 0; i < dtSalaryInfo.Rows.Count; i++) { //插入行开始标识 sbSalaryInfo.AppendLine("<tr>"); //选择框 if (i == dtSalaryInfo.Rows.Count - 1) { sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='hidden' id='txtSalaryID_" + (i + 1).ToString() + "' value='" + GetSafeData.GetStringFromInt(dtSalaryInfo.Rows[i], "ID") + "' /><input type='hidden' id='txtEditFlag_" + (i + 1).ToString() + "' value='1' />" + "<input type='checkbox' onclick='SetCheckAll(this);' id='chkSelect_" + (i + 1).ToString() + "' /></td>"); //应缴税上限 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' maxlength = '12' onchange='Number_round(this,\"0\");' readonly=\"readonly\" style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MinMoney") + "' class='tdinput' id='txtMinMoney_" + (i + 1).ToString() + "' /></td>"); //应缴税下限 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' maxlength = '12' onchange='Number_round(this,\"0\");' style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MaxMoney") + "' class='tdinput' id='txtMaxMoney_" + (i + 1).ToString() + "' /></td>"); //税率 sbSalaryInfo.AppendLine("<td class='tdColInput'>" + "<input type='text' maxlength = '3' style='width:98%;' onchange='Number_round(this,\"2\");' onblur='CalculateTotalSalary(this,\"" + (i + 1).ToString() + "\");' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "TaxPercent") + "' class='tdinput' id='txtPersonTaxPercent_" + (i + 1).ToString() + "' /></td>"); //速算扣除数(元) sbSalaryInfo.AppendLine("<td class='tdColInput'>" + "<input type='text' maxlength = '16' readonly ='readonly' style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MinusMoney") + "' class='tdinput' id='txtPersonMinusMoney_" + (i + 1).ToString() + "' /></td>"); } else { sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='hidden' id='txtSalaryID_" + (i + 1).ToString() + "' value='" + GetSafeData.GetStringFromInt(dtSalaryInfo.Rows[i], "ID") + "' /><input type='hidden' id='txtEditFlag_" + (i + 1).ToString() + "' value='1' />" + "<input type='checkbox' onclick='SetCheckAll(this);' id='chkSelect_" + (i + 1).ToString() + "' style=\"display:none \" /></td>"); //应缴税上限 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' maxlength = '12' readonly=\"readonly\" onchange='Number_round(this,\"0\");' style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MinMoney") + "' class='tdinput' id='txtMinMoney_" + (i + 1).ToString() + "' /></td>"); //应缴税下限 sbSalaryInfo.AppendLine("<td class='tdColInputCenter'>" + "<input type='text' maxlength = '12' readonly=\"readonly\" onchange='Number_round(this,\"0\");' style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MaxMoney") + "' class='tdinput' id='txtMaxMoney_" + (i + 1).ToString() + "' /></td>"); //税率 sbSalaryInfo.AppendLine("<td class='tdColInput'>" + "<input type='text' maxlength = '3' style='width:98%;' onchange='Number_round(this,\"2\");' readonly=\"readonly\" onblur='CalculateTotalSalary(this,\"" + (i + 1).ToString() + "\");' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "TaxPercent") + "' class='tdinput' id='txtPersonTaxPercent_" + (i + 1).ToString() + "' /></td>"); //速算扣除数(元) sbSalaryInfo.AppendLine("<td class='tdColInput'>" + "<input type='text' maxlength = '16' readonly ='readonly' style='width:98%;' value='" + GetSafeData.ValidateDataRow_Decimal(dtSalaryInfo.Rows[i], "MinusMoney") + "' class='tdinput' id='txtPersonMinusMoney_" + (i + 1).ToString() + "' /></td>"); } //插入行结束标识 sbSalaryInfo.AppendLine("</tr>"); } } //返回信息 return(sbSalaryInfo.ToString()); }