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
1c620639
Commit
1c620639
authored
Jul 12, 2019
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
平台费用流水增加导出功能
parent
dcc4bea6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
201 additions
and
3 deletions
+201
-3
OrdersServices.cs
Bailun.DC.Services/OrdersServices.cs
+104
-0
OrdersController.cs
Bailun.DC.Web/Areas/Reports/Controllers/OrdersController.cs
+66
-0
ListPlatformCost.cshtml
...DC.Web/Areas/Reports/Views/Orders/ListPlatformCost.cshtml
+27
-2
HomeController.cs
Bailun.DC.Web/Controllers/HomeController.cs
+4
-1
No files found.
Bailun.DC.Services/OrdersServices.cs
View file @
1c620639
...
@@ -121,6 +121,7 @@ namespace Bailun.DC.Services
...
@@ -121,6 +121,7 @@ namespace Bailun.DC.Services
}
}
}
}
public
dc_base_oms_order
ListPlatformCostCount
(
string
platform
,
DateTime
?
start
,
DateTime
?
end
,
string
website
,
string
account
,
string
warehousetype
,
string
warehousecode
,
int
?
companyid
,
string
skucategoryids
)
public
dc_base_oms_order
ListPlatformCostCount
(
string
platform
,
DateTime
?
start
,
DateTime
?
end
,
string
website
,
string
account
,
string
warehousetype
,
string
warehousecode
,
int
?
companyid
,
string
skucategoryids
)
{
{
var
sql
=
"select sum(t1.amount_sales*t1.seller_order_exchange_rate) amount_sales,sum((if(t1.platform_type='Ebay',t1.seller_other_exchange_rate,t1.seller_order_exchange_rate))*t1.cost_platform_fee) as cost_platform_fee,sum(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,sum(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) cost_paypal_fee,sum(t1.cost_tail) cost_tail,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping from dc_base_oms_order t1 "
;
var
sql
=
"select sum(t1.amount_sales*t1.seller_order_exchange_rate) amount_sales,sum((if(t1.platform_type='Ebay',t1.seller_other_exchange_rate,t1.seller_order_exchange_rate))*t1.cost_platform_fee) as cost_platform_fee,sum(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,sum(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) cost_paypal_fee,sum(t1.cost_tail) cost_tail,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping from dc_base_oms_order t1 "
;
...
@@ -215,6 +216,109 @@ namespace Bailun.DC.Services
...
@@ -215,6 +216,109 @@ namespace Bailun.DC.Services
}
}
}
}
/// <summary>
/// 导出 平台费用流水
/// </summary>
/// <param name="parameter"></param>
/// <param name="platform"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="total"></param>
/// <returns></returns>
public
List
<
dc_base_oms_order
>
ListPlatformCost
(
string
platform
,
DateTime
?
start
,
DateTime
?
end
,
string
website
,
string
account
,
string
warehousetype
,
string
warehousecode
,
int
?
companyid
,
string
skucategoryids
)
{
var
sql
=
"select t1.* from dc_base_oms_order t1"
;
var
sqlparam
=
new
DynamicParameters
();
if
(!
string
.
IsNullOrEmpty
(
warehousetype
))
{
sql
+=
" join (select tb.bailun_order_id from dc_base_oms_sku tb join dc_base_warehouse t2 on tb.warehouse_code = t2.warehouse_code and t2.hq_type= @warehousetype"
;
sqlparam
.
Add
(
"warehousetype"
,
warehousetype
);
if
(!
string
.
IsNullOrEmpty
(
warehousecode
))
{
sql
+=
" and tb.warehouse_code=@warehousecode"
;
sqlparam
.
Add
(
"warehousecode"
,
warehousecode
);
}
sql
+=
" group by tb.bailun_order_id limit 1) t2 on t1.bailun_order_id=t2.bailun_order_id "
;
}
if
(!
string
.
IsNullOrWhiteSpace
(
skucategoryids
))
{
sql
+=
" join dc_base_oms_sku t3 on t1.bailun_order_id=t3.bailun_order_id "
;
var
arr
=
skucategoryids
.
Split
(
'|'
).
Where
(
a
=>
!
string
.
IsNullOrEmpty
(
a
)).
ToList
();
if
(
arr
.
Count
>
0
)
{
//获取选中分类下所有的分类
var
AllCategory
=
Services
.
CommonServices
.
GetCategoryList
(
0
);
var
listcategory
=
new
List
<
Models
.
Common
.
CategoryDto
>();
foreach
(
var
item
in
arr
)
{
listcategory
.
AddRange
(
Services
.
CommonServices
.
GetCategoryListAll
(
AllCategory
,
int
.
Parse
(
item
)));
}
var
s
=
string
.
Join
(
","
,
listcategory
.
Select
(
a
=>
a
.
C_ID
));
if
(!
string
.
IsNullOrEmpty
(
s
))
{
sql
+=
" and t3.bailun_category_id in ("
+
s
+
")"
;
}
}
}
sql
+=
" where t1.bailun_order_status!='Canceled' and ((t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle') or t1.platform_type='FBA') and t1.has_scalp=0 and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') "
;
if
(
companyid
.
HasValue
&&
companyid
.
Value
>
0
)
{
sql
+=
"and t1.company_id = "
+
companyid
.
Value
;
//增加公司id判断
}
if
(!
string
.
IsNullOrEmpty
(
platform
))
{
sql
+=
" and t1.platform_type=@platform_type"
;
sqlparam
.
Add
(
"platform_type"
,
platform
);
}
if
(
start
.
HasValue
)
{
sql
+=
" and t1.paid_time>=@paidtimestart"
;
sqlparam
.
Add
(
"paidtimestart"
,
start
.
Value
.
ToString
(
"yyyy-MM-dd"
));
}
if
(
end
.
HasValue
)
{
sql
+=
" and t1.paid_time<@paidtimeend"
;
sqlparam
.
Add
(
"paidtimeend"
,
end
.
Value
.
AddDays
(
1
).
ToString
(
"yyyy-MM-dd"
));
}
if
(!
string
.
IsNullOrEmpty
(
website
))
{
sql
+=
" and t1.website=@website"
;
sqlparam
.
Add
(
"website"
,
website
);
}
if
(!
string
.
IsNullOrEmpty
(
account
))
{
sql
+=
" and t1.seller_account=@seller_account"
;
sqlparam
.
Add
(
"seller_account"
,
account
);
}
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
var
obj
=
cn
.
Query
<
dc_base_oms_order
>(
sql
,
sqlparam
);
return
obj
.
AsList
();
}
}
#
endregion
#
endregion
#
region
亚马逊
#
region
亚马逊
...
...
Bailun.DC.Web/Areas/Reports/Controllers/OrdersController.cs
View file @
1c620639
...
@@ -85,6 +85,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -85,6 +85,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
{
total
=
total
,
total
=
total
,
rows
=
list
,
rows
=
list
,
companyid
=
companyid
,
count_row
=
new
{
count_row
=
new
{
bailun_order_id
=
"总计"
,
bailun_order_id
=
"总计"
,
amount_sales
=
countM
.
amount_sales
.
ToString
(
"N2"
),
amount_sales
=
countM
.
amount_sales
.
ToString
(
"N2"
),
...
@@ -109,6 +110,71 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
...
@@ -109,6 +110,71 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
});
});
}
}
/// <summary>
/// 导出平台费用流水
/// </summary>
/// <param name="platform"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="website"></param>
/// <param name="account"></param>
/// <param name="warehousetype"></param>
/// <param name="warehousecode"></param>
/// <param name="skucategoryids"></param>
/// <returns></returns>
public
ActionResult
ExportPlatformCost
(
string
platform
,
DateTime
?
start
,
DateTime
?
end
,
string
website
,
string
account
,
string
warehousetype
,
string
warehousecode
,
string
skucategoryids
,
int
companyid
)
{
var
obj
=
new
Services
.
OrdersServices
().
ListPlatformCost
(
platform
,
start
,
end
,
website
,
account
,
warehousetype
,
warehousecode
,
companyid
,
skucategoryids
);
var
o
=
obj
.
Select
(
p
=>
new
{
p
.
origin_order_id
,
p
.
bailun_order_id
,
p
.
platform_type
,
p
.
website
,
p
.
seller_account
,
amount_sales
=
(
p
.
amount_sales
*
p
.
seller_order_exchange_rate
).
ToString
(
"N2"
),
amount_refund
=
(
p
.
amount_refund
*
p
.
seller_order_exchange_rate
).
ToString
(
"N2"
),
amount_prepaid
=
p
.
amount_prepaid
.
ToString
(
"N2"
),
cost_promotion
=
(
p
.
cost_promotion
*
p
.
seller_order_exchange_rate
).
ToString
(
"N2"
),
amount_shipping
=
(
p
.
amount_shipping
*
p
.
seller_order_exchange_rate
).
ToString
(
"N2"
),
cost_platform_fee
=
(
p
.
platform_type
==
"Ebay"
?
p
.
cost_platform_fee
*
p
.
seller_other_exchange_rate
:
p
.
cost_platform_fee
*
p
.
seller_order_exchange_rate
).
ToString
(
"N2"
),
cost_product
=
p
.
cost_product
.
ToString
(
"N2"
),
cost_package
=
p
.
cost_package
.
ToString
(
"N2"
),
cost_fba_fee
=
(
p
.
cost_fba_fee
*
p
.
seller_order_exchange_rate
).
ToString
(
"N2"
),
cost_paypal_fee
=
(
p
.
cost_paypal_fee
*
p
.
seller_order_exchange_rate
).
ToString
(
"N2"
),
cost_refund_commisson
=
(
p
.
cost_refund_commisson
*
p
.
seller_order_exchange_rate
).
ToString
(
"N2"
),
cost_handle_bailun
=
p
.
cost_handle_bailun
.
ToString
(
"N2"
),
cost_handle_platform
=
p
.
cost_handle_platform
.
ToString
(
"N2"
),
cost_first
=
p
.
cost_first
.
ToString
(
"N2"
),
cost_tail
=
p
.
cost_tail
.
ToString
(
"N2"
),
profit_total
=
p
.
profit_total
.
ToString
(
"N2"
),
profit_rate
=
(
p
.
profit_rate
*
100
).
ToString
(
"N2"
),
paid_time
=
p
.
paid_time
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
),
});
var
colNames
=
new
List
<
string
>
{
"平台订单号"
,
"平台名称"
,
"平台站点"
,
"卖家帐号"
,
"销售额"
,
"平台费"
,
"促销费"
,
"尾程费"
,
"百伦处理费"
,
"产品成本"
,
"头程费"
,
"预收金额"
,
"利润"
,
"利润率"
,
"退款金额"
,
"运费收入"
,
"FBA费"
,
"Paypal费"
,
"付款时间"
};
var
list
=
new
List
<
string
>();
foreach
(
var
item
in
o
)
{
list
.
Add
(
item
.
origin_order_id
+
"|"
+
item
.
platform_type
+
"|"
+
item
.
website
+
"|"
+
item
.
seller_account
+
"|"
+
item
.
amount_sales
+
"|"
+
item
.
cost_platform_fee
+
"|"
+
item
.
cost_promotion
+
"|"
+
item
.
cost_tail
+
"|"
+
item
.
cost_handle_bailun
+
"|"
+
item
.
cost_product
+
"|"
+
item
.
cost_first
+
"|"
+
item
.
amount_prepaid
+
"|"
+
item
.
profit_total
+
"|"
+
item
.
profit_rate
+
"|"
+
item
.
amount_refund
+
"|"
+
item
.
amount_shipping
+
"|"
+
item
.
cost_fba_fee
+
"|"
+
item
.
cost_paypal_fee
+
"|"
+
item
.
paid_time
);
}
var
filename
=
platform
+
"平台费用流水"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
);
var
filepath
=
_hostingEnvironment
.
WebRootPath
+
"\\Files\\Report\\"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
"\\"
;
ToCSV
(
list
,
colNames
,
filename
,
filepath
);
return
File
(
"~/Files/Report/"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd"
)
+
"/"
+
filename
+
".csv"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
filename
+
".csv"
);
}
#
endregion
#
endregion
...
...
Bailun.DC.Web/Areas/Reports/Views/Orders/ListPlatformCost.cshtml
View file @
1c620639
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
<div class="form-group">
<div class="form-group">
<label> </label>
<label> </label>
<button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i> 查询</button>
<button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i> 查询</button>
<button type="button" class="btn btn-success" onclick="exportxls();">导出</button>
</div>
</div>
</div>
</div>
</form>
</form>
...
@@ -89,6 +90,7 @@
...
@@ -89,6 +90,7 @@
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script type="text/javascript">
<script type="text/javascript">
var companyid = -1;
var tb;
var tb;
$(document).ready(function () {
$(document).ready(function () {
laydate.render({ elem: '#start' });
laydate.render({ elem: '#start' });
...
@@ -142,7 +144,7 @@
...
@@ -142,7 +144,7 @@
}
}
@if (ViewBag.platform != "FBA")
@if (ViewBag.platform != "FBA")
{
{
@Html.Raw("{ field: 'cost_tail', title: '尾程费', width: '120', sortable: true, iscount: true },{ field: 'cost_handle_bailun', title: '
第三方仓
处理费', width: '160', sortable: true, iscount: true},")
@Html.Raw("{ field: 'cost_tail', title: '尾程费', width: '120', sortable: true, iscount: true },{ field: 'cost_handle_bailun', title: '
百伦
处理费', width: '160', sortable: true, iscount: true},")
}
}
//{ field: 'cost_refund_commisson', title: '退款佣金', width: '120', sortable: true, iscount: true },
//{ field: 'cost_refund_commisson', title: '退款佣金', width: '120', sortable: true, iscount: true },
...
@@ -167,7 +169,11 @@
...
@@ -167,7 +169,11 @@
var url = '@Url.Content("~/Reports/Orders/ListPlatformCostJson")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s;
var url = '@Url.Content("~/Reports/Orders/ListPlatformCostJson")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s;
if (tb == undefined) {
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {showfooter: true, showCount: true});
tb = OnlyTable("roletable", columns, url, "", {
showfooter: true, showCount: true, loadsuccess: function (result) {
companyid = result.companyid;
}
});
}
}
else {
else {
tb.bootstrapTable('refresh', { url: url });
tb.bootstrapTable('refresh', { url: url });
...
@@ -267,6 +273,25 @@
...
@@ -267,6 +273,25 @@
return s;
return s;
}
}
function exportxls() {
if ($('#start').val() == '' || $('#end').val() == '') {
alert('请选择付款时间');
return false;
}
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
var url = '@Url.Content("~/Reports/Orders/ExportPlatformCost")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s;
window.open(url + '&companyid=' + companyid, '_blank');
}
</script>
</script>
}
}
...
...
Bailun.DC.Web/Controllers/HomeController.cs
View file @
1c620639
...
@@ -49,6 +49,8 @@ namespace Bailun.DC.Web.Controllers
...
@@ -49,6 +49,8 @@ namespace Bailun.DC.Web.Controllers
ViewBag
.
username
=
username
;
ViewBag
.
username
=
username
;
ViewBag
.
departmentname
=
departmentname
;
ViewBag
.
departmentname
=
departmentname
;
HttpContext
.
Response
.
Cookies
.
Append
(
"companyid"
,
companyid
+
""
);
return
View
();
return
View
();
}
}
...
@@ -150,7 +152,8 @@ namespace Bailun.DC.Web.Controllers
...
@@ -150,7 +152,8 @@ namespace Bailun.DC.Web.Controllers
success
=
true
,
success
=
true
,
userid
=
userid
,
userid
=
userid
,
username
=
username
,
username
=
username
,
jobs
=
jobs
jobs
=
jobs
,
companyid
=
companyid
});
});
}
}
...
...
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