123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- using OASystem.Domain.Entities.Groups;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OASystem.Domain.ViewModels.Groups
- {
- public class EnterExitCostQuoteView:Grp_EnterExitCostQuoteItem
- {
- }
- /// <summary>
- /// 初始化基础项视图
- /// </summary>
- public class InitBasicItemView
- {
- public int Id { get; set; }
- public string Name { get; set; }
- public bool IsOnlyRemark { get; set; } = false;
- public int Index { get; set; }
- }
- public class NameView
- {
- public int Id { get; set; }
- public string Name { get; set; }
- }
- public class EnterExitCostQuoteNameView : NameView { }
- public class EnterExitCostQuoteGroupNameView : NameView { }
- public class EnterExitCostQuoteInfoView
- {
- /// <summary>
- /// Id
- /// </summary>
- public int Id { get; set; }
- /// <summary>
- /// 报价名称
- /// </summary>
- public string Name { get; set; }
- /// <summary>
- /// 团组Id
- /// </summary>
- public int GroupId { get; set; }
- /// <summary>
- /// 汇率信息
- /// </summary>
- public CurrencyInfo[] Rates { get; set; } = Array.Empty<CurrencyInfo>();
- /// <summary>
- /// 费用列表
- /// </summary>
- public QuoteItemInfo[] FeeItems { get; set; } = Array.Empty<QuoteItemInfo>();
- /// <summary>
- /// 费用合计
- /// </summary>
- public decimal TotalAmt
- {
- get
- {
- return FeeItems.Sum(x => x.TotalAmt);
- }
- }
- }
-
- public class QuoteItemInfo
- {
- public int QuoteId { get; set; }
- public int ItemId { get; set; }
- public string ItemName { get; set; }
- public bool IsOnlyRemark { get; set; }
- public string ItemWrapName
- {
- get {
- var thisItemName = ItemName;
- var label = new StringBuilder();
- if (!string.IsNullOrEmpty(thisItemName))
- {
- if (thisItemName.Contains("\\n"))
- {
- var strs = thisItemName.Split("\\n");
- label.AppendLine(strs[0]);
- label.AppendLine(strs[1]);
- }
- else label.Append(thisItemName);
- }
- return label.ToString();
- }
- }
- public decimal TotalAmt { get { return Infos.Any() ? TruncDecimals(Infos.Sum(x => x.TotalAmt)) : 0.00M; } }
- public QuoteSubItemInfo[] Infos { get; set; } = Array.Empty<QuoteSubItemInfo>();
- public int Index { get; set; }
- /// <summary>
- /// decimal 保留小数,不四舍五入
- /// </summary>
- /// <param name="value"></param>
- /// <param name="decimalPlaces"></param>
- /// <returns></returns>
- private decimal TruncDecimals(decimal value, int decimalPlaces = 2)
- {
- decimal scaleFactor = (decimal)Math.Pow(10, decimalPlaces);
- var truncated = Math.Truncate(scaleFactor * value) / scaleFactor;
- // 检查是否需要补零
- if (GetDecimalDigits(value) < decimalPlaces)
- {
- string format = "0." + new string('0', decimalPlaces);
- truncated = decimal.Parse(truncated.ToString(format));
- }
- return truncated;
- }
- private int GetDecimalDigits(decimal number)
- {
- string[] parts = number.ToString().Split('.');
- return parts.Length > 1 ? parts[1].Length : 0;
- }
- }
- public class QuoteSubItemInfo
- {
- public int Id { get; set; }
- public int ItemId { get; set; }
- public int Index { get; set; }
- public string FeeName { get; set; }
- /// <summary>
- /// 单价
- /// </summary>
- public decimal UnitPrice { get; set; }
- /// <summary>
- /// 币种
- /// </summary>
- public string Currency { get; set; }
- /// <summary>
- /// 数量/天数/间/晚/次
- /// </summary>
- public decimal Quantity { get; set; }
- /// <summary>
- /// 人数
- /// </summary>
- public int PplNum { get; set; }
- /// <summary>
- /// 合计(CNY)
- /// </summary>
- public decimal TotalAmt { get; set; }
- public string Remark { get; set; }
- }
- }
|