wzp
2021-11-30 f0a773e75016d08684a5c1fdd70d81f68141845d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<%@ WebHandler Language="C#" Class="GwStatisProfitHandler" %>
using Dao;
using Model;
using System;
using System.Collections.Generic;
using System.Text;
 
public class GwStatisProfitHandler : PageHandler<SysUser>
{
  private GwStatisProfitDao _Dao = new GwStatisProfitDao();
 
  public override JsonPageResult ProcessRequestInternal(PageContext<SysUser> context)
  {
      string @string = context.GetString("action");
      switch (@string)
    {
      case "loadStatisProfit":
        return this.loadStatisProfit(context);
      default:
        throw new Exception("Invalid Action=" + @string);
    }
  }
 
  private JsonPageResult loadStatisProfit(PageContext<SysUser> context)
  {
    DateTime dateTime1 = context.GetDateTime("begintime");
    DateTime dateTime2 = context.GetDateTime("endtime");
    string string1 = context.GetString("spid");
    string string2 = context.GetString("opid");
    string string3 = context.GetString("statistype");
    StatisOption so = (StatisOption) context.GetInt("statisoption");
    List<GwOp> oplist;
    using (GwOpDao gwOpDao = new GwOpDao())
      oplist = gwOpDao.LoadInfoList();
    List<GwStatisProfitItem> list = this._Dao.Query(dateTime1, dateTime2, string1, string2, string3, so);
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.Append("<tr class=\"header\">");
    stringBuilder.Append("<th >时间</th>");
    if ((so & StatisOption.OPID) == StatisOption.OPID)
      stringBuilder.Append("<th >通道</th>");
    if ((so & StatisOption.SpID) == StatisOption.SpID)
      stringBuilder.Append("<th >账户</th>");
    stringBuilder.Append("<th style='text-align: right;'>AP接收总费用(元)</th>");
    stringBuilder.Append("<th style='text-align: right;'>AP成功费用(元)</th>");
    stringBuilder.Append("<th style='text-align: right;'>OP提交总费用(元)</th>");
    stringBuilder.Append("<th style='text-align: right;'>OP成功费用(元)</th>");
    stringBuilder.Append("<th style='text-align: right;'>毛利润(元)</th>");
    stringBuilder.Append("<th style='text-align: right;'>净利润(元)</th>");
    stringBuilder.Append("</tr>");
    foreach (GwStatisProfitItem statisProfitItem in list)
    {
      stringBuilder.AppendFormat("<tr>");
      stringBuilder.AppendFormat("<td>{0}</td>", (object) statisProfitItem.Title);
      if ((so & StatisOption.OPID) == StatisOption.OPID)
        stringBuilder.AppendFormat("<td>{0}</td>", (object) this.GetOpName(oplist, statisProfitItem.OPID));
      if ((so & StatisOption.SpID) == StatisOption.SpID)
        stringBuilder.AppendFormat("<td>{0}</td>", (object) statisProfitItem.SpID);
      int num1 = statisProfitItem.APFee0 + statisProfitItem.APFee1 + statisProfitItem.APFee2 + statisProfitItem.APFee3 + statisProfitItem.APFee4 + statisProfitItem.APFee5;
      int num2 = statisProfitItem.OPFee0 + statisProfitItem.OPFee1 + statisProfitItem.OPFee2 + statisProfitItem.OPFee3 + statisProfitItem.OPFee4 + statisProfitItem.OPFee5;
      int num3 = num1 - (statisProfitItem.APFee0 + statisProfitItem.APFee2 + statisProfitItem.APFee3 + statisProfitItem.APFee5);
      stringBuilder.AppendFormat("<td style='text-align: right;'>{0}</td>", (object) ((double) num1 / 1000.0));
      stringBuilder.AppendFormat("<td style='text-align: right;'>{0}</td>", (object) ((double) num3 / 1000.0));
      stringBuilder.AppendFormat("<td style='text-align: right;'>{0}</td>", (object) ((double) num2 / 1000.0));
      stringBuilder.AppendFormat("<td style='text-align: right;'>{0}</td>", (object) ((double) statisProfitItem.OPFee4 / 1000.0));
      stringBuilder.AppendFormat("<td style='text-align: right;'>{0}</td>", (object) ((double) (num1 - num2) / 1000.0));
      stringBuilder.AppendFormat("<td style='text-align: right;'>{0}</td>", (object) ((double) (num3 - statisProfitItem.OPFee4) / 1000.0));
      stringBuilder.AppendFormat("</tr>");
    }
    return new JsonPageResult(true, (object) stringBuilder.ToString());
  }
 
  private string GetOpName(List<GwOp> oplist, int opID)
  {
    if (oplist == null)
      return string.Empty;
    GwOp gwOp = oplist.Find((Predicate<GwOp>) (op => op.OpID == opID));
    if (gwOp != null)
      return string.Format("{0}-{1}", (object) gwOp.OpID, (object) gwOp.OpName);
    return string.Empty;
  }
}