Files
zszq-trs/YLErpDAL/Helpers/TradeFeeHelper.cs
T
2024-05-09 14:06:26 +08:00

31 lines
836 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YLErp.Helpers
{
public static class TradeFeeHelper
{
/// <summary>
/// 计算含费价格
/// </summary>
/// <param name="fee"></param>
/// <param name="price"></param>
/// <param name="qty"></param>
/// <param name="deriction"></param>
/// <returns></returns>
public static decimal CalcPriceWithFee(decimal fee, decimal price, decimal qty,int deriction)
{
if (qty == 0)
{
return 0;
}
decimal derictionFlag = deriction == 1 ? 1 : -1;
decimal priceFee = (price * qty + fee* derictionFlag) / qty;
return priceFee;
}
}
}