using System; using System.Collections.Generic; using System.Linq; namespace CRM.Core.Model.QueryModels { public class AuditResultQuery { public class AuditItemResult { public int mon { get; set; } public int itemId { get; set; } public int parentId { get; set; } public int sort { get; set; } public int level { get; set; } public string item { get; set; } public decimal income { get; set; } public decimal depositreceived { get; set; } public decimal costprice { get; set; } public decimal lastcostprice { get; set; } public decimal checkCostprice { get; set; } public decimal modulePrice { get; set; } public decimal modulRefundprice { get; set; } public decimal orderRefundprice { get; set; } public decimal noUseOrderRefundprice { get; set; } public decimal payprice { get; set; } public decimal useprice { get; set; } public decimal onlinePrice { get; set; } public decimal costpriceRefund { get; set; } public decimal monIncome { get; set; } public decimal actualRefundprice { get; set; } public decimal depConsume { get; set; } /// /// 净收款 /// public decimal netPayprice { get { return payprice - actualRefundprice; } } /// /// 当月收入/实际收款净额(实际收款-实际退款) /// public string monIncomeper { get { return $"{Math.Round((netPayprice != 0 ? (monIncome / netPayprice) : 0) * 100, 2)}%"; } } /// /// 成本/订单金额 /// public string costper { get { return $"{Math.Round((modulePrice != 0 ? (checkCostprice / modulePrice) : 0) * 100, 2)}%"; } } /// /// 实际退款/实际收款 /// public string refundper { get { return $"{Math.Round((payprice != 0 ? (actualRefundprice / payprice) : 0) * 100, 2)}%"; } } /// /// 渠道消费/实际收款 /// public string consumeper { get { return $"{Math.Round((payprice != 0 ? (depConsume / payprice) : 0) * 100, 2)}%"; } } } public class AuditResult { public List auditItemResults { get; set; } public decimal sumPayprice { get; set; } public decimal sumRefundprice { get; set; } public string auditDate { get; set; } public string DataEnd { get; set; } public string remark { get; set; } } public class depConsume { public string title { get; set; } public int deptid { get; set; } public int campainid { get; set; } public string mon { get; set; } public DateTime ctime { get; set; } public decimal price { get; set; } } public class ItemdepConsume: depConsume { public int itemid { get; set; } public string item { get; set; } } public class ItemTree { public int itemid { get; set; } public string item { get; set; } public int parentId { get; set; } public List childItemTrees { get; set; } } /// /// 树形排序? /// /// /// /// public static List SortTrees(List auditItemResults,int parentId) { var result = new List(); var lv0 = auditItemResults.Where(d => d.parentId == parentId).OrderBy(d=>d.sort); var item = auditItemResults.Where(d => d.itemId == parentId).First(); if(item==null) return result; result.Add(item); var lv=item.level; foreach (var lv0item in lv0) { lv0item.level = lv+ 1; result.AddRange(SortTrees(auditItemResults,lv0item.itemId)); } return result; } public enum QueryType { income, qc, act, cur } } }