Commit 4966511e by guanzhenshan

增加sku分类搜索

parent 8291a44f
......@@ -10,14 +10,18 @@ namespace Bailun.DC.Common
{
#if DEBUG
public static string ConnectionString = "server=gz-cdb-kp7s5i79.sql.tencentcdb.com;port=61691;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;";
/// <summary>
/// sku分类url
/// </summary>
public static string SkumsCategory = "http://api.sku.bailuntec.com/api/BailunCateData/GetAllCategoryList";
#else
public static string ConnectionString = "server=10.0.8.15;port=3306;database=bailun_datacenter;uid=root;password=#7kfnymAM$Y9-Ntf;";
#endif
public static string OAUrl = "http://www.bailuntec.com";
/// <summary>
/// sku分类url
/// </summary>
public static string SkumsCategory = "http://10.0.6.13:8001/api/BailunCateData/GetAllCategoryList";
#endif
public static string OAUrl = "http://www.bailuntec.com";
}
}
......@@ -12,6 +12,8 @@ namespace Bailun.DC.Services
{
public class CommonServices
{
public static List<Models.Common.CategoryDto> ListSkuCategory { get; set; }
/// <summary>
/// 获取即时汇率
/// </summary>
......@@ -156,6 +158,11 @@ namespace Bailun.DC.Services
{
if (level == 0)
{
if (ListSkuCategory != null && ListSkuCategory.Count > 0)
{
return ListSkuCategory;
}
List<Models.Common.CategoryDto> datas = new List<Models.Common.CategoryDto>();
var tempLevel = 1;
while (true)
......@@ -167,6 +174,7 @@ namespace Bailun.DC.Services
}
else
{
ListSkuCategory = datas;
return datas;
}
tempLevel++;
......
......@@ -176,17 +176,17 @@ namespace Bailun.DC.Services
/// <param name="end">付款结束时间</param>
/// <param name="total">符合条件的记录数</param>
/// <returns></returns>
public List<dc_base_oms_order> ListAmazonStatistics(BtTableParameter parameter, string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode,int? companyid, ref int total)
public List<dc_base_oms_order> ListAmazonStatistics(BtTableParameter parameter, string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode,int? companyid, ref int total,string skucategoryids)
{
var sqlparam = new DynamicParameters();
var sql = @"select platform_type,seller_account,website,sum(amount_sales*seller_order_exchange_rate) 'amount_sales',sum(cost_product) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate) 'cost_platform_fee',sum(cost_first) 'cost_first',count(t1.id) 'order_count',sum(cost_total) 'cost_total',sum(cost_logistics) 'cost_logistics',sum(profit_total) 'profit_total',(sum(profit_total)/sum(amount_sales*seller_order_exchange_rate)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate) amount_refund,count(amount_prepaid>0 or null) as noshippingcount,sum(cost_handle_bailun) cost_handle_bailun,sum(cost_handle_platform) cost_handle_platform from dc_base_oms_order t1";
var presql = "select platform_type,seller_account,website,sum(amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 ";
var sql = @"select t1.platform_type,t1.seller_account,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) 'cost_platform_fee',sum(t1.cost_first) 'cost_first',count(t1.id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_logistics) 'cost_logistics',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform from dc_base_oms_order t1";
//var presql = "select platform_type,seller_account,website,sum(amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 ";
if (!string.IsNullOrEmpty(warehoursetype))
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_type_ex=@warehoursetype";
presql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_type_ex=@warehoursetype";
//presql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_type_ex=@warehoursetype";
sqlparam.Add("warehoursetype", warehoursetype);
}
if (!string.IsNullOrEmpty(warehousecode))
......@@ -194,16 +194,41 @@ namespace Bailun.DC.Services
if (!string.IsNullOrEmpty(warehoursetype))
{
sql += " and t2.warehouse_code=@warehouse_code";
presql += " and t2.warehouse_code=@warehouse_code";
//presql += " and t2.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code", warehousecode);
}
else
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_code=@warehouse_code";
presql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_code=@warehouse_code";
//presql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code", warehousecode);
}
}
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 + ")";
}
}
}
var fromsql = " where t1.paid_time>='" + start.ToString("yyyy-MM-dd") + "' and t1.paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and t1.platform_type='Amazon' and t1.bailun_order_status!='Canceled' and t1.has_scalp=0 and t1.has_innersale=0 ";
if (companyid.HasValue && companyid.Value > 0)
......@@ -223,6 +248,7 @@ namespace Bailun.DC.Services
sqlparam.Add("website", website);
}
var prefromsql = fromsql;
fromsql += " and t1.bailun_payment_status!='Canceled' and t1.bailun_order_status!='CantHandle'";
fromsql += " group by t1.seller_account,t1.website,t1.platform_type";
......@@ -273,12 +299,12 @@ namespace Bailun.DC.Services
/// <param name="end">付款结束时间</param>
/// <param name="total">符合条件的记录数</param>
/// <returns></returns>
public dc_base_oms_order ListAmazonStatisticsCount(string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode,int? companyid)
public dc_base_oms_order ListAmazonStatisticsCount(string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode,int? companyid,string skucategoryids)
{
var sqlparam = new DynamicParameters();
var presql = "select sum(amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 ";
var sql = "select sum(amount_sales*seller_order_exchange_rate) 'amount_sales',sum(cost_product) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate) 'cost_platform_fee',sum(cost_first) 'cost_first',count(t1.id) 'order_count',sum(cost_total) 'cost_total',sum(cost_logistics) 'cost_logistics',sum(profit_total) 'profit_total',(sum(profit_total)/sum(amount_sales*seller_order_exchange_rate)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate) amount_refund,count(amount_prepaid>0 or null) as noshippingcount,sum(cost_handle_bailun) cost_handle_bailun,sum(cost_handle_platform) cost_handle_platform from dc_base_oms_order t1 ";
var presql = "select sum(t1.amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 ";
var sql = "select sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) 'cost_platform_fee',sum(t1.cost_first) 'cost_first',count(t1.id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_logistics) 'cost_logistics',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform from dc_base_oms_order t1 ";
if (!string.IsNullOrEmpty(warehoursetype))
{
......@@ -301,12 +327,36 @@ namespace Bailun.DC.Services
sqlparam.Add("warehouse_code", warehousecode);
}
}
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 + ")";
}
}
}
var fromsql = " where t1.paid_time>='" + start.ToString("yyyy-MM-dd") + "' and t1.paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and t1.platform_type='Amazon' and t1.bailun_order_status!='Canceled' and t1.has_scalp=0 and t1.has_innersale=0 ";
if (companyid.HasValue && companyid.Value > 0)
{
fromsql += " t1.company_id="+companyid.Value; //增加公司id过滤
fromsql += " and t1.company_id="+companyid.Value; //增加公司id过滤
}
if (!string.IsNullOrWhiteSpace(account))
......@@ -355,35 +405,62 @@ namespace Bailun.DC.Services
/// <param name="end">付款结束时间</param>
/// <param name="total">符合条件的记录数</param>
/// <returns></returns>
public List<Models.Orders.mAmazonStatistics> ListFBAStatistics(BtTableParameter parameter, string account, string website, DateTime start, DateTime end,int? companyid, ref int total)
public List<Models.Orders.mAmazonStatistics> ListFBAStatistics(BtTableParameter parameter, string account, string website, DateTime start, DateTime end,int? companyid, ref int total,string skucategoryids)
{
var sqlparam = new DynamicParameters();
var sql = @"select platform_type,seller_account,website,sum(amount_sales*seller_order_exchange_rate) 'amount_product',sum(cost_product) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate) 'platform_fee',sum(cost_first) 'head_fee',count(id) 'order_count',sum(cost_total) 'cost_count',sum(cost_shipping) 'nofba_logisticsfee',sum(profit_total) 'profit_count',(sum(profit_total)/sum(amount_total*seller_order_exchange_rate)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate) amount_refund,sum(cost_fba_fee*seller_order_exchange_rate) cost_fba_fee,sum(cost_paypal_fee*seller_order_exchange_rate) cost_paypal_fee,sum(cost_package) cost_package,count(amount_prepaid>0 or null) as noshippingcount from dc_base_oms_order where paid_time>='" + start.ToString("yyyy-MM-dd") + "' and paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and platform_type='FBA' and bailun_order_status!='Canceled' and bailun_order_status!='CantHandle' and has_scalp=0 and has_innersale=0";
var sql = @"select t1.platform_type,t1.seller_account,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_product',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) 'platform_fee',sum(t1.cost_first) 'head_fee',count(t1.id) 'order_count',sum(t1.cost_total) 'cost_count',sum(t1.cost_shipping) 'nofba_logisticsfee',sum(t1.profit_total) 'profit_count',(sum(t1.profit_total)/sum(t1.amount_total*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) cost_paypal_fee,sum(t1.cost_package) cost_package,count(t1.amount_prepaid>0 or null) as noshippingcount from dc_base_oms_order t1 ";
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.paid_time>='" + start.ToString("yyyy-MM-dd") + "' and t1.paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and t1.platform_type='FBA' and t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 ";
if (!string.IsNullOrWhiteSpace(account))
{
sql += " and seller_account=@seller_account";
sql += " and t1.seller_account=@seller_account";
sqlparam.Add("seller_account", account);
}
if (!string.IsNullOrWhiteSpace(website))
{
sql += " and website=@website";
sql += " and t1.website=@website";
sqlparam.Add("website", website);
}
if (companyid.HasValue && companyid.Value > 0)
{
sql += " and company_id=" + companyid.Value; //增加公司id过滤
sql += " and t1.company_id=" + companyid.Value; //增加公司id过滤
}
sql += " group by seller_account,website,platform_type";
sql += " group by t1.seller_account,t1.website,t1.platform_type";
if (!string.IsNullOrWhiteSpace(parameter.sort))
{
sql += " order by "+parameter.sort+" "+parameter.order;
sql += " order by t1." + parameter.sort+" "+parameter.order;
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
......@@ -408,27 +485,54 @@ namespace Bailun.DC.Services
/// <param name="website">站点</param>
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
public Models.Orders.mAmazonStatistics ListFBAStatisticsCount(string account, string website, DateTime start, DateTime end,int? companyid)
public Models.Orders.mAmazonStatistics ListFBAStatisticsCount(string account, string website, DateTime start, DateTime end,int? companyid,string skucategoryids)
{
var sqlparam = new DynamicParameters();
var sql = @"select sum(amount_sales*seller_order_exchange_rate) 'amount_product',sum(cost_product) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate) 'platform_fee',sum(cost_first) 'head_fee',count(id) 'order_count',sum(cost_total) 'cost_count',sum(cost_shipping) 'nofba_logisticsfee',sum(profit_total) 'profit_count',(sum(profit_total)/sum(amount_product*seller_order_exchange_rate)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate) amount_refund,sum(cost_fba_fee*seller_order_exchange_rate) cost_fba_fee,sum(cost_paypal_fee*seller_order_exchange_rate) cost_paypal_fee,sum(cost_package) cost_package,count(amount_prepaid>0 or null) as noshippingcount from dc_base_oms_order where paid_time>='" + start.ToString("yyyy-MM-dd") + "' and paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and platform_type='FBA' and bailun_order_status!='Canceled' and bailun_order_status!='CantHandle' and has_scalp=0 and has_innersale=0";
var sql = @"select sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_product',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) 'platform_fee',sum(t1.cost_first) 'head_fee',count(t1.id) 'order_count',sum(t1.cost_total) 'cost_count',sum(t1.cost_shipping) 'nofba_logisticsfee',sum(t1.profit_total) 'profit_count',(sum(t1.profit_total)/sum(t1.amount_product*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) cost_paypal_fee,sum(t1.cost_package) cost_package,count(t1.amount_prepaid>0 or null) as noshippingcount from dc_base_oms_order t1 ";
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.paid_time>='" + start.ToString("yyyy-MM-dd") + "' and t1.paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and t1.platform_type='FBA' and t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 ";
if (!string.IsNullOrWhiteSpace(account))
{
sql += " and seller_account=@seller_account";
sql += " and t1.seller_account=@seller_account";
sqlparam.Add("seller_account", account);
}
if (!string.IsNullOrWhiteSpace(website))
{
sql += " and website=@website";
sql += " and t1.website=@website";
sqlparam.Add("website", website);
}
if (companyid.HasValue && companyid.Value > 0)
{
sql += " and company_id" + companyid.Value;
sql += " and t1.company_id=" + companyid.Value; //增加公司id筛选
}
......@@ -443,7 +547,6 @@ namespace Bailun.DC.Services
return obj;
}
}
......@@ -460,11 +563,36 @@ namespace Bailun.DC.Services
/// <param name="sku">sku编码</param>
/// <param name="total">符合条件的记录数</param>
/// <returns></returns>
public List<Models.Orders.dc_base_oms_order> ListOrders(BtTableParameter parameter, string platform, string website, string account, DateTime? start, DateTime? end, string orderno, string sku,int? companyid, ref int total,string itemid=null)
public List<Models.Orders.dc_base_oms_order> ListOrders(BtTableParameter parameter, string platform, string website, string account, DateTime? start, DateTime? end, string orderno, string sku,int? companyid, ref int total, string skucategoryids, string itemid=null)
{
var sqlparam = new DynamicParameters();
var sql = "select t1.origin_order_id,t1.bailun_order_id,t1.platform_type,t1.website,t1.seller_account,t1.platform_order_type,t1.bailun_order_status,t1.bailun_payment_status,t1.bailun_shipping_status,t1.order_currency,(t1.amount_total*t1.seller_order_exchange_rate) amount_total,(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping,(t1.amount_product*t1.seller_order_exchange_rate) amount_product,(t1.amount_adjustment*t1.seller_order_exchange_rate) amount_adjustment,(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,((if(t1.platform_type='Ebay',t1.seller_other_exchange_rate,t1.seller_order_exchange_rate))*t1.cost_platform_fee) cost_platform_fee,t1.cost_product,t1.cost_first,t1.cost_package,(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,t1.cost_total,(t1.profit_total) profit_total,t1.profit_rate,t1.create_time,t1.order_update_time,t1.profit_oms from dc_base_oms_order t1";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
sql += " join dc_base_oms_sku t5 on t1.bailun_order_id=t5.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 t5.bailun_category_id in (" + s + ") ";
}
}
}
var strwhere = " where t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 ";
if (companyid.HasValue && companyid.Value>0)
......@@ -570,11 +698,36 @@ namespace Bailun.DC.Services
/// <param name="orderno">平台单号</param>
/// <param name="sku">sku编码</param>
/// <returns></returns>
public Models.Orders.dc_base_oms_order ListOrdersCount(string platform, string website, string account, DateTime? start, DateTime? end, string orderno, string sku,int? companyid, string itemid = null)
public Models.Orders.dc_base_oms_order ListOrdersCount(string platform, string website, string account, DateTime? start, DateTime? end, string orderno, string sku,int? companyid, string skucategoryids, string itemid = null)
{
var sqlparam = new DynamicParameters();
var sql = "select sum(t1.amount_total*t1.seller_order_exchange_rate) amount_total,sum(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping,sum(t1.amount_product*t1.seller_order_exchange_rate) amount_product,sum(t1.amount_adjustment*t1.seller_order_exchange_rate) amount_adjustment,sum(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,sum((if(t1.platform_type='FBA',t1.seller_other_exchange_rate,t1.seller_order_exchange_rate))*t1.cost_platform_fee) cost_platform_fee,sum(t1.cost_product) cost_product,sum(t1.cost_first) cost_first,sum(t1.cost_package) cost_package,sum(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,sum(t1.cost_total) cost_total,sum(t1.profit_total) profit_total,sum(t1.profit_oms) profit_oms from dc_base_oms_order t1";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
sql += " join dc_base_oms_sku t5 on t1.bailun_order_id=t5.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 t5.bailun_category_id in (" + s + ") ";
}
}
}
var strwhere = " where t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 ";
if (companyid.HasValue && companyid.Value > 0)
......@@ -836,10 +989,37 @@ namespace Bailun.DC.Services
/// <param name="orderno"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<Models.Orders.mFBAAbnormalOrder> ListFbaAbnormalOrder(BtTableParameter parameter, string account, string website, DateTime? start, DateTime? end, string orderno,int? companyid, ref int total)
public List<Models.Orders.mFBAAbnormalOrder> ListFbaAbnormalOrder(BtTableParameter parameter, string account, string website, DateTime? start, DateTime? end, string orderno,int? companyid, ref int total,string skucategoryids)
{
var sqlparam = new DynamicParameters();
var strwhere = "select t1.origin_order_id,t1.platform_type,t1.website,t1.seller_account,t1.bailun_sku,t1.order_currency,t1.cost_fba_fee,(t1.fba_fee_rmb*t1.seller_order_exchange_rate) fba_fee_rmb,t2.average_fba_fee,t2.min_fba_fee,t2.max_fba_fee,t1.create_time,t1.seller_order_exchange_rate from dc_base_oms_sku t1 join dc_mid_fba_fee_avg t2 on t1.bailun_sku=t2.bailun_sku and t1.website=t2.website where t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 and t1.platform_type in ('Amazon','FBA') and t1.has_fba_exception=1";
var sql = "select t1.origin_order_id,t1.platform_type,t1.website,t1.seller_account,t1.bailun_sku,t1.order_currency,t1.cost_fba_fee,(t1.cost_fba_fee*t1.seller_order_exchange_rate) fba_fee_rmb,t2.average_fba_fee,t2.min_fba_fee,t2.max_fba_fee,t1.create_time,t1.seller_order_exchange_rate";
var strwhere = " from dc_base_oms_sku t1 ";
strwhere += " join dc_mid_fba_fee_avg t2 on t1.bailun_sku=t2.bailun_sku and t1.website=t2.website ";
strwhere += " where t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 and t1.platform_type in ('Amazon','FBA') and t1.has_fba_exception=1 ";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
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))
{
strwhere += " and t1.bailun_category_id in (" + s + ") ";
}
}
}
if (companyid.HasValue && companyid.Value > 0)
{
......@@ -893,33 +1073,60 @@ namespace Bailun.DC.Services
cn.Open();
}
var obj = cn.Page<Models.Orders.mFBAAbnormalOrder>(parameter.pageIndex, parameter.limit, strwhere, ref total, sqlparam);
var obj = cn.Page<Models.Orders.mFBAAbnormalOrder>(parameter.pageIndex, parameter.limit, sql+strwhere, ref total, sqlparam,"select count(t1.id) "+strwhere,2*60);
return obj.AsList();
}
}
public List<Models.Orders.dc_base_oms_order> ListPlatformFeeAbnormal(BtTableParameter parameter, string platform, string account, string website, string orderno, DateTime? start, DateTime? end,int? companyid, ref int total)
public List<Models.Orders.dc_base_oms_order> ListPlatformFeeAbnormal(BtTableParameter parameter, string platform, string account, string website, string orderno, DateTime? start, DateTime? end,int? companyid, ref int total,string skucategoryids)
{
var sqlparam = new DynamicParameters();
var strwhere = "select origin_order_id,bailun_order_id,seller_account,amount_product,cost_platform_fee,(cost_platform_fee/amount_product) platform_fee_rate,platform_type,website,create_time from dc_base_oms_order where bailun_order_status!='Canceled' and bailun_order_status!='CantHandle' and has_scalp=0 and has_innersale=0 and has_platform_exception=1 ";
var strwhere = "select t1.origin_order_id,t1.bailun_order_id,t1.seller_account,t1.amount_product,t1.cost_platform_fee,(t1.cost_platform_fee/t1.amount_product) platform_fee_rate,t1.platform_type,t1.website,t1.create_time from dc_base_oms_order t1 ";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
strwhere += " 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))
{
strwhere += " and t3.bailun_category_id in (" + s + ") ";
}
}
}
strwhere += " where t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 and t1.has_platform_exception=1 ";
if (companyid.HasValue && companyid.Value > 0)
{
strwhere += " and company_id=" + companyid.Value; //增加公司id过滤
strwhere += " and t1.company_id=" + companyid.Value; //增加公司id过滤
}
if (!string.IsNullOrWhiteSpace(platform))
{
if (platform.ToUpper() == "AMAZON")
{
strwhere += " and platform_type in ('Amazon','FBA')";
strwhere += " and t1.platform_type in ('Amazon','FBA')";
sqlparam.Add("platform_type", platform);
}
else
{
strwhere += " and platform_type=@platform_type";
strwhere += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
}
}
......@@ -927,37 +1134,37 @@ namespace Bailun.DC.Services
if (!string.IsNullOrWhiteSpace(website))
{
strwhere += " and website=@website";
strwhere += " and t1.website=@website";
sqlparam.Add("website", website);
}
if (!string.IsNullOrWhiteSpace(account))
{
strwhere += " and seller_account=@seller_account";
strwhere += " and t1.seller_account=@seller_account";
sqlparam.Add("seller_account", account);
}
if (!string.IsNullOrWhiteSpace(orderno))
{
strwhere += " and origin_order_id=@origin_order_id";
strwhere += " and t1.origin_order_id=@origin_order_id";
sqlparam.Add("origin_order_id", orderno);
}
if (start.HasValue)
{
strwhere += " and paid_time>=@paid_time_start";
strwhere += " and t1.paid_time>=@paid_time_start";
sqlparam.Add("paid_time_start", start.Value);
}
if (end.HasValue)
{
strwhere += " and paid_time<@paid_time_end";
strwhere += " and t1.paid_time<@paid_time_end";
sqlparam.Add("paid_time_end", end.Value.AddDays(1));
}
if (!string.IsNullOrWhiteSpace(parameter.sort))
{
strwhere += " order by " + parameter.sort;
strwhere += " order by t1." + parameter.sort;
if (!string.IsNullOrWhiteSpace(parameter.order))
{
......@@ -989,26 +1196,54 @@ namespace Bailun.DC.Services
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public Models.Orders.dc_base_oms_order ListPlatformFeeAbnormalCount(string platform, string account, string website, string orderno, DateTime? start, DateTime? end,int? companyid)
public Models.Orders.dc_base_oms_order ListPlatformFeeAbnormalCount(string platform, string account, string website, string orderno, DateTime? start, DateTime? end,int? companyid,string skucategoryids)
{
var sqlparam = new DynamicParameters();
var strwhere = "select sum(amount_product) amount_product,sum(cost_platform_fee) cost_platform_fee from dc_base_oms_order where bailun_order_status!='Canceled' and bailun_order_status!='CantHandle' and has_scalp=0 and has_innersale=0 and has_platform_exception=1 ";
var strwhere = "select sum(t1.amount_product) amount_product,sum(t1.cost_platform_fee) cost_platform_fee from dc_base_oms_order t1 ";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
strwhere += " 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))
{
strwhere += " and t3.bailun_category_id in (" + s + ") ";
}
}
}
strwhere += " where t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 and t1.has_platform_exception=1 ";
if (companyid.HasValue && companyid.Value > 0)
{
strwhere += " and company_id=" + companyid.Value; //增加公司id过滤
strwhere += " and t1.company_id=" + companyid.Value; //增加公司id过滤
}
if (!string.IsNullOrWhiteSpace(platform))
{
if (platform.ToUpper() == "AMAZON")
{
strwhere += " and platform_type in ('Amazon','FBA')";
strwhere += " and t1.platform_type in ('Amazon','FBA')";
sqlparam.Add("platform_type", platform);
}
else
{
strwhere += " and platform_type=@platform_type";
strwhere += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
}
}
......@@ -1016,31 +1251,31 @@ namespace Bailun.DC.Services
if (!string.IsNullOrWhiteSpace(website))
{
strwhere += " and website=@website";
strwhere += " and t1.website=@website";
sqlparam.Add("website", website);
}
if (!string.IsNullOrWhiteSpace(account))
{
strwhere += " and seller_account=@seller_account";
strwhere += " and t1.seller_account=@seller_account";
sqlparam.Add("seller_account", account);
}
if (!string.IsNullOrWhiteSpace(orderno))
{
strwhere += " and origin_order_id=@origin_order_id";
strwhere += " and t1.origin_order_id=@origin_order_id";
sqlparam.Add("origin_order_id", orderno);
}
if (start.HasValue)
{
strwhere += " and paid_time>=@paid_time_start";
strwhere += " and t1.paid_time>=@paid_time_start";
sqlparam.Add("paid_time_start", start.Value);
}
if (end.HasValue)
{
strwhere += " and paid_time<@paid_time_end";
strwhere += " and t1.paid_time<@paid_time_end";
sqlparam.Add("paid_time_end", end.Value.AddDays(1));
}
......
......@@ -132,7 +132,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="end">付款结束时间</param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string ListAmazonSaleStatisticsJson(BtTableParameter parameter, string sellaccount, string website, DateTime start, DateTime end,string warehousetype, string warehousecode)
public string ListAmazonSaleStatisticsJson(BtTableParameter parameter, string sellaccount, string website, DateTime start, DateTime end,string warehousetype, string warehousecode,string skucategoryids)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
......@@ -142,9 +142,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var objwithdraw = new Services.PlatformSiteServices().GetPlatformLossWithdraw().Where(a => a.english_name == "Amazon").FirstOrDefault();
var list = service.ListAmazonStatistics(parameter, sellaccount, website, start, end, warehousetype,warehousecode,companyid, ref total);
var list = service.ListAmazonStatistics(parameter, sellaccount, website, start, end, warehousetype,warehousecode,companyid, ref total,skucategoryids);
var countM = service.ListAmazonStatisticsCount(sellaccount, website, start, end,warehousetype,warehousecode,companyid);
var countM = service.ListAmazonStatisticsCount(sellaccount, website, start, end,warehousetype,warehousecode,companyid,skucategoryids);
countM.website = "总计:";
countM.amount_sales = Math.Round(countM.amount_sales, 2, MidpointRounding.AwayFromZero);
countM.cost_product = Math.Round(countM.cost_product, 2, MidpointRounding.AwayFromZero);
......@@ -226,16 +226,16 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="end">结束时间</param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string ListFBASaleStatisticsJson(BtTableParameter parameter, string sellaccount, string website, DateTime start, DateTime end)
public string ListFBASaleStatisticsJson(BtTableParameter parameter, string sellaccount, string website, DateTime start, DateTime end,string skucategoryids)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var total = 0;
var service = new Services.OrdersServices();
var objwithdraw = new Services.PlatformSiteServices().GetPlatformLossWithdraw().Where(a => a.english_name == "Amazon").FirstOrDefault();
var list = service.ListFBAStatistics(parameter, sellaccount, website, start, end,companyid, ref total);
var list = service.ListFBAStatistics(parameter, sellaccount, website, start, end,companyid, ref total,skucategoryids);
var countM = service.ListFBAStatisticsCount(sellaccount, website, start, end,companyid);
var countM = service.ListFBAStatisticsCount(sellaccount, website, start, end,companyid, skucategoryids);
countM.website = "总计:";
countM.amount_product = Math.Round(countM.amount_product, 2, MidpointRounding.AwayFromZero);
countM.cost_count = Math.Round(countM.cost_count, 2, MidpointRounding.AwayFromZero);
......@@ -257,7 +257,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
countM.cost_fba_fee = Math.Round(countM.cost_fba_fee, 2, MidpointRounding.AwayFromZero);
countM.cost_paypal_fee = Math.Round(countM.cost_paypal_fee, 2, MidpointRounding.AwayFromZero);
countM.cost_package = Math.Round(countM.cost_package, 2, MidpointRounding.AwayFromZero);
countM.profit_rate = Math.Round((countM.profit_count / countM.amount_product), 2, MidpointRounding.AwayFromZero);
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
......@@ -338,14 +338,14 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="sku">sku编码</param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string ListOrderJson(BtTableParameter parameter, string platform, string account, string website, DateTime? start, DateTime? end,string orderno,string sku)
public string ListOrderJson(BtTableParameter parameter, string platform, string account, string website, DateTime? start, DateTime? end,string orderno,string sku,string skucategoryids)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var total = 0;
var service = new Services.OrdersServices();
var obj = service.ListOrders(parameter, platform, website, account, start, end, orderno, sku,companyid, ref total);
var obj = service.ListOrders(parameter, platform, website, account, start, end, orderno, sku,companyid, ref total,skucategoryids);
var countM = service.ListOrdersCount(platform, website, account, start, end, orderno, sku,companyid);
var countM = service.ListOrdersCount(platform, website, account, start, end, orderno, sku,companyid,skucategoryids);
countM.amount_adjustment = Math.Round(countM.amount_adjustment, 2, MidpointRounding.AwayFromZero);
countM.amount_gift_wrap = Math.Round(countM.amount_gift_wrap, 2, MidpointRounding.AwayFromZero);
countM.amount_product = Math.Round(countM.amount_product, 2, MidpointRounding.AwayFromZero);
......@@ -502,12 +502,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="end">付款结束时间</param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string FBAabnormalOrderJson(BtTableParameter parameter, string account, string website, string orderno, DateTime? start, DateTime? end)
public string FBAabnormalOrderJson(BtTableParameter parameter, string account, string website, string orderno, DateTime? start, DateTime? end,string skucategoryids)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var total = 0;
var obj = new Services.OrdersServices().ListFbaAbnormalOrder(parameter, account, website, start, end, orderno,companyid, ref total);
var obj = new Services.OrdersServices().ListFbaAbnormalOrder(parameter, account, website, start, end, orderno,companyid, ref total,skucategoryids);
var list = obj.Select(p => new {
average_fba_fee = p.average_fba_fee>0?p.average_fba_fee.ToString("N2") :"0",
......@@ -551,14 +551,14 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="end"></param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string PlatformFeeAbnormalJson(BtTableParameter parameter,string platform,string account,string website,string orderno,DateTime? start,DateTime? end)
public string PlatformFeeAbnormalJson(BtTableParameter parameter,string platform,string account,string website,string orderno,DateTime? start,DateTime? end,string skucategoryids)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var total = 0;
var service = new Services.OrdersServices();
var obj = service.ListPlatformFeeAbnormal(parameter, platform, account, website, orderno, start, end,companyid, ref total);
var obj = service.ListPlatformFeeAbnormal(parameter, platform, account, website, orderno, start, end,companyid, ref total, skucategoryids);
var countM = service.ListPlatformFeeAbnormalCount(platform, account, website, orderno, start, end,companyid);
var countM = service.ListPlatformFeeAbnormalCount(platform, account, website, orderno, start, end,companyid, skucategoryids);
countM.amount_product = Math.Round(countM.amount_product, 2, MidpointRounding.AwayFromZero);
countM.cost_platform_fee = Math.Round(countM.cost_platform_fee, 2, MidpointRounding.AwayFromZero);
countM.seller_account = "总计:";
......
......@@ -7,12 +7,22 @@
<div class="row">
<div class="col-sm-12">
<div id="leftcontain" style="position:relative;float:left;width:215px;margin-right:-220px;background-color:#fff;height:780px;border-top:solid 1px #E7EAEC;display:none;">
<div id="ztree" class="ztree" style="margin:5px 10px;max-height: 800px;overflow: auto;">
</div>
</div>
<div style="float:right;width:100%;">
<div id="rightcontain">
<div class="ibox-content m-b-sm border-bottom">
<div class="alert alert-warning">提示:1、因WMS接口原因,头程费还取不到,导致利润偏高;2、报表的收入、费用和利润都是取已发货部分的金额;3、预收款取的是未发货部分的销售额;4、所有金额和费用都是按sku维度获取的</div>
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>仓库类型</label>
<label>&nbsp;</label>
<button type="button" class="btn btn-success" onclick="showleft();">分类筛选</button>
</div>
<div class="form-group">
<label>&nbsp;</label>
<select id="warehousetype" name="warehousetype" class="form-control">
<option value="">请选择仓库类型</option>
<option value="自发货仓">自发货仓</option>
......@@ -56,14 +66,18 @@
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
</div>
</div>
@section css{
<link href="~/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.alink {
color: cornflowerblue;
cursor: pointer;
......@@ -71,6 +85,8 @@
</style>
}
@section scripts{
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script type="text/javascript">
var tb;
$(document).ready(function () {
......@@ -91,6 +107,8 @@
$('#warehousetype').change(function () {
listWarehouse();
})
listcategory12();
})
function list() {
......@@ -171,7 +189,15 @@
{ field: 'profit_rate', title: '总实际利润率%', width: '130', sortable: true, iscount: true },
];
var url = '@Url.Content("~/Reports/Orders/ListAmazonSaleStatisticsJson")' + '?' + $("#toolbar").serialize();
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
var url = '@Url.Content("~/Reports/Orders/ListAmazonSaleStatisticsJson")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s;
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {showfooter: true, showCount: true});
......@@ -244,6 +270,48 @@
}
function showleft() {
var c = $('#leftcontain').css('display');
if (c == 'none') {
$('#leftcontain').css('display', 'inline');
$("#rightcontain").animate({ marginLeft: "220px" });
}
else {
$('#leftcontain').css('display', 'none');
$("#rightcontain").animate({ marginLeft: "0px" });
}
}
function listcategory12() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListSkuCategoryOneAndSecondLevel")',
paramData: '',
type: 'POST',
func: function (result) {
var setting = {
check: {
chkStyle:'checkbox',
enable: true
}
};
zTreeObj = $.fn.zTree.init($("#ztree"), setting, eval('('+result+')'));
}
})
}
function getChkNode() {
var s = '';
var o = $.fn.zTree.getZTreeObj("ztree");
var nodes = o.getCheckedNodes();
for (var i in nodes) {
if (nodes[i].children == null || nodes[i].children.length <= 0) {
s += (nodes[i].id) + '|';
}
}
return s;
}
</script>
......
......@@ -8,10 +8,21 @@
<div class="row">
<div class="col-sm-12">
<div id="leftcontain" style="position:relative;float:left;width:215px;margin-right:-220px;background-color:#fff;height:780px;border-top:solid 1px #E7EAEC;display:none;">
<div id="ztree" class="ztree" style="margin:5px 10px;max-height: 800px;overflow: auto;">
</div>
</div>
<div style="float:right;width:100%;">
<div id="rightcontain">
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-success" onclick="showleft();">分类筛选</button>
</div>
<div class="form-group">
<label>销售帐号:</label>
<select id="account" name="account" class="form-control" style="width:160px;">
<option value="">选择帐号</option>
......@@ -45,8 +56,11 @@
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
</div>
</div>
@section css{
<link href="~/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
<style>
.mules {
white-space: nowrap;
......@@ -56,6 +70,8 @@
</style>
}
@section scripts{
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script type="text/javascript">
var tb;
$(document).ready(function () {
......@@ -70,6 +86,7 @@
listAccount();
listWebsite();
listcategory12();
})
function list() {
......@@ -93,7 +110,15 @@
{ field: 'create_time', title: '下单时间', width: '100', sortable: true }
];
var url = '@Url.Content("~/Reports/Orders/FBAabnormalOrderJson")' + '?' + $("#toolbar").serialize();
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
var url = '@Url.Content("~/Reports/Orders/FBAabnormalOrderJson")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s;
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "",);
......@@ -135,6 +160,48 @@
})
}
function showleft() {
var c = $('#leftcontain').css('display');
if (c == 'none') {
$('#leftcontain').css('display', 'inline');
$("#rightcontain").animate({ marginLeft: "220px" });
}
else {
$('#leftcontain').css('display', 'none');
$("#rightcontain").animate({ marginLeft: "0px" });
}
}
function listcategory12() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListSkuCategoryOneAndSecondLevel")',
paramData: '',
type: 'POST',
func: function (result) {
var setting = {
check: {
chkStyle:'checkbox',
enable: true
}
};
zTreeObj = $.fn.zTree.init($("#ztree"), setting, eval('('+result+')'));
}
})
}
function getChkNode() {
var s = '';
var o = $.fn.zTree.getZTreeObj("ztree");
var nodes = o.getCheckedNodes();
for (var i in nodes) {
if (nodes[i].children == null || nodes[i].children.length <= 0) {
s += (nodes[i].id) + '|';
}
}
return s;
}
</script>
}
......
......@@ -7,9 +7,21 @@
<div class="row">
<div class="col-sm-12">
<div id="leftcontain" style="position:relative;float:left;width:215px;margin-right:-220px;background-color:#fff;height:780px;border-top:solid 1px #E7EAEC;display:none;">
<div id="ztree" class="ztree" style="margin:5px 10px;max-height: 800px;overflow: auto;">
</div>
</div>
<div style="float:right;width:100%;">
<div id="rightcontain">
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-success" onclick="showleft();">分类筛选</button>
</div>
@*<div class="form-group">
<label>统计维度:</label>
<select id="stype" name="stype" class="form-control">
......@@ -47,14 +59,18 @@
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
</div>
</div>
@section css{
<link href="~/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.alink {
color: cornflowerblue;
cursor: pointer;
......@@ -62,6 +78,8 @@
</style>
}
@section scripts{
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script type="text/javascript">
var tb;
$(document).ready(function () {
......@@ -76,6 +94,8 @@
listAccount();
listWebsite();
listcategory12();
})
function list() {
......@@ -156,7 +176,15 @@
{ field: 'profit_rate', title: '总实际利润率%', width: '130', sortable: true, iscount: true },
];
var url = '@Url.Content("~/Reports/Orders/ListFBASaleStatisticsJson")' + '?' + $("#toolbar").serialize();
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
var url = '@Url.Content("~/Reports/Orders/ListFBASaleStatisticsJson")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s;
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", { showfooter: true, showCount: true });
......@@ -202,6 +230,48 @@
layer_show(platform + " " + website + " " + $('#start').val() + "至" + $('#end').val() + ' 订单明细', '@Url.Content("~/Reports/Orders/ListOrderDetail?platform=")' + platform + '&website=' + website + '&account=' + account + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=' + colval + '&coltitle=' + coltitle + '&showsingle=' + single, '90%', '90%');
}
function showleft() {
var c = $('#leftcontain').css('display');
if (c == 'none') {
$('#leftcontain').css('display', 'inline');
$("#rightcontain").animate({ marginLeft: "220px" });
}
else {
$('#leftcontain').css('display', 'none');
$("#rightcontain").animate({ marginLeft: "0px" });
}
}
function listcategory12() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListSkuCategoryOneAndSecondLevel")',
paramData: '',
type: 'POST',
func: function (result) {
var setting = {
check: {
chkStyle:'checkbox',
enable: true
}
};
zTreeObj = $.fn.zTree.init($("#ztree"), setting, eval('('+result+')'));
}
})
}
function getChkNode() {
var s = '';
var o = $.fn.zTree.getZTreeObj("ztree");
var nodes = o.getCheckedNodes();
for (var i in nodes) {
if (nodes[i].children == null || nodes[i].children.length <= 0) {
s += (nodes[i].id) + '|';
}
}
return s;
}
</script>
}
......
......@@ -7,11 +7,22 @@
<div class="row">
<div class="col-sm-12">
<div id="leftcontain" style="position:relative;float:left;width:215px;margin-right:-220px;background-color:#fff;height:780px;border-top:solid 1px #E7EAEC;display:none;">
<div id="ztree" class="ztree" style="margin:5px 10px;max-height: 800px;overflow: auto;">
</div>
</div>
<div style="float:right;width:100%;">
<div id="rightcontain">
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<input id="platform" name="platform" type="hidden" value="@ViewBag.platform" />
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-success" onclick="showleft();">分类筛选</button>
</div>
<div class="form-group">
<label>站点:</label>
<select id="website" name="website" class="form-control">
<option value="">选择站点</option>
......@@ -49,8 +60,11 @@
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
</div>
</div>
@section css{
<link href="~/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
<link href="~/css/bootstrap-table-fixed-columns.css" rel="stylesheet" />
<style>
.mules {
......@@ -61,6 +75,8 @@
</style>
}
@section scripts{
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script src="~/js/bootstrap-table-fixed-columns.js" type="text/javascript"></script>
<script type="text/javascript">
var tb;
......@@ -76,6 +92,8 @@
listAccount();
listWebsite();
listcategory12();
})
function list() {
......@@ -115,7 +133,15 @@
{ field: 'order_update_time', title: '更新时间', width: '140', sortable: true }
];
var url = '@Url.Content("~/Reports/Orders/ListOrderJson")' + '?' + $("#toolbar").serialize();
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
var url = '@Url.Content("~/Reports/Orders/ListOrderJson")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s;
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
......@@ -176,6 +202,48 @@
})
}
function showleft() {
var c = $('#leftcontain').css('display');
if (c == 'none') {
$('#leftcontain').css('display', 'inline');
$("#rightcontain").animate({ marginLeft: "220px" });
}
else {
$('#leftcontain').css('display', 'none');
$("#rightcontain").animate({ marginLeft: "0px" });
}
}
function listcategory12() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListSkuCategoryOneAndSecondLevel")',
paramData: '',
type: 'POST',
func: function (result) {
var setting = {
check: {
chkStyle:'checkbox',
enable: true
}
};
zTreeObj = $.fn.zTree.init($("#ztree"), setting, eval('('+result+')'));
}
})
}
function getChkNode() {
var s = '';
var o = $.fn.zTree.getZTreeObj("ztree");
var nodes = o.getCheckedNodes();
for (var i in nodes) {
if (nodes[i].children == null || nodes[i].children.length <= 0) {
s += (nodes[i].id) + '|';
}
}
return s;
}
</script>
}
......
......@@ -2,16 +2,28 @@
@{
ViewData["Title"] = "平台费异常订单";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] {"统计","亚马逊","平台费用异常订单" };
ViewBag.Nav = new string[] { "统计", "亚马逊", "平台费用异常订单" };
}
<div class="row">
<div class="col-sm-12">
<div id="leftcontain" style="position:relative;float:left;width:215px;margin-right:-220px;background-color:#fff;height:780px;border-top:solid 1px #E7EAEC;display:none;">
<div id="ztree" class="ztree" style="margin:5px 10px;max-height: 800px;overflow: auto;">
</div>
</div>
<div style="float:right;width:100%;">
<div id="rightcontain">
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<input id="platform" name="platform" type="hidden" value="@ViewBag.platform" />
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-success" onclick="showleft();">分类筛选</button>
</div>
<div class="form-group">
<label>站点:</label>
<select id="website" name="website" class="form-control">
<option value="">选择站点</option>
......@@ -45,8 +57,11 @@
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
</div>
</div>
@section css{
<link href="~/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
<style>
.mules {
white-space: nowrap;
......@@ -56,6 +71,8 @@
</style>
}
@section scripts{
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script type="text/javascript">
var tb;
$(document).ready(function () {
......@@ -70,6 +87,7 @@
listAccount();
listWebsite();
listcategory12();
})
function list() {
......@@ -89,7 +107,15 @@
{ field: 'create_time', title: '下单时间', width: '140', sortable: true }
];
var url = '@Url.Content("~/Reports/Orders/PlatformFeeAbnormalJson")' + '?' + $("#toolbar").serialize();
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
var url = '@Url.Content("~/Reports/Orders/PlatformFeeAbnormalJson")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s;
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
......@@ -147,6 +173,48 @@
})
}
function showleft() {
var c = $('#leftcontain').css('display');
if (c == 'none') {
$('#leftcontain').css('display', 'inline');
$("#rightcontain").animate({ marginLeft: "220px" });
}
else {
$('#leftcontain').css('display', 'none');
$("#rightcontain").animate({ marginLeft: "0px" });
}
}
function listcategory12() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListSkuCategoryOneAndSecondLevel")',
paramData: '',
type: 'POST',
func: function (result) {
var setting = {
check: {
chkStyle:'checkbox',
enable: true
}
};
zTreeObj = $.fn.zTree.init($("#ztree"), setting, eval('('+result+')'));
}
})
}
function getChkNode() {
var s = '';
var o = $.fn.zTree.getZTreeObj("ztree");
var nodes = o.getCheckedNodes();
for (var i in nodes) {
if (nodes[i].children == null || nodes[i].children.length <= 0) {
s += (nodes[i].id) + '|';
}
}
return s;
}
</script>
}
......
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