Commit 636b0806 by guanzhenshan

增加支持查询FBA发货收入数据

parent f271ef0a
...@@ -16,5 +16,7 @@ namespace Bailun.DC.MonthShippingIncoming.Model ...@@ -16,5 +16,7 @@ namespace Bailun.DC.MonthShippingIncoming.Model
public decimal amount_sales { get; set; } public decimal amount_sales { get; set; }
public string account_name { get; set; }
} }
} }
...@@ -95,7 +95,7 @@ namespace Bailun.DC.MonthShippingIncoming ...@@ -95,7 +95,7 @@ namespace Bailun.DC.MonthShippingIncoming
cn.Open(); cn.Open();
} }
cn.Execute("delete from dc_month_shipping_incoming where month='"+day.ToString("yyyy-MM")+"'"); cn.Execute("delete from dc_month_shipping_incoming where month='"+day.ToString("yyyy-MM")+ "' and platform_type!='FBA'");
cn.Execute(sql); cn.Execute(sql);
} }
......
...@@ -5336,13 +5336,11 @@ group by currency"; ...@@ -5336,13 +5336,11 @@ group by currency";
if(m.amount_sales_jingyou.HasValue) if(m.amount_sales_jingyou.HasValue)
{ {
obj.amount_sales_jingyou = m.amount_sales_jingyou.Value; obj.amount_sales_jingyou = m.amount_sales_jingyou.Value;
sql_update += " amount_sales_jingyou=" + obj.amount_sales_jingyou;
} }
if(m.amount_sales_dianzi.HasValue) if(m.amount_sales_dianzi.HasValue)
{ {
obj.amount_sales_dianzi = m.amount_sales_dianzi.Value; obj.amount_sales_dianzi = m.amount_sales_dianzi.Value;
sql_update += " amount_sales_dianzi=" + obj.amount_sales_dianzi;
} }
if(m.amount_sales_jiaju.HasValue) if(m.amount_sales_jiaju.HasValue)
...@@ -5409,25 +5407,21 @@ group by currency"; ...@@ -5409,25 +5407,21 @@ group by currency";
if(m.fee_logistics_direct.HasValue) if(m.fee_logistics_direct.HasValue)
{ {
obj.fee_logistics_direct = m.fee_logistics_direct.Value; obj.fee_logistics_direct = m.fee_logistics_direct.Value;
sql_update += " fee_logistics_direct=" + obj.fee_logistics_direct;
} }
if(m.fee_logistics_first.HasValue) if(m.fee_logistics_first.HasValue)
{ {
obj.fee_logistics_first = m.fee_logistics_first.Value; obj.fee_logistics_first = m.fee_logistics_first.Value;
sql_update += " fee_logistics_first=" + obj.fee_logistics_first;
} }
if(m.fee_logistics_tail.HasValue) if(m.fee_logistics_tail.HasValue)
{ {
obj.fee_logistics_tail = m.fee_logistics_tail.Value; obj.fee_logistics_tail = m.fee_logistics_tail.Value;
sql_update += " fee_logistics_tail=" + obj.fee_logistics_tail;
} }
if(m.fee_paycash_sales.HasValue) if(m.fee_paycash_sales.HasValue)
{ {
obj.fee_paycash_sales = m.fee_paycash_sales.Value; obj.fee_paycash_sales = m.fee_paycash_sales.Value;
sql_update += " fee_paycash_sales=" + obj.fee_paycash_sales;
} }
if(m.fee_platform.HasValue) if(m.fee_platform.HasValue)
...@@ -5527,63 +5521,47 @@ group by currency"; ...@@ -5527,63 +5521,47 @@ group by currency";
//销售额=家居用品类+服装类+电子产品类+精油类+美容美甲类+其他 //销售额=家居用品类+服装类+电子产品类+精油类+美容美甲类+其他
obj.amount_sales = obj.amount_sales_dianzi + obj.amount_sales_fuzhuang + obj.amount_sales_jiaju + obj.amount_sales_jingyou + obj.amount_sales_meirongmj+obj.amount_sales_other; obj.amount_sales = obj.amount_sales_dianzi + obj.amount_sales_fuzhuang + obj.amount_sales_jiaju + obj.amount_sales_jingyou + obj.amount_sales_meirongmj+obj.amount_sales_other;
sql_update += " ,amount_sales=" + obj.amount_sales;
//产品成本=家居用品类+服装类+电子产品类+精油类+美容美甲类+其他类型成本 //产品成本=家居用品类+服装类+电子产品类+精油类+美容美甲类+其他类型成本
obj.cost = obj.cost_dianzi + obj.cost_fuzhuang + obj.cost_jiaju + obj.cost_jingyou + obj.cost_meirongmj+obj.cost_other; obj.cost = obj.cost_dianzi + obj.cost_fuzhuang + obj.cost_jiaju + obj.cost_jingyou + obj.cost_meirongmj+obj.cost_other;
sql_update += " ,cost=" + obj.cost;
//平台扣费及退款 //平台扣费及退款
obj.fee_platform_and_refund = obj.fee_platform + obj.fee_fba + obj.fee_refund+obj.fee_ad; obj.fee_platform_and_refund = obj.fee_platform + obj.fee_fba + obj.fee_refund+obj.fee_ad;
sql_update += " ,fee_platform_and_refund=" + obj.fee_platform_and_refund;
//物流仓储费用 = 头程运输+直邮物流费+尾程物流费+海外仓仓储+海外仓杂费 //物流仓储费用 = 头程运输+直邮物流费+尾程物流费+海外仓仓储+海外仓杂费
obj.fee_logistics_storage = obj.fee_logistics_first + obj.fee_logistics_direct+obj.fee_logistics_tail + obj.fee_storage+ obj.fee_storage_incidentals; obj.fee_logistics_storage = obj.fee_logistics_first + obj.fee_logistics_direct+obj.fee_logistics_tail + obj.fee_storage+ obj.fee_storage_incidentals;
sql_update += " ,fee_logistics_storage=" + obj.fee_logistics_storage;
//销售费用合计=平台扣费及退款+物流仓储费用+付现销售费用 //销售费用合计=平台扣费及退款+物流仓储费用+付现销售费用
obj.fee_sales_count = obj.fee_platform_and_refund + obj.fee_logistics_storage + obj.fee_paycash_sales; obj.fee_sales_count = obj.fee_platform_and_refund + obj.fee_logistics_storage + obj.fee_paycash_sales;
sql_update += " ,fee_sales_count=" + obj.fee_sales_count;
//销售利润=销售额-产品成本-销售费用合计 //销售利润=销售额-产品成本-销售费用合计
obj.profit_sales = obj.amount_sales - obj.cost - obj.fee_sales_count; obj.profit_sales = obj.amount_sales - obj.cost - obj.fee_sales_count;
sql_update += " ,profit_sales=" + obj.profit_sales;
//销售毛利率=销售利润/销售额 //销售毛利率=销售利润/销售额
obj.rate_profit_sales = obj.amount_sales > 0 ? obj.profit_sales / obj.amount_sales : 0; obj.rate_profit_sales = obj.amount_sales > 0 ? obj.profit_sales / obj.amount_sales : 0;
sql_update += " ,rate_profit_sales=" + obj.rate_profit_sales;
//管理成本=香港百伦+广州百伦+美容美甲店+杨杉+信荟蓝+成品仓+迪致+广州美甲生产仓 //管理成本=香港百伦+广州百伦+美容美甲店+杨杉+信荟蓝+成品仓+迪致+广州美甲生产仓
obj.managercost_count = obj.managecost_bl_gz + obj.managecost_bl_xg + obj.managecost_meijia + obj.managercost_chengpincang + obj.managercost_xinhuilan + obj.managercost_yangshan+obj.managercost_dizhi+obj.managercost_meijiashengchan; obj.managercost_count = obj.managecost_bl_gz + obj.managecost_bl_xg + obj.managecost_meijia + obj.managercost_chengpincang + obj.managercost_xinhuilan + obj.managercost_yangshan+obj.managercost_dizhi+obj.managercost_meijiashengchan;
sql_update += " ,managercost_count=" + obj.managercost_count;
//营业利润=销售利润-管理成本合计-财务费用 //营业利润=销售利润-管理成本合计-财务费用
obj.profit = obj.profit_sales - obj.managercost_count - obj.fee_finance; obj.profit = obj.profit_sales - obj.managercost_count - obj.fee_finance;
sql_update += " ,profit=" + obj.profit;
//营业毛利率=营业利润/销售额 //营业毛利率=营业利润/销售额
obj.rate_profit = obj.amount_sales > 0 ? obj.profit / obj.amount_sales : 0; obj.rate_profit = obj.amount_sales > 0 ? obj.profit / obj.amount_sales : 0;
sql_update += " ,rate_profit=" + obj.rate_profit;
//实际利润=营业利润+其他收入+营业外收入-营业外支出-资产减值 //实际利润=营业利润+其他收入+营业外收入-营业外支出-资产减值
obj.actual_profit = obj.profit + obj.incoming_other + obj.incoming_non_operating - obj.pay_non_operating-(obj.impairment_assets??0); obj.actual_profit = obj.profit + obj.incoming_other + obj.incoming_non_operating - obj.pay_non_operating-(obj.impairment_assets??0);
sql_update += " ,actual_profit=" + obj.actual_profit;
//利润结余=实际利润-分红 //利润结余=实际利润-分红
obj.profit_balance = obj.actual_profit - obj.dividend; obj.profit_balance = obj.actual_profit - obj.dividend;
sql_update += " ,profit_balance=" + obj.profit_balance;
//净利率 = 利润结余/销售额 //净利率 = 利润结余/销售额
obj.rate_profit_actual = obj.amount_sales > 0 ? obj.profit_balance / obj.amount_sales : 0; obj.rate_profit_actual = obj.amount_sales > 0 ? obj.profit_balance / obj.amount_sales : 0;
sql_update += " ,rate_profit_actual=" + obj.rate_profit_actual;
obj.lastupdatetime = DateTime.Now; obj.lastupdatetime = DateTime.Now;
obj.lastupdateuserid = uid; obj.lastupdateuserid = uid;
obj.lastupdateusername = username; obj.lastupdateusername = username;
sql_update += $" ,lastupdatetime='{obj.lastupdatetime.ToString("yyyy-MM-dd HH:mm:ss")}',lastupdateuserid={obj.lastupdateuserid},lastupdateusername='{obj.lastupdateusername}'";
//sql_update += " where id="+obj.id;
#endregion #endregion
if (obj.id>0) if (obj.id>0)
...@@ -6424,6 +6402,84 @@ group by currency"; ...@@ -6424,6 +6402,84 @@ group by currency";
} }
} }
/// <summary>
///
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="col"></param>
/// <returns></returns>
public List<dc_base_finance_fee> ListMonthProfitFeeOrderDetail(BtTableParameter parameter,DateTime start,DateTime end,string col,ref int total)
{
var sql = $"select * from dc_base_finance_managecost where pay_time>='{start.ToString("yyyy-MM-dd")}' and pay_time<'{end.ToString("yyyy-MM-dd")}' ";
if (col.Trim() == "fee_paycash_sales") //付现
{
sql += @" and (company_name='香港百伦科技有限公司' or
(fee_super_type in ('推广费','物流费用') and company_name!='(英国)4kmiles technologies ltd'
and company_name!='香港四千里数据科技有限公司'
and company_name!='YOUNGTOP INTERNATIONAL LIMITED'
and company_name!='深圳市四千里数据科技有限公司'
and company_name!='4Kmiles tec Limited'
and company_name!='广州四千里数据科技有限公司'
and company_name!='广州哈倪蔓生物科技有限公司'
and company_name!='广州哈倪蔓生物科技有限公司深圳分公司'
and company_name!='广州拉古娜生物科技有限公司'
)) ";
}
else if (col.Trim() == "managecost_bl_gz") //广州百伦
{
sql += " and (company_name='广州百伦供应链科技有限公司' and fee_super_type!='推广费' and fee_super_type!='物流费用') ";
}
else if (col.Trim() == "managecost_meijia") //美甲
{
//歌戈儿
sql += " and (company_name like '%歌戈儿%' and fee_super_type!='推广费' and fee_super_type!='物流费用') ";
}
else if (col.Trim() == "managercost_chengpincang") //成品仓
{
sql += " and (company_name in ('广州电子服装仓','阳山仓') and fee_super_type!='推广费' and fee_super_type!='物流费用') ";
}
else if (col.Trim() == "managercost_yangshan") //扬杉
{
sql += " and (company_name like '%扬杉%' and fee_super_type!='推广费' and fee_super_type!='物流费用') ";
}
else if (col.Trim() == "managercost_xinhuilan") //信荟蓝
{
sql += " and (company_name like '%信荟蓝%' and fee_super_type!='推广费' and fee_super_type!='物流费用') ";
}
else if (col.Trim() == "managercost_meijiashengchan") //美甲生产仓
{
sql += " and (company_name like '%美甲生产仓%' and fee_super_type!='推广费' and fee_super_type!='物流费用') ";
}
else if (col.Trim() == "managercost_dizhi") //迪致美容
{
sql += " and (company_name like '%迪致美容%' and fee_super_type!='推广费' and fee_super_type!='物流费用') ";
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{
if(cn.State== ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.Page<dc_base_finance_fee>(parameter.pageIndex,parameter.limit,sql,ref total);
return obj.ToList();
}
}
#endregion #endregion
#region 应收账款 #region 应收账款
......
...@@ -9138,6 +9138,35 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -9138,6 +9138,35 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
/// <summary>
/// 费用明细
/// </summary>
/// <param name="month">月份</param>
/// <param name="col">字段类型</param>
/// <returns></returns>
public ActionResult MonthSaleProfitNew_FeeOrderDetail(string month,string col)
{
ViewBag.month = month;
ViewBag.col = col;
return View();
}
/// <summary>
/// 费用单明细
/// </summary>
/// <param name="parameter">分页信息</param>
/// <param name="month">月份</param>
/// <param name="col">字段类型</param>
/// <returns></returns>
public string MonthSaleProfitNew_FeeOrderDetailJson(BtTableParameter parameter,string month,string col)
{
return "";
}
#endregion #endregion
...@@ -9523,22 +9552,25 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -9523,22 +9552,25 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// oms发货收入 /// oms发货收入
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ActionResult ShippingIncoming() public ActionResult ShippingIncoming(int type=1)
{ {
ViewBag.type = type;
return View(); return View();
} }
/// <summary> /// <summary>
/// oms发货收入 /// oms发货收入
/// </summary> /// </summary>
/// <param name="type">1:自发货,2:FBA</param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public JsonResult ShippingIncomingJson(string month) public JsonResult ShippingIncomingJson(string month,int type)
{ {
try try
{ {
var result = new List<dc_month_shipping_incoming>(); var result = new List<dc_month_shipping_incoming>();
var list = new Services.FinanceReportServices().ListMonthShippingIncoming(month); var list = new Services.FinanceReportServices().ListMonthShippingIncoming(month,type==2);
//组装数据 //组装数据
list = list.OrderBy(a => a.platform_type).ToList(); list = list.OrderBy(a => a.platform_type).ToList();
...@@ -9608,12 +9640,18 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -9608,12 +9640,18 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
public ActionResult ExportShippingIncoming(string month) /// <summary>
///
/// </summary>
/// <param name="month"></param>
/// <param name="type">1:自发货,2:FBA</param>
/// <returns></returns>
public ActionResult ExportShippingIncoming(string month, int type)
{ {
try try
{ {
var result = new List<dc_month_shipping_incoming>(); var result = new List<dc_month_shipping_incoming>();
var obj = new Services.FinanceReportServices().ListMonthShippingIncoming(month); var obj = new Services.FinanceReportServices().ListMonthShippingIncoming(month, type == 2);
//组装数据 //组装数据
obj = obj.OrderBy(a => a.platform_type).ToList(); obj = obj.OrderBy(a => a.platform_type).ToList();
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
$.submit({ $.submit({
url: '@Url.Content("~/Reports/Finance/ShippingIncomingJson")', url: '@Url.Content("~/Reports/Finance/ShippingIncomingJson")',
type: 'POST', type: 'POST',
paramData: $("#toolbar").serialize(), paramData: $("#toolbar").serialize()+'&type=@(ViewBag.type)',
func: function (result) { func: function (result) {
if (result.success) { if (result.success) {
$('#tb').find('tbody').html(''); $('#tb').find('tbody').html('');
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
return; return;
} }
window.open('@Url.Content("~/Reports/Finance/ExportShippingIncoming?month=")' + mon, '_blank'); window.open('@Url.Content("~/Reports/Finance/ExportShippingIncoming?month=")' + mon+'&type=@(ViewBag.type)', '_blank');
} }
function clearHtml(s) { function clearHtml(s) {
......
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