master
he 2022-09-28 17:34:16 +08:00
parent aaaaace8b6
commit 5e50ad1d7e
5 changed files with 77 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -6,6 +6,14 @@ using IRaCIS.Core.Domain.Models;
namespace IRaCIS.Application.ViewModels namespace IRaCIS.Application.ViewModels
{ {
public enum PendingEnum
{
Pending=0,
Lock=1,
}
public class PaymentDTO public class PaymentDTO
{ {
public PageOutput<PaymentViewModel> CostList { get; set; } public PageOutput<PaymentViewModel> CostList { get; set; }
@ -35,6 +43,15 @@ namespace IRaCIS.Application.ViewModels
public bool IsLock { get; set; } = false; public bool IsLock { get; set; } = false;
public string IsLockStr
{
get
{
return this.IsLock ? PendingEnum.Lock.ToString() : PendingEnum.Pending.ToString();
}
}
public decimal ExchangeRate { get; set; } public decimal ExchangeRate { get; set; }
public decimal PaymentCNY { get; set; } public decimal PaymentCNY { get; set; }
@ -63,6 +80,31 @@ namespace IRaCIS.Application.ViewModels
public string CalculateUser { get; set; } public string CalculateUser { get; set; }
} }
public class SummaryPaymentData
{
public List<PaymentViewModel> Row { get; set; }
public string YearMonth { get; set; }
public decimal ExchangeRate { get; set; }
public decimal SumPaymentUSD
{
get
{
return this.Row.Sum(x => x.PaymentUSD);
}
}
public decimal SumPaymentCNY {
get
{
return this.Row.Sum(x => x.PaymentCNY);
}
}
}
public class MonthlyPaymentQueryDTO : PageInput public class MonthlyPaymentQueryDTO : PageInput
{ {
public DateTime StatisticsDate { get; set; } public DateTime StatisticsDate { get; set; }

View File

@ -26,9 +26,11 @@ namespace IRaCIS.Application.Services
private readonly IReviewerPayInfoRepository _doctorPayInfoRepository; private readonly IReviewerPayInfoRepository _doctorPayInfoRepository;
private readonly ITrialRepository _trialRepository; private readonly ITrialRepository _trialRepository;
private readonly IDoctorRepository _doctorRepository; private readonly IDoctorRepository _doctorRepository;
private readonly IExchangeRateService _exchangeRateService;
private readonly IRankPriceRepository _rankPriceRepository; private readonly IRankPriceRepository _rankPriceRepository;
private readonly IPaymentDetailRepository _paymentDetailRepository; private readonly IPaymentDetailRepository _paymentDetailRepository;
private readonly ICRORepository _croRepository; private readonly ICRORepository _croRepository;
private readonly IWorkloadRepository _workloadRepository; private readonly IWorkloadRepository _workloadRepository;
private readonly ITrialRevenuesPriceRepository _trialRevenuePriceRepository; private readonly ITrialRevenuesPriceRepository _trialRevenuePriceRepository;
private readonly IPaymentAdjustmentRepository _payAdjustmentRepository; private readonly IPaymentAdjustmentRepository _payAdjustmentRepository;
@ -42,6 +44,7 @@ namespace IRaCIS.Application.Services
IReviewerPayInfoRepository doctorPayInfoRepository, IReviewerPayInfoRepository doctorPayInfoRepository,
ITrialRepository trialRepository, ITrialRepository trialRepository,
IDoctorRepository doctorRepository, IDoctorRepository doctorRepository,
IExchangeRateService exchangeRateService,
IRankPriceRepository rankPriceRepository, IRankPriceRepository rankPriceRepository,
IPaymentDetailRepository costStatisticsDetailRepository, IPaymentDetailRepository costStatisticsDetailRepository,
ICRORepository croCompanyRepository, ICRORepository croCompanyRepository,
@ -58,6 +61,7 @@ namespace IRaCIS.Application.Services
_doctorPayInfoRepository = doctorPayInfoRepository; _doctorPayInfoRepository = doctorPayInfoRepository;
_trialRepository = trialRepository; _trialRepository = trialRepository;
_doctorRepository = doctorRepository; _doctorRepository = doctorRepository;
this._exchangeRateService = exchangeRateService;
_rankPriceRepository = rankPriceRepository; _rankPriceRepository = rankPriceRepository;
_paymentDetailRepository = costStatisticsDetailRepository; _paymentDetailRepository = costStatisticsDetailRepository;
_croRepository = croCompanyRepository; _croRepository = croCompanyRepository;
@ -1224,6 +1228,12 @@ namespace IRaCIS.Application.Services
System.IO.Directory.CreateDirectory("./file/Direct"); System.IO.Directory.CreateDirectory("./file/Direct");
} }
if (!System.IO.Directory.Exists("./file/Summary"))
{
System.IO.Directory.CreateDirectory("./file/Summary");
}
if (!System.IO.Directory.Exists("./Zip")) if (!System.IO.Directory.Exists("./Zip"))
{ {
System.IO.Directory.CreateDirectory("./Zip"); System.IO.Directory.CreateDirectory("./Zip");
@ -1244,7 +1254,7 @@ namespace IRaCIS.Application.Services
var deletepaths =new List<string>(){ var deletepaths =new List<string>(){
"./file/Direct","./file/云账户" ,"./file" "./file/Direct","./file/云账户" ,"./file/Summary","./file"
}; };
@ -1335,6 +1345,30 @@ namespace IRaCIS.Application.Services
var cloudPaymentPath = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\Payroll Summary_(云账户).xlsx"); var cloudPaymentPath = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\Payroll Summary_(云账户).xlsx");
MiniExcel.SaveAsByTemplate($"./file/云账户/Payroll Summary_{inDto.YearMonth}(云账户).xlsx", cloudPaymentPath, cloudPaymentInfo); MiniExcel.SaveAsByTemplate($"./file/云账户/Payroll Summary_{inDto.YearMonth}(云账户).xlsx", cloudPaymentPath, cloudPaymentInfo);
// 生成summary
var summaryPaymentPath = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\Template\Payment Summary.xlsx");
var sumData = GetMonthlyPaymentList(new MonthlyPaymentQueryDTO()
{
PageIndex = 1,
PageSize = 99999,
Asc = true,
StatisticsDate = DateTime.Parse(inDto.YearMonth),
}).CurrentPageData.ToList();
SummaryPaymentData summaryPaymentData = new SummaryPaymentData()
{
YearMonth=inDto.YearMonth,
Row= sumData,
ExchangeRate = _exchangeRateService.GetExchangeRateByMonth(inDto.YearMonth)
};
MiniExcel.SaveAsByTemplate($"./file/Summary/Payroll Summary_{inDto.YearMonth}.xlsx", summaryPaymentPath, summaryPaymentData);
ZipFile.CreateFromDirectory("./file", "Zip/Payroll.zip"); ZipFile.CreateFromDirectory("./file", "Zip/Payroll.zip");
Stream stream = new System.IO.FileStream("./Zip/Payroll.zip", FileMode.Open, FileAccess.Read); Stream stream = new System.IO.FileStream("./Zip/Payroll.zip", FileMode.Open, FileAccess.Read);