修改计算金额为0 就不插入

master
he 2024-03-25 16:45:36 +08:00
parent 21074a5ffe
commit 2cf4f5d280
1 changed files with 27 additions and 18 deletions

View File

@ -14,6 +14,7 @@ using IRaCIS.Core.Domain.Interfaces;
using IRaCIS.Core.Domain.Models; using IRaCIS.Core.Domain.Models;
using System.Data; using System.Data;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Drawing;
namespace IRaCIS.Application.Services namespace IRaCIS.Application.Services
{ {
@ -741,25 +742,33 @@ namespace IRaCIS.Application.Services
} }
decimal totalUSD = award + totalNormal;//总费用 decimal totalUSD = award + totalNormal;//总费用
result = AddOrUpdateMonthlyPayment(new PaymentCommand var paymentyearMonth = new DateTime(param.CalculateMonth.Year, param.CalculateMonth.Month, 1).ToString("yyyy-MM");
{ var paymentModel = _paymentRepository.GetAll().FirstOrDefault(t =>
DoctorId = doctor, t.DoctorId == doctor && t.YearMonth == paymentyearMonth);
Year = param.CalculateMonth.Year,
Month = param.CalculateMonth.Month,
PaymentUSD = totalUSD,
CalculateUser = token,
CalculateTime = DateTime.Now,
ExchangeRate = exchangeRate,
PaymentCNY = exchangeRate * totalUSD,
});
// 计算金额为0 就不插入
reviewerPaymentUSDList.Add(new ReviewerPaymentUSD { DoctorId = doctor, PaymentUSD = totalUSD, RecordId = result.Data }); if (totalUSD != 0 || paymentModel != null)
foreach (var detail in paymentDetailList) {
{ result = AddOrUpdateMonthlyPayment(new PaymentCommand
detail.PaymentId = result.Data; {
} DoctorId = doctor,
AddOrUpdateMonthlyPaymentDetail(paymentDetailList, result.Data); Year = param.CalculateMonth.Year,
Month = param.CalculateMonth.Month,
PaymentUSD = totalUSD,
CalculateUser = token,
CalculateTime = DateTime.Now,
ExchangeRate = exchangeRate,
PaymentCNY = exchangeRate * totalUSD,
});
reviewerPaymentUSDList.Add(new ReviewerPaymentUSD { DoctorId = doctor, PaymentUSD = totalUSD, RecordId = result.Data });
foreach (var detail in paymentDetailList)
{
detail.PaymentId = result.Data;
}
AddOrUpdateMonthlyPaymentDetail(paymentDetailList, result.Data);
}
UpdatePaymentAdjustment(doctor, yearMonth); UpdatePaymentAdjustment(doctor, yearMonth);
} }