ComplianceServer/oldcode/Core.Model/QueryModels/AuditResultQuery.cs

122 lines
4.4 KiB
C#

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; }
/// <summary>
/// 净收款
/// </summary>
public decimal netPayprice { get { return payprice - actualRefundprice; } }
/// <summary>
/// 当月收入/实际收款净额(实际收款-实际退款)
/// </summary>
public string monIncomeper { get { return $"{Math.Round((netPayprice != 0 ? (monIncome / netPayprice) : 0) * 100, 2)}%"; } }
/// <summary>
/// 成本/订单金额
/// </summary>
public string costper
{ get { return $"{Math.Round((modulePrice != 0 ? (checkCostprice / modulePrice) : 0) * 100, 2)}%"; } }
/// <summary>
/// 实际退款/实际收款
/// </summary>
public string refundper
{ get { return $"{Math.Round((payprice != 0 ? (actualRefundprice / payprice) : 0) * 100, 2)}%"; } }
/// <summary>
/// 渠道消费/实际收款
/// </summary>
public string consumeper
{ get { return $"{Math.Round((payprice != 0 ? (depConsume / payprice) : 0) * 100, 2)}%"; } }
}
public class AuditResult
{
public List<AuditItemResult> 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<ItemTree> childItemTrees { get; set; }
}
/// <summary>
/// 树形排序?
/// </summary>
/// <param name="auditItemResults"></param>
/// <param name="parentId"></param>
/// <returns></returns>
public static List<AuditItemResult> SortTrees(List<AuditItemResult> auditItemResults,int parentId)
{
var result = new List<AuditItemResult>();
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 }
}
}