Commit a60f3878 by guanzhenshan

解决销售统计报表无法按账号进行筛选的问题

parent 9be9c6cb
...@@ -94,5 +94,9 @@ namespace Bailun.DC.Models ...@@ -94,5 +94,9 @@ namespace Bailun.DC.Models
/// </summary> /// </summary>
public decimal amount_refund_rmb { get; set; } public decimal amount_refund_rmb { get; set; }
/// <summary>
/// 发货状态
/// </summary>
public string bailun_shipping_status { get; set; }
} }
} }
...@@ -2121,41 +2121,41 @@ namespace Bailun.DC.Services ...@@ -2121,41 +2121,41 @@ namespace Bailun.DC.Services
public List<dc_base_crm_refund> ListOrderRefund(BtTableParameter request,string platform,string website,string account,DateTime? start,DateTime? end,ref int total) public List<dc_base_crm_refund> ListOrderRefund(BtTableParameter request,string platform,string website,string account,DateTime? start,DateTime? end,ref int total)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
var sql = "select * from dc_base_crm_refund where 1=1 "; var sql = "select t1.*,if(t2.bailun_shipping_status is null,t3.bailun_shipping_status,t2.bailun_shipping_status) as bailun_shipping_status from dc_base_crm_refund t1 left join dc_base_oms_order t2 on t1.origin_order_id=t2.origin_order_id left join dc_base_oms_order t3 on t1.origin_order_id=t3.transaction_id where 1=1 ";
if (!string.IsNullOrEmpty(platform)) if (!string.IsNullOrEmpty(platform))
{ {
sql += " and platform_type=@platform_type"; sql += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform); sqlparam.Add("platform_type", platform);
} }
if (!string.IsNullOrEmpty(website)) if (!string.IsNullOrEmpty(website))
{ {
sql += " and website=@website"; sql += " and t1.website=@website";
sqlparam.Add("website", website); sqlparam.Add("website", website);
} }
if(!string.IsNullOrEmpty(account)) if(!string.IsNullOrEmpty(account))
{ {
sql += " and bailun_account=@bailun_account"; sql += " and t1.bailun_account=@bailun_account";
sqlparam.Add("bailun_account", account); sqlparam.Add("bailun_account", account);
} }
if (start.HasValue) if (start.HasValue)
{ {
sql += " and refund_time>=@refund_time_start"; sql += " and t1.refund_time>=@refund_time_start";
sqlparam.Add("refund_time_start", start.Value.ToString("yyyy-MM-dd HH:mm:ss")); sqlparam.Add("refund_time_start", start.Value.ToString("yyyy-MM-dd HH:mm:ss"));
} }
if (end.HasValue) if (end.HasValue)
{ {
sql += " and refund_time<@refund_time_end"; sql += " and t1.refund_time<@refund_time_end";
sqlparam.Add("refund_time_end", end.Value.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")); sqlparam.Add("refund_time_end", end.Value.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss"));
} }
if (!string.IsNullOrEmpty(request.sort)) if (!string.IsNullOrEmpty(request.sort))
{ {
sql += " order by " + request.sort + " " + request.order; sql += " order by t1." + request.sort + " " + request.order;
} }
else else
{ {
sql += " order by refund_time desc"; sql += " order by t1.refund_time desc";
} }
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
......
...@@ -144,7 +144,6 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -144,7 +144,6 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
countM.loss_withdrawal = countM.amount_product * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0); countM.loss_withdrawal = countM.amount_product * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0);
countM.profit_rate = countM.amount_product>0?Math.Round((countM.profit_count / countM.amount_product), 2, MidpointRounding.AwayFromZero):0; countM.profit_rate = countM.amount_product>0?Math.Round((countM.profit_count / countM.amount_product), 2, MidpointRounding.AwayFromZero):0;
var obj = list.Select(p => new var obj = list.Select(p => new
{ {
p.platform_type, p.platform_type,
...@@ -1157,6 +1156,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -1157,6 +1156,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
linked = (a.linked==1?"是":"否"), linked = (a.linked==1?"是":"否"),
refund_time = a.refund_time.HasValue?a.refund_time.Value.ToString("yyyy-MM-dd HH:mm:ss"):"", refund_time = a.refund_time.HasValue?a.refund_time.Value.ToString("yyyy-MM-dd HH:mm:ss"):"",
amount_refund_rmb = a.amount_refund_rmb.ToString("N2"), amount_refund_rmb = a.amount_refund_rmb.ToString("N2"),
a.bailun_shipping_status,
}); });
return JsonConvert.SerializeObject(new { total=total,rows = list,count_row=new { return JsonConvert.SerializeObject(new { total=total,rows = list,count_row=new {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div class="form-group"> <div class="form-group">
<label>销售帐号:</label> <label>销售帐号:</label>
<select id="saleaccount" name="saleaccount" class="form-control" style="width:160px;"> <select id="sellaccount" name="sellaccount" class="form-control" style="width:160px;">
<option value="">选择帐号</option> <option value="">选择帐号</option>
</select> </select>
</div> </div>
...@@ -178,10 +178,10 @@ ...@@ -178,10 +178,10 @@
paramData: 'platform=Amazon', paramData: 'platform=Amazon',
func: function (result) { func: function (result) {
if (result != null && result != undefined) { if (result != null && result != undefined) {
$('#saleaccount').html('<option value="">选择帐号</option>'); $('#sellaccount').html('<option value="">选择帐号</option>');
for (var i = 0; i < result.length; i++) { for (var i = 0; i < result.length; i++) {
if (result[i] != '') { if (result[i] != '') {
$('#saleaccount').append('<option value="' + result[i] + '">' + result[i] + '</option>'); $('#sellaccount').append('<option value="' + result[i] + '">' + result[i] + '</option>');
} }
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
</div>*@ </div>*@
<div class="form-group"> <div class="form-group">
<label>销售帐号:</label> <label>销售帐号:</label>
<select id="saleaccount" name="saleaccount" class="form-control" style="width:160px;"> <select id="sellaccount" name="sellaccount" class="form-control" style="width:160px;">
<option value="">选择帐号</option> <option value="">选择帐号</option>
</select> </select>
</div> </div>
...@@ -173,9 +173,9 @@ ...@@ -173,9 +173,9 @@
paramData: 'platform=FBA', paramData: 'platform=FBA',
func: function (result) { func: function (result) {
if (result != null && result != undefined) { if (result != null && result != undefined) {
$('#saleaccount').html('<option value="">选择帐号</option>'); $('#sellaccount').html('<option value="">选择帐号</option>');
for (var i = 0; i < result.length; i++) { for (var i = 0; i < result.length; i++) {
$('#saleaccount').append('<option value="' + result[i] + '">' + result[i]+'</option>'); $('#sellaccount').append('<option value="' + result[i] + '">' + result[i]+'</option>');
} }
} }
} }
......
...@@ -138,12 +138,12 @@ ...@@ -138,12 +138,12 @@
$.submit({ $.submit({
url: '@Url.Content("~/Reports/Orders/ListAccount")', url: '@Url.Content("~/Reports/Orders/ListAccount")',
type:'POST', type:'POST',
paramData: 'platform=FBA', paramData: 'platform=@(ViewBag.platform)',
func: function (result) { func: function (result) {
if (result != null && result != undefined) { if (result != null && result != undefined) {
$('#saleaccount').html('<option value="">选择帐号</option>'); $('#account').html('<option value="">选择帐号</option>');
for (var i = 0; i < result.length; i++) { for (var i = 0; i < result.length; i++) {
$('#saleaccount').append('<option value="' + result[i] + '">' + result[i]+'</option>'); $('#account').append('<option value="' + result[i] + '">' + result[i]+'</option>');
} }
} }
} }
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
$.submit({ $.submit({
url: '@Url.Content("~/Reports/Orders/ListWebSite")', url: '@Url.Content("~/Reports/Orders/ListWebSite")',
type:'POST', type:'POST',
paramData: 'platform=FBA', paramData: 'platform=@(ViewBag.platform)',
func: function (result) { func: function (result) {
if (result != null && result != undefined) { if (result != null && result != undefined) {
$('#website').html('<option value="">选择站点</option>'); $('#website').html('<option value="">选择站点</option>');
......
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
return '<div class="mules" title="' + data.origin_order_id + '">' + data.origin_order_id + '</div>'; return '<div class="mules" title="' + data.origin_order_id + '">' + data.origin_order_id + '</div>';
} }
}, },
{ field: 'bailun_shipping_status', title: '发货状态', width: '110', sortable: false, iscount: false },
{ {
field: 'bailun_sku', title: '百伦SKU', width: '100', sortable: true, formatter: function (idx, data) { field: 'bailun_sku', title: '百伦SKU', width: '100', sortable: true, formatter: function (idx, data) {
return '<div class="mules" title="' + data.bailun_sku + '">' + data.bailun_sku + '</div>'; return '<div class="mules" title="' + data.bailun_sku + '">' + data.bailun_sku + '</div>';
...@@ -99,10 +100,12 @@ ...@@ -99,10 +100,12 @@
return '<div class="mules" title="' + data.platform_sku + '">' + data.platform_sku + '</div>'; return '<div class="mules" title="' + data.platform_sku + '">' + data.platform_sku + '</div>';
} }
}, },
{ field: 'amount_refund_rmb', title: '退款金额RMB', width: '110', sortable: true, iscount: true }, { field: 'order_currency', title: '币种', width: '80', sortable: true, iscount: false },
{ field: 'bailun_sku_quantity_refund', title: '退货数量', width: '80', sortable: true, iscount: true }, { field: 'amount_refund', title: '退款金额原币', width: '130', sortable: true, iscount: false },
{ field: 'bailun_sku_unit_price', title: 'Sku采购价', width: '100', sortable: true, iscount: false }, { field: 'amount_refund_rmb', title: '退款金额RMB', width: '130', sortable: true, iscount: true },
{ field: 'linked', title: '订单关联', width: '100', sortable: true, iscount: false }, { field: 'bailun_sku_quantity_refund', title: '退货数量', width: '110', sortable: true, iscount: true },
{ field: 'bailun_sku_unit_price', title: 'Sku采购价', width: '120', sortable: true, iscount: false },
//{ field: 'linked', title: '订单关联', width: '110', sortable: true, iscount: false },
{ field: 'refund_time', title: '退款时间', width: '160', sortable: true, iscount: false } { field: 'refund_time', title: '退款时间', width: '160', sortable: true, iscount: false }
]; ];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment