Grp_GroupCostParameter.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. namespace OASystem.Domain.Entities.Groups
  2. {
  3. /// <summary>
  4. /// 团组成本预算表
  5. /// </summary>
  6. [SugarTable("Grp_GroupCostParameter")]
  7. public class Grp_GroupCostParameter : EntityBase
  8. {
  9. /// <summary>
  10. /// 团组ID
  11. /// </summary>
  12. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  13. public int DiId { get; set; }
  14. /// <summary>
  15. /// 币种
  16. /// </summary>
  17. [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
  18. public string Currency { get; set; }
  19. /// <summary>
  20. /// 汇率
  21. /// </summary>
  22. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  23. public decimal Rate { get; set; }
  24. /// <summary>
  25. /// 税率
  26. /// </summary>
  27. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  28. public decimal Tax { get; set; }
  29. /// <summary>
  30. /// 房费预算
  31. /// </summary>
  32. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  33. public decimal FFYS { get; set; }
  34. /// <summary>
  35. /// 酒店系数
  36. /// </summary>
  37. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  38. public decimal HotelXS { get; set; }
  39. /// <summary>
  40. /// 经济舱成本
  41. /// </summary>
  42. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  43. public decimal JJCCB { get; set; }
  44. /// <summary>
  45. /// 经济舱系数
  46. /// </summary>
  47. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  48. public decimal JJCXS { get; set; }
  49. /// <summary>
  50. /// 经济舱人数
  51. /// </summary>
  52. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  53. public int JJCRS { get; set; }
  54. /// <summary>
  55. /// 公务舱成本
  56. /// </summary>
  57. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  58. public decimal GWCCB { get; set; }
  59. /// <summary>
  60. /// 公务舱系数
  61. /// </summary>
  62. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  63. public decimal GWCXS { get; set; }
  64. /// <summary>
  65. /// 公务舱人数
  66. /// </summary>
  67. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  68. public int GWCRS { get; set; }
  69. /// <summary>
  70. /// 火车票成本
  71. /// </summary>
  72. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  73. public decimal HCPCB { get; set; }
  74. /// <summary>
  75. /// 火车票系数
  76. /// </summary>
  77. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  78. public decimal HCPXS { get; set; }
  79. /// <summary>
  80. /// 火车票人数
  81. /// </summary>
  82. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  83. public int HCPRS { get; set; }
  84. /// <summary>
  85. /// 船票成本
  86. /// </summary>
  87. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  88. public decimal CPCB { get; set; }
  89. /// <summary>
  90. /// 船票系数
  91. /// </summary>
  92. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  93. public decimal CPXS { get; set; }
  94. /// <summary>
  95. /// 船票人数
  96. /// </summary>
  97. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  98. public int CPRS { get; set; }
  99. /// <summary>
  100. /// 保险成本
  101. /// </summary>
  102. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  103. public decimal BXCB { get; set; }
  104. /// <summary>
  105. /// 保险系数
  106. /// </summary>
  107. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  108. public decimal BXXS { get; set; }
  109. /// <summary>
  110. /// 保险人数
  111. /// </summary>
  112. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  113. public int BXRS { get; set; }
  114. /// <summary>
  115. /// 核酸检测成本
  116. /// </summary>
  117. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  118. public decimal HSCB { get; set; }
  119. /// <summary>
  120. /// 核酸检测系数
  121. /// </summary>
  122. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  123. public decimal HSXS { get; set; }
  124. /// <summary>
  125. /// 核酸检测人数
  126. /// </summary>
  127. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  128. public int HSRS { get; set; }
  129. /// <summary>
  130. /// 签证成本
  131. /// </summary>
  132. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  133. public decimal VisaCB { get; set; }
  134. /// <summary>
  135. /// 签证系数
  136. /// </summary>
  137. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  138. public decimal VisaXS { get; set; }
  139. /// <summary>
  140. /// 签证人数
  141. /// </summary>
  142. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  143. public int VisaRS { get; set; }
  144. /// <summary>
  145. /// 公务成本 : 公杂费
  146. /// </summary>
  147. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  148. public decimal GWCB { get; set; }
  149. /// <summary>
  150. /// 公务系数: 公杂费
  151. /// </summary>
  152. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  153. public decimal GWXS { get; set; }
  154. /// <summary>
  155. /// 公务人数 : 公杂费
  156. /// </summary>
  157. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  158. public int GWRS { get; set; }
  159. /// <summary>
  160. /// 地接成本
  161. /// </summary>
  162. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  163. public decimal DJCB { get; set; }
  164. /// <summary>
  165. /// 地接人数
  166. /// </summary>
  167. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  168. public int DJRS { get; set; }
  169. /// <summary>
  170. /// 地接系数
  171. /// </summary>
  172. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  173. public decimal DJXS { get; set; }
  174. /// <summary>
  175. /// 单间 单人成本
  176. /// </summary>
  177. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  178. public decimal SGRCB { get; set; }
  179. /// <summary>
  180. /// 单间数量(人数)
  181. /// </summary>
  182. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  183. public int SGRNumber { get; set; }
  184. /// <summary>
  185. /// 单间 系数
  186. /// </summary>
  187. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  188. public decimal SGRXS { get; set; }
  189. /// <summary>
  190. /// 1/2标间 单人成本
  191. /// </summary>
  192. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  193. public decimal TBRCB { get; set; }
  194. /// <summary>
  195. /// 1/2标间数量(人数)
  196. /// </summary>
  197. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  198. public int TBRNumber { get; set; }
  199. /// <summary>
  200. /// 1/2标间 系数
  201. /// </summary>
  202. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  203. public decimal TBRXS { get; set; }
  204. /// <summary>
  205. /// 小套房/豪华套房 单人成本
  206. /// </summary>
  207. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  208. public decimal JSESCB { get; set; }
  209. /// <summary>
  210. /// 小套房/豪华套房数量(人数)
  211. /// </summary>
  212. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  213. public int JSESNumber { get; set; }
  214. /// <summary>
  215. /// 小套房/豪华套房 系数
  216. /// </summary>
  217. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  218. public decimal JSESXS { get; set; }
  219. /// <summary>
  220. /// 套房 单人成本
  221. /// </summary>
  222. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  223. public decimal SUITECB { get; set; }
  224. /// <summary>
  225. /// 套房数量(人数)
  226. /// </summary>
  227. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  228. public int SUITENumber { get; set; }
  229. /// <summary>
  230. /// 套房 系数
  231. /// </summary>
  232. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  233. public decimal SUITEXS { get; set; }
  234. /// <summary>
  235. /// 零用金成本
  236. /// </summary>
  237. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  238. public decimal LYJCB { get; set; }
  239. /// <summary>
  240. /// 零用金系数
  241. /// </summary>
  242. [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
  243. public decimal LYJXS { get; set; }
  244. /// <summary>
  245. /// 零用金人数
  246. /// </summary>
  247. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  248. public int LYJRS { get; set; }
  249. /// <summary>
  250. /// 成本完成标识 0:未完成 1:完成
  251. /// </summary>
  252. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  253. public int IsShare { get; set; }
  254. /// <summary>
  255. /// 分段类型 A B
  256. /// </summary>
  257. [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
  258. public string CostType { get; set; }
  259. /// <summary>
  260. /// 开始时间
  261. /// </summary>
  262. [SugarColumn(IsNullable = true, ColumnDataType = "DateTime")]
  263. public string CostTypeStartTime { get; set; }
  264. /// <summary>
  265. /// 结束时间
  266. /// </summary>
  267. [SugarColumn(IsNullable = true, ColumnDataType = "DateTime")]
  268. public string CostTypeendTime { get; set; }
  269. /// <summary>
  270. /// 此段人数
  271. /// </summary>
  272. [SugarColumn(IsNullable = true, ColumnDataType = "int")]
  273. public int CostTypenumber { get; set; }
  274. /// <summary>
  275. /// 头等舱成本
  276. /// </summary>
  277. public decimal TDCCB { get; set; }
  278. /// <summary>
  279. /// 头等舱系数
  280. /// </summary>
  281. public decimal TDCXS { get; set; }
  282. /// <summary>
  283. /// 头等舱人数
  284. /// </summary>
  285. public int TDCRS { get; set; }
  286. }
  287. public class Grp_GroupCostParameterView : Grp_GroupCostParameter
  288. {
  289. }
  290. /// <summary>
  291. /// 费用计算
  292. /// </summary>
  293. public class GroupCostCalculate : Grp_GroupCostParameter
  294. {
  295. #region 各项费用计算 单人报价、总报价
  296. /// <summary>
  297. /// 签证单人报价
  298. /// </summary>
  299. public decimal VisaSinglePrice { get { return VisaCB * VisaXS; } }
  300. /// <summary>
  301. /// 保险单人报价
  302. /// </summary>
  303. public decimal PolicySinglePrice { get { return BXCB * BXXS; } }
  304. /// <summary>
  305. /// 火车票单人报价
  306. /// </summary>
  307. public decimal TicketSinglePrice { get { return HCPCB * HCPXS; } }
  308. /// <summary>
  309. /// 机票经济舱单人报价
  310. /// </summary>
  311. public decimal EconomySinglePrice { get { return JJCCB * JJCXS; } }
  312. /// <summary>
  313. /// 机票公务舱单人报价
  314. /// </summary>
  315. public decimal BusinessSinglePrice { get { return GWCCB * GWCXS; } }
  316. /// <summary>
  317. /// 机票头等舱单人报价
  318. /// </summary>
  319. public decimal FirstClassSinglePrice { get { return TDCCB * TDCXS; } }
  320. /// <summary>
  321. /// 船票单人报价
  322. /// </summary>
  323. public decimal FerryTicketSinglePrice { get { return CPCB * CPXS; } }
  324. /// <summary>
  325. /// 核酸检测单人报价
  326. /// </summary>
  327. public decimal NucleicAcidTesSinglePrice { get { return HSCB * HSXS; } }
  328. /// <summary>
  329. /// 酒店TBR 单人报价
  330. /// </summary>
  331. public decimal HotelTBRSinglePrice { get { return TBRCB * TBRXS; } }
  332. /// <summary>
  333. /// 酒店SGR 单人报价
  334. /// </summary>
  335. public decimal HotelSGRSinglePrice { get { return SGRCB * SGRXS; } }
  336. /// <summary>
  337. /// 酒店JSES 单人报价
  338. /// </summary>
  339. public decimal HotelJSESSinglePrice { get { return JSESCB * JSESXS; } }
  340. /// <summary>
  341. /// 酒店Suite 单人报价
  342. /// </summary>
  343. public decimal HotelSuiteSinglePrice { get { return SUITECB * SUITEXS; } }
  344. /// <summary>
  345. /// 地接 单人报价
  346. /// </summary>
  347. public decimal GroundSinglePrice { get { return DJCB * DJXS; } }
  348. /// <summary>
  349. /// 公务 单人报价
  350. /// </summary>
  351. public decimal BusinessActivitySinglePrice { get { return GWCB * GWXS; } }
  352. /// <summary>
  353. /// 零用金 单人报价
  354. /// </summary>
  355. public decimal PettyCashSinglePrice { get { return LYJCB * LYJXS; } }
  356. #endregion
  357. #region 费用组合计算 单人报价、总报价
  358. /// <summary>
  359. /// 费用集合
  360. /// </summary>
  361. public List<ChildFeeInfo> ChildFeeInfos
  362. {
  363. get
  364. {
  365. var list = new List<ChildFeeInfo>();
  366. var otherSinglePrice = VisaSinglePrice + PolicySinglePrice + TicketSinglePrice + FerryTicketSinglePrice + NucleicAcidTesSinglePrice + GroundSinglePrice + BusinessActivitySinglePrice + PettyCashSinglePrice;
  367. //经济舱 TBR、经济舱 SGR、经济舱 JS/ES、经济舱 SUITE、公务舱 TBR、公务舱 SGR、公务舱 JS/ES、公务舱 SUITE、头等舱 JS/ES、头等舱 SUITE
  368. if (JJCRS > 0)
  369. {
  370. if (TBRNumber > 0)
  371. {
  372. list.Add(new ChildFeeInfo("经济舱 TBR", EconomySinglePrice + HotelTBRSinglePrice + otherSinglePrice, JJCRS));
  373. }
  374. else if (SGRNumber > 0)
  375. {
  376. list.Add(new ChildFeeInfo("经济舱 SGR", EconomySinglePrice + HotelSGRSinglePrice + otherSinglePrice, JJCRS));
  377. }
  378. else if(SGRNumber > 0)
  379. {
  380. list.Add(new ChildFeeInfo("经济舱 JS/ES", EconomySinglePrice + HotelJSESSinglePrice + otherSinglePrice, JJCRS));
  381. }
  382. else if(SGRNumber > 0)
  383. {
  384. list.Add(new ChildFeeInfo("经济舱 SUITE", EconomySinglePrice + HotelSuiteSinglePrice + otherSinglePrice, JJCRS));
  385. }
  386. }
  387. if (GWCRS > 0)
  388. {
  389. if (TBRNumber > 0)
  390. {
  391. list.Add(new ChildFeeInfo("公务舱 TBR", BusinessSinglePrice + HotelTBRSinglePrice + otherSinglePrice, GWCRS));
  392. }
  393. else if(SGRNumber > 0)
  394. {
  395. list.Add(new ChildFeeInfo("公务舱 SGR", BusinessSinglePrice + HotelSGRSinglePrice + otherSinglePrice, GWCRS));
  396. }
  397. else if(SGRNumber > 0)
  398. {
  399. list.Add(new ChildFeeInfo("公务舱 JS/ES", BusinessSinglePrice + HotelJSESSinglePrice + otherSinglePrice, GWCRS));
  400. }
  401. else if(SGRNumber > 0)
  402. {
  403. list.Add(new ChildFeeInfo("公务舱 SUITE", BusinessSinglePrice + HotelSuiteSinglePrice + otherSinglePrice, GWCRS));
  404. }
  405. }
  406. if (TDCRS > 0)
  407. {
  408. if (SGRNumber > 0)
  409. {
  410. list.Add(new ChildFeeInfo("头等舱 JS/ES", FirstClassSinglePrice + HotelJSESSinglePrice + otherSinglePrice, TDCRS));
  411. }
  412. else if(SGRNumber > 0)
  413. {
  414. list.Add(new ChildFeeInfo("头等舱 SUITE", FirstClassSinglePrice + HotelSuiteSinglePrice + otherSinglePrice, TDCRS));
  415. }
  416. }
  417. return list;
  418. }
  419. }
  420. #endregion
  421. public decimal GroupTotalPrice { get { return ChildFeeInfos.Sum(x => x.TotalPrice); } }
  422. }
  423. public class ChildFeeInfo
  424. {
  425. /// <summary>
  426. /// 费用类型名称
  427. /// </summary>
  428. public string TypeName { get; set; }
  429. /// <summary>
  430. /// 单人报价
  431. /// </summary>
  432. public decimal SinglePrice { get; set; }
  433. /// <summary>
  434. /// 总人数
  435. /// </summary>
  436. public int TotalPeople { get; set; }
  437. /// <summary>
  438. /// 总报价
  439. /// </summary>
  440. public decimal TotalPrice { get; set; }
  441. public ChildFeeInfo() { }
  442. /// <summary>
  443. /// 重构
  444. /// </summary>
  445. /// <param name="typeName">类型名称</param>
  446. /// <param name="singlePrice">单人报价</param>
  447. /// <param name="totalPeople">人数</param>
  448. public ChildFeeInfo(string typeName, decimal singlePrice, int totalPeople)
  449. {
  450. TypeName = typeName;
  451. SinglePrice = TruncateTo(singlePrice, 2);
  452. TotalPeople = totalPeople;
  453. TotalPrice = TruncateTo(SinglePrice * totalPeople, 2);
  454. }
  455. /// <summary>
  456. /// 截断保留指定位数小数(不四舍五入)
  457. /// </summary>
  458. public decimal TruncateTo(decimal value, int decimals)
  459. {
  460. decimal factor = (decimal)Math.Pow(10, decimals);
  461. return Math.Truncate(value * factor) / factor;
  462. }
  463. }
  464. }