chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Data.Common;
|
||||
using Wellan.Data;
|
||||
using Wellan.Common;
|
||||
|
||||
/// <summary>
|
||||
/// 計算勞退金
|
||||
/// </summary>
|
||||
public class Blra : LaborAndHealthFee
|
||||
{
|
||||
private int _annuitySalary;
|
||||
private double _companyFee;
|
||||
private double _personalFee;
|
||||
private int _inworkdays;
|
||||
|
||||
public Blra(DateTime aDate)
|
||||
: base(aDate)
|
||||
{
|
||||
_bftyp = 3;
|
||||
_tableName = "BLRA";
|
||||
}
|
||||
|
||||
public LaborRetireAnnuity GetFee()
|
||||
{
|
||||
LaborRetireAnnuity fee = new LaborRetireAnnuity();
|
||||
fee.Init();
|
||||
fee.CompanyFee = Convert.ToInt32(Math.Round(_companyFee, MidpointRounding.AwayFromZero));
|
||||
fee.PersonalFee = Convert.ToInt32(Math.Round(_personalFee, MidpointRounding.AwayFromZero));
|
||||
fee.AnnuitySalary = _annuitySalary;
|
||||
return fee;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_annuitySalary = 0;
|
||||
_companyFee = 0;
|
||||
_personalFee = 0;
|
||||
_inworkdays = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 計算勞退提撥,並加入 Blra 的執行個體中
|
||||
/// </summary>
|
||||
/// <param name="salary">月薪</param>
|
||||
/// <param name="startDay">本月在職起始日</param>
|
||||
/// <param name="endDay">本月在職結束日</param>
|
||||
/// <param name="personalRate">個人提繳率</param>
|
||||
/// <param name="employeeType">員工類別 1=雇主 2=員工</param>
|
||||
/// <param name="thisMonthDays">本月到職天數</param>
|
||||
/// <param name="nation">員工國籍 1=本國籍 2=外國籍</param>
|
||||
public void Add(int salary, DateTime startDay, DateTime endDay, int personalRate, string employeeType, int thisMonthDays, string nation)
|
||||
{
|
||||
// 外國籍員工沒有勞退提撥
|
||||
if (nation == "2")
|
||||
return;
|
||||
|
||||
double bsamt = GetAmont(salary);
|
||||
double daysRatio = 0;
|
||||
int days = 0;
|
||||
int monthEndDay = WGuard1.GetMonthEnd(startDay, 0).Day;
|
||||
_annuitySalary = Convert.ToInt32(bsamt);
|
||||
|
||||
if (bsamt > 0)
|
||||
{
|
||||
// 月初日到月底日
|
||||
if (startDay.Day == 1 && endDay.Day == monthEndDay)
|
||||
{
|
||||
days = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 結束日是月底日
|
||||
if (endDay.Day == monthEndDay)
|
||||
{
|
||||
if (startDay.Day == 30 || startDay.Day == 31)
|
||||
days = 1;
|
||||
else
|
||||
days = 30 - startDay.Day + 1;
|
||||
}
|
||||
else
|
||||
// 結束日非月底日
|
||||
{
|
||||
days = endDay.Day - startDay.Day + 1;
|
||||
}
|
||||
if (days > 30)
|
||||
days = 30;
|
||||
}
|
||||
|
||||
/*
|
||||
// 月初日到月底日,以 30 天計算
|
||||
if (startDay.Day == 1 && endDay.Day == monthEndDay)
|
||||
{
|
||||
days = 30;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 結束日是月底日,用 30 去減
|
||||
//if (endDay.Day == monthEndDay)
|
||||
// days = 30 - startDay.Day + 1;
|
||||
// 結束日非月底日,用實際結束日去減
|
||||
//else
|
||||
days = endDay.Day - startDay.Day + 1;
|
||||
// 調整天數,最多 30 天
|
||||
if (days > 30)
|
||||
days = 30;
|
||||
}
|
||||
*/
|
||||
|
||||
// 若本月累計天數 > 30 則減去多出的天數
|
||||
if (_inworkdays + days > 30)
|
||||
days = 30 - _inworkdays;
|
||||
_inworkdays += days;
|
||||
|
||||
daysRatio = Convert.ToDouble(days) / 30d;
|
||||
|
||||
// 計算公司提撥
|
||||
if (employeeType == "1") // 員工身份是雇主
|
||||
_companyFee += 0;
|
||||
else
|
||||
_companyFee += Math.Round(bsamt * 0.06 * daysRatio, 4, MidpointRounding.AwayFromZero);
|
||||
|
||||
// 計算個人提撥
|
||||
_personalFee += Math.Round(bsamt * ((double)personalRate / 100) * daysRatio, 4, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct LaborRetireAnnuity
|
||||
{
|
||||
public int CompanyFee;
|
||||
public int PersonalFee;
|
||||
public int AnnuitySalary;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
AnnuitySalary = 0;
|
||||
CompanyFee = 0;
|
||||
PersonalFee = 0;
|
||||
}
|
||||
|
||||
public void Add(LaborRetireAnnuity fee)
|
||||
{
|
||||
AnnuitySalary = fee.AnnuitySalary;
|
||||
CompanyFee += fee.CompanyFee;
|
||||
PersonalFee += fee.PersonalFee;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user