diff --git a/IRaCIS.Core.API/Zip/Payroll.zip b/IRaCIS.Core.API/Zip/Payroll.zip index fdc674f..d554099 100644 Binary files a/IRaCIS.Core.API/Zip/Payroll.zip and b/IRaCIS.Core.API/Zip/Payroll.zip differ diff --git a/IRaCIS.Core.API/wwwroot/Template/Payment Summary.xlsx b/IRaCIS.Core.API/wwwroot/Template/Payment Summary.xlsx new file mode 100644 index 0000000..c531d37 Binary files /dev/null and b/IRaCIS.Core.API/wwwroot/Template/Payment Summary.xlsx differ diff --git a/IRaCIS.Core.API/wwwroot/Template/Payroll Summary_(云账户).xlsx b/IRaCIS.Core.API/wwwroot/Template/Payroll Summary_(云账户).xlsx index 50c0104..ca947af 100644 Binary files a/IRaCIS.Core.API/wwwroot/Template/Payroll Summary_(云账户).xlsx and b/IRaCIS.Core.API/wwwroot/Template/Payroll Summary_(云账户).xlsx differ diff --git a/IRaCIS.Core.Application.Contracts/Financial/DTO/PaymentViewModel.cs b/IRaCIS.Core.Application.Contracts/Financial/DTO/PaymentViewModel.cs index fcca0fc..59ea2ef 100644 --- a/IRaCIS.Core.Application.Contracts/Financial/DTO/PaymentViewModel.cs +++ b/IRaCIS.Core.Application.Contracts/Financial/DTO/PaymentViewModel.cs @@ -6,6 +6,14 @@ using IRaCIS.Core.Domain.Models; namespace IRaCIS.Application.ViewModels { + public enum PendingEnum + { + + Pending=0, + + Lock=1, + } + public class PaymentDTO { public PageOutput CostList { get; set; } @@ -35,6 +43,15 @@ namespace IRaCIS.Application.ViewModels 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 PaymentCNY { get; set; } @@ -63,6 +80,31 @@ namespace IRaCIS.Application.ViewModels public string CalculateUser { get; set; } } + + public class SummaryPaymentData + { + public List 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 DateTime StatisticsDate { get; set; } diff --git a/IRaCIS.Core.Application/Financial/FinancialService.cs b/IRaCIS.Core.Application/Financial/FinancialService.cs index 86dec92..799332d 100644 --- a/IRaCIS.Core.Application/Financial/FinancialService.cs +++ b/IRaCIS.Core.Application/Financial/FinancialService.cs @@ -26,9 +26,11 @@ namespace IRaCIS.Application.Services private readonly IReviewerPayInfoRepository _doctorPayInfoRepository; private readonly ITrialRepository _trialRepository; private readonly IDoctorRepository _doctorRepository; + private readonly IExchangeRateService _exchangeRateService; private readonly IRankPriceRepository _rankPriceRepository; private readonly IPaymentDetailRepository _paymentDetailRepository; private readonly ICRORepository _croRepository; + private readonly IWorkloadRepository _workloadRepository; private readonly ITrialRevenuesPriceRepository _trialRevenuePriceRepository; private readonly IPaymentAdjustmentRepository _payAdjustmentRepository; @@ -42,6 +44,7 @@ namespace IRaCIS.Application.Services IReviewerPayInfoRepository doctorPayInfoRepository, ITrialRepository trialRepository, IDoctorRepository doctorRepository, + IExchangeRateService exchangeRateService, IRankPriceRepository rankPriceRepository, IPaymentDetailRepository costStatisticsDetailRepository, ICRORepository croCompanyRepository, @@ -58,6 +61,7 @@ namespace IRaCIS.Application.Services _doctorPayInfoRepository = doctorPayInfoRepository; _trialRepository = trialRepository; _doctorRepository = doctorRepository; + this._exchangeRateService = exchangeRateService; _rankPriceRepository = rankPriceRepository; _paymentDetailRepository = costStatisticsDetailRepository; _croRepository = croCompanyRepository; @@ -1224,6 +1228,12 @@ namespace IRaCIS.Application.Services 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")) { System.IO.Directory.CreateDirectory("./Zip"); @@ -1244,7 +1254,7 @@ namespace IRaCIS.Application.Services var deletepaths =new List(){ - "./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"); 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"); Stream stream = new System.IO.FileStream("./Zip/Payroll.zip", FileMode.Open, FileAccess.Read);