Commit 7dd56f9d by zhouminghui

fix

parent 57100411
......@@ -68,35 +68,39 @@ namespace Bailun.DC.Models.WebApiModels
/// </summary>
[Description("仓储费")]
fee_logistics_storage = 4,
/// <summary>
///
/// </summary>
[Description("销售费用-税金")]
fee_sales_taxes = 5,
/// <summary>
/// 销售费用合计
/// </summary>
[Description("销售费用合计")]
fee_sales_count = 5,
fee_sales_count = 6,
/// <summary>
/// 管理成本合计
/// </summary>
[Description("管理成本合计")]
managercost_count = 6,
managercost_count = 7,
/// <summary>
/// 营业利润
/// </summary>
[Description("营业利润")]
profit = 7,
profit = 8,
/// <summary>
/// 实际利润
/// </summary>
[Description("实际利润")]
actual_profit = 8,
actual_profit = 9,
/// <summary>
/// 净利率
/// </summary>
[Description("净利率")]
rate_profit_actual = 9
rate_profit_actual = 10
}
}
......@@ -20,7 +20,7 @@ namespace Bailun.DC.Models.WebApiModels
public string DatacenterCol { get; set; }
public string Currency { get; set; }
public string ExchangeRate { get; set; }
public string AmountValRmb { get; set; }
public decimal? AmountValRmb { get; set; }
public string Month { get; set; }
}
}
......@@ -105,22 +105,37 @@ namespace Bailun.DC.Models.WebApiModels
public decimal fee_platform { get; set; }
/// <summary>
/// 平台扣费及退款
/// 广告及宣传费用
/// </summary>
[ParentName("平台费", ParentNameEnum.fee_platform)]
public decimal fee_platform_and_refund { get; set; }
[ParentName("广告及宣传费", ParentNameEnum.fee_platform)]
public decimal fee_ad { get; set; }
/// <summary>
/// FBA费
/// 佣金及平台费-亚马逊FBA
/// </summary>
[ParentName("FBA费", ParentNameEnum.fee_platform)]
[ParentName("佣金及平台费-亚马逊FBA", ParentNameEnum.fee_platform)]
public decimal fee_fba { get; set; }
/// <summary>
/// 广告及宣传费用
/// 佣金及平台费-亚马逊非FBA
/// </summary>
[ParentName("广告及宣传费", ParentNameEnum.fee_platform)]
public decimal fee_ad { get; set; }
[ParentName("佣金及平台费-亚马逊非FBA", ParentNameEnum.fee_platform)]
public decimal? fee_nofba { get; set; }//new
/// <summary>
/// 佣金及平台费-Ebay
/// </summary>
[ParentName("佣金及平台费-Ebay", ParentNameEnum.fee_platform)]
public decimal? fee_ebay { get; set; }//new
/// <summary>
/// 佣金及平台费-其他平台
/// </summary>
[ParentName("佣金及平台费-其他平台", ParentNameEnum.fee_platform)]
public decimal? fee_ohtre { get; set; }//new
///// <summary>
///// 平台扣费及退款
///// </summary>
//[ParentName("平台费", ParentNameEnum.fee_platform)]
//public decimal fee_platform_and_refund { get; set; }
/// <summary>
/// 物流仓储费用
/// </summary>
......@@ -131,41 +146,51 @@ namespace Bailun.DC.Models.WebApiModels
///// </summary>
//public decimal amount_withdraw { get; set; }
/// <summary>
/// 头程
/// 头程运输
/// </summary>
[ParentName("头程", ParentNameEnum.fee_logistics_storage)]
[ParentName("头程运输-平台", ParentNameEnum.fee_logistics_storage)]
public decimal fee_logistics_first { get; set; }
[ParentName("头程运输-非平台", ParentNameEnum.fee_logistics_storage)]
public decimal? fee_nologistics_first { get; set; }//new
/// <summary>
/// 直邮物流费 国内发货
/// </summary>
[ParentName("直邮物流费", ParentNameEnum.fee_logistics_storage)]
public decimal fee_logistics_direct { get; set; }
/// <summary>
/// 尾程费 国外发货
/// 尾程物流费
/// </summary>
[ParentName("尾程物流费", ParentNameEnum.fee_logistics_storage)]
[ParentName("尾程物流费-平台", ParentNameEnum.fee_logistics_storage)]
public decimal fee_logistics_tail { get; set; }
[ParentName("尾程物流费-非平台", ParentNameEnum.fee_logistics_storage)]
public decimal? fee_nologistics_tail { get; set; }//new
/// <summary>
/// 海外仓仓储
/// 直邮物流费
/// </summary>
[ParentName("海外仓仓储费", ParentNameEnum.fee_logistics_storage)]
public decimal fee_storage { get; set; }
[ParentName("直邮物流费-平台", ParentNameEnum.fee_logistics_storage)]
public decimal fee_logistics_direct { get; set; }
[ParentName("直邮物流费-非平台", ParentNameEnum.fee_logistics_storage)]
public decimal? fee_nologistics_direct { get; set; }//new
/// <summary>
/// 海外仓其他杂
/// 仓储
/// </summary>
[ParentName("海外仓其他杂费", ParentNameEnum.fee_logistics_storage)]
public decimal fee_storage_incidentals { get; set; }
[ParentName("仓储费-平台", ParentNameEnum.fee_logistics_storage)]
public decimal fee_storage { get; set; }
[ParentName("仓储费-非平台", ParentNameEnum.fee_logistics_storage)]
public decimal? fee_nostorage { get; set; }//new
/// <summary>
/// 付现销售费用
/// </summary>
[ParentName("付现销售费用", ParentNameEnum.fee_logistics_storage)]
public decimal fee_paycash_sales { get; set; }
///// <summary>
///// 海外仓其他杂费
///// </summary>
//[ParentName("海外仓其他杂费", ParentNameEnum.fee_logistics_storage)]
//public decimal fee_storage_incidentals { get; set; }
///// <summary>
///// 付现销售费用
///// </summary>
//[ParentName("付现销售费用", ParentNameEnum.fee_logistics_storage)]
//public decimal fee_paycash_sales { get; set; }
[ParentName("销售费用-税金", ParentNameEnum.fee_sales_taxes)]
public decimal? fee_sales_taxes { get; set; }//new
/// <summary>
/// 销售费用合计
/// </summary>
......@@ -194,49 +219,54 @@ namespace Bailun.DC.Models.WebApiModels
[ParentName("管理成本合计", ParentNameEnum.managercost_count)]
public decimal managercost_count { get; set; }
///// <summary>
///// 管理成本-香港百伦
///// </summary>
//[ParentName("香港百伦科技有限公司")]
//public decimal managecost_bl_xg { get; set; }
/// <summary>
/// 管理成本-广州百伦
/// </summary>
[ParentName("广州百伦供应链科技有限公司", ParentNameEnum.managercost_count)]
public decimal managecost_bl_gz { get; set; }
/// <summary>
/// 管理成本-美容美甲店
/// 管理成本-香港百伦
/// </summary>
[ParentName("广州歌戈儿生活科技有限公司", ParentNameEnum.managercost_count)]
public decimal managecost_meijia { get; set; }
[ParentName("香港百伦科技有限公司", ParentNameEnum.managercost_count)]
public decimal managecost_bl_xg { get; set; }
/// <summary>
/// 管理成本-杨杉
/// </summary>
[ParentName("深圳前海扬杉创新科技有限公司", ParentNameEnum.managercost_count)]
public decimal managercost_yangshan { get; set; }
/// <summary>
/// 管理成本-成品仓
/// </summary>
[ParentName("广州电子服装仓&阳山", ParentNameEnum.managercost_count)]
public decimal managercost_chengpincang { get; set; }
/// <summary>
/// 管理成本-信荟蓝
/// </summary>
[ParentName("广州信荟蓝科技有限公司", ParentNameEnum.managercost_count)]
public decimal managercost_xinhuilan { get; set; }
/// <summary>
/// 管理成本-广州电子服装仓
/// </summary>
[ParentName("广州电子服装仓", ParentNameEnum.managercost_count)]
public decimal? managercost_gzdz { get; set; }//new
[ParentName("阳山仓", ParentNameEnum.managercost_count)]
public decimal? managercost_ys { get; set; }//new
/// <summary>
/// 管理成本-美容美甲店
/// </summary>
[ParentName("广州歌戈儿生活科技有限公司(含分公司)", ParentNameEnum.managercost_count)]
public decimal managecost_meijia { get; set; }
/// <summary>
/// 迪致美容
/// </summary>
[ParentName("广州迪致美容科技有限公司", ParentNameEnum.managercost_count)]
public decimal managercost_dizhi { get; set; }
/// <summary>
/// 广州灵酷跨境科技有限公司
/// </summary>
[ParentName("广州灵酷跨境科技有限公司", ParentNameEnum.managercost_count)]
public decimal? managercost_gzlk { get; set; }//new
/// <summary>
/// 广州灵酷跨境科技有限公司
/// </summary>
[ParentName("广州崇瑜信息技术咨询有限公司", ParentNameEnum.managercost_count)]
public decimal? managercost_gzcy { get; set; }//new
///// <summary>
///// 广州美甲生产仓
///// </summary>
//public decimal managercost_meijiashengchan { get; set; }
/// <summary>
/// 营业利润
......@@ -276,11 +306,11 @@ namespace Bailun.DC.Models.WebApiModels
/// </summary>
[ParentName("减:营业外支出", ParentNameEnum.profit)]
public decimal pay_non_operating { get; set; }
/// <summary>
/// 减:资产减值损失
/// </summary>
[ParentName("减:资产减值损失", ParentNameEnum.profit)]
public decimal? impairment_assets { get; set; }
///// <summary>
///// 减:资产减值损失
///// </summary>
//[ParentName("减:资产减值损失", ParentNameEnum.profit)]
//public decimal? impairment_assets { get; set; }
/// <summary>
/// 实际利润
/// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models
{
/// <summary>
/// 预计销售利润表
/// </summary>
public class dc_month_sales_profit_v2
{
/// <summary>
/// auto_increment
/// </summary>
public int id { get; set; }
/// <summary>
/// 月份
/// </summary>
public string month { get; set; }
/// <summary>
/// 总销售额
/// </summary>
public decimal amount_sales { get; set; }
/// <summary>
/// 销售额-精油
/// </summary>
public decimal amount_sales_jingyou { get; set; }
/// <summary>
/// 销售额-电子
/// </summary>
public decimal amount_sales_dianzi { get; set; }
/// <summary>
/// 销售额-家居产品
/// </summary>
public decimal amount_sales_jiaju { get; set; }
/// <summary>
/// 销售额-美容美甲产品
/// </summary>
public decimal amount_sales_meirongmj { get; set; }
/// <summary>
/// 销售额-服装
/// </summary>
public decimal amount_sales_fuzhuang { get; set; }
/// <summary>
/// 销售额-其他
/// </summary>
public decimal amount_sales_other { get; set; }
/// <summary>
/// 总成本
/// </summary>
public decimal cost { get; set; }
/// <summary>
/// 精油成本
/// </summary>
public decimal cost_jingyou { get; set; }
/// <summary>
/// 电子成本
/// </summary>
public decimal cost_dianzi { get; set; }
/// <summary>
/// 家居成本
/// </summary>
public decimal cost_jiaju { get; set; }
/// <summary>
/// 美容美甲产品成本
/// </summary>
public decimal cost_meirongmj { get; set; }
/// <summary>
/// 服装成本
/// </summary>
public decimal cost_fuzhuang { get; set; }
/// <summary>
/// 其他成本
/// </summary>
public decimal cost_other { get; set; }
/// <summary>
/// 平台扣费及退款
/// </summary>
public decimal fee_platform_and_refund { get; set; }
/// <summary>
/// 平台费
/// </summary>
public decimal fee_platform { get; set; }
/// <summary>
/// FBA费
/// </summary>
public decimal fee_fba { get; set; }
/// <summary>
/// 广告及宣传费用
/// </summary>
public decimal fee_ad { get; set; }
/// <summary>
/// 平台退款
/// </summary>
public decimal fee_refund { get; set; }
/// <summary>
/// 平台提现回款
/// </summary>
public decimal amount_withdraw { get; set; }
/// <summary>
/// 物流仓储费用
/// </summary>
public decimal fee_logistics_storage { get; set; }
/// <summary>
/// 头程费
/// </summary>
public decimal fee_logistics_first { get; set; }
/// <summary>
/// 尾程费 国外发货
/// </summary>
public decimal fee_logistics_tail { get; set; }
/// <summary>
/// 直邮物流费 国内发货
/// </summary>
public decimal fee_logistics_direct { get; set; }
/// <summary>
/// 海外仓仓储
/// </summary>
public decimal fee_storage { get; set; }
/// <summary>
/// 海外仓其他杂费
/// </summary>
public decimal fee_storage_incidentals { get; set; }
/// <summary>
/// 付现销售费用
/// </summary>
public decimal fee_paycash_sales { get; set; }
/// <summary>
/// 销售费用合计
/// </summary>
public decimal fee_sales_count { get; set; }
/// <summary>
/// 销售利润
/// </summary>
public decimal profit_sales { get; set; }
/// <summary>
/// 销售毛利率
/// </summary>
public decimal rate_profit_sales { get; set; }
/// <summary>
/// 管理成本-香港百伦
/// </summary>
public decimal managecost_bl_xg { get; set; }
/// <summary>
/// 管理成本-广州百伦
/// </summary>
public decimal managecost_bl_gz { get; set; }
/// <summary>
/// 管理成本-美容美甲店
/// </summary>
public decimal managecost_meijia { get; set; }
/// <summary>
/// 管理成本-杨杉
/// </summary>
public decimal managercost_yangshan { get; set; }
/// <summary>
/// 管理成本-成品仓
/// </summary>
public decimal managercost_chengpincang { get; set; }
/// <summary>
/// 管理成本-信荟蓝
/// </summary>
public decimal managercost_xinhuilan { get; set; }
/// <summary>
/// 迪致美容
/// </summary>
public decimal managercost_dizhi { get; set; }
/// <summary>
/// 广州美甲生产仓
/// </summary>
public decimal managercost_meijiashengchan { get; set; }
/// <summary>
/// 管理成本合计
/// </summary>
public decimal managercost_count { get; set; }
/// <summary>
/// 财务费用
/// </summary>
public decimal fee_finance { get; set; }
/// <summary>
/// 营业利润
/// </summary>
public decimal profit { get; set; }
/// <summary>
/// 营业毛利率
/// </summary>
public decimal rate_profit { get; set; }
/// <summary>
/// 加:其他收入
/// </summary>
public decimal incoming_other { get; set; }
/// <summary>
/// 加:出口退税收入
/// </summary>
public decimal incoming_refundtax { get; set; }
/// <summary>
/// 加:歌戈尔收入
/// </summary>
public decimal incoming_gogirl { get; set; }
/// <summary>
/// 加:营业外收入
/// </summary>
public decimal incoming_non_operating { get; set; }
/// <summary>
/// 减:营业外支出
/// </summary>
public decimal pay_non_operating { get; set; }
/// <summary>
/// 实际利润
/// </summary>
public decimal actual_profit { get; set; }
/// <summary>
/// 减:分红
/// </summary>
public decimal dividend { get; set; }
/// <summary>
/// 利润结余
/// </summary>
public decimal profit_balance { get; set; }
/// <summary>
/// 净利润率
/// </summary>
public decimal rate_profit_actual { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新人
/// </summary>
public int lastupdateuserid { get; set; }
/// <summary>
/// 更新人
/// </summary>
public string lastupdateusername { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime lastupdatetime { get; set; }
/// <summary>
/// 是否编辑的版本,1:是,0:否
/// </summary>
public int isedit { get; set; }
/// <summary>
/// 减:资产减值损失
/// </summary>
public decimal? impairment_assets { get; set; }
/// <summary>
/// 佣金及平台费-亚马逊非FBA
/// </summary>
public decimal fee_nofba { get; set; }//new
/// <summary>
/// 佣金及平台费-Ebay
/// </summary>
public decimal fee_ebay { get; set; }//new
/// <summary>
/// 佣金及平台费-其他平台
/// </summary>
public decimal fee_ohtre { get; set; }//new
/// <summary>
/// 头程运输-非平台
/// </summary>
public decimal fee_nologistics_first { get; set; }//new
/// <summary>
/// 尾程物流费-非平台
/// </summary>
public decimal fee_nologistics_tail { get; set; }//new
/// <summary>
/// 直邮物流费-非平台
/// </summary>
public decimal fee_nologistics_direct { get; set; }//new
/// <summary>
/// 仓储费-非平台
/// </summary>
public decimal fee_nostorage { get; set; }//new
/// <summary>
/// 销售费用-税金
/// </summary>
public decimal fee_sales_taxes { get; set; }//new
/// <summary>
/// 广州电子服装仓
/// </summary>
public decimal managercost_gzdz { get; set; }//new
/// <summary>
/// 阳山仓
/// </summary>
public decimal managercost_ys { get; set; }//new
/// <summary>
/// 广州灵酷跨境科技有限公司
/// </summary>
public decimal managercost_gzlk { get; set; }//new
/// <summary>
/// 广州崇瑜信息技术咨询有限公司
/// </summary>
public decimal managercost_gzcy { get; set; }//new
}
}
......@@ -447,7 +447,7 @@ and s1.management_cost_name = @managementcostname";
/// <returns></returns>
public List<MonthSalesProfitDto> ListMonthSaleProfitNew(string start, string end)
{
var sql = $"select * from dc_month_sales_profit where month>='{start}' ";
var sql = $"select * from dc_month_sales_profit_v2 where month>='{start}' ";
if (!string.IsNullOrEmpty(end))
{
......@@ -554,11 +554,11 @@ and s1.management_cost_name = @managementcostname";
cn.Open();
}
input.Month = input.Month.Replace("月份", "");
var sql = $"select * from dc_month_sales_profit where isedit = 1 and month = '{input.Month}'";
var obj = SimpleCRUD.Query<dc_month_sales_profit>(sql, null, GlobalConfig.ConnectionString).FirstOrDefault();
var sql = $"select * from dc_month_sales_profit_v2 where isedit = 1 and month = '{input.Month}'";
var obj = SimpleCRUD.Query<dc_month_sales_profit_v2>(sql, null, GlobalConfig.ConnectionString).FirstOrDefault();
if (obj == null)
{
obj = new dc_month_sales_profit
obj = new dc_month_sales_profit_v2
{
month = input.Month,
amount_sales = 0,
......@@ -614,6 +614,19 @@ and s1.management_cost_name = @managementcostname";
cost_other = 0,
managercost_xinhuilan = 0,
impairment_assets = 0,
fee_nofba = 0,
fee_ebay = 0,
fee_ohtre = 0,
fee_nologistics_first = 0,
fee_nologistics_tail = 0,
fee_nologistics_direct = 0,
fee_nostorage = 0,
fee_sales_taxes = 0,
managercost_gzdz = 0,
managercost_ys = 0,
managercost_gzlk = 0,
managercost_gzcy = 0,
};
}
var type = obj.GetType();
......@@ -733,22 +746,28 @@ or (is_lend=2 and cost_form=1)) and pay_time>= @start and pay_time< @end ");
parameters.Add("start", start);
parameters.Add("end", end);
if (feeName == "广州歌戈儿生活科技有限公司")
{
sql.Append(" and (company_name like '%歌戈儿%' and (type_name!='销售收入' and type_name!='出口退税款')) ");
}
else if (feeName.Contains("广州电子服装仓&阳山"))
if (feeName.Contains("广州歌戈儿生活科技有限公司"))
{
sql.Append(" and (company_name in ('广州电子服装仓','阳山仓') and type_name!='出口退税款') ");
sql.Append(" and company_name like '%歌戈儿%' ");
//sql.Append(" and (company_name like '%歌戈儿%' and (type_name!='销售收入' and type_name!='出口退税款')) ");
}
//else if (feeName.Contains("广州电子服装仓&阳山"))
//{
// sql.Append(" and (company_name in ('广州电子服装仓','阳山仓') and type_name!='出口退税款') ");
//}
else
{
sql.Append(" and (company_name =@feeName and type_name!='出口退税款') ");
//sql.Append(" and (company_name =@feeName and type_name!='出口退税款') ");
sql.Append(" and company_name =@feeName ");
parameters.Add("feeName", feeName);
}
return sql.ToString();
}
/// <summary>
/// 查询平台数据
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public CommonApiResponseDto<PageResult<List<MonthPlatformProfitDto>>> GetMonthProfitFeePlatformFeeDetail(GetMonthProfitPlatformDetailInput input)
{
var sql = BuildMonthProfitFeePlatformFeeDetailSql(input, out DynamicParameters param);
......@@ -770,7 +789,7 @@ or (is_lend=2 and cost_form=1)) and pay_time>= @start and pay_time< @end ");
{
Currency = "合计",
AmountVal = Math.Round(count.Item1, 2).ToString(),
AmountValRmb = Math.Round(count.Item2, 2).ToString(),
AmountValRmb = Math.Round(count.Item2, 2),
});
}
result = result.ToPageResult(input.PageIndex, total, data);
......@@ -779,7 +798,14 @@ or (is_lend=2 and cost_form=1)) and pay_time>= @start and pay_time< @end ");
return new CommonApiResponseDto<PageResult<List<MonthPlatformProfitDto>>> { Data = result };
}
/// <summary>
/// 生成平台SQL
/// </summary>
/// <param name="input"></param>
/// <param name="parameters"></param>
/// <param name="isPage"></param>
/// <param name="isSum"></param>
/// <returns></returns>
public string BuildMonthProfitFeePlatformFeeDetailSql(GetMonthProfitPlatformDetailInput input, out DynamicParameters parameters, bool isPage = false,bool isSum = false)
{
parameters = new DynamicParameters();
......@@ -804,14 +830,14 @@ JOIN order_fee_config s2
ON s2.id = s1.order_fee_config_id WHERE s1.amountval != 0 AND s1.month = @month ");
}
parameters.Add("month", input.Month);
if (input.FeeName == "FBA费")
{
sql.Append("AND s2.datacenter_col LIKE '%佣金及平台费-亚马逊FBA%'");
}
else
{
sql.Append($"AND s2.datacenter_col LIKE '%{input.FeeName}%'");
}
//if (input.FeeName == "FBA费")
//{
// sql.Append("AND s2.datacenter_col LIKE '%佣金及平台费-亚马逊FBA%'");
//}
//else
//{
sql.Append($"AND s2.datacenter_col LIKE '%{input.FeeName}'");
//}
if (isPage)
{
//sql.Append($" LIMIT {input.PageNumber} OFFSET {(input.PageIndex - 1) * input.PageNumber}");
......@@ -821,6 +847,11 @@ ON s2.id = s1.order_fee_config_id WHERE s1.amountval != 0 AND s1.month = @month
}
return sql.ToString();
}
/// <summary>
/// 导出平台费用信息
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public List<MonthPlatformProfitDto> ExportMonthProfitFeePlatformFeeDetail(GetMonthProfitPlatformDetailInput input)
{
var sql = BuildMonthProfitFeePlatformFeeDetailSql(input, out DynamicParameters parameters, false, false);
......@@ -955,7 +986,7 @@ ORDER BY t1.createtime DESC ";
}
else
{
data = SimpleCRUD.Query<dc_month_sales_profit_orderdetail>(sql, null, GlobalConfig.ConnectionString).ToList();
data = SimpleCRUD.Query<dc_month_sales_profit_orderdetail>(sql, parameters, GlobalConfig.ConnectionString).ToList();
}
data = data.Select(a =>
{
......@@ -977,5 +1008,143 @@ ORDER BY t1.createtime DESC ";
return new CommonApiResponseDto<PageResult<List<dc_month_sales_profit_orderdetail>>> { Data = result };
}
#endregion
#region 同步数据
/// <summary>
/// 拉取旧的dc_month_sales_profit表数据到新表,生成新的汇总数据
/// </summary>
public bool SyncMonthSalesProfit(DateTime date)
{
try
{
//拉取旧表数据
var time = string.Empty;
#if DEBUG
time = date.ToString("yyyy-MM");
#else
time = DateTime.Now.AddMonths(-1).ToString("yyyy-MM")
#endif
var sql = $"select * from dc_month_sales_profit where isedit != 1 and month = '{time}'";
var oldData = SimpleCRUD.Query<dc_month_sales_profit_v2>(sql, null, GlobalConfig.ConnectionString).FirstOrDefault();
//对旧表数据进行赋值新数据
//var field = new MonthSalesProfitDto();
//var name = field.amount_sales_jingyou.GetType().GetCustomAttribute<System.ComponentModel.DisplayNameAttribute>().DisplayName;
//销售额
oldData.amount_sales_jingyou = Math.Round(GetPlatformTypeMonthlyStatistics(time, "精油产品").Sum(x => x.total_amount_sales), 2);
oldData.amount_sales_dianzi = Math.Round(GetPlatformTypeMonthlyStatistics(time, "电子产品").Sum(x => x.total_amount_sales), 2);
oldData.amount_sales_jiaju = Math.Round(GetPlatformTypeMonthlyStatistics(time, "家居产品").Sum(x => x.total_amount_sales), 2);
oldData.amount_sales_meirongmj = Math.Round(GetPlatformTypeMonthlyStatistics(time, "美容美甲产品").Sum(x => x.total_amount_sales), 2);
oldData.amount_sales_fuzhuang = Math.Round(GetPlatformTypeMonthlyStatistics(time, "服装").Sum(x => x.total_amount_sales), 2);
oldData.amount_sales_other = Math.Round(GetPlatformTypeMonthlyStatistics(time, "其他").Sum(x => x.total_amount_sales), 2);
oldData.fee_refund = Math.Round(GetMonthProfitPlatformPlatformSummary(new GetMonthProfitPlatformDetailInput { Month = time }).Data.Sum(x => x.RefundRmb.Value), 2);//取数待定
//成本
oldData.cost_jingyou = Math.Round(GetPlatformTypeMonthlyStatistics(time, "精油产品").Sum(x => x.total_amount_sales), 2);
oldData.cost_dianzi = Math.Round(GetPlatformTypeMonthlyStatistics(time, "电子产品").Sum(x => x.total_amount_sales), 2);
oldData.cost_jiaju = Math.Round(GetPlatformTypeMonthlyStatistics(time, "家居产品").Sum(x => x.total_amount_sales), 2);
oldData.cost_meirongmj = Math.Round(GetPlatformTypeMonthlyStatistics(time, "美容美甲产品").Sum(x => x.total_amount_sales), 2);
oldData.cost_fuzhuang = Math.Round(GetPlatformTypeMonthlyStatistics(time, "服装").Sum(x => x.total_amount_sales), 2);
oldData.cost_other = Math.Round(GetPlatformTypeMonthlyStatistics(time, "其他").Sum(x => x.total_amount_sales), 2);
//平台费用
oldData.fee_ad = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "广告及宣传费" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_fba = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-亚马逊FBA" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_nofba = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-亚马逊非FBA" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_ebay = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-Ebay" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_ohtre = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-其他平台" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
//物流仓储费用
oldData.fee_logistics_first = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "头程运输-平台" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_nologistics_first = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "头程运输-非平台" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_logistics_tail = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "尾程物流费-平台" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_nologistics_tail = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "尾程物流费-非平台" })
.Where(m=>m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_logistics_direct = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "直邮物流费-平台" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_nologistics_direct = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "直邮物流费-非平台" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_storage = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "仓储费-平台" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
oldData.fee_nostorage = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "仓储费-非平台" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
//加:营业外收入
oldData.incoming_non_operating = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外收入" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
//减:营业外支出
oldData.pay_non_operating = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外支出" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
//销售费用-税金
oldData.fee_sales_taxes = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "税金" })
.Where(m => m.AmountValRmb != null).Sum(x => x.AmountValRmb.Value), 2);
//管理成本
var bl_xg = GetMonthProfitFeeManagementCostDetail(time, "香港百伦科技有限公司").Data;
var bl_gz = GetMonthProfitFeeManagementCostDetail(time, "广州百伦供应链科技有限公司").Data;
var meijia = GetMonthProfitFeeManagementCostDetail(time, "广州歌戈儿生活科技有限公司").Data;
var yangshan = GetMonthProfitFeeManagementCostDetail(time, "深圳前海扬杉创新科技有限公司").Data;
var xinhuilan = GetMonthProfitFeeManagementCostDetail(time, "广州信荟蓝科技有限公司").Data;
var gzdz = GetMonthProfitFeeManagementCostDetail(time, "广州电子服装仓").Data;
var ys = GetMonthProfitFeeManagementCostDetail(time, "阳山仓").Data;
var dizhi = GetMonthProfitFeeManagementCostDetail(time, "广州迪致美容科技有限公司").Data;
var gzlk = GetMonthProfitFeeManagementCostDetail(time, "广州灵酷跨境科技有限公司").Data;
var gzcy = GetMonthProfitFeeManagementCostDetail(time, "广州崇瑜信息技术咨询有限公司").Data;
oldData.managecost_bl_xg = Math.Round(bl_xg.Count == 0 ? 0 : bl_xg.Last().AmountRmb.Value, 2);
oldData.managecost_bl_gz = Math.Round(bl_gz.Count == 0 ? 0 : bl_gz.Last().AmountRmb.Value, 2);
oldData.managecost_meijia = Math.Round(meijia.Count == 0 ? 0 : meijia.Last().AmountRmb.Value, 2);
oldData.managercost_yangshan = Math.Round(yangshan.Count == 0 ? 0 : yangshan.Last().AmountRmb.Value, 2);
oldData.managercost_xinhuilan = Math.Round(xinhuilan.Count == 0 ? 0 : xinhuilan.Last().AmountRmb.Value, 2);
oldData.managercost_gzdz = Math.Round(gzdz.Count == 0 ? 0 : gzdz.Last().AmountRmb.Value, 2);
oldData.managercost_ys = Math.Round(ys.Count == 0 ? 0 : ys.Last().AmountRmb.Value, 2);
oldData.managercost_dizhi = Math.Round(dizhi.Count == 0 ? 0 : dizhi.Last().AmountRmb.Value, 2);
oldData.managercost_gzlk = Math.Round(gzlk.Count == 0 ? 0 : gzlk.Last().AmountRmb.Value, 2);
oldData.managercost_gzcy = Math.Round(gzcy.Count == 0 ? 0 : gzcy.Last().AmountRmb.Value, 2);
oldData.profit_sales = Math.Round(GetMonthSalesProfitDetail(new MonthProfitOrderDetailPageInputDto { Month = time }, false)
.Data.Data.Sum(x => x.sale_profit), 2);
//保存
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var result = cn.Update(oldData);
}
return true;
}
catch (Exception e)
{
return false;
}
}
#endregion
}
}
......@@ -238,7 +238,7 @@ namespace Bailun.DC.WebApi.Controllers
cost_fuzhuang = editModel.cost_fuzhuang + item.cost_fuzhuang,
cost_other = editModel.cost_other + item.cost_other,
fee_platform = editModel.fee_platform + item.fee_platform,
fee_platform_and_refund = editModel.fee_platform_and_refund + item.fee_platform_and_refund,
//fee_platform_and_refund = editModel.fee_platform_and_refund + item.fee_platform_and_refund,
fee_fba = editModel.fee_fba + item.fee_fba,
fee_ad = editModel.fee_ad + item.fee_ad,
fee_logistics_storage = editModel.fee_logistics_storage + item.fee_logistics_storage,
......@@ -246,8 +246,8 @@ namespace Bailun.DC.WebApi.Controllers
fee_logistics_direct = editModel.fee_logistics_direct + item.fee_logistics_direct,
fee_logistics_tail = editModel.fee_logistics_tail + item.fee_logistics_tail,
fee_storage = editModel.fee_storage + item.fee_storage,
fee_storage_incidentals = editModel.fee_storage_incidentals + item.fee_storage_incidentals,
fee_paycash_sales = editModel.fee_paycash_sales + item.fee_paycash_sales,
//fee_storage_incidentals = editModel.fee_storage_incidentals + item.fee_storage_incidentals,
//fee_paycash_sales = editModel.fee_paycash_sales + item.fee_paycash_sales,
fee_sales_count = editModel.fee_sales_count + item.fee_sales_count,
profit_sales = editModel.profit_sales + item.profit_sales,
rate_profit_sales = editModel.rate_profit_sales + item.rate_profit_sales,
......@@ -256,7 +256,7 @@ namespace Bailun.DC.WebApi.Controllers
managecost_bl_gz = editModel.managecost_bl_gz + item.managecost_bl_gz,
managecost_meijia = editModel.managecost_meijia + item.managecost_meijia,
managercost_yangshan = editModel.managercost_yangshan + item.managercost_yangshan,
managercost_chengpincang = editModel.managercost_chengpincang + item.managercost_chengpincang,
//managercost_chengpincang = editModel.managercost_chengpincang + item.managercost_chengpincang,
managercost_xinhuilan = editModel.managercost_xinhuilan + item.managercost_xinhuilan,
managercost_dizhi = editModel.managercost_dizhi + item.managercost_dizhi,
profit = editModel.profit + item.profit,
......@@ -266,9 +266,23 @@ namespace Bailun.DC.WebApi.Controllers
incoming_gogirl = editModel.incoming_gogirl + item.incoming_gogirl,
incoming_non_operating = editModel.incoming_non_operating + item.incoming_non_operating,
pay_non_operating = editModel.pay_non_operating + item.pay_non_operating,
impairment_assets = editModel.impairment_assets + item.impairment_assets,
//impairment_assets = editModel.impairment_assets + item.impairment_assets,
actual_profit = editModel.actual_profit + item.actual_profit,
rate_profit_actual = editModel.rate_profit_actual + item.rate_profit_actual,
managercost_gzcy = editModel.managercost_gzcy + item.managercost_gzcy,
managercost_gzlk = editModel.managercost_gzlk + item.managercost_gzlk,
managercost_ys = editModel.managercost_ys + item.managercost_ys,
managercost_gzdz = editModel.managercost_gzdz + item.managercost_gzdz,
fee_sales_taxes = editModel.fee_sales_taxes + item.fee_sales_taxes,
fee_nostorage = editModel.fee_nostorage + item.fee_nostorage,
fee_nologistics_direct = editModel.fee_nologistics_direct + item.fee_nologistics_direct,
fee_nologistics_tail = editModel.fee_nologistics_tail + item.fee_nologistics_tail,
fee_nologistics_first = editModel.fee_nologistics_first + item.fee_nologistics_first,
fee_ohtre = editModel.fee_ohtre + item.fee_ohtre,
fee_ebay = editModel.fee_ebay + item.fee_ebay,
fee_nofba = editModel.fee_nofba + item.fee_nofba,
isedit = 2
});
}
......@@ -495,11 +509,12 @@ namespace Bailun.DC.WebApi.Controllers
}
[HttpGet("getReFundTest")]
public object GetReFundTest()
public object GetReFundTest(DateTime time)
{
var sql = "select * from dc_month_sales_profit_orderdetail limit 1";
var data = Dapper.SimpleCRUD.Query<dc_month_sales_profit_orderdetail>(sql, null, Common.GlobalConfig.ConnectionString).FirstOrDefault();
return data;
return new FinanceService().SyncMonthSalesProfit(time);
//var sql = "select * from dc_month_sales_profit_orderdetail limit 1";
//var data = Dapper.SimpleCRUD.Query<dc_month_sales_profit_orderdetail>(sql, null, Common.GlobalConfig.ConnectionString).FirstOrDefault();
//return data;
}
#endregion
}
......
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