|
@@ -627,22 +627,33 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> UploadTax(IFormFile file,string yearMonth)
|
|
|
+ public async Task<IActionResult> WageSheetTaxTemplate()
|
|
|
{
|
|
|
+ string serverUrl = AppSettingsHelper.Get("WageSheetExcelBaseUrl");
|
|
|
+ return Ok(JsonView(true, "操作成功!",new { FileUrl = serverUrl + "Office/WageSheetFile/个税导入模板.xlsx" }));
|
|
|
+ }
|
|
|
|
|
|
- string ymFormat = "yyyy-MM";
|
|
|
- DateTime yearMonthDt;
|
|
|
- bool yearMonthDtIsValid = DateTime.TryParseExact(yearMonth, ymFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out yearMonthDt);
|
|
|
- if (!yearMonthDtIsValid) return Ok(JsonView(false, "年月格式错误!正确时间格式:yyyy-MM "));
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> UploadTax(IFormFile file)
|
|
|
+ {
|
|
|
try
|
|
|
{
|
|
|
- var TypeName = Request.Headers["TypeName"].ToString();
|
|
|
+ var yearMonth = Request.Headers["YearMonth"].ToString();
|
|
|
+
|
|
|
+ string ymFormat = "yyyy-MM";
|
|
|
+ DateTime yearMonthDt;
|
|
|
+ bool yearMonthDtIsValid = DateTime.TryParseExact(yearMonth, ymFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out yearMonthDt);
|
|
|
+ if (!yearMonthDtIsValid) return Ok(JsonView(false, "年月格式错误!正确时间格式:yyyy-MM "));
|
|
|
if (file != null)
|
|
|
{
|
|
|
var fileDir = AppSettingsHelper.Get("WageSheetExcelFptPath");
|
|
@@ -708,7 +719,7 @@ namespace OASystem.API.Controllers
|
|
|
Left Join Sys_Department sd On sys_u1.DepId = sd.Id
|
|
|
Where pm_ws.IsDel = 0 And pm_ws.YearMonth = '{0}'
|
|
|
Order By UserId Asc ", yearMonth);
|
|
|
- var wageSheetList = await _wageSheetRep._sqlSugar.SqlQueryable<WageSheetItemInfoView>(sql).ToListAsync();
|
|
|
+ var wageSheetList = await _wageSheetRep._sqlSugar.SqlQueryable<WageSheetInfoView>(sql).ToListAsync();
|
|
|
|
|
|
if (wageSheetList.Count <= 0)
|
|
|
{
|
|
@@ -719,19 +730,22 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
string name = taxData.Rows[i][0].ToString().Trim();
|
|
|
|
|
|
- List<WageSheetItemInfoView> wageSheets = new List<WageSheetItemInfoView>();
|
|
|
+ List<WageSheetInfoView> wageSheets = new List<WageSheetInfoView>();
|
|
|
wageSheets = wageSheetList.Where(it => it.Name.Equals(name)).ToList();
|
|
|
if (wageSheets.Count > 0)
|
|
|
{
|
|
|
wageSheetList.Where(it => it.Name.Equals(name))
|
|
|
- .Select(it =>
|
|
|
- {
|
|
|
- it.WithholdingTax = Convert.ToDecimal(taxData.Rows[i][1].ToString());
|
|
|
- return it;
|
|
|
- })
|
|
|
- .ToList();
|
|
|
+ .Select(it =>
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ decimal tax = Convert.ToDecimal(taxData.Rows[i][1].ToString());
|
|
|
+ it.WithholdingTax = tax;
|
|
|
+ it.AfterTax -= tax;
|
|
|
+ return it;
|
|
|
+ })
|
|
|
+ .ToList();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
List<Pm_WageSheet> wageSheets1 = new List<Pm_WageSheet>();
|
|
|
wageSheets1 = _mapper.Map<List<Pm_WageSheet>>(wageSheetList);
|