Browse Source

.

master^2
yibo 7 years ago
parent
commit
d42e97dc44
1 changed files with 22 additions and 15 deletions
  1. +22
    -15
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/SaleSummaryReport_/SaleSummaryReport.cs

+ 22
- 15
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/SaleSummaryReport_/SaleSummaryReport.cs View File

@ -133,27 +133,28 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports.SaleSummaryReport_
}
}
List<Tuple<long, string>> FirstDepts
List<Tuple<long, string, int>> FirstDepts
{
get
{
if (ViewState["FirstDepts"] == null)
ViewState["FirstDepts"] = GetFirstDepts();
return (List<Tuple<long, string>>)ViewState["FirstDepts"];
return (List<Tuple<long, string, int>>)ViewState["FirstDepts"];
}
set { ViewState["FirstDepts"] = value; }
}
List<Tuple<long, string>> GetFirstDepts()
List<Tuple<long, string, int>> GetFirstDepts()
{
var dept = SaleDepartmentInfo;
var query = new DQueryDom(new JoinAlias(typeof(Department)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Columns.Add(DQSelectColumn.Field("Depth"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Domain_ID", DomainContext.Current.ID), DQCondition.EQ("Stopped", false), DQCondition.EQ("Depth", dept.Item2 + 1)));
query.Where.Conditions.Add(DQCondition.EQ(string.Format("TreeDeep{0}ID", dept.Item2), dept.Item1));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
return query.EExecuteList<long, string>();
return query.EExecuteList<long, string, int>();
}
Tuple<long, int> SaleDepartmentInfo
@ -171,30 +172,31 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports.SaleSummaryReport_
}
}
List<Tuple<long, string>> SecondDepts
List<Tuple<long, string, int>> SecondDepts
{
get
{
if (ViewState["SecondDepts"] == null)
ViewState["SecondDepts"] = GetSecondDepts();
return (List<Tuple<long, string>>)ViewState["SecondDepts"];
return (List<Tuple<long, string, int>>)ViewState["SecondDepts"];
}
set { ViewState["SecondDepts"] = value; }
}
List<Tuple<long, string>> GetSecondDepts()
List<Tuple<long, string, int>> GetSecondDepts()
{
var depth = SaleDepartmentInfo.Item2;
var selectedItem = firstFilterTree.GetSelecteItem();
if (!selectedItem.Selected || string.IsNullOrEmpty(selectedItem.Value))
return new List<Tuple<long, string>>();
return new List<Tuple<long, string, int>>();
var info = selectedItem.Tag as Tuple<long, string, int>;
var query = new DQueryDom(new JoinAlias(typeof(Department)));
query.Columns.Add(DQSelectColumn.Field("ID"));
query.Columns.Add(DQSelectColumn.Field("Name"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Domain_ID", DomainContext.Current.ID), DQCondition.EQ("Stopped", false), DQCondition.EQ("Depth", depth + 2)));
query.Where.Conditions.Add(DQCondition.EQ(string.Format("TreeDeep{0}ID", depth + 1), long.Parse(firstFilterTree.GetSelecteItem().Value)));
query.Columns.Add(DQSelectColumn.Field("Depth"));
query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Domain_ID", DomainContext.Current.ID), DQCondition.EQ("Stopped", false), DQCondition.EQ("Depth", info.Item3 + 1)));
query.Where.Conditions.Add(DQCondition.EQ(string.Format("TreeDeep{0}ID", info.Item3), info.Item1));
query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID"));
return query.EExecuteList<long, string>();
return query.EExecuteList<long, string, int>();
}
static FilterTree firstFilterTree;
@ -210,6 +212,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports.SaleSummaryReport_
foreach (var item in FirstDepts)
{
var node = new FilterTreeNode(item.Item2, item.Item1.ToString());
node.Tag = item;
firstFilterTree.DataSource.Childs.Add(node);
}
}
@ -225,7 +228,8 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports.SaleSummaryReport_
{
if (!string.IsNullOrEmpty(node.Value))
{
query.Where.Conditions.Add(DQCondition.EQ(JoinAlias.Create("dept"), "TreeDeep1ID", long.Parse(node.Value)));
var info = node.Tag as Tuple<long, string, int>;
query.Where.Conditions.Add(DQCondition.EQ(JoinAlias.Create("dept"), string.Format("TreeDeep{0}ID", info.Item3), info.Item1));
}
};
@ -238,6 +242,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports.SaleSummaryReport_
foreach (var item in SecondDepts)
{
var node = new FilterTreeNode(item.Item2, item.Item1.ToString());
node.Tag = item;
secondFilterTree.DataSource.Childs.Add(node);
}
}
@ -258,7 +263,8 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports.SaleSummaryReport_
{
if (!string.IsNullOrEmpty(node.Value))
{
query.Where.Conditions.Add(DQCondition.EQ(JoinAlias.Create("dept"), "TreeDeep2ID", long.Parse(node.Value)));
var info = node.Tag as Tuple<long, string, int>;
query.Where.Conditions.Add(DQCondition.EQ(JoinAlias.Create("dept"), string.Format("TreeDeep{0}ID", info.Item3), info.Item1));
}
};
@ -269,6 +275,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports.SaleSummaryReport_
protected override DQueryDom GetQueryDom()
{
var saleDepth = SaleDepartmentInfo.Item2;
var main = new JoinAlias(typeof(TempClass));
var dept = new JoinAlias("dept", typeof(Department));
var _3Dept = new JoinAlias("_3Dept", typeof(Department));
@ -277,7 +284,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports.SaleSummaryReport_
var query = new DQueryDom(main);
TempClass.Register(query, SelectDate);
query.From.AddJoin(JoinType.Left, new DQDmoSource(dept), DQCondition.EQ(main, "Department_ID", dept, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(_3Dept), DQCondition.EQ(dept, string.Format("TreeDeep{0}ID", SaleDepartmentInfo.Item2 + 3), _3Dept, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(_3Dept), DQCondition.EQ(DQExpression.LogicCase(DQCondition.GreaterThanOrEqual(dept, "Depth", saleDepth + 3), DQExpression.Field(dept, string.Format("TreeDeep{0}ID", SaleDepartmentInfo.Item2 + 3)), DQCondition.EQ(dept, "Depth", saleDepth + 2), DQExpression.Field(dept, string.Format("TreeDeep{0}ID", SaleDepartmentInfo.Item2 + 2)), DQExpression.Field(dept, string.Format("TreeDeep{0}ID", SaleDepartmentInfo.Item2 + 1))), DQExpression.Field(_3Dept, "ID")));
query.From.AddJoin(JoinType.Left, new DQDmoSource(customer), DQCondition.EQ(main, "Customer_ID", customer, "ID"));
query.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(main, "Goods_ID", goods, "ID"));


Loading…
Cancel
Save