Commit a60f3878 by guanzhenshan

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

parent 9be9c6cb
......@@ -94,5 +94,9 @@ namespace Bailun.DC.Models
/// </summary>
public decimal amount_refund_rmb { get; set; }
/// <summary>
/// 发货状态
/// </summary>
public string bailun_shipping_status { get; set; }
}
}
......@@ -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)
{
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))
{
sql += " and platform_type=@platform_type";
sql += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
}
if (!string.IsNullOrEmpty(website))
{
sql += " and website=@website";
sql += " and t1.website=@website";
sqlparam.Add("website", website);
}
if(!string.IsNullOrEmpty(account))
{
sql += " and bailun_account=@bailun_account";
sql += " and t1.bailun_account=@bailun_account";
sqlparam.Add("bailun_account", account);
}
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"));
}
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"));
}
if (!string.IsNullOrEmpty(request.sort))
{
sql += " order by " + request.sort + " " + request.order;
sql += " order by t1." + request.sort + " " + request.order;
}
else
{
sql += " order by refund_time desc";
sql += " order by t1.refund_time desc";
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
......
......@@ -143,8 +143,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
countM.amount_refund = Math.Round(countM.amount_refund, 2, MidpointRounding.AwayFromZero);
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;
var obj = list.Select(p => new
{
p.platform_type,
......@@ -1157,6 +1156,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
linked = (a.linked==1?"是":"否"),
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"),
a.bailun_shipping_status,
});
return JsonConvert.SerializeObject(new { total=total,rows = list,count_row=new {
......
......@@ -28,7 +28,7 @@
<div class="form-group">
<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>
</select>
</div>
......@@ -178,10 +178,10 @@
paramData: 'platform=Amazon',
func: function (result) {
if (result != null && result != undefined) {
$('#saleaccount').html('<option value="">选择帐号</option>');
$('#sellaccount').html('<option value="">选择帐号</option>');
for (var i = 0; i < result.length; 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 @@
</div>*@
<div class="form-group">
<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>
</select>
</div>
......@@ -173,9 +173,9 @@
paramData: 'platform=FBA',
func: function (result) {
if (result != null && result != undefined) {
$('#saleaccount').html('<option value="">选择帐号</option>');
$('#sellaccount').html('<option value="">选择帐号</option>');
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 @@
$.submit({
url: '@Url.Content("~/Reports/Orders/ListAccount")',
type:'POST',
paramData: 'platform=FBA',
paramData: 'platform=@(ViewBag.platform)',
func: function (result) {
if (result != null && result != undefined) {
$('#saleaccount').html('<option value="">选择帐号</option>');
$('#account').html('<option value="">选择帐号</option>');
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 @@
$.submit({
url: '@Url.Content("~/Reports/Orders/ListWebSite")',
type:'POST',
paramData: 'platform=FBA',
paramData: 'platform=@(ViewBag.platform)',
func: function (result) {
if (result != null && result != undefined) {
$('#website').html('<option value="">选择站点</option>');
......
......@@ -89,6 +89,7 @@
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) {
return '<div class="mules" title="' + data.bailun_sku + '">' + data.bailun_sku + '</div>';
......@@ -99,10 +100,12 @@
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: 'bailun_sku_quantity_refund', title: '退货数量', width: '80', sortable: true, iscount: true },
{ field: 'bailun_sku_unit_price', title: 'Sku采购价', width: '100', sortable: true, iscount: false },
{ field: 'linked', title: '订单关联', width: '100', sortable: true, iscount: false },
{ field: 'order_currency', title: '币种', width: '80', sortable: true, iscount: false },
{ field: 'amount_refund', title: '退款金额原币', width: '130', sortable: true, iscount: false },
{ field: 'amount_refund_rmb', title: '退款金额RMB', width: '130', sortable: true, iscount: true },
{ 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 }
];
......
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