31 lines
836 B
C#
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;
|
|
}
|
|
}
|
|
}
|