Commit a56385d6 by guanzhenshan

调整月销售利润报表,增加尾程费项

parent 13a95bab
...@@ -106,10 +106,18 @@ namespace Bailun.DC.Models ...@@ -106,10 +106,18 @@ namespace Bailun.DC.Models
/// 头程费 /// 头程费
/// </summary> /// </summary>
public decimal fee_logistics_first { get; set; } public decimal fee_logistics_first { get; set; }
/// <summary>
/// 尾程费 国外发货
/// </summary>
public decimal fee_logistics_tail { get; set; }
/// <summary> /// <summary>
/// 直邮物流费 /// 直邮物流费 国内发货
/// </summary> /// </summary>
public decimal fee_logistics_direct { get; set; } public decimal fee_logistics_direct { get; set; }
/// <summary> /// <summary>
/// 海外仓仓储及其他费用 /// 海外仓仓储及其他费用
/// </summary> /// </summary>
......
...@@ -100,9 +100,15 @@ namespace Bailun.DC.Models ...@@ -100,9 +100,15 @@ namespace Bailun.DC.Models
/// </summary> /// </summary>
public decimal? fee_logistics_first { get; set; } public decimal? fee_logistics_first { get; set; }
/// <summary> /// <summary>
/// 直邮物流费 /// 直邮物流费 国内发货
/// </summary> /// </summary>
public decimal? fee_logistics_direct { get; set; } public decimal? fee_logistics_direct { get; set; }
/// <summary>
/// 尾程费 国外发货
/// </summary>
public decimal? fee_logistics_tail { get; set; }
/// <summary> /// <summary>
/// 海外仓仓储及其他费用 /// 海外仓仓储及其他费用
/// </summary> /// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.MonthSaleProfit.Models
{
public class mLogisticsFee
{
public decimal cost_logistics { get; set; }
public string hq_type { get; set; }
}
}
...@@ -454,6 +454,7 @@ namespace Bailun.DC.MonthSaleProfit ...@@ -454,6 +454,7 @@ namespace Bailun.DC.MonthSaleProfit
fee_finance = 0, fee_finance = 0,
fee_logistics_direct = 0, fee_logistics_direct = 0,
fee_logistics_first = 0, fee_logistics_first = 0,
fee_logistics_tail = 0,
fee_logistics_storage = 0, fee_logistics_storage = 0,
fee_paycash_sales = 0, fee_paycash_sales = 0,
fee_platform = 0, fee_platform = 0,
...@@ -582,12 +583,21 @@ namespace Bailun.DC.MonthSaleProfit ...@@ -582,12 +583,21 @@ namespace Bailun.DC.MonthSaleProfit
//平台扣费及退款 //平台扣费及退款
m.fee_platform_and_refund = m.fee_platform + m.fee_fba + m.fee_refund; m.fee_platform_and_refund = m.fee_platform + m.fee_fba + m.fee_refund;
//物流仓储费用 = 头程运输+直邮物流费+海外仓仓储及其他费用 sql = $@"select sum(t2.cost_logistics*t1.quantity_shipped) as cost_logistics,t3.hq_type from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_order_id = t2.bailun_order_id and t1.bailun_sku=t2.bailun_sku and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and (t2.platform_type!='FBA' and t2.bailun_order_status!='CantHandle') and t2.has_scalp =0 and t2.has_delete=0 and t2.company_id=1
join dc_base_warehouse t3 on t1.warehouse_code=t3.warehouse_code
where t1.has_delete=0 and t1.shipping_status = 'TotalShipping' and t1.company_id=1 and t1.shipping_time>='{day.ToString("yyyy-MM-dd")}' and t1.shipping_time<'{day.AddMonths(1).ToString("yyyy-MM-dd")}'
group by t3.hq_type";
var objLogistics = cn.Query<Models.mLogisticsFee>(sql,null,null,true,3*60).ToList();
//物流仓储费用 = 头程运输+直邮物流费(国内发货)+尾程物流费(国外发货)+海外仓仓储及其他费用
m.fee_logistics_first = objOrder.Sum(a => a.cost_first??0) + objFBA.Sum(a => a.cost_first??0); m.fee_logistics_first = objOrder.Sum(a => a.cost_first??0) + objFBA.Sum(a => a.cost_first??0);
m.fee_logistics_direct = objOrder.Sum(a => a.cost_logistics??0); m.fee_logistics_direct = objLogistics.Where(a => a.hq_type == "国内仓")?.Sum(b => b.cost_logistics) ?? 0; //objOrder.Sum(a => a.cost_logistics??0);
m.fee_logistics_tail = objLogistics.Where(a => a.hq_type != "国内仓")?.Sum(b => b.cost_logistics) ?? 0;
m.fee_storage = objOrder.Sum(a => a.total_fee??0); m.fee_storage = objOrder.Sum(a => a.total_fee??0);
m.fee_logistics_storage = m.fee_logistics_first + m.fee_logistics_direct + m.fee_storage; m.fee_logistics_storage = m.fee_logistics_first + m.fee_logistics_direct+m.fee_logistics_tail + m.fee_storage;
//利息支出 //利息支出
...@@ -651,8 +661,8 @@ namespace Bailun.DC.MonthSaleProfit ...@@ -651,8 +661,8 @@ namespace Bailun.DC.MonthSaleProfit
} }
cn.Execute("delete from dc_month_sales_profit where month='" + m.month + "'"); cn.Execute("delete from dc_month_sales_profit where month='" + m.month + "'");
sql = $@"insert dc_month_sales_profit (month,amount_sales,amount_sales_jingyou,amount_sales_dianzi,amount_sales_jiaju,amount_sales_meirongmj,amount_sales_fuzhuang,amount_sales_other,cost,cost_jingyou,cost_dianzi,cost_jiaju,cost_meirongmj,cost_fuzhuang,cost_other,fee_platform_and_refund,fee_platform,fee_fba,fee_refund,amount_withdraw,fee_logistics_storage,fee_logistics_first,fee_logistics_direct,fee_storage,fee_paycash_sales,fee_sales_count,profit_sales,rate_profit_sales,managecost_bl_xg,managecost_bl_gz,managecost_meijia,managercost_yangshan,managercost_chengpincang,managercost_xinhuilan,managercost_count,fee_finance,profit,rate_profit,incoming_other,incoming_non_operating,pay_non_operating,actual_profit,dividend,profit_balance,rate_profit_actual,createtime,lastupdateuserid,lastupdateusername,lastupdatetime,isedit) values sql = $@"insert dc_month_sales_profit (month,amount_sales,amount_sales_jingyou,amount_sales_dianzi,amount_sales_jiaju,amount_sales_meirongmj,amount_sales_fuzhuang,amount_sales_other,cost,cost_jingyou,cost_dianzi,cost_jiaju,cost_meirongmj,cost_fuzhuang,cost_other,fee_platform_and_refund,fee_platform,fee_fba,fee_refund,amount_withdraw,fee_logistics_storage,fee_logistics_first,fee_logistics_direct,fee_logistics_tail,fee_storage,fee_paycash_sales,fee_sales_count,profit_sales,rate_profit_sales,managecost_bl_xg,managecost_bl_gz,managecost_meijia,managercost_yangshan,managercost_chengpincang,managercost_xinhuilan,managercost_count,fee_finance,profit,rate_profit,incoming_other,incoming_non_operating,pay_non_operating,actual_profit,dividend,profit_balance,rate_profit_actual,createtime,lastupdateuserid,lastupdateusername,lastupdatetime,isedit) values
('{m.month}',{m.amount_sales},{m.amount_sales_jingyou},{m.amount_sales_dianzi},{m.amount_sales_jiaju},{m.amount_sales_meirongmj},{m.amount_sales_fuzhuang},{m.amount_sales_other},{m.cost},{m.cost_jingyou},{m.cost_dianzi},{m.cost_jiaju},{m.cost_meirongmj},{m.cost_fuzhuang},{m.cost_other},{m.fee_platform_and_refund},{m.fee_platform},{m.fee_fba},{m.fee_refund},{m.amount_withdraw},{m.fee_logistics_storage},{m.fee_logistics_first},{m.fee_logistics_direct},{m.fee_storage},{m.fee_paycash_sales},{m.fee_sales_count},{m.profit_sales},{m.rate_profit_sales},{m.managecost_bl_xg},{m.managecost_bl_gz},{m.managecost_meijia},{m.managercost_yangshan},{m.managercost_chengpincang},{m.managercost_xinhuilan},{m.managercost_count},{m.fee_finance},{m.profit},{m.rate_profit},{m.incoming_other},{m.incoming_non_operating},{m.pay_non_operating},{m.actual_profit},{m.dividend},{m.profit_balance},{m.rate_profit_actual},'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',{m.lastupdateuserid},'{m.lastupdateusername}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',0)"; ('{m.month}',{m.amount_sales},{m.amount_sales_jingyou},{m.amount_sales_dianzi},{m.amount_sales_jiaju},{m.amount_sales_meirongmj},{m.amount_sales_fuzhuang},{m.amount_sales_other},{m.cost},{m.cost_jingyou},{m.cost_dianzi},{m.cost_jiaju},{m.cost_meirongmj},{m.cost_fuzhuang},{m.cost_other},{m.fee_platform_and_refund},{m.fee_platform},{m.fee_fba},{m.fee_refund},{m.amount_withdraw},{m.fee_logistics_storage},{m.fee_logistics_first},{m.fee_logistics_direct},{m.fee_logistics_tail},{m.fee_storage},{m.fee_paycash_sales},{m.fee_sales_count},{m.profit_sales},{m.rate_profit_sales},{m.managecost_bl_xg},{m.managecost_bl_gz},{m.managecost_meijia},{m.managercost_yangshan},{m.managercost_chengpincang},{m.managercost_xinhuilan},{m.managercost_count},{m.fee_finance},{m.profit},{m.rate_profit},{m.incoming_other},{m.incoming_non_operating},{m.pay_non_operating},{m.actual_profit},{m.dividend},{m.profit_balance},{m.rate_profit_actual},'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',{m.lastupdateuserid},'{m.lastupdateusername}','{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',0)";
cn.Execute(sql); cn.Execute(sql);
} }
......
...@@ -5277,6 +5277,7 @@ group by currency"; ...@@ -5277,6 +5277,7 @@ group by currency";
fee_finance = 0, fee_finance = 0,
fee_logistics_direct = 0, fee_logistics_direct = 0,
fee_logistics_first = 0, fee_logistics_first = 0,
fee_logistics_tail = 0,
fee_logistics_storage = 0, fee_logistics_storage = 0,
fee_paycash_sales = 0, fee_paycash_sales = 0,
fee_platform = 0, fee_platform = 0,
...@@ -5412,6 +5413,11 @@ group by currency"; ...@@ -5412,6 +5413,11 @@ group by currency";
obj.fee_logistics_first = m.fee_logistics_first.Value; obj.fee_logistics_first = m.fee_logistics_first.Value;
} }
if(m.fee_logistics_tail.HasValue)
{
obj.fee_logistics_tail = m.fee_logistics_tail.Value;
}
if(m.fee_logistics_storage.HasValue) if(m.fee_logistics_storage.HasValue)
{ {
obj.fee_logistics_storage = m.fee_logistics_storage.Value; obj.fee_logistics_storage = m.fee_logistics_storage.Value;
......
...@@ -8277,6 +8277,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -8277,6 +8277,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
fee_finance = a.fee_finance.ToString("N2"), fee_finance = a.fee_finance.ToString("N2"),
fee_logistics_direct = a.fee_logistics_direct.ToString("N2"), fee_logistics_direct = a.fee_logistics_direct.ToString("N2"),
fee_logistics_first = a.fee_logistics_first.ToString("N2"), fee_logistics_first = a.fee_logistics_first.ToString("N2"),
fee_logistics_tail = a.fee_logistics_tail.ToString("N2"),
fee_logistics_storage = a.fee_logistics_storage.ToString("N2"), fee_logistics_storage = a.fee_logistics_storage.ToString("N2"),
fee_paycash_sales= a.fee_paycash_sales.ToString("N2"), fee_paycash_sales= a.fee_paycash_sales.ToString("N2"),
fee_platform = a.fee_platform.ToString("N2"), fee_platform = a.fee_platform.ToString("N2"),
...@@ -8338,7 +8339,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -8338,7 +8339,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
listHead.Add(new Tuple<string, string, int>("物流仓储费用", "fee_logistics_storage", 1)); listHead.Add(new Tuple<string, string, int>("物流仓储费用", "fee_logistics_storage", 1));
listHead.Add(new Tuple<string, string, int>("头程运输", "fee_logistics_first", 0)); listHead.Add(new Tuple<string, string, int>("头程运输", "fee_logistics_first", 0));
listHead.Add(new Tuple<string, string, int>("直邮物流费", "fee_logistics_direct", 0)); listHead.Add(new Tuple<string, string, int>("直邮物流费", "fee_logistics_direct", 0));
//listHead.Add(new Tuple<string, string, int>("尾程物流费", "", 0)); listHead.Add(new Tuple<string, string, int>("尾程物流费", "fee_logistics_tail", 0));
listHead.Add(new Tuple<string, string, int>("海外仓仓储费", "fee_storage", 0)); listHead.Add(new Tuple<string, string, int>("海外仓仓储费", "fee_storage", 0));
listHead.Add(new Tuple<string, string, int>("付现销售费用", "fee_paycash_sales", 0)); listHead.Add(new Tuple<string, string, int>("付现销售费用", "fee_paycash_sales", 0));
...@@ -8396,6 +8397,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -8396,6 +8397,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
m.fee_finance = item.Sum(a => a.fee_finance); m.fee_finance = item.Sum(a => a.fee_finance);
m.fee_logistics_direct = item.Sum(a => a.fee_logistics_direct); m.fee_logistics_direct = item.Sum(a => a.fee_logistics_direct);
m.fee_logistics_first = item.Sum(a => a.fee_logistics_first); m.fee_logistics_first = item.Sum(a => a.fee_logistics_first);
m.fee_logistics_tail = item.Sum(a => a.fee_logistics_tail);
m.fee_logistics_storage = item.Sum(a => a.fee_logistics_storage); m.fee_logistics_storage = item.Sum(a => a.fee_logistics_storage);
m.fee_paycash_sales = item.Sum(a => a.fee_paycash_sales); m.fee_paycash_sales = item.Sum(a => a.fee_paycash_sales);
m.fee_platform = item.Sum(a => a.fee_platform); m.fee_platform = item.Sum(a => a.fee_platform);
...@@ -8427,8 +8429,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -8427,8 +8429,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
//平台扣费及退款 //平台扣费及退款
m.fee_platform_and_refund = m.fee_platform + m.fee_fba + m.fee_refund; m.fee_platform_and_refund = m.fee_platform + m.fee_fba + m.fee_refund;
//物流仓储费用 = 头程运输+直邮物流费+海外仓仓储及其他费用 //物流仓储费用 = 头程运输+直邮物流费+尾程费+海外仓仓储及其他费用
m.fee_logistics_storage = m.fee_logistics_first + m.fee_logistics_direct + m.fee_storage; m.fee_logistics_storage = m.fee_logistics_first + m.fee_logistics_direct+m.fee_logistics_tail + m.fee_storage;
//销售费用合计=平台扣费及退款+物流仓储费用+付现销售费用 //销售费用合计=平台扣费及退款+物流仓储费用+付现销售费用
m.fee_sales_count = m.fee_platform_and_refund + m.fee_logistics_storage + m.fee_paycash_sales; m.fee_sales_count = m.fee_platform_and_refund + m.fee_logistics_storage + m.fee_paycash_sales;
...@@ -8485,6 +8487,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -8485,6 +8487,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
fee_logistics_direct = a.fee_logistics_direct.ToString("N2"), fee_logistics_direct = a.fee_logistics_direct.ToString("N2"),
fee_logistics_first = a.fee_logistics_first.ToString("N2"), fee_logistics_first = a.fee_logistics_first.ToString("N2"),
fee_logistics_storage = a.fee_logistics_storage.ToString("N2"), fee_logistics_storage = a.fee_logistics_storage.ToString("N2"),
fee_logistics_tail = a.fee_logistics_tail.ToString("N2"),
fee_paycash_sales = a.fee_paycash_sales.ToString("N2"), fee_paycash_sales = a.fee_paycash_sales.ToString("N2"),
fee_platform = a.fee_platform.ToString("N2"), fee_platform = a.fee_platform.ToString("N2"),
fee_platform_and_refund = a.fee_platform_and_refund.ToString("N2"), fee_platform_and_refund = a.fee_platform_and_refund.ToString("N2"),
......
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