3 changed files with 48 additions and 3 deletions
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Globalization; |
|||
using System.Windows.Data; |
|||
|
|||
namespace BBWY.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(); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue