Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
Overview
Overview
Details
Activity
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
bltdc
DataCenter_Core2.1_20190520
Commits
8afac2ab
Commit
8afac2ab
authored
Apr 09, 2020
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整sku利润统计报表,增加ebay广告费、上架费、亚马逊广告费和退款数据
parent
b7ff9ccd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
331 additions
and
21 deletions
+331
-21
dc_base_finance_amazon_ad_product.cs
Bailun.DC.Models/dc_base_finance_amazon_ad_product.cs
+2
-0
dc_base_finance_ebay.cs
Bailun.DC.Models/dc_base_finance_ebay.cs
+2
-0
OrdersServices.cs
Bailun.DC.Services/OrdersServices.cs
+240
-11
OrdersController.cs
Bailun.DC.Web/Areas/Reports/Controllers/OrdersController.cs
+87
-10
No files found.
Bailun.DC.Models/dc_base_finance_amazon_ad_product.cs
View file @
8afac2ab
...
...
@@ -230,5 +230,7 @@ namespace Bailun.DC.Models
/// 站点
/// </summary>
public
string
site_en
{
get
;
set
;
}
public
string
platform
{
get
;
set
;
}
}
}
Bailun.DC.Models/dc_base_finance_ebay.cs
View file @
8afac2ab
...
...
@@ -123,5 +123,7 @@ namespace Bailun.DC.Models
/// 帐号
/// </summary>
public
string
account_name
{
get
;
set
;
}
public
string
platform
{
get
;
set
;
}
}
}
Bailun.DC.Services/OrdersServices.cs
View file @
8afac2ab
...
...
@@ -1645,7 +1645,6 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 获取平台利润
/// </summary>
...
...
@@ -1883,7 +1882,6 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 根据发货时间获取平台利润统计
/// </summary>
...
...
@@ -3504,6 +3502,130 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 获取Ebay的费用统计
/// </summary>
/// <param name="companyid"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="total"></param>
/// <param name="feetype"></param>
/// <returns></returns>
public
List
<
dc_base_finance_ebay
>
EbayFeeCount
(
int
?
companyid
,
DateTime
?
start
,
DateTime
?
end
,
string
[]
feetype
,
string
orderno
,
string
account
,
bool
isUSD
,
string
itemid
,
int
[]
producttype
,
int
?
skusource
,
int
?
shippingstrategy
,
int
statistictype
)
{
var
sqlparam
=
new
DynamicParameters
();
var
sql
=
$"select sum(t1.gross_amount) gross_amount,sum(t1.net_amount) net_amount,sum(t1.
{(
isUSD
?
"exchange_rate_usd"
:
"exchange_rate"
)}
*t1.gross_amount) gross_amount_rmb from dc_base_finance_ebay t1 "
;
if
(!
string
.
IsNullOrWhiteSpace
(
account
))
{
sql
+=
" join dc_base_company_account t2 on t1.company_id=t2.company_id and t1.account_id=t2.account_id "
;
sql
+=
" and t2.account_name=@account_name "
;
sqlparam
.
Add
(
"account_name"
,
account
);
}
//Add by Allan at 20200320
if
((
producttype
!=
null
&&
producttype
.
Count
()
>
0
)
||
skusource
.
HasValue
||
shippingstrategy
.
HasValue
||
statistictype
!=
0
)
{
var
s
=
""
;
if
(
statistictype
==
1
)
//sku产品类型
{
s
=
" t10.bailun_category_id as platform,"
;
}
else
if
(
statistictype
==
2
)
//sku来源
{
s
=
" t10.source as platform,"
;
}
sql
=
$"select
{
s
}
0 gross_amount,0 net_amount,sum(t1.
{(
isUSD
?
"exchange_rate_usd"
:
"exchange_rate"
)}
*t1.sku_amount*t1.sku_count) gross_amount_rmb from dc_base_finance_ebay_item t1 "
;
sqlparam
=
new
DynamicParameters
();
if
(!
string
.
IsNullOrWhiteSpace
(
account
))
{
sql
+=
" join dc_base_company_account t2 on t1.company_id=t2.company_id and t1.account_id=t2.account_id "
;
sql
+=
" and t2.account_name=@account_name "
;
sqlparam
.
Add
(
"account_name"
,
account
);
}
sql
+=
" join dc_base_sku t10 on t1.bailun_sku=t10.bailun_sku "
;
if
(
producttype
.
Count
()
>
0
)
{
sql
+=
" and t10.bailun_category_id in ("
+
string
.
Join
(
","
,
producttype
)
+
") "
;
}
if
(
skusource
.
HasValue
)
{
sql
+=
" and t10.source="
+
skusource
;
}
if
(
shippingstrategy
.
HasValue
)
//1专线;2中国发货;3美国仓
{
}
}
sql
+=
" where t1.id!=0 "
;
if
(
start
.
HasValue
)
{
sql
+=
" and t1.bj_date>=@start"
;
sqlparam
.
Add
(
"start"
,
start
.
Value
);
}
if
(
end
.
HasValue
)
{
sql
+=
" and t1.bj_date<@end"
;
sqlparam
.
Add
(
"end"
,
end
.
Value
.
AddDays
(
1
));
}
if
(
companyid
.
HasValue
&&
companyid
.
Value
>
0
)
{
sql
+=
" and t1.company_id=@companyid"
;
sqlparam
.
Add
(
"companyid"
,
companyid
.
Value
);
}
if
(!
string
.
IsNullOrEmpty
(
orderno
))
{
sql
+=
" and t1.order_line_id=@orderno"
;
sqlparam
.
Add
(
"orderno"
,
orderno
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
itemid
))
{
sql
+=
" and t1.item_id=@item_id"
;
sqlparam
.
Add
(
"item_id"
,
itemid
);
}
if
(
feetype
!=
null
&&
feetype
.
Length
>
0
)
{
sql
+=
" and t1.account_entry_type in ('"
+
string
.
Join
(
"','"
,
feetype
)
+
"')"
;
}
if
(
statistictype
==
1
)
//1:sku品类
{
sql
+=
"group by t10.bailun_category_id"
;
}
else
if
(
statistictype
==
2
)
//2:sku来源
{
sql
+=
"group by t10.source"
;
}
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
var
obj
=
cn
.
Query
<
dc_base_finance_ebay
>(
sql
,
sqlparam
).
ToList
();
return
obj
;
}
}
/// <summary>
/// 获取汇损费用列表
/// </summary>
/// <param name="parameter"></param>
...
...
@@ -5338,23 +5460,23 @@ namespace Bailun.DC.Services
if
(
statistictype
==
1
)
//sku品类
{
str_statistic_col
=
"t10.bailun_category_id as platform_type"
;
}
else
if
(
statistictype
==
2
)
//sku来源
{
str_statistic_col
=
"t
6
0.source as platform_type"
;
str_statistic_col
=
"t
1
0.source as platform_type"
;
}
var
sqlparam
=
new
DynamicParameters
();
var
sql
=
$"select
{
str_statistic_col
}
,
{(
isUSD
?
"sum(t1.amount_refund_usd)"
:
"sum(t1.amount_refund_rmb)"
)}
as amount_refund from dc_base_crm_refund t1 "
;
if
((
producttype
!=
null
&&
producttype
.
Count
()>
0
)
||
skusource
.
HasValue
||
shippingstrategy
.
HasValue
)
if
((
producttype
!=
null
&&
producttype
.
Count
()>
0
)
||
skusource
.
HasValue
||
shippingstrategy
.
HasValue
||
statistictype
!=
0
)
{
sql
+=
" join dc_base_sku t10 on t1.bailun_sku=t10.bailun_sku "
;
if
(
producttype
.
Count
()>
0
)
if
(
producttype
!=
null
&&
producttype
.
Count
()>
0
)
{
sql
+=
" and t10.
product_type
in ("
+
string
.
Join
(
","
,
producttype
)+
") "
;
sql
+=
" and t10.
bailun_category_id
in ("
+
string
.
Join
(
","
,
producttype
)+
") "
;
}
if
(
skusource
.
HasValue
)
...
...
@@ -5408,7 +5530,7 @@ namespace Bailun.DC.Services
}
else
if
(
statistictype
==
2
)
//sku来源
{
sql
+=
"
join dc_base_sku t60 on t1.bailun_sku=t60.bailun_sku and t6
0.source in (1,2,3,6,7,11) "
;
sql
+=
"
and t1
0.source in (1,2,3,6,7,11) "
;
}
sql
+=
" where t1.shipping_status='TotalShipping' and t1.is_deleted=0 and is_freeze=0 "
;
...
...
@@ -5454,11 +5576,11 @@ namespace Bailun.DC.Services
}
else
if
(
statistictype
==
1
)
{
sql
+=
" group by t10.bailun_category_id"
;
}
else
if
(
statistictype
==
2
)
{
sql
+=
" group by t
6
0.source"
;
sql
+=
" group by t
1
0.source"
;
}
...
...
@@ -5631,7 +5753,7 @@ namespace Bailun.DC.Services
if
(
producttype
.
Count
()>
0
)
{
sql
+=
" and t10.
product_type
in ("
+
string
.
Join
(
","
,
producttype
)+
") "
;
sql
+=
" and t10.
bailun_category_id
in ("
+
string
.
Join
(
","
,
producttype
)+
") "
;
}
if
(
skusource
.
HasValue
)
...
...
@@ -5681,6 +5803,113 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 亚马逊广告费汇总
/// </summary>
/// <param name="account"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="companyid"></param>
/// <returns></returns>
public
List
<
dc_base_finance_amazon_ad_product
>
ListAmazonADSkuCount
(
string
account
,
DateTime
?
start
,
DateTime
?
end
,
int
?
companyid
,
bool
isUSD
,
int
[]
producttype
,
int
?
skusource
,
int
?
shippingstrategy
,
int
statistictype
)
{
var
sqlparam
=
new
DynamicParameters
();
var
sql
=
$"select sum(cost) cost,sum(cost*
{(
isUSD
?
"exchange_rate_usd"
:
"exchange_rate"
)}
) cost_rmb from dc_base_finance_amazon_ad_product t1 join dc_base_company_account t2 on t1.account_id=t2.account_id "
;
if
(!
string
.
IsNullOrEmpty
(
account
))
{
sql
+=
" and t2.account_name=@account"
;
sqlparam
.
Add
(
"account"
,
account
);
}
//Add by Allan at 20200320
if
((
producttype
!=
null
&&
producttype
.
Count
()
>
0
)
||
skusource
.
HasValue
||
shippingstrategy
.
HasValue
||
statistictype
!=
0
)
{
var
s
=
""
;
if
(
statistictype
==
1
)
{
s
=
" t10.bailun_category_id as platform,"
;
}
else
if
(
statistictype
==
2
)
{
s
=
" t10.source as platform,"
;
}
sql
=
$"select
{
s
}
sum(cost) cost,sum(cost*
{(
isUSD
?
"exchange_rate_usd"
:
"exchange_rate"
)}
) cost_rmb from dc_base_finance_amazon_item t1 join dc_base_company_account t2 on t1.account_id=t2.account_id "
;
sqlparam
=
new
DynamicParameters
();
if
(!
string
.
IsNullOrEmpty
(
account
))
{
sql
+=
" and t2.account_name=@account"
;
sqlparam
.
Add
(
"account"
,
account
);
}
sql
+=
" join dc_base_sku t10 on t1.bailun_sku=t10.bailun_sku "
;
if
(
producttype
.
Count
()
>
0
)
{
sql
+=
" and t10.bailun_category_id in ("
+
string
.
Join
(
","
,
producttype
)
+
") "
;
}
if
(
skusource
.
HasValue
)
{
sql
+=
" and t10.source="
+
skusource
;
}
if
(
shippingstrategy
.
HasValue
)
//1专线;2中国发货;3美国仓
{
}
}
sql
+=
" where t1.id!=0 "
;
if
(
companyid
.
HasValue
&&
companyid
.
Value
>
0
)
{
sql
+=
" and t1.company_id=@companyid"
;
sqlparam
.
Add
(
"companyid"
,
companyid
);
}
if
(
start
.
HasValue
)
{
sql
+=
" and t1.report_date>=@start"
;
sqlparam
.
Add
(
"start"
,
start
.
Value
);
}
if
(
end
.
HasValue
)
{
sql
+=
" and t1.report_date<@end"
;
sqlparam
.
Add
(
"end"
,
end
.
Value
.
AddDays
(
1
));
}
if
(
statistictype
==
1
)
{
sql
+=
" group by t10.bailun_category_id "
;
}
else
if
(
statistictype
==
2
)
{
sql
+=
" group by t10.source "
;
}
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
var
obj
=
cn
.
Query
<
dc_base_finance_amazon_ad_product
>(
sql
,
sqlparam
).
ToList
();
return
obj
;
}
}
#
endregion
#
region
Wish
...
...
Bailun.DC.Web/Areas/Reports/Controllers/OrdersController.cs
View file @
8afac2ab
...
...
@@ -1591,6 +1591,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var
wishAD
=
new
dc_base_finance_wish
();
var
aliexpressAD
=
new
dc_base_finance_aliexpress
();
var
listebayADFee
=
new
List
<
dc_base_finance_ebay
>();
var
listebayPutAway
=
new
List
<
dc_base_finance_ebay
>();
var
listamazonAD
=
new
List
<
dc_base_finance_amazon_ad_product
>();
var
ADfeeType
=
new
string
[]
{
"FeeAd"
};
...
...
@@ -1770,6 +1776,13 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
aliexpressAD
=
_service
.
ListAliexpressADCount
(
companyid
,
""
,
dtstart
,
dtend
,
currency
.
ToUpper
()
==
"USD"
);
wishAD
=
_service
.
ListWishADCount
(
companyid
,
null
,
dtstart
,
dtend
,
currency
.
ToUpper
()
==
"USD"
);
}
else
{
listebayADFee
=
_service
.
EbayFeeCount
(
companyid
,
dtstart
,
dtend
,
ADfeeType
,
""
,
""
,
currency
.
ToUpper
()
==
"USD"
,
""
,
producttype
,
skusource
,
shippingstrategy
,
statistictype
);
listebayPutAway
=
_service
.
EbayFeeCount
(
companyid
,
dtstart
,
dtend
,
PutAwayFeeType
,
""
,
""
,
currency
.
ToUpper
()
==
"USD"
,
""
,
producttype
,
skusource
,
shippingstrategy
,
statistictype
);
listamazonAD
=
_service
.
ListAmazonADSkuCount
(
""
,
dtstart
,
dtend
,
companyid
,
currency
.
ToUpper
()
==
"USD"
,
producttype
,
skusource
,
shippingstrategy
,
statistictype
);
}
//aliexpressAD = _service.ListAliexpressADCount(companyid, "", dtstart, dtend, currency.ToUpper() == "USD");
...
...
@@ -1794,13 +1807,24 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
listRefund
=
_service
.
ListPlatformRefund
(
dtstart
,
dtend
,
companyid
,
platform
,
website
,
currency
.
ToUpper
()
==
"USD"
,
true
,
null
,
null
,
null
,
statistictype
);
//包含未发货的退款金额
}
ebayADFee
=
_service
.
EbayFeeCount
(
companyid
,
dtstart
,
dtend
,
ADfeeType
,
""
,
""
,
currency
.
ToUpper
()
==
"USD"
,
""
,
null
,
null
,
null
);
ebayPutAway
=
_service
.
EbayFeeCount
(
companyid
,
dtstart
,
dtend
,
PutAwayFeeType
,
""
,
""
,
currency
.
ToUpper
()
==
"USD"
,
""
,
null
,
null
,
null
);
if
(
statistictype
==
0
)
{
ebayADFee
=
_service
.
EbayFeeCount
(
companyid
,
dtstart
,
dtend
,
ADfeeType
,
""
,
""
,
currency
.
ToUpper
()
==
"USD"
,
""
,
null
,
null
,
null
);
ebayPutAway
=
_service
.
EbayFeeCount
(
companyid
,
dtstart
,
dtend
,
PutAwayFeeType
,
""
,
""
,
currency
.
ToUpper
()
==
"USD"
,
""
,
null
,
null
,
null
);
amazonAD
=
_service
.
ListAmazonADSkuCount
(
""
,
dtstart
,
dtend
,
companyid
,
currency
.
ToUpper
()
==
"USD"
,
null
,
null
,
null
);
amazonAD
=
_service
.
ListAmazonADSkuCount
(
""
,
dtstart
,
dtend
,
companyid
,
currency
.
ToUpper
()
==
"USD"
,
null
,
null
,
null
);
wishAD
=
_service
.
ListWishADCount
(
companyid
,
null
,
dtstart
,
dtend
,
currency
.
ToUpper
()
==
"USD"
);
aliexpressAD
=
_service
.
ListAliexpressADCount
(
companyid
,
""
,
dtstart
,
dtend
,
currency
.
ToUpper
()
==
"USD"
);
}
else
{
listebayADFee
=
_service
.
EbayFeeCount
(
companyid
,
dtstart
,
dtend
,
ADfeeType
,
""
,
""
,
currency
.
ToUpper
()
==
"USD"
,
""
,
producttype
,
skusource
,
shippingstrategy
,
statistictype
);
listebayPutAway
=
_service
.
EbayFeeCount
(
companyid
,
dtstart
,
dtend
,
PutAwayFeeType
,
""
,
""
,
currency
.
ToUpper
()
==
"USD"
,
""
,
producttype
,
skusource
,
shippingstrategy
,
statistictype
);
listamazonAD
=
_service
.
ListAmazonADSkuCount
(
""
,
dtstart
,
dtend
,
companyid
,
currency
.
ToUpper
()
==
"USD"
,
producttype
,
skusource
,
shippingstrategy
,
statistictype
);
}
}
if
(
statistictype
==
1
)
//按产品类型统计时,格式化数据
{
...
...
@@ -1824,6 +1848,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var
children
=
result
.
Where
(
a
=>
arrcategory
.
Contains
(
a
.
platform_type
)).
ToList
();
var
children_EbayAD
=
listebayADFee
.
Where
(
a
=>
arrcategory
.
Contains
(
a
.
platform
)).
ToList
();
var
children_EbayPutAway
=
listebayPutAway
.
Where
(
a
=>
arrcategory
.
Contains
(
a
.
platform
)).
ToList
();
var
children_AmazonAD
=
listamazonAD
.
Where
(
a
=>
arrcategory
.
Contains
(
a
.
platform
)).
ToList
();
var
children_Return
=
listRefund
.
Where
(
a
=>
arrcategory
.
Contains
(
a
.
platform_type
)).
ToList
();
var
m
=
result
.
Where
(
a
=>
a
.
platform_type
==
item
.
c_id
.
ToString
()).
FirstOrDefault
();
if
(
children
.
Count
>
0
)
...
...
@@ -1832,7 +1862,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
m
=
new
Models
.
Orders
.
dc_base_oms_sku
{
id
=
item
.
c_id
,
platform_type
=
item
.
c_name
,
platform_type
=
item
.
c_name
,
cost_platform_fee
=
0
,
profit_total
=
0
,
amount_refund
=
0
,
...
...
@@ -1848,6 +1878,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
cost_paypal_fee
=
0
,
order_count
=
0
,
customerprice
=
0
,
adfee
=
0
,
putawayfee
=
0
,
};
}
...
...
@@ -1857,7 +1890,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
m
.
cost_platform_fee
+=
children
.
Sum
(
a
=>
a
.
cost_platform_fee
);
m
.
profit_total
+=
children
.
Sum
(
a
=>
a
.
profit_total
);
m
.
amount_refund
+=
children
.
Sum
(
a
=>
a
.
amount_refund
);
//
m.amount_refund += children.Sum(a => a.amount_refund);
m
.
amount_sales
+=
children
.
Sum
(
a
=>
a
.
amount_sales
);
m
.
cost_first
+=
children
.
Sum
(
a
=>
a
.
cost_first
);
...
...
@@ -1869,6 +1902,10 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
m
.
cost_fba_fee
+=
children
.
Sum
(
a
=>
a
.
cost_fba_fee
);
m
.
cost_paypal_fee
+=
children
.
Sum
(
a
=>
a
.
cost_paypal_fee
);
m
.
adfee
+=
(
children_EbayAD
.
Count
>
0
?
children_EbayAD
.
Sum
(
a
=>
a
.
gross_amount_rmb
)
:
0
)
+
(
children_AmazonAD
.
Count
>
0
?
children_AmazonAD
.
Sum
(
a
=>
a
.
cost_rmb
)
:
0
);
m
.
putawayfee
+=
(
children_EbayPutAway
.
Count
>
0
?
children_EbayPutAway
.
Sum
(
a
=>
a
.
gross_amount_rmb
)
:
0
);
m
.
amount_refund
+=
(
children_Return
.
Count
>
0
?
children_Return
.
Sum
(
a
=>
a
.
amount_refund
)
:
0
);
m
.
amount_refund_rate
=
(
m
.
amount_sales
>
0
?
m
.
amount_refund
/
m
.
amount_sales
:
0
);
}
if
(
m
!=
null
)
...
...
@@ -1885,6 +1922,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
foreach
(
var
item
in
result
)
{
if
(
statistictype
==
0
)
{
item
.
adfee
=
0
;
item
.
putawayfee
=
0
;
...
...
@@ -1895,7 +1934,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
item
.
putawayfee
=
ebayPutAway
!=
null
?
ebayPutAway
.
gross_amount_rmb
:
0
;
item
.
profit_total
=
(
item
.
profit_total
-
(
item
.
adfee
??
0
)
-
(
item
.
putawayfee
??
0
));
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
):
0
;
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
)
:
0
;
}
else
if
(
item
.
platform_type
.
ToLower
()
==
"fba"
)
//亚马逊广告费
...
...
@@ -1903,23 +1942,59 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
item
.
adfee
=
amazonAD
!=
null
?
amazonAD
.
cost_rmb
:
0
;
item
.
profit_total
=
(
item
.
profit_total
-
item
.
adfee
??
0
);
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
):
0
;
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
)
:
0
;
}
else
if
(
item
.
platform_type
.
ToLower
()
==
"wish"
)
//Wish广告费
{
item
.
adfee
=
wishAD
!=
null
?
wishAD
.
daily_total_campaign_spend
:
0
;
item
.
profit_total
=
(
item
.
profit_total
-
item
.
adfee
??
0
);
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
):
0
;
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
)
:
0
;
}
else
if
(
item
.
platform_type
.
ToLower
()
==
"aliexpress"
)
//速卖通广告费
{
item
.
adfee
=
aliexpressAD
!=
null
?
aliexpressAD
.
cost_fee
:
0
;
item
.
profit_total
=
(
item
.
profit_total
-
item
.
adfee
??
0
);
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
):
0
;
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
)
:
0
;
}
}
else
if
(
statistictype
==
1
)
{
item
.
profit_total
=
item
.
profit_total
-
(
item
.
adfee
??
0
)
-
(
item
.
putawayfee
??
0
);
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
)
:
0
;
}
else
if
(
statistictype
==
2
)
//sku来源
{
item
.
adfee
=
0
;
item
.
putawayfee
=
0
;
var
_objEbayAd
=
listebayADFee
.
Where
(
a
=>
a
.
platform
==
item
.
platform_type
).
FirstOrDefault
();
if
(
_objEbayAd
!=
null
)
{
item
.
adfee
+=
_objEbayAd
.
gross_amount_rmb
;
item
.
profit_total
-=
_objEbayAd
.
gross_amount_rmb
;
}
var
_objEbayPutAway
=
listebayPutAway
.
Where
(
a
=>
a
.
platform
==
item
.
platform_type
).
FirstOrDefault
();
if
(
_objEbayPutAway
!=
null
)
{
item
.
putawayfee
+=
_objEbayPutAway
.
gross_amount_rmb
;
item
.
profit_total
-=
_objEbayPutAway
.
gross_amount_rmb
;
}
var
_objAmazonAD
=
listamazonAD
.
Where
(
a
=>
a
.
platform
==
item
.
platform_type
).
FirstOrDefault
();
if
(
_objAmazonAD
!=
null
)
{
item
.
adfee
+=
_objAmazonAD
.
cost_rmb
;
item
.
profit_total
-=
_objAmazonAD
.
cost_rmb
;
}
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
)
:
0
;
}
if
(
statistictype
!=
1
)
{
item
.
amount_refund
=
0
;
item
.
amount_refund_rate
=
0
;
var
objRefund
=
listRefund
.
Where
(
a
=>
a
.
platform_type
.
ToLower
()
==
item
.
platform_type
.
ToLower
()).
FirstOrDefault
();
...
...
@@ -1931,7 +2006,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
//利润减去退款
item
.
profit_total
=
(
item
.
profit_total
-
item
.
amount_refund
);
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
):
0
;
item
.
profit_rate
=
item
.
amount_sales
!=
0
?
Math
.
Round
((
item
.
profit_total
/
item
.
amount_sales
),
2
)
:
0
;
}
if
(
statistictype
==
2
)
...
...
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