Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
c28354a7
Commit
c28354a7
authored
Jun 08, 2021
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
75a8f220
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
309 additions
and
214 deletions
+309
-214
StatisticsModule.cs
Mall.Module.MarketingCenter/StatisticsModule.cs
+271
-214
LiveHouseController.cs
Mall.WebApi/Controllers/AppletWeChat/LiveHouseController.cs
+38
-0
No files found.
Mall.Module.MarketingCenter/StatisticsModule.cs
View file @
c28354a7
...
...
@@ -514,11 +514,60 @@ namespace Mall.Module.MarketingCenter
string
prvSTime
=
Convert
.
ToDateTime
(
StartTime
).
AddMonths
(-
1
).
ToString
(
"yyyy-MM-dd"
);
string
prvETime
=
Convert
.
ToDateTime
(
prvSTime
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
var
prvlist
=
user_StatisticsRepository
.
GetList
(
new
RB_User_Statistics_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
StartTime
=
prvSTime
,
EndTime
=
prvETime
});
#
region
首先
查询上期平均值
int
PreDay
=
Convert
.
ToDateTime
(
prvETime
).
Day
-
20
;
#
region
上月
decimal
presPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
VipNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
YXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
JXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
Profit
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
endregion
List
<
object
>
RList
=
new
List
<
object
>();
//根据日期遍历
int
MaxDay
=
Convert
.
ToDateTime
(
EndTime
).
Day
;
string
SDate
=
StartTime
;
#
region
月平均
#
region
上期参数
decimal
sPeopleNum
=
0
;
decimal
sOrderNum
=
0
;
decimal
sPayMoney
=
0
;
decimal
sBuyNum
=
0
;
decimal
sAvgOrderNum
=
0
;
decimal
sAvgBuyNum
=
0
;
decimal
sAvgUnitPrice
=
0
;
decimal
sAvgBuyPrice
=
0
;
decimal
sMemberNum
=
0
;
decimal
sPaymentNum
=
0
;
decimal
sMOrderRate
=
0
;
decimal
sReBuyNum
=
0
;
decimal
sReBuyRate
=
0
;
decimal
sNewPeopleNum
=
0
;
decimal
sPXNum
=
0
;
decimal
sVipNum
=
0
;
decimal
sYXNum
=
0
;
decimal
sJXNum
=
0
;
decimal
sProfit
=
0
;
decimal
sProfitRate
=
0
;
#
endregion
#
region
月平均参数
decimal
yPeopleNum
=
0
;
decimal
yOrderNum
=
0
;
decimal
yPayMoney
=
0
;
...
...
@@ -597,28 +646,6 @@ namespace Mall.Module.MarketingCenter
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
上月
decimal
sPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
PeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
OrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
PayMoney
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
BuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
MemberNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
PaymentNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
MOrderRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
PXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
VipNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
YXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
JXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
平均
RList
.
Add
(
new
{
...
...
@@ -649,26 +676,26 @@ namespace Mall.Module.MarketingCenter
RList
.
Add
(
new
{
Date
=
"环比成长"
,
PeopleNum
=
Math
.
Round
(
sPeopleNum
>
0
?
(
PeopleNum
-
sPeopleNum
)
/
sPeopleNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
OrderNum
=
Math
.
Round
(
sOrderNum
>
0
?
(
OrderNum
-
sOrderNum
)
/
sOrderNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
PayMoney
=
Math
.
Round
(
sPayMoney
>
0
?
(
PayMoney
-
sPayMoney
)
/
sPayMoney
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
BuyNum
=
Math
.
Round
(
sBuyNum
>
0
?
(
BuyNum
-
sBuyNum
)
/
sBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
AvgOrderNum
=
Math
.
Round
(
sAvgOrderNum
>
0
?
(
AvgOrderNum
-
sAvgOrderNum
)
/
sAvgOrderNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
AvgBuyNum
=
Math
.
Round
(
sAvgBuyNum
>
0
?
(
AvgBuyNum
-
sAvgBuyNum
)
/
sAvgBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
AvgUnitPrice
=
Math
.
Round
(
sAvgUnitPrice
>
0
?
(
AvgUnitPrice
-
sAvgUnitPrice
)
/
sAvgUnitPrice
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
AvgBuyPrice
=
Math
.
Round
(
sAvgBuyPrice
>
0
?
(
AvgBuyPrice
-
sAvgBuyPrice
)
/
sAvgBuyPrice
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
MemberNum
=
Math
.
Round
(
sMemberNum
>
0
?
(
MemberNum
-
sMemberNum
)
/
sMemberNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
PaymentNum
=
Math
.
Round
(
sPaymentNum
>
0
?
(
PaymentNum
-
sPaymentNum
)
/
sPaymentNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
MOrderRate
=
Math
.
Round
(
sMOrderRate
>
0
?
(
MOrderRate
-
sMOrderRate
)
/
sMOrderRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
ReBuyNum
=
Math
.
Round
(
sReBuyNum
>
0
?
(
ReBuyNum
-
sReBuyNum
)
/
sReBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
ReBuyRate
=
Math
.
Round
(
sReBuyRate
>
0
?
(
ReBuyRate
-
sReBuyRate
)
/
sReBuyRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
NewPeopleNum
=
Math
.
Round
(
sNewPeopleNum
>
0
?
(
NewPeopleNum
-
sNewPeopleNum
)
/
sNewPeopleNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
PXNum
=
Math
.
Round
(
sPXNum
>
0
?
(
PXNum
-
sPXNum
)
/
sPXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
VipNum
=
Math
.
Round
(
sVipNum
>
0
?
(
VipNum
-
sVipNum
)
/
sVipNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
YXNum
=
Math
.
Round
(
sYXNum
>
0
?
(
YXNum
-
sYXNum
)
/
sYXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
JXNum
=
Math
.
Round
(
sJXNum
>
0
?
(
JXNum
-
sJXNum
)
/
sJXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
Profit
=
Math
.
Round
(
sProfit
>
0
?
(
Profit
-
sProfit
)
/
sProfit
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
ProfitRate
=
Math
.
Round
(
sProfitRate
>
0
?
(
ProfitRate
-
sProfitRate
)
/
sProfitRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
PeopleNum
=
Math
.
Round
(
presPeopleNum
>
0
?
(
PeopleNum
-
presPeopleNum
)
/
pre
sPeopleNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
OrderNum
=
Math
.
Round
(
presOrderNum
>
0
?
(
OrderNum
-
presOrderNum
)
/
pre
sOrderNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
PayMoney
=
Math
.
Round
(
presPayMoney
>
0
?
(
PayMoney
-
presPayMoney
)
/
pre
sPayMoney
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
BuyNum
=
Math
.
Round
(
presBuyNum
>
0
?
(
BuyNum
-
presBuyNum
)
/
pre
sBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
AvgOrderNum
=
Math
.
Round
(
presAvgOrderNum
>
0
?
(
AvgOrderNum
-
presAvgOrderNum
)
/
pre
sAvgOrderNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
AvgBuyNum
=
Math
.
Round
(
presAvgBuyNum
>
0
?
(
AvgBuyNum
-
presAvgBuyNum
)
/
pre
sAvgBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
AvgUnitPrice
=
Math
.
Round
(
presAvgUnitPrice
>
0
?
(
AvgUnitPrice
-
presAvgUnitPrice
)
/
pre
sAvgUnitPrice
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
AvgBuyPrice
=
Math
.
Round
(
presAvgBuyPrice
>
0
?
(
AvgBuyPrice
-
presAvgBuyPrice
)
/
pre
sAvgBuyPrice
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
MemberNum
=
Math
.
Round
(
presMemberNum
>
0
?
(
MemberNum
-
presMemberNum
)
/
pre
sMemberNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
PaymentNum
=
Math
.
Round
(
presPaymentNum
>
0
?
(
PaymentNum
-
presPaymentNum
)
/
pre
sPaymentNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
MOrderRate
=
Math
.
Round
(
presMOrderRate
>
0
?
(
MOrderRate
-
presMOrderRate
)
/
pre
sMOrderRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
ReBuyNum
=
Math
.
Round
(
presReBuyNum
>
0
?
(
ReBuyNum
-
presReBuyNum
)
/
pre
sReBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
ReBuyRate
=
Math
.
Round
(
presReBuyRate
>
0
?
(
ReBuyRate
-
presReBuyRate
)
/
pre
sReBuyRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
NewPeopleNum
=
Math
.
Round
(
presNewPeopleNum
>
0
?
(
NewPeopleNum
-
presNewPeopleNum
)
/
pre
sNewPeopleNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
PXNum
=
Math
.
Round
(
presPXNum
>
0
?
(
PXNum
-
presPXNum
)
/
pre
sPXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
VipNum
=
Math
.
Round
(
presVipNum
>
0
?
(
VipNum
-
presVipNum
)
/
pre
sVipNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
YXNum
=
Math
.
Round
(
presYXNum
>
0
?
(
YXNum
-
presYXNum
)
/
pre
sYXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
JXNum
=
Math
.
Round
(
presJXNum
>
0
?
(
JXNum
-
presJXNum
)
/
pre
sJXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
Profit
=
Math
.
Round
(
presProfit
>
0
?
(
Profit
-
presProfit
)
/
pre
sProfit
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
ProfitRate
=
Math
.
Round
(
presProfitRate
>
0
?
(
ProfitRate
-
presProfitRate
)
/
pre
sProfitRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
,
});
#
endregion
...
...
@@ -694,6 +721,28 @@ namespace Mall.Module.MarketingCenter
yProfit
+=
Profit
;
yProfitRate
+=
ProfitRate
;
#
endregion
#
region
当期赋值
用于下期环比
sPeopleNum
=
PeopleNum
;
sOrderNum
=
OrderNum
;
sPayMoney
=
PayMoney
;
sBuyNum
=
BuyNum
;
sAvgOrderNum
=
AvgOrderNum
;
sAvgBuyNum
=
AvgBuyNum
;
sAvgUnitPrice
=
AvgUnitPrice
;
sAvgBuyPrice
=
AvgBuyPrice
;
sMemberNum
=
MemberNum
;
sPaymentNum
=
PaymentNum
;
sMOrderRate
=
MOrderRate
;
sReBuyNum
=
ReBuyNum
;
sReBuyRate
=
ReBuyRate
;
sNewPeopleNum
=
NewPeopleNum
;
sPXNum
=
PXNum
;
sVipNum
=
VipNum
;
sYXNum
=
YXNum
;
sJXNum
=
JXNum
;
sProfit
=
Profit
;
sProfitRate
=
ProfitRate
;
#
endregion
}
else
if
(
Convert
.
ToDateTime
(
SDate
).
Day
==
20
)
{
...
...
@@ -719,28 +768,6 @@ namespace Mall.Module.MarketingCenter
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
上月
decimal
sPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
VipNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
YXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
JXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
平均
RList
.
Add
(
new
{
...
...
@@ -816,10 +843,31 @@ namespace Mall.Module.MarketingCenter
yProfit
+=
Profit
;
yProfitRate
+=
ProfitRate
;
#
endregion
#
region
当期赋值
用于下期环比
sPeopleNum
=
PeopleNum
;
sOrderNum
=
OrderNum
;
sPayMoney
=
PayMoney
;
sBuyNum
=
BuyNum
;
sAvgOrderNum
=
AvgOrderNum
;
sAvgBuyNum
=
AvgBuyNum
;
sAvgUnitPrice
=
AvgUnitPrice
;
sAvgBuyPrice
=
AvgBuyPrice
;
sMemberNum
=
MemberNum
;
sPaymentNum
=
PaymentNum
;
sMOrderRate
=
MOrderRate
;
sReBuyNum
=
ReBuyNum
;
sReBuyRate
=
ReBuyRate
;
sNewPeopleNum
=
NewPeopleNum
;
sPXNum
=
PXNum
;
sVipNum
=
VipNum
;
sYXNum
=
YXNum
;
sJXNum
=
JXNum
;
sProfit
=
Profit
;
sProfitRate
=
ProfitRate
;
#
endregion
}
else
if
(
Convert
.
ToDateTime
(
SDate
).
Day
==
MaxDay
)
{
int
NowDay
=
MaxDay
-
20
;
int
PreDay
=
Convert
.
ToDateTime
(
prvETime
).
Day
-
20
;
#
region
本月
decimal
PeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
OrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
...
...
@@ -842,28 +890,6 @@ namespace Mall.Module.MarketingCenter
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
Profit
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
上月
decimal
sPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
VipNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
YXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
JXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
Profit
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
平均
RList
.
Add
(
new
{
...
...
@@ -988,27 +1014,27 @@ namespace Mall.Module.MarketingCenter
TotalPXNum
,
TotalVIPNum
,
TotalYXNum
,
TotalJXNum
,
AvgPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
PeopleNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
OrderNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
PayMoney
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
BuyNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
AvgOrderNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
AvgBuyNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
MemberNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
PaymentNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
MOrderRate
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
ReBuyNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
ReBuyRate
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
NewPeopleNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
PXNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
VipNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
YXNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
JXNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
Profit
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
AvgProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
ProfitRate
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
,
TotalJXNum
,
AvgPeopleNum
=
presPeopleNum
,
AvgOrderNum
=
presOrderNum
,
AvgPayMoney
=
presPayMoney
,
AvgBuyNum
=
presBuyNum
,
AvgAvgOrderNum
=
presAvgOrderNum
,
AvgAvgBuyNum
=
presAvgBuyNum
,
AvgAvgUnitPrice
=
presAvgUnitPrice
,
AvgAvgBuyPrice
=
presAvgBuyPrice
,
AvgMemberNum
=
presMemberNum
,
AvgPaymentNum
=
presPaymentNum
,
AvgMOrderRate
=
presMOrderRate
,
AvgReBuyNum
=
presReBuyNum
,
AvgReBuyRate
=
presReBuyRate
,
AvgNewPeopleNum
=
presNewPeopleNum
,
AvgPXNum
=
presPXNum
,
AvgVipNum
=
presVipNum
,
AvgYXNum
=
presYXNum
,
AvgJXNum
=
presJXNum
,
AvgProfit
=
presProfit
,
AvgProfitRate
=
presProfitRate
,
MonthProfit
=
list
.
Sum
(
x
=>
x
.
Profit
),
RList
};
...
...
@@ -1031,33 +1057,60 @@ namespace Mall.Module.MarketingCenter
string
prvSTime
=
Convert
.
ToDateTime
(
StartTime
).
AddMonths
(-
1
).
ToString
(
"yyyy-MM-dd"
);
string
prvETime
=
Convert
.
ToDateTime
(
prvSTime
).
AddMonths
(
1
).
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd"
);
var
prvlist
=
user_StatisticsRepository
.
GetList
(
new
RB_User_Statistics_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
,
StartTime
=
prvSTime
,
EndTime
=
prvETime
});
#
region
首先
查询上期平均值
int
PreDay
=
Convert
.
ToDateTime
(
prvETime
).
Day
-
20
;
#
region
上月
decimal
presPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
VipNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
YXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
JXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
Profit
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
presProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
endregion
List
<
object
>
RList
=
new
List
<
object
>();
//根据日期遍历
int
MaxDay
=
Convert
.
ToDateTime
(
EndTime
).
Day
;
string
SDate
=
StartTime
;
#
region
初始
日
平均
#
region
初始
上期
平均
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
23
)
{
new
ExcelColumn
(
value
:
"
日
平均"
){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
PeopleNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
OrderNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
PayMoney
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
BuyNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
AvgOrderNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
AvgBuyNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
MemberNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
PaymentNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
MOrderRate
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()
+
"%"
){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
ReBuyNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
ReBuyRate
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()
+
"%"
){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
NewPeopleNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
PXNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
VipNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
YXNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
},
new
ExcelColumn
(
value
:
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Sum
(
x
=>
x
.
JXNum
))
/
MaxDay
,
2
,
MidpointRounding
.
AwayFromZero
)
.
ToString
()){
}
new
ExcelColumn
(
value
:
"
上期
平均"
){
},
new
ExcelColumn
(
value
:
presPeopleNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presOrderNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presPayMoney
.
ToString
()){
},
new
ExcelColumn
(
value
:
presBuyNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presAvgOrderNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presAvgBuyNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presAvgUnitPrice
.
ToString
()){
},
new
ExcelColumn
(
value
:
presAvgBuyPrice
.
ToString
()){
},
new
ExcelColumn
(
value
:
presMemberNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presPaymentNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presMOrderRate
.
ToString
()
+
"%"
){
},
new
ExcelColumn
(
value
:
presReBuyNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presReBuyRate
.
ToString
()
+
"%"
){
},
new
ExcelColumn
(
value
:
presNewPeopleNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presPXNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presVipNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presYXNum
.
ToString
()){
},
new
ExcelColumn
(
value
:
presJXNum
.
ToString
()){
}
},
ColumnHight
=
30
};
...
...
@@ -1095,6 +1148,28 @@ namespace Mall.Module.MarketingCenter
DataList
.
Add
(
header1
);
#
endregion
#
region
上期参数
decimal
sPeopleNum
=
0
;
decimal
sOrderNum
=
0
;
decimal
sPayMoney
=
0
;
decimal
sBuyNum
=
0
;
decimal
sAvgOrderNum
=
0
;
decimal
sAvgBuyNum
=
0
;
decimal
sAvgUnitPrice
=
0
;
decimal
sAvgBuyPrice
=
0
;
decimal
sMemberNum
=
0
;
decimal
sPaymentNum
=
0
;
decimal
sMOrderRate
=
0
;
decimal
sReBuyNum
=
0
;
decimal
sReBuyRate
=
0
;
decimal
sNewPeopleNum
=
0
;
decimal
sPXNum
=
0
;
decimal
sVipNum
=
0
;
decimal
sYXNum
=
0
;
decimal
sJXNum
=
0
;
decimal
sProfit
=
0
;
decimal
sProfitRate
=
0
;
#
endregion
#
region
月平均参数
decimal
yPeopleNum
=
0
;
decimal
yOrderNum
=
0
;
...
...
@@ -1176,28 +1251,6 @@ namespace Mall.Module.MarketingCenter
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
上月
decimal
sPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
PeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
OrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
PayMoney
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
BuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
MemberNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
PaymentNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
MOrderRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
PXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
VipNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
YXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
JXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
<=
10
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
平均
ExcelDataSource
datarow2
=
new
ExcelDataSource
()
...
...
@@ -1232,24 +1285,24 @@ namespace Mall.Module.MarketingCenter
{
ExcelRows
=
new
List
<
ExcelColumn
>(
23
)
{
new
ExcelColumn
(
value
:
"环比成长"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sPeopleNum
>
0
?
(
PeopleNum
-
sPeopleNum
)
/
sPeopleNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sOrderNum
>
0
?
(
OrderNum
-
sOrderNum
)
/
sOrderNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sPayMoney
>
0
?
(
PayMoney
-
sPayMoney
)
/
sPayMoney
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sBuyNum
>
0
?
(
BuyNum
-
sBuyNum
)
/
sBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sAvgOrderNum
>
0
?
(
AvgOrderNum
-
sAvgOrderNum
)
/
sAvgOrderNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sAvgBuyNum
>
0
?
(
AvgBuyNum
-
sAvgBuyNum
)
/
sAvgBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sAvgUnitPrice
>
0
?
(
AvgUnitPrice
-
sAvgUnitPrice
)
/
sAvgUnitPrice
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sAvgBuyPrice
>
0
?
(
AvgBuyPrice
-
sAvgBuyPrice
)
/
sAvgBuyPrice
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sMemberNum
>
0
?
(
MemberNum
-
sMemberNum
)
/
sMemberNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sPaymentNum
>
0
?
(
PaymentNum
-
sPaymentNum
)
/
sPaymentNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sMOrderRate
>
0
?
(
MOrderRate
-
sMOrderRate
)
/
sMOrderRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sReBuyNum
>
0
?
(
ReBuyNum
-
sReBuyNum
)
/
sReBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sReBuyRate
>
0
?
(
ReBuyRate
-
sReBuyRate
)
/
sReBuyRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sNewPeopleNum
>
0
?
(
NewPeopleNum
-
sNewPeopleNum
)
/
sNewPeopleNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sPXNum
>
0
?
(
PXNum
-
sPXNum
)
/
sPXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sVipNum
>
0
?
(
VipNum
-
sVipNum
)
/
sVipNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sYXNum
>
0
?
(
YXNum
-
sYXNum
)
/
sYXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
sJXNum
>
0
?
(
JXNum
-
sJXNum
)
/
sJXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presPeopleNum
>
0
?
(
PeopleNum
-
presPeopleNum
)
/
pre
sPeopleNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presOrderNum
>
0
?
(
OrderNum
-
presOrderNum
)
/
pre
sOrderNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presPayMoney
>
0
?
(
PayMoney
-
presPayMoney
)
/
pre
sPayMoney
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presBuyNum
>
0
?
(
BuyNum
-
presBuyNum
)
/
pre
sBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presAvgOrderNum
>
0
?
(
AvgOrderNum
-
presAvgOrderNum
)
/
pre
sAvgOrderNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presAvgBuyNum
>
0
?
(
AvgBuyNum
-
presAvgBuyNum
)
/
pre
sAvgBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presAvgUnitPrice
>
0
?
(
AvgUnitPrice
-
presAvgUnitPrice
)
/
pre
sAvgUnitPrice
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presAvgBuyPrice
>
0
?
(
AvgBuyPrice
-
presAvgBuyPrice
)
/
pre
sAvgBuyPrice
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presMemberNum
>
0
?
(
MemberNum
-
presMemberNum
)
/
pre
sMemberNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presPaymentNum
>
0
?
(
PaymentNum
-
presPaymentNum
)
/
pre
sPaymentNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presMOrderRate
>
0
?
(
MOrderRate
-
presMOrderRate
)
/
pre
sMOrderRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presReBuyNum
>
0
?
(
ReBuyNum
-
presReBuyNum
)
/
pre
sReBuyNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presReBuyRate
>
0
?
(
ReBuyRate
-
presReBuyRate
)
/
pre
sReBuyRate
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presNewPeopleNum
>
0
?
(
NewPeopleNum
-
presNewPeopleNum
)
/
pre
sNewPeopleNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presPXNum
>
0
?
(
PXNum
-
presPXNum
)
/
pre
sPXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presVipNum
>
0
?
(
VipNum
-
presVipNum
)
/
pre
sVipNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presYXNum
>
0
?
(
YXNum
-
presYXNum
)
/
pre
sYXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
new
ExcelColumn
(
value
:(
Math
.
Round
(
presJXNum
>
0
?
(
JXNum
-
presJXNum
)
/
pre
sJXNum
:
1
,
4
,
MidpointRounding
.
AwayFromZero
)
*
100
).
ToString
()+
"%"
){
},
},
ColumnHight
=
30
};
...
...
@@ -1310,6 +1363,28 @@ namespace Mall.Module.MarketingCenter
yProfit
+=
Profit
;
yProfitRate
+=
ProfitRate
;
#
endregion
#
region
当期赋值
用于下期环比
sPeopleNum
=
PeopleNum
;
sOrderNum
=
OrderNum
;
sPayMoney
=
PayMoney
;
sBuyNum
=
BuyNum
;
sAvgOrderNum
=
AvgOrderNum
;
sAvgBuyNum
=
AvgBuyNum
;
sAvgUnitPrice
=
AvgUnitPrice
;
sAvgBuyPrice
=
AvgBuyPrice
;
sMemberNum
=
MemberNum
;
sPaymentNum
=
PaymentNum
;
sMOrderRate
=
MOrderRate
;
sReBuyNum
=
ReBuyNum
;
sReBuyRate
=
ReBuyRate
;
sNewPeopleNum
=
NewPeopleNum
;
sPXNum
=
PXNum
;
sVipNum
=
VipNum
;
sYXNum
=
YXNum
;
sJXNum
=
JXNum
;
sProfit
=
Profit
;
sProfitRate
=
ProfitRate
;
#
endregion
}
else
if
(
Convert
.
ToDateTime
(
SDate
).
Day
==
20
)
{
...
...
@@ -1335,28 +1410,6 @@ namespace Mall.Module.MarketingCenter
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
上月
decimal
sPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
PXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
VipNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
YXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
JXNum
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
Profit
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
10
&&
x
.
Date
.
Day
<=
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
平均
ExcelDataSource
datarow2
=
new
ExcelDataSource
()
...
...
@@ -1469,11 +1522,32 @@ namespace Mall.Module.MarketingCenter
yProfit
+=
Profit
;
yProfitRate
+=
ProfitRate
;
#
endregion
#
region
当期赋值
用于下期环比
sPeopleNum
=
PeopleNum
;
sOrderNum
=
OrderNum
;
sPayMoney
=
PayMoney
;
sBuyNum
=
BuyNum
;
sAvgOrderNum
=
AvgOrderNum
;
sAvgBuyNum
=
AvgBuyNum
;
sAvgUnitPrice
=
AvgUnitPrice
;
sAvgBuyPrice
=
AvgBuyPrice
;
sMemberNum
=
MemberNum
;
sPaymentNum
=
PaymentNum
;
sMOrderRate
=
MOrderRate
;
sReBuyNum
=
ReBuyNum
;
sReBuyRate
=
ReBuyRate
;
sNewPeopleNum
=
NewPeopleNum
;
sPXNum
=
PXNum
;
sVipNum
=
VipNum
;
sYXNum
=
YXNum
;
sJXNum
=
JXNum
;
sProfit
=
Profit
;
sProfitRate
=
ProfitRate
;
#
endregion
}
else
if
(
Convert
.
ToDateTime
(
SDate
).
Day
==
MaxDay
)
{
int
NowDay
=
MaxDay
-
20
;
int
PreDay
=
Convert
.
ToDateTime
(
prvETime
).
Day
-
20
;
#
region
本月
decimal
PeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
OrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
...
...
@@ -1496,28 +1570,6 @@ namespace Mall.Module.MarketingCenter
decimal
Profit
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
Profit
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
ProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
list
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
NowDay
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
上月
decimal
sPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PeopleNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
OrderNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPayMoney
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PayMoney
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
BuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgOrderNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgOrderNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgUnitPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgUnitPrice
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sAvgBuyPrice
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
AvgBuyPrice
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMemberNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MemberNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPaymentNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PaymentNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sMOrderRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
MOrderRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sReBuyRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ReBuyRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sNewPeopleNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
NewPeopleNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sPXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
PXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sVipNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
VipNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sYXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
YXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sJXNum
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
JXNum
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfit
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
Profit
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
decimal
sProfitRate
=
Math
.
Round
(
Convert
.
ToDecimal
(
prvlist
.
Where
(
x
=>
x
.
Date
.
Day
>
20
).
Sum
(
x
=>
x
.
ProfitRate
))
/
PreDay
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
平均
ExcelDataSource
datarow2
=
new
ExcelDataSource
()
...
...
@@ -1757,6 +1809,11 @@ namespace Mall.Module.MarketingCenter
return
DataList
;
}
public
object
GetDSMoreMonthStatistics
(
string
startTime
,
string
endTime
,
int
tenantId
,
int
mallBaseId
)
{
throw
new
NotImplementedException
();
}
#
endregion
}
}
Mall.WebApi/Controllers/AppletWeChat/LiveHouseController.cs
View file @
c28354a7
...
...
@@ -1488,6 +1488,44 @@ namespace Mall.WebApi.Controllers.AppletWeChat
}
/// <summary>
/// 每月统计
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetDSMoreMonthStatistics
(
object
requestMsg
)
{
var
requestParm
=
JsonConvert
.
DeserializeObject
<
RequestParm
>(
requestMsg
.
ToString
());
JObject
parms
=
JObject
.
Parse
(
requestParm
.
msg
.
ToString
());
string
StartTime
=
parms
.
GetStringValue
(
"StartTime"
);
//开始时间 月
string
EndTime
=
parms
.
GetStringValue
(
"EndTime"
);
//结束时间 月
if
(
string
.
IsNullOrEmpty
(
StartTime
))
{
return
ApiResult
.
ParamIsNull
();
}
if
(
string
.
IsNullOrEmpty
(
EndTime
))
{
return
ApiResult
.
ParamIsNull
();
}
try
{
StartTime
=
Convert
.
ToDateTime
(
StartTime
).
ToString
(
"yyyy-MM"
);
EndTime
=
Convert
.
ToDateTime
(
EndTime
).
ToString
(
"yyyy-MM"
);
}
catch
(
Exception
)
{
return
ApiResult
.
Failed
(
"月份格式有误"
);
}
if
(
Convert
.
ToDateTime
(
StartTime
)
>
Convert
.
ToDateTime
(
EndTime
))
{
return
ApiResult
.
Failed
(
"起始月份不能大于结束月份"
);
}
var
Robj
=
statisticsModule
.
GetDSMoreMonthStatistics
(
StartTime
,
EndTime
,
requestParm
.
TenantId
,
requestParm
.
MallBaseId
);
return
ApiResult
.
Success
(
""
,
Robj
);
}
#
endregion
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment