Commit 63b31c12 by 陶然

优化核算日期计算算法

parent ba0e6587
......@@ -99,11 +99,15 @@ namespace Kivii.Finances
}
}
}
if (payment.Metadata == null) payment.Metadata = new Dictionary<string, string>();
if (payment.InvoiceTime != null)
{
if (!payment.Metadata.ContainsKey("ManualAuditTime"))
{
if (payment.InvoiceTime.Value > payment.OperateTime) payment.AuditTime = payment.InvoiceTime;
else payment.AuditTime = payment.OperateTime;
payment.AddOnlyProperties(o => o.AuditTime);
}
//if (payment.AuditTime == null)
//{
......
......@@ -339,12 +339,16 @@ namespace Kivii.Finances
{
payment.InvoiceTime = invoiceTime;
payment.AddOnlyProperties(o => o.InvoiceTime);
if (payment.Metadata == null) payment.Metadata = new Dictionary<string, string>();
if (payment.InvoiceTime != null)
{
if (!payment.Metadata.ContainsKey("ManualAuditTime"))
{
if (payment.InvoiceTime.Value > payment.OperateTime) payment.AuditTime = payment.InvoiceTime;
else payment.AuditTime = payment.OperateTime;
payment.AddOnlyProperties(o => o.AuditTime);
}
}
//if (payment.AuditTime == null)
//{
// payment.AuditTime = invoiceTime;
......@@ -735,10 +739,14 @@ namespace Kivii.Finances
//splitPayment.Summary = string.Empty;
if (!remark.IsNullOrEmpty()) splitPayment.Remark += $"[认领备注: {remark}]";
splitPayment.OperateTime = payment.OperateTime;
if (splitPayment.Metadata == null) splitPayment.Metadata = new Dictionary<string, string>();
if (splitPayment.InvoiceTime != null)
{
if (!splitPayment.Metadata.ContainsKey("ManualAuditTime"))
{
if (splitPayment.InvoiceTime.Value > splitPayment.OperateTime) splitPayment.AuditTime = payment.InvoiceTime;
else splitPayment.AuditTime = payment.OperateTime;
}
}
if (operatorKvid != null && operatorKvid.Value != Guid.Empty)
......@@ -814,7 +822,7 @@ namespace Kivii.Finances
splitPayment.Type = paymentType;
//金额设置
splitPayment.AuditorName = splitPayment.OperateTime.Year.ToString();
splitPayment.AuditTime = payment.OperateTime;
//splitPayment.AuditTime = payment.OperateTime;
splitPayment.Amount = amountSplit;
splitPayment.AmountSplited = 0;
splitPayment.AmountUsed = 0;
......
......@@ -3,6 +3,7 @@ using Kivii.Linq;
using Kivii.Web;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Text;
......@@ -13,7 +14,26 @@ namespace Kivii.Finances.Transforms
[RequiresAnyRole(SystemRoles.Everyone)]
public class PaymentUpdate : RestfulUpdate<Payment>
{
public override bool OnPreRestfulUpdate(IRequest req, IResponse res, IDbConnection dbConnection, IRestfulUpdateResponse<Payment> rtns)
{
if (Item.OnlyPropertiesIsExist(o => o.AuditTime))
{
if (Item.Metadata.IsNullOrEmpty())
{
Item.Metadata = new Dictionary<string, string>();
if (Item.AuditTime != null)
{
Item.Metadata["ManualAuditTime"] = true.ToString();
}
else
{
Item.Metadata["ManualAuditTime"] = string.Empty;
}
Item.AddOnlyProperties(o => o.Metadata);
}
}
return base.OnPreRestfulUpdate(req, res, dbConnection, rtns);
}
}
[RequiresAnyRole(SystemRoles.Everyone)]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment