Commit 022aa526 by guanzhenshan

应收款报表区分应收款和预收款

parent b60c0748
......@@ -23,8 +23,8 @@ namespace Bailun.DC.DailyPlatformReceivable
// //Console.WriteLine("Hello World!");
// var _services = new Services();
// var start = DateTime.Parse("2019-12-06");
// var start = DateTime.Parse("2019-11-01");
// while (start.AddDays(1) < DateTime.Now)
// {
// Console.WriteLine(start);
......
......@@ -66,7 +66,7 @@ namespace Bailun.DC.DailyPlatformReceivable
sql = $@"select sum(t1.amount_sales*t2.quantity_shipped*t1.seller_order_exchange_rate) amount
from dc_base_oms_pick t2
join dc_base_oms_sku t1 on t1.bailun_order_id=t2.bailun_order_id and t1.bailun_sku=t2.bailun_sku and t1.has_scalp=0 and t1.has_delete=0 and t1.has_innersale=0 and t1.bailun_order_status!='Canceled' and t1.has_innersale=0 and t1.company_id=1 and t1.platform_type='Ebay'
where t2.has_delete=0 and t2.shipping_status='TotalShipping' and t2.company_id=1 and t2.shipping_time>='2019-11-01' and t2.shipping_time<'2019-11-02' ";
where t2.has_delete=0 and t2.shipping_status='TotalShipping' and t2.company_id=1 and t2.shipping_time>='{day.ToString("yyyy-MM-dd")}' and t2.shipping_time<'{day.AddDays(1).ToString("yyyy-MM-dd")}' ";
var EbayShipping = cn.QueryFirstOrDefault<decimal?>(sql)??0;
//退款(未发货的)
sql = $"select sum(amount_refund_rmb) amount from dc_base_crm_refund where platform_type = 'Ebay' and company_id = 1 and is_deleted = 0 and is_freeze = 0 and shipping_status = 'UnShipping' and refund_time>= '{day.ToString("yyyy-MM-dd")}' and refund_time<'{day.AddDays(1).ToString("yyyy-MM-dd")}'";
......
......@@ -4490,7 +4490,7 @@ group by currency";
/// <param name="end">结束时间</param>
/// <param name="total">符合条件的记录数</param>
/// <returns></returns>
public List<dc_daily_receivable> ListReceivable(BtTableParameter parameter,string platform,DateTime start, DateTime end,ref int total)
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 sqlparam = new DynamicParameters();
......@@ -4501,6 +4501,15 @@ group by currency";
sqlparam.Add("platform", platform);
}
if (type == 1) //Ebay
{
sql += " and platform='Ebay'";
}
else if (type == 2) //非Ebay
{
sql += " and platform!='Ebay'";
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
......@@ -4521,7 +4530,7 @@ group by currency";
/// <param name="start">开始时间</param>
/// <param name="end">结束时间</param>
/// <returns></returns>
public dc_daily_receivable ListReceivableCount(string platform, DateTime start, DateTime end)
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 sqlparam = new DynamicParameters();
......@@ -4532,6 +4541,15 @@ group by currency";
sqlparam.Add("platform", platform);
}
if (type == 1) //Ebay
{
sql += " and platform='Ebay'";
}
else if (type == 2) //非Ebay
{
sql += " and platform!='Ebay'";
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
......
......@@ -6075,12 +6075,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="end">结束时间</param>
/// <param name="platform">平台类型</param>
/// <returns></returns>
public string PlatformReceivableJson(BtTableParameter parameter, DateTime start, DateTime end, string platform)
public string PlatformReceivableJson(BtTableParameter parameter, DateTime start, DateTime end, string platform,int type)
{
var total = 0;
var _service = new Services.FinanceReportServices();
var obj = _service.ListReceivable(parameter, platform, start, end, ref total);
var obj = _service.ListReceivable(parameter, platform, start, end,type, ref total);
var list = obj.Select(a => new {
a.platform,
......@@ -6097,7 +6097,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
lastupdatetime = a.lastupdatetime.ToString("yyyy-MM-dd HH:mm:ss")
});
var objCount = _service.ListReceivableCount(platform, start, end);
var objCount = _service.ListReceivableCount(platform, start, end,type);
return JsonConvert.SerializeObject(new {
total = list.Count(),
......
......@@ -12,12 +12,19 @@
说明:<br />
Ebay预收账款 = 期初预收余额+本期收款(订单付款金额)-发货金额-退款(未发货的)<br />
非Ebay应收账款 = 期初应收余额+本期销售收入-平台扣费-放款金额-退款金额+其他
</div>
</div>
</div>
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>&nbsp;</label>
<select id="type" name="type" class="form-control" style="width:100px;">
<option value="1">Ebay</option>
<option value="2">非Ebay</option>
</select>
</div>
<div class="form-group">
<label>日期</label>
<input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(ViewBag.start)" />
<span>至</span>
......@@ -37,9 +44,12 @@
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<div id="tb_ebay" class="ibox-content m-b-sm border-bottom">
<table id="roletable" style="table-layout:fixed;"></table>
</div>
<div id="tb_noebay" class="ibox-content m-b-sm border-bottom" style="display:none;">
<table id="roletable_noebay" style="table-layout:fixed;"></table>
</div>
</div>
</div>
@section css{
......@@ -55,6 +65,7 @@
@section scripts{
<script type="text/javascript">
var tb;
var tb2;
$(document).ready(function () {
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
......@@ -79,33 +90,74 @@
return false;
}
var type = $('#type').val();
//预收账款
var columns = [
{ field: 'day', title: '统计日期', width: '110' },
{ field: 'platform', title: '平台类型', width: '110', iscount: true },
{ field: 'amount_start', title: '期初收余额', width: '130', iscount: true },
{ field: 'amount_start', title: '期初收余额', width: '130', iscount: true },
{ 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_sale_shipping', title:'发货收款',width:'110',iscount:true},
{ field: 'amount_platformfee', title: '平台费', width: '110', iscount: true },
{ field: 'amount_incoming', 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_end', title: '期末应收账款', width: '130', iscount: true }
{ field: 'amount_end', title: '收账款', width: '130', iscount: true }
];
//应收账款
if (type == 2) {
columns = [
{ field: 'day', title: '统计日期', width: '110' },
{ field: 'platform', title: '平台类型', width: '110', iscount: true },
{ field: 'amount_start', title: '期初应收余额', width: '130', iscount: true },
{ field: 'amount_sale_shipping', title: '本期销售收入', width: '130', iscount: true },
{ field: 'amount_platformfee', title: '平台扣费', width: '110', iscount: true },
{ field: 'amount_incoming', title: '放款金额', width: '110', iscount: true },
{ field: 'amount_refund', title: '退款(已发货)', width: '130', iscount: true },
{ field: 'amount_other', title: '其他金额', width: '110', iscount: true },
{ field: 'amount_end', title: '期末应收账款', width: '130', iscount: true }
];
}
var url = '@Url.Content("~/Reports/Finance/PlatformReceivableJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
showfooter: true, showCount: true, loadsuccess: function (d) {
//替换汇总行的相关列值
}
});
if (type == 1) {
$('#tb_noebay').hide();
$('#tb_ebay').show();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
showfooter: true, showCount: true, loadsuccess: function (d) {
//替换汇总行的相关列值
}
});
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
else {
tb.bootstrapTable('refresh', { url: url });
$('#tb_ebay').hide();
$('#tb_noebay').show();
if (tb2 == undefined) {
tb2 = OnlyTable("roletable_noebay", columns, url, "", {
showfooter: true, showCount: true, loadsuccess: function (d) {
//替换汇总行的相关列值
}
});
}
else {
tb2.bootstrapTable('refresh', { url: url });
}
}
}
</script>
......
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