Commit 39b13b19 by guanzhenshan

更改平台预收账款报表

parent 31e8ce15
......@@ -5129,24 +5129,35 @@ group by currency";
/// <returns></returns>
public List<dc_daily_receivable> ListReceivable(BtTableParameter parameter,string platform,DateTime start, DateTime end,int type,ref int total)
{
var sql = $"select * from dc_daily_receivable where day>='{start.ToString("yyyy-MM-dd")}' and day<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
var sql = $"select platform,sum(amount_sale_pay) as amount_sale_pay,sum(amount_shipping) amount_shipping,sum(amount_refund) amount_refund,sum(amount_sale_shipping) amount_sale_shipping,sum(amount_platformfee) amount_platformfee,sum(amount_incoming) amount_incoming,sum(amount_other) amount_other from dc_daily_receivable where day>='{start.ToString("yyyy-MM-dd")}' and day<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
var sqlparam = new DynamicParameters();
var sql_start = $"select * from dc_daily_receivable where day='{start.ToString("yyyy-MM-dd")}'";
var sql_end = $"select * from dc_daily_receivable where day='{end.ToString("yyyy-MM-dd")}'";
if (!string.IsNullOrEmpty(platform))
{
sql += " and platform=@platform";
sql_start += " and platform=@platform";
sql_end += " and platform=@platform";
sqlparam.Add("platform", platform);
}
if (type == 1) //Ebay
{
sql += " and platform='Ebay'";
sql_start += " and platform='Ebay'";
sql_end += " and platform='Ebay'";
}
else if (type == 2) //非Ebay
{
sql += " and platform!='Ebay'";
sql_start += " and platform!='Ebay'";
sql_end += " and platform!='Ebay'";
}
sql += " group by platform";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
......@@ -5154,7 +5165,33 @@ group by currency";
cn.Open();
}
var obj = cn.Page<dc_daily_receivable>(parameter.pageIndex, parameter.limit, sql, ref total, sqlparam).ToList();
var obj = cn.Query<dc_daily_receivable>(sql, sqlparam).ToList();
if (obj.Count > 0)
{
//期初
var listStart = cn.Query<dc_daily_receivable>(sql_start);
//期末
var listEnd = cn.Query<dc_daily_receivable>(sql_end);
foreach (var item in obj)
{
var objStart = listStart.Where(a => a.platform == item.platform).FirstOrDefault();
if (objStart != null)
{
item.amount_start = objStart.amount_start;
}
var objEnd = listEnd.Where(a => a.platform == item.platform).FirstOrDefault();
if (objEnd != null)
{
item.amount_end = objEnd.amount_end;
}
}
}
return obj;
}
......@@ -5169,7 +5206,7 @@ group by currency";
/// <returns></returns>
public dc_daily_receivable ListReceivableCount(string platform, DateTime start, DateTime end,int type)
{
var sql = $"select sum(amount_sale_pay) amount_sale_pay,sum(amount_shipping) amount_shipping,sum(amount_refund) amount_refund,sum(amount_sale_shipping) amount_sale_shipping,sum(amount_platformfee) amount_platformfee,sum(amount_incoming) amount_incoming,sum(amount_other) amount_other from dc_daily_receivable where day>='{start.ToString("yyyy-MM-dd")}' and day<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
var sql = $"select platform,sum(amount_sale_pay) amount_sale_pay,sum(amount_shipping) amount_shipping,sum(amount_refund) amount_refund,sum(amount_sale_shipping) amount_sale_shipping,sum(amount_platformfee) amount_platformfee,sum(amount_incoming) amount_incoming,sum(amount_other) amount_other from dc_daily_receivable where day>='{start.ToString("yyyy-MM-dd")}' and day<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
var sqlparam = new DynamicParameters();
if (!string.IsNullOrEmpty(platform))
......@@ -5270,13 +5307,19 @@ group by currency";
return "找不到该记录。";
}
obj.amount_other = otheramount;
if (obj.platform.ToLower() == "ebay")
{
return "ebay平台不能修改数据。";
//期初预收余额+本期收款(订单付款金额)-发货金额-退款(未发货的)+其他
obj.amount_end = obj.amount_start + obj.amount_sale_pay - obj.amount_shipping - obj.amount_refund + obj.amount_other;
}
obj.amount_other = otheramount;
obj.amount_end = obj.amount_start + obj.amount_sale_shipping - obj.amount_platformfee - obj.amount_incoming - obj.amount_refund + obj.amount_other;
else
{
obj.amount_end = obj.amount_start + obj.amount_sale_shipping - obj.amount_platformfee - obj.amount_incoming - obj.amount_refund + obj.amount_other;
}
obj.lastupdatetime = DateTime.Now;
obj.lastupdateuserid = uid;
obj.lastupdateusername = username;
......
......@@ -7201,7 +7201,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var list = obj.Select(a => new {
a.id,
a.platform,
day = a.day.ToString("yyyy-MM-dd"),
day = start!=end? (start.ToString("yyyy-MM-dd") +"至"+ end.ToString("yyyy-MM-dd")) : start.ToString("yyyy-MM-dd"), //a.day.ToString("yyyy-MM-dd"),
amount_end = a.amount_end.ToString("N2"),
amount_incoming = a.amount_incoming.ToString("N2"),
amount_other = a.amount_other.ToString("N2"),
......
......@@ -10,7 +10,7 @@
<div class="ibox-content m-b-sm border-bottom">
<div class="alert alert-warning">
说明:<br />
Ebay预收账款 = 期初预收余额+本期收款(订单付款金额)-发货金额-退款(未发货的)<br />
Ebay预收账款 = 期初预收余额+本期收款(订单付款金额)-发货金额-退款(未发货的)+其他<br />
非Ebay应收账款 = 期初应收余额+本期销售收入-平台扣费-放款金额-退款金额+其他
</div>
</div>
......@@ -103,7 +103,11 @@
{ field: 'amount_sale_pay', title: '本期收款', width: '110', iscount: true },
{ field: 'amount_shipping', title: '发货金额', width: '110',iscount: true },
{ field: 'amount_refund', title: '退款(未发货)', width: '100', iscount: true },
{ field: 'amount_other', title: '其他金额', width: '110', iscount: true },
{
field: 'amount_other', title: '其他金额', width: '110', iscount: true, formatter: function (idx, data) {
return '<span>' + data.amount_other + '</span><a style="margin-left:3px;" href="javascript:;" onclick="showmodel(' + data.id + ',\'' + data.day + '\',\'' + data.platform + '\',\'' + data.amount_other + '\');">编辑</a>';
}
},
{ field: 'amount_end', title: '预收账款', width: '130', iscount: true }
];
......
......@@ -29,8 +29,8 @@
<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
<script type="text/javascript">
login_localhost();
//login();
//login_localhost();
login();
window.location = "@Url.Content("~/Home/Main")";
</script>
</body>
......
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