修改视图
This commit is contained in:
@@ -1150,8 +1150,8 @@ namespace Pilot.Report.Exploitation.AnnualSalesPaymentSum
|
||||
,[武汉派诺-往年订单变更] as WuhanPilotUsualAlter, [碳索业绩] as Discovery,[香港派诺业绩] as HongKongPilot,[华夏云联业绩] as HuaXiaYunLian ,[明细区域] as DetailArea
|
||||
,[ZhuhaiPilot]=[累计销售额]+[往年订单变更金额]
|
||||
,[PilotSumAmount]=[累计销售额]+[往年订单变更金额]+[兴诺业绩]+[兴诺往年订单变更]+[武汉派诺-当年业绩]+[武汉派诺-往年订单变更]+[碳索业绩]+[香港派诺业绩]+[华夏云联业绩]
|
||||
,ROW_NUMBER() OVER (ORDER BY [销售员ID]) AS FID
|
||||
,ROW_NUMBER() OVER (ORDER BY [销售员ID]) AS FIDENTITYID ,0 AS Sort, 0 as sortNum
|
||||
,ROW_NUMBER() OVER (ORDER BY [SBU] ,[销售员ID])*10 AS FID
|
||||
,ROW_NUMBER() OVER (ORDER BY [SBU] ,[销售员ID])*10 AS FIDENTITYID ,0 AS Sort
|
||||
into {tableName}
|
||||
FROM (
|
||||
SELECT DISTINCT
|
||||
@@ -1268,56 +1268,117 @@ AND AA.[订单日期] >='{yearStart}' AND AA.[订单日期] <'{yearEnd}') kk
|
||||
Loghelp.Log("年度销售额&回款额汇总");
|
||||
Loghelp.Log(sql2);
|
||||
var list= DBUtils.ExecuteDynamicObject(this.Context, sql2);
|
||||
//var sbuList = list.Select(t => t["SBU"].ToString).ToList();
|
||||
//string sbu = "";
|
||||
//int row = 0;
|
||||
//foreach (var item in list)
|
||||
//{
|
||||
// if (sbu != item["sbu"] && row>0 ||(row==(list.Count-1)))
|
||||
// {
|
||||
// var templist = list.Where(t => t["sbu"] == sbu).ToList();
|
||||
// sbu = item["sbu"].ToString();
|
||||
// var tempItem = item.Copy();
|
||||
// tempItem["Salesperson"] = sbu + "小计";
|
||||
// tempItem["sbu"] = "";
|
||||
// tempItem["X1Month"] = templist.Sum(t =>long.Parse( t["X1Month"].ToString()));
|
||||
// tempItem["X2Month"] = templist.Sum(t => long.Parse(t["X2Month"].ToString()));
|
||||
// tempItem["X3Month"] = templist.Sum(t => long.Parse(t["X3Month"].ToString()));
|
||||
// tempItem["X4Month"] = templist.Sum(t => long.Parse(t["X4Month"].ToString()));
|
||||
// tempItem["X5Month"] = templist.Sum(t => long.Parse(t["X5Month"].ToString()));
|
||||
// tempItem["X6Month"] = templist.Sum(t => long.Parse(t["X6Month"].ToString()));
|
||||
// tempItem["X7Month"] = templist.Sum(t => long.Parse(t["X7Month"].ToString()));
|
||||
// tempItem["X8Month"] = templist.Sum(t => long.Parse(t["X8Month"].ToString()));
|
||||
// tempItem["X9Month"] = templist.Sum(t => long.Parse(t["X9Month"].ToString()));
|
||||
// tempItem["X10Month"] = templist.Sum(t => long.Parse(t["X10Month"].ToString()));
|
||||
// tempItem["X11Month"] = templist.Sum(t => long.Parse(t["X11Month"].ToString()));
|
||||
// tempItem["X12Month"] = templist.Sum(t => long.Parse(t["X12Month"].ToString()));
|
||||
|
||||
// tempItem["H1Month"] = templist.Sum(t => long.Parse(t["H1Month"].ToString()));
|
||||
// tempItem["H2Month"] = templist.Sum(t => long.Parse(t["H2Month"].ToString()));
|
||||
// tempItem["H3Month"] = templist.Sum(t => long.Parse(t["H3Month"].ToString()));
|
||||
// tempItem["H4Month"] = templist.Sum(t => long.Parse(t["H4Month"].ToString()));
|
||||
// tempItem["H5Month"] = templist.Sum(t => long.Parse(t["H5Month"].ToString()));
|
||||
// tempItem["H6Month"] = templist.Sum(t => long.Parse(t["H6Month"].ToString()));
|
||||
// tempItem["H7Month"] = templist.Sum(t => long.Parse(t["H7Month"].ToString()));
|
||||
// tempItem["H8Month"] = templist.Sum(t => long.Parse(t["H8Month"].ToString()));
|
||||
// tempItem["H9Month"] = templist.Sum(t => long.Parse(t["H9Month"].ToString()));
|
||||
// tempItem["H10Month"] = templist.Sum(t => long.Parse(t["H10Month"].ToString()));
|
||||
// tempItem["H11Month"] = templist.Sum(t => long.Parse(t["H11Month"].ToString()));
|
||||
// tempItem["H12Month"] = templist.Sum(t => long.Parse(t["H12Month"].ToString()));
|
||||
|
||||
// tempItem["H1Month"] = templist.Sum(t => long.Parse(t["H1Month"].ToString()));
|
||||
|
||||
// list.Insert(row, tempItem);
|
||||
// }
|
||||
|
||||
// if (row == 0)
|
||||
// {
|
||||
// sbu = item["sbu"].ToString();
|
||||
// }
|
||||
var sbuList = list.Select(t=>t["SBU"]).ToList().Distinct().ToList();
|
||||
|
||||
|
||||
//}
|
||||
// sbu
|
||||
//EMT
|
||||
//半导体及北方大区
|
||||
//采购部
|
||||
//电能质量APF / SVG产品线
|
||||
//服务运维部
|
||||
//国际事业部
|
||||
//海外营销部
|
||||
//机场行业线
|
||||
//决策团队
|
||||
//诺瓦数能
|
||||
//其他
|
||||
//商务运营部
|
||||
//数据中心
|
||||
//武汉派诺
|
||||
//新疆区
|
||||
//医院
|
||||
//营销中心
|
||||
//硬件研发部
|
||||
//战略市场部
|
||||
//智慧能源事业部
|
||||
|
||||
string sbu1 = "";
|
||||
string sbu2 = "";
|
||||
string sbu3 = "";
|
||||
string sbu4 = "";
|
||||
string sbu = "";
|
||||
Dictionary<string, decimal> heBingDic = new Dictionary<string, decimal>();
|
||||
heBingDic.Add(sbu1, 0);
|
||||
heBingDic.Add(sbu2, 0);
|
||||
heBingDic.Add(sbu3, 0);
|
||||
heBingDic.Add(sbu4, 0);
|
||||
int row = 0;
|
||||
var insertList = list.Where(t=>1==0).ToList();
|
||||
insertList = new List<DynamicObject>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (sbu != item["sbu"] && row > 0 || (row == (list.Count - 1)))
|
||||
{
|
||||
var templist = list.Where(t => t["sbu"] == sbu).ToList();
|
||||
|
||||
var tempItem = item.Copy();
|
||||
tempItem["Salesperson"] = sbu + "小计";
|
||||
sbu = item["sbu"].ToString();
|
||||
tempItem["sbu"] = "";
|
||||
tempItem["X1Month"] = templist.Sum(t => long.Parse(t["X1Month"].ToString()));
|
||||
tempItem["X2Month"] = templist.Sum(t => long.Parse(t["X2Month"].ToString()));
|
||||
tempItem["X3Month"] = templist.Sum(t => long.Parse(t["X3Month"].ToString()));
|
||||
tempItem["X4Month"] = templist.Sum(t => long.Parse(t["X4Month"].ToString()));
|
||||
tempItem["X5Month"] = templist.Sum(t => long.Parse(t["X5Month"].ToString()));
|
||||
tempItem["X6Month"] = templist.Sum(t => long.Parse(t["X6Month"].ToString()));
|
||||
tempItem["X7Month"] = templist.Sum(t => long.Parse(t["X7Month"].ToString()));
|
||||
tempItem["X8Month"] = templist.Sum(t => long.Parse(t["X8Month"].ToString()));
|
||||
tempItem["X9Month"] = templist.Sum(t => long.Parse(t["X9Month"].ToString()));
|
||||
tempItem["X10Month"] = templist.Sum(t => long.Parse(t["X10Month"].ToString()));
|
||||
tempItem["X11Month"] = templist.Sum(t => long.Parse(t["X11Month"].ToString()));
|
||||
tempItem["X12Month"] = templist.Sum(t => long.Parse(t["X12Month"].ToString()));
|
||||
|
||||
tempItem["H1Month"] = templist.Sum(t => long.Parse(t["H1Month"].ToString()));
|
||||
tempItem["H2Month"] = templist.Sum(t => long.Parse(t["H2Month"].ToString()));
|
||||
tempItem["H3Month"] = templist.Sum(t => long.Parse(t["H3Month"].ToString()));
|
||||
tempItem["H4Month"] = templist.Sum(t => long.Parse(t["H4Month"].ToString()));
|
||||
tempItem["H5Month"] = templist.Sum(t => long.Parse(t["H5Month"].ToString()));
|
||||
tempItem["H6Month"] = templist.Sum(t => long.Parse(t["H6Month"].ToString()));
|
||||
tempItem["H7Month"] = templist.Sum(t => long.Parse(t["H7Month"].ToString()));
|
||||
tempItem["H8Month"] = templist.Sum(t => long.Parse(t["H8Month"].ToString()));
|
||||
tempItem["H9Month"] = templist.Sum(t => long.Parse(t["H9Month"].ToString()));
|
||||
tempItem["H10Month"] = templist.Sum(t => long.Parse(t["H10Month"].ToString()));
|
||||
tempItem["H11Month"] = templist.Sum(t => long.Parse(t["H11Month"].ToString()));
|
||||
tempItem["H12Month"] = templist.Sum(t => long.Parse(t["H12Month"].ToString()));
|
||||
|
||||
tempItem["XCumulative"] = templist.Sum(t => long.Parse(t["XCumulative"].ToString()));
|
||||
tempItem["UsualAlterAmount"] = templist.Sum(t => long.Parse(t["UsualAlterAmount"].ToString()));
|
||||
tempItem["SiNO"] = templist.Sum(t => long.Parse(t["SiNO"].ToString()));
|
||||
tempItem["SiNOUsualAlter"] = templist.Sum(t => long.Parse(t["SiNOUsualAlter"].ToString()));
|
||||
tempItem["WuhanPilotThisYear"] = templist.Sum(t => long.Parse(t["WuhanPilotThisYear"].ToString()));
|
||||
tempItem["WuhanPilotUsualAlter"] = templist.Sum(t => long.Parse(t["WuhanPilotUsualAlter"].ToString()));
|
||||
tempItem["Discovery"] = templist.Sum(t => long.Parse(t["Discovery"].ToString()));
|
||||
tempItem["HongKongPilot"] = templist.Sum(t => long.Parse(t["HongKongPilot"].ToString()));
|
||||
tempItem["HuaXiaYunLian"] = templist.Sum(t => long.Parse(t["HuaXiaYunLian"].ToString()));
|
||||
tempItem["DetailArea"] = item["DetailArea"].ToString();
|
||||
tempItem["ZhuhaiPilot"] = templist.Sum(t => long.Parse(t["[ZhuhaiPilot]"].ToString()));
|
||||
tempItem["PilotSumAmount"] = templist.Sum(t => long.Parse(t["PilotSumAmount"].ToString()));
|
||||
tempItem["FID"] =int.Parse(item["FID"].ToString())+1;
|
||||
tempItem["FIDENTITYID"] = int.Parse(item["FIDENTITYID"].ToString()) + 1; ;
|
||||
tempItem["Sort"] = 1;
|
||||
insertList.Add(tempItem);
|
||||
}
|
||||
|
||||
if (row == 0)
|
||||
{
|
||||
sbu = item["sbu"].ToString();
|
||||
}
|
||||
|
||||
}
|
||||
var heJi2 = insertList.Where(t =>( t["SBU"].ToString().Contains("EMT") && !t["SBU"].ToString().Contains("EMT团队")) || t["SBU"].ToString().Contains("数据中心")
|
||||
|| t["SBU"].ToString().Contains("医院") || t["SBU"].ToString().Contains("机场行业线")).ToList();
|
||||
|
||||
var heJi3 = insertList.Where(t => t["SBU"].ToString().Contains("半导体及北方大区") || t["SBU"].ToString().Contains("营销中心")
|
||||
|| t["SBU"].ToString().Contains("新疆区") ).ToList();
|
||||
|
||||
var heJi4 = insertList.Where(t => t["SBU"].ToString().Contains("诺瓦数能") || t["SBU"].ToString().Contains("智慧能源事业部")
|
||||
|| t["SBU"].ToString().Contains("国际事业部") ||( t["SBU"].ToString().Contains("其他")|| t["SBU"]==null)).ToList();
|
||||
|
||||
|
||||
string insertSql=$@"insert into {tableName} ";
|
||||
|
||||
//string upsql = $@"update {tableName} set fid=sortNum,FIDENTITYID=sortNum1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user