You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
809 B

2 years ago
using System;
using System.Globalization;
using System.Windows.Data;
namespace BBWYB.Client.Converters
{
/// <summary>
/// 销售毛利率转换器
/// </summary>
public class SaleGrossProfitConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
decimal.TryParse(values[0]?.ToString(), out decimal profit);
decimal.TryParse(values[1]?.ToString(), out decimal actualAmount);
return $"{(actualAmount == 0 ? 0M : Math.Round(profit / actualAmount * 100, 2))}%";
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}