Commit 15492610 by guanzhenshan

解决财务费用数据不对的问题

parent 05b3c93b
...@@ -550,5 +550,10 @@ namespace Bailun.DC.Models.Orders ...@@ -550,5 +550,10 @@ namespace Bailun.DC.Models.Orders
/// 货值 /// 货值
/// </summary> /// </summary>
public decimal? productvalue { get; set; } public decimal? productvalue { get; set; }
/// <summary>
/// 尾程费 (按公式计算的)
/// </summary>
public decimal cost_logistics { get; set; }
} }
} }
...@@ -1033,18 +1033,17 @@ namespace Bailun.DC.Services ...@@ -1033,18 +1033,17 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListFinanceFee(BtTableParameter parameter, string platform, int feetype, int feecharacter, string account, DateTime? start, DateTime? end, string orderno, int? companyid, ref int total) public List<Models.Orders.dc_base_oms_sku> ListFinanceFee(BtTableParameter parameter, string platform, int feetype, int feecharacter, string account, DateTime? start, DateTime? end, string orderno, int? companyid, ref int total)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
var sql = "select t1.origin_order_id,t1.platform_type,t1.website,t1.seller_account,t1.platform_order_type,t1.bailun_sku,t1.amount_product,t1.cost_first,t1.amount_shipping,t1.cost_promotion,t1.cost_shipping,t1.cost_fba_fee,t1.cost_platform_fee,t1.cost_package,t1.amount_total,t1.cost_total+t1.cost_shipping as cost_total,t1.paid_time,t1.seller_order_exchange_rate,t1.finance_order_exchange_rate from dc_base_oms_sku t1"; var sql = "select t1.origin_order_id,t1.platform_type,t1.website,t1.seller_account,(t1.amount_sales*t1.seller_order_exchange_rate) amount_sales,(t1.cost_platform_fee*if(t1.platform_type='Ebay',t1.seller_other_exchange_rate,t1.seller_order_exchange_rate)) cost_platform_fee,(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,t1.cost_first,(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping,t1.cost_logistics,(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,t1.cost_total,t1.amount_total,t1.paid_time from dc_base_oms_order t1";
sql += " where t1.bailun_order_status!='Canceled' and ((t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle') or t1.platform_type='FBA') and t1.has_scalp=0 and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') ";
if (companyid.HasValue && companyid.Value > 0) if (companyid.HasValue && companyid.Value > 0)
{ {
sql += " join dc_base_oms_order t2 on t1.bailun_order_id=t2.bailun_order_id "; sql += " and t1.company_id=" + companyid.Value; //增加公司id过滤
sql += " and t2.company_id=" + companyid.Value; //增加公司id过滤
} }
sql += " where t1.bailun_order_status!='Canceled' and ((t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle') or t1.platform_type='FBA') and t1.has_scalp=0 and t1.has_innersale=0 and t1.has_delete=0 and t1.bailun_interception_status in ('None','Failed') ";
if (!string.IsNullOrWhiteSpace(platform)) if (!string.IsNullOrWhiteSpace(platform))
{ {
if (platform.ToUpper() == "AMAZON") if (platform.ToUpper() == "AMAZON")
...@@ -1121,7 +1120,7 @@ namespace Bailun.DC.Services ...@@ -1121,7 +1120,7 @@ namespace Bailun.DC.Services
public Models.Orders.dc_base_oms_sku ListFinanceFeeCount(string platform, int feetype, int feecharacter, string account, DateTime? start, DateTime? end, string orderno, int? companyid) public Models.Orders.dc_base_oms_sku ListFinanceFeeCount(string platform, int feetype, int feecharacter, string account, DateTime? start, DateTime? end, string orderno, int? companyid)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
var sql = "select sum(t1.amount_product) amount_product,sum(t1.cost_first) cost_first,sum(t1.amount_shipping) amount_shipping,sum(t1.cost_promotion) cost_promotion,sum(t1.cost_shipping) cost_shipping,sum(t1.cost_fba_fee) cost_fba_fee,sum(t1.cost_platform_fee) cost_platform_fee,sum(t1.cost_package) cost_package,sum(t1.amount_total) amount_total,sum(t1.cost_total+t1.cost_shipping) as cost_total from dc_base_oms_sku t1 "; var sql = "select sum(t1.amount_sales*t1.seller_order_exchange_rate) amount_sales,sum(t1.cost_platform_fee*if(t1.platform_type='Ebay',t1.seller_other_exchange_rate,t1.seller_order_exchange_rate)) cost_platform_fee,sum(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,sum(t1.cost_first) cost_first,sum(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping,sum(t1.cost_logistics) cost_logistics,sum(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,sum(t1.cost_total) cost_total,sum(t1.amount_total) amount_total from dc_base_oms_order t1";
if (companyid.HasValue && companyid.Value > 0) if (companyid.HasValue && companyid.Value > 0)
{ {
...@@ -1129,7 +1128,7 @@ namespace Bailun.DC.Services ...@@ -1129,7 +1128,7 @@ namespace Bailun.DC.Services
sql += " and t2.company_id=" + companyid.Value; //增加公司id过滤 sql += " and t2.company_id=" + companyid.Value; //增加公司id过滤
} }
sql += " where t1.bailun_order_status!='Canceled' and ((t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle') or t1.platform_type='FBA') and t1.has_scalp=0 and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') "; sql += " where t1.bailun_order_status!='Canceled' and ((t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle') or t1.platform_type='FBA') and t1.has_scalp=0 and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') ";
if (!string.IsNullOrWhiteSpace(platform)) if (!string.IsNullOrWhiteSpace(platform))
{ {
......
...@@ -2913,7 +2913,6 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2913,7 +2913,6 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
#endregion #endregion
#region Common #region Common
...@@ -2948,5 +2947,16 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2948,5 +2947,16 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
#endregion #endregion
#region 采购入库、调拨入库、发货、调拨出库
public ActionResult FinanceExpore()
{
return View();
}
#endregion
} }
} }
\ No newline at end of file
...@@ -507,55 +507,61 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -507,55 +507,61 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32(); var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var total = 0; var total = 0;
var service = new Services.OrdersServices(); var service = new Services.OrdersServices();
var objwithdraw = new Services.PlatformSiteServices().GetPlatformLossWithdraw().Where(a => a.english_name == platform).FirstOrDefault();
var obj = service.ListFinanceFee(parameter, platform, feetype, feecharacter, account, start, end, orderno,companyid, ref total); var obj = service.ListFinanceFee(parameter, platform, feetype, feecharacter, account, start, end, orderno,companyid, ref total);
var countM = service.ListFinanceFeeCount(platform, feetype, feecharacter, account, start, end, orderno,companyid); var countM = service.ListFinanceFeeCount(platform, feetype, feecharacter, account, start, end, orderno,companyid);
countM.amount_adjustment = Math.Round(countM.amount_adjustment, 2, MidpointRounding.AwayFromZero); countM.amount_sales = Math.Round(countM.amount_sales, 2);
countM.amount_gift_wrap = Math.Round(countM.amount_gift_wrap, 2, MidpointRounding.AwayFromZero); countM.cost_platform_fee = Math.Round(countM.cost_platform_fee, 2);
countM.amount_product = Math.Round(countM.amount_product, 2, MidpointRounding.AwayFromZero); countM.amount_shipping = Math.Round(countM.amount_shipping, 2);
countM.amount_refund = Math.Round(countM.amount_refund, 2, MidpointRounding.AwayFromZero); countM.cost_promotion = Math.Round(countM.cost_promotion, 2);
countM.amount_shipping = Math.Round(countM.amount_shipping, 2, MidpointRounding.AwayFromZero); countM.cost_first = Math.Round(countM.cost_first, 2);
countM.amount_tax = Math.Round(countM.amount_tax, 2, MidpointRounding.AwayFromZero); countM.cost_logistics = Math.Round(countM.cost_logistics, 2);
countM.amount_total = Math.Round(countM.amount_total, 2, MidpointRounding.AwayFromZero); countM.cost_fba_fee = Math.Round(countM.cost_fba_fee, 2);
countM.platform_fee_rate = countM.amount_sales>0?Math.Round((countM.cost_platform_fee / countM.amount_sales * 100), 2):0;
//countM.cost_estimate_logistics = Math.Round(countM.cost_estimate_logistics, 2, MidpointRounding.AwayFromZero); countM.losswithdrawal = Math.Round((countM.amount_sales * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0) > 0 ? (countM.amount_sales * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0)) : 0), 2);
countM.cost_fba_fee = Math.Round(countM.cost_fba_fee, 2, MidpointRounding.AwayFromZero); countM.amount_total = Math.Round(countM.amount_total, 2);
countM.cost_first = Math.Round(countM.cost_first, 2, MidpointRounding.AwayFromZero); countM.cost_total = Math.Round(countM.cost_total, 2);
countM.cost_package = Math.Round(countM.cost_package, 2, MidpointRounding.AwayFromZero);
countM.cost_paypal_fee = Math.Round(countM.cost_paypal_fee, 2, MidpointRounding.AwayFromZero); countM.bailun_sku = "总计:";
countM.cost_platform_fee = Math.Round(countM.cost_platform_fee, 2, MidpointRounding.AwayFromZero);
countM.cost_product = Math.Round(countM.cost_product, 2, MidpointRounding.AwayFromZero);
countM.cost_promotion = Math.Round(countM.cost_promotion, 2, MidpointRounding.AwayFromZero);
countM.cost_refund_commisson = Math.Round(countM.cost_refund_commisson, 2, MidpointRounding.AwayFromZero);
countM.cost_shipping = Math.Round(countM.cost_shipping, 2, MidpointRounding.AwayFromZero);
countM.cost_total = Math.Round(countM.cost_total, 2, MidpointRounding.AwayFromZero);
countM.profit_total = Math.Round(countM.profit_total, 2, MidpointRounding.AwayFromZero);
countM.website = "总计:";
var list = obj.Select(p => new { var list = obj.Select(p => new {
p.origin_order_id, p.origin_order_id,
p.platform_type, p.platform_type,
p.website, p.website,
p.seller_account, p.seller_account,
p.platform_order_type,
p.bailun_sku, p.bailun_sku,
amount_product = p.amount_product>0? (p.amount_product*p.seller_order_exchange_rate).ToString("N2"):"0", amount_sales = p.amount_sales.ToString("N2"),
cost_first = p.cost_first>0? p.cost_first.ToString("N2") :"0", cost_platform_fee = p.cost_platform_fee.ToString("N2"),
amount_shipping = p.amount_shipping>0? (p.amount_shipping * p.seller_order_exchange_rate).ToString("N2") :"0", amount_shipping = p.amount_shipping.ToString("N2"),
cost_promotion= p.cost_promotion>0? (p.cost_promotion * p.seller_order_exchange_rate).ToString("N2") :"0", cost_promotion = p.cost_promotion.ToString("N2"),
cost_shipping = p.cost_shipping>0? p.cost_shipping.ToString("N2") :"0", cost_first = p.cost_first.ToString("N2"),
cost_fba_fee = p.cost_fba_fee>0? (p.cost_fba_fee * p.seller_order_exchange_rate).ToString("N2") :"0", cost_logistics = p.cost_logistics.ToString("N2"),
cost_platform_fee = p.cost_platform_fee>0? (p.cost_platform_fee * p.seller_order_exchange_rate).ToString("N2") :"0", cost_fba_fee = p.cost_fba_fee.ToString("N2"),
platform_fee_rate = (p.cost_platform_fee/ p.amount_product *100).ToString("N2"), platform_fee_rate = p.amount_sales>0?(p.cost_platform_fee/ p.amount_sales * 100).ToString("N2"):"0",
cost_package = p.cost_package>0? p.cost_package.ToString("N2") :"0", losswithdrawal = (p.amount_sales * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0)) > 0 ? (p.amount_sales * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0)).ToString("N2") : "0",
losswithdrawal = p.losswithdrawal>0? p.losswithdrawal.ToString("N2") :"0", amount_total = p.amount_total.ToString("N2"),
amount_total = p.amount_total>0? p.amount_total.ToString("N2") :"0", cost_total = p.cost_total.ToString("N2"),
cost_total = p.cost_total>0? p.cost_total.ToString("N2") :"0",
paid_time = p.paid_time.ToString("yyyy-MM-dd HH:mm:ss") paid_time = p.paid_time.ToString("yyyy-MM-dd HH:mm:ss")
}); });
return JsonConvert.SerializeObject(new { total = total, rows = list,count_row=countM }); return JsonConvert.SerializeObject(new { total = total, rows = list,count_row=new {
bailun_sku = "总计",
amount_sales = countM.amount_sales.ToString("N2"),
cost_platform_fee = countM.cost_platform_fee.ToString("N2"),
amount_shipping = countM.amount_shipping.ToString("N2"),
cost_promotion = countM.cost_promotion.ToString("N2"),
cost_first = countM.cost_first.ToString("N2"),
cost_logistics = countM.cost_logistics.ToString("N2"),
cost_fba_fee = countM.cost_fba_fee.ToString("N2"),
platform_fee_rate = countM.platform_fee_rate.ToString("N2"),
losswithdrawal = countM.losswithdrawal.ToString("N2"),
amount_total = countM.amount_total.ToString("N2"),
cost_total = countM.cost_total.ToString("N2"),
}
});
} }
/// <summary> /// <summary>
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<label>付款时间</label> <label>付款时间</label>
<input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"))" /> <input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"))" />
<span>至</span> <span>至</span>
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.ToString("yyyy-MM-dd"))" /> <input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />
</div> </div>
<div class="form-group"> <div class="form-group">
<label>&nbsp;</label> <label>&nbsp;</label>
...@@ -87,23 +87,19 @@ ...@@ -87,23 +87,19 @@
return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account+'</div>'; return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account+'</div>';
} }
}, },
{ field: 'platform_order_type', title: '订单类型', width: '100', sortable: true }, //{ field: 'bailun_sku', title: 'Sku', width: '100', iscount: true },
{ { field: 'amount_sales', title: '销售额', width: '100', sortable: true, iscount: true },
field: 'bailun_sku', title: '产品库sku', width: '130', sortable: true, iscount: true, formatter: function (idx, data) { { field: 'cost_platform_fee', title: '平台费', width: '100', sortable: true, iscount: true },
return '<div class="mules" title="' + data.bailun_sku + '">' + data.bailun_sku + '</div>'; { field: 'amount_shipping', title: '运费收入', width: '90', sortable: true, iscount: true },
}
},
{ field: 'amount_product', title: 'sku金额', width: '100', sortable: true, iscount: true },
{ field: 'cost_first', title: '头程费', width: '110', sortable: true, iscount: true },
{ field: 'amount_shipping', title: '运费金额', width: '90', sortable: true, iscount: true },
{ field: 'cost_promotion', title: '促销费', width: '90', sortable: true, iscount: true }, { field: 'cost_promotion', title: '促销费', width: '90', sortable: true, iscount: true },
{ field: 'cost_shipping', title: '物流费用', width: '90', sortable: true, iscount: true }, { field: 'cost_first', title: '头程费', width: '110', sortable: true, iscount: true },
{ field: 'cost_logistics', title: '尾程费', width: '100', sortable: true, iscount: true },
{ field: 'cost_fba_fee', title: 'fba费用', width: '100', sortable: true, iscount: true }, { field: 'cost_fba_fee', title: 'fba费用', width: '100', sortable: true, iscount: true },
{ field: 'cost_platform_fee', title: '平台佣金', width: '100', sortable: true, iscount: true },
{ field: 'platform_fee_rate', title: '佣金比例%', width: '90', sortable: true }, { field: 'platform_fee_rate', title: '佣金比例%', width: '90' },
{ field: 'cost_package', title: '包裹费', width: '90', sortable: true, iscount: true },
{ field: 'losswithdrawal', title: '提现损耗', width: '100', sortable: true, iscount: true }, { field: 'losswithdrawal', title: '提现损耗', width: '100', sortable: true, iscount: true },
{ field: 'amount_product', title: '总收入', width: '90', sortable: true, iscount: true }, { field: 'amount_total', title: '总收入', width: '90', sortable: true, iscount: true },
{ field: 'cost_total', title: '总支出', width: '90', sortable: true, iscount: true }, { field: 'cost_total', title: '总支出', width: '90', sortable: true, iscount: true },
{ field: 'paid_time', title: '付款时间', width: '140', sortable: true } { field: 'paid_time', title: '付款时间', width: '140', sortable: true }
]; ];
......
var baseUrl = 'http://testdata.bailuntec.com'; //'http://localhost:59628/';// var baseUrl = 'http://data.bailuntec.com'; //'http://localhost:59628/';//
var globalOrderSort=''; var globalOrderSort='';
var globalOrderType = ''; var globalOrderType = '';
......
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