namespace OASystem.Domain.Entities.Groups
{
///
/// 团组成本预算表
///
[SugarTable("Grp_GroupCostParameter")]
public class Grp_GroupCostParameter : EntityBase
{
///
/// 团组ID
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int DiId { get; set; }
///
/// 币种
///
[SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
public string Currency { get; set; }
///
/// 汇率
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal Rate { get; set; }
///
/// 税率
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal Tax { get; set; }
///
/// 房费预算
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal FFYS { get; set; }
///
/// 酒店系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal HotelXS { get; set; }
///
/// 经济舱成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal JJCCB { get; set; }
///
/// 经济舱系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal JJCXS { get; set; }
///
/// 经济舱人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int JJCRS { get; set; }
///
/// 公务舱成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal GWCCB { get; set; }
///
/// 公务舱系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal GWCXS { get; set; }
///
/// 公务舱人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int GWCRS { get; set; }
///
/// 火车票成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal HCPCB { get; set; }
///
/// 火车票系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal HCPXS { get; set; }
///
/// 火车票人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int HCPRS { get; set; }
///
/// 船票成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal CPCB { get; set; }
///
/// 船票系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal CPXS { get; set; }
///
/// 船票人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int CPRS { get; set; }
///
/// 保险成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal BXCB { get; set; }
///
/// 保险系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal BXXS { get; set; }
///
/// 保险人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int BXRS { get; set; }
///
/// 核酸检测成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal HSCB { get; set; }
///
/// 核酸检测系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal HSXS { get; set; }
///
/// 核酸检测人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int HSRS { get; set; }
///
/// 签证成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal VisaCB { get; set; }
///
/// 签证系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal VisaXS { get; set; }
///
/// 签证人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int VisaRS { get; set; }
///
/// 公务成本 : 公杂费
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal GWCB { get; set; }
///
/// 公务系数: 公杂费
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal GWXS { get; set; }
///
/// 公务人数 : 公杂费
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int GWRS { get; set; }
///
/// 地接成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal DJCB { get; set; }
///
/// 地接人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int DJRS { get; set; }
///
/// 地接系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal DJXS { get; set; }
///
/// 单间 单人成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal SGRCB { get; set; }
///
/// 单间数量(人数)
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int SGRNumber { get; set; }
///
/// 单间 系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal SGRXS { get; set; }
///
/// 1/2标间 单人成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal TBRCB { get; set; }
///
/// 1/2标间数量(人数)
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int TBRNumber { get; set; }
///
/// 1/2标间 系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal TBRXS { get; set; }
///
/// 小套房/豪华套房 单人成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal JSESCB { get; set; }
///
/// 小套房/豪华套房数量(人数)
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int JSESNumber { get; set; }
///
/// 小套房/豪华套房 系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal JSESXS { get; set; }
///
/// 套房 单人成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal SUITECB { get; set; }
///
/// 套房数量(人数)
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int SUITENumber { get; set; }
///
/// 套房 系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal SUITEXS { get; set; }
///
/// 零用金成本
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal LYJCB { get; set; }
///
/// 零用金系数
///
[SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
public decimal LYJXS { get; set; }
///
/// 零用金人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int LYJRS { get; set; }
///
/// 成本完成标识 0:未完成 1:完成
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int IsShare { get; set; }
///
/// 分段类型 A B
///
[SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
public string CostType { get; set; }
///
/// 开始时间
///
[SugarColumn(IsNullable = true, ColumnDataType = "DateTime")]
public string CostTypeStartTime { get; set; }
///
/// 结束时间
///
[SugarColumn(IsNullable = true, ColumnDataType = "DateTime")]
public string CostTypeendTime { get; set; }
///
/// 此段人数
///
[SugarColumn(IsNullable = true, ColumnDataType = "int")]
public int CostTypenumber { get; set; }
///
/// 头等舱成本
///
public decimal TDCCB { get; set; }
///
/// 头等舱系数
///
public decimal TDCXS { get; set; }
///
/// 头等舱人数
///
public int TDCRS { get; set; }
}
public class Grp_GroupCostParameterView : Grp_GroupCostParameter
{
}
///
/// 费用计算
///
public class GroupCostCalculate : Grp_GroupCostParameter
{
#region 各项费用计算 单人报价、总报价
///
/// 签证单人报价
///
public decimal VisaSinglePrice { get { return VisaCB * VisaXS; } }
///
/// 保险单人报价
///
public decimal PolicySinglePrice { get { return BXCB * BXXS; } }
///
/// 火车票单人报价
///
public decimal TicketSinglePrice { get { return HCPCB * HCPXS; } }
///
/// 机票经济舱单人报价
///
public decimal EconomySinglePrice { get { return JJCCB * JJCXS; } }
///
/// 机票公务舱单人报价
///
public decimal BusinessSinglePrice { get { return GWCCB * GWCXS; } }
///
/// 机票头等舱单人报价
///
public decimal FirstClassSinglePrice { get { return TDCCB * TDCXS; } }
///
/// 船票单人报价
///
public decimal FerryTicketSinglePrice { get { return CPCB * CPXS; } }
///
/// 核酸检测单人报价
///
public decimal NucleicAcidTesSinglePrice { get { return HSCB * HSXS; } }
///
/// 酒店TBR 单人报价
///
public decimal HotelTBRSinglePrice { get { return TBRCB * TBRXS; } }
///
/// 酒店SGR 单人报价
///
public decimal HotelSGRSinglePrice { get { return SGRCB * SGRXS; } }
///
/// 酒店JSES 单人报价
///
public decimal HotelJSESSinglePrice { get { return JSESCB * JSESXS; } }
///
/// 酒店Suite 单人报价
///
public decimal HotelSuiteSinglePrice { get { return SUITECB * SUITEXS; } }
///
/// 地接 单人报价
///
public decimal GroundSinglePrice { get { return DJCB * DJXS; } }
///
/// 公务 单人报价
///
public decimal BusinessActivitySinglePrice { get { return GWCB * GWXS; } }
///
/// 零用金 单人报价
///
public decimal PettyCashSinglePrice { get { return LYJCB * LYJXS; } }
#endregion
#region 费用组合计算 单人报价、总报价
///
/// 费用集合
///
public List ChildFeeInfos
{
get
{
var list = new List();
var otherSinglePrice = VisaSinglePrice + PolicySinglePrice + TicketSinglePrice + FerryTicketSinglePrice + NucleicAcidTesSinglePrice + GroundSinglePrice + BusinessActivitySinglePrice + PettyCashSinglePrice;
//经济舱 TBR、经济舱 SGR、经济舱 JS/ES、经济舱 SUITE、公务舱 TBR、公务舱 SGR、公务舱 JS/ES、公务舱 SUITE、头等舱 JS/ES、头等舱 SUITE
if (JJCRS > 0)
{
if (TBRNumber > 0)
{
list.Add(new ChildFeeInfo("经济舱 TBR", EconomySinglePrice + HotelTBRSinglePrice + otherSinglePrice, JJCRS));
}
else if (SGRNumber > 0)
{
list.Add(new ChildFeeInfo("经济舱 SGR", EconomySinglePrice + HotelSGRSinglePrice + otherSinglePrice, JJCRS));
}
else if(SGRNumber > 0)
{
list.Add(new ChildFeeInfo("经济舱 JS/ES", EconomySinglePrice + HotelJSESSinglePrice + otherSinglePrice, JJCRS));
}
else if(SGRNumber > 0)
{
list.Add(new ChildFeeInfo("经济舱 SUITE", EconomySinglePrice + HotelSuiteSinglePrice + otherSinglePrice, JJCRS));
}
}
if (GWCRS > 0)
{
if (TBRNumber > 0)
{
list.Add(new ChildFeeInfo("公务舱 TBR", BusinessSinglePrice + HotelTBRSinglePrice + otherSinglePrice, GWCRS));
}
else if(SGRNumber > 0)
{
list.Add(new ChildFeeInfo("公务舱 SGR", BusinessSinglePrice + HotelSGRSinglePrice + otherSinglePrice, GWCRS));
}
else if(SGRNumber > 0)
{
list.Add(new ChildFeeInfo("公务舱 JS/ES", BusinessSinglePrice + HotelJSESSinglePrice + otherSinglePrice, GWCRS));
}
else if(SGRNumber > 0)
{
list.Add(new ChildFeeInfo("公务舱 SUITE", BusinessSinglePrice + HotelSuiteSinglePrice + otherSinglePrice, GWCRS));
}
}
if (TDCRS > 0)
{
if (SGRNumber > 0)
{
list.Add(new ChildFeeInfo("头等舱 JS/ES", FirstClassSinglePrice + HotelJSESSinglePrice + otherSinglePrice, TDCRS));
}
else if(SGRNumber > 0)
{
list.Add(new ChildFeeInfo("头等舱 SUITE", FirstClassSinglePrice + HotelSuiteSinglePrice + otherSinglePrice, TDCRS));
}
}
return list;
}
}
#endregion
public decimal GroupTotalPrice { get { return ChildFeeInfos.Sum(x => x.TotalPrice); } }
}
public class ChildFeeInfo
{
///
/// 费用类型名称
///
public string TypeName { get; set; }
///
/// 单人报价
///
public decimal SinglePrice { get; set; }
///
/// 总人数
///
public int TotalPeople { get; set; }
///
/// 总报价
///
public decimal TotalPrice { get; set; }
public ChildFeeInfo() { }
///
/// 重构
///
/// 类型名称
/// 单人报价
/// 人数
public ChildFeeInfo(string typeName, decimal singlePrice, int totalPeople)
{
TypeName = typeName;
SinglePrice = TruncateTo(singlePrice, 2);
TotalPeople = totalPeople;
TotalPrice = TruncateTo(SinglePrice * totalPeople, 2);
}
///
/// 截断保留指定位数小数(不四舍五入)
///
public decimal TruncateTo(decimal value, int decimals)
{
decimal factor = (decimal)Math.Pow(10, decimals);
return Math.Truncate(value * factor) / factor;
}
}
}