Commit 82af317e by guanzhenshan

资产负债表应收账款增加明细显示

parent f8877e8a
...@@ -1639,6 +1639,84 @@ namespace Bailun.DC.Services ...@@ -1639,6 +1639,84 @@ namespace Bailun.DC.Services
} }
} }
/// <summary>
/// 获取应收账款明细汇总金额
/// </summary>
/// <param name="date">日期</param>
/// <param name="companyvalue">付款主体</param>
/// <returns></returns>
public Tuple<decimal, decimal> ReceivablesCount(DateTime date)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var sql = $"select sum(case when platform != 'Ebay' then amount_end else 0 end) - sum(case when platform = 'Ebay' then amount_end else 0 end) as amount from dc_daily_receivable where day = '{date.ToString("yyyy-MM-dd")}'";
var objRec = cn.QueryFirstOrDefault<decimal?>(sql);
sql = $"select sum((amount - ifnull(had_pay, 0) + ifnull(compensate, 0)) * to_rmb_rate) from dc_daily_fee where recoed_time = '{date.ToString("yyyy-MM-dd")}' and company_value in (53,3,5,60,66,59,50,8,1,61,2,70)";
var objBorr = cn.QueryFirstOrDefault<decimal?>(sql);
return new Tuple<decimal, decimal>(objRec ?? 0, objBorr ?? 0);
}
}
/// <summary>
/// 获取平台应收账款明细
/// </summary>
/// <param name="request"></param>
/// <param name="date"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<dc_daily_receivable> ListReceivables(BtTableParameter request, DateTime date,ref int total)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var sql = $"select (case when platform != 'Ebay' then amount_end else -amount_end end) as amount_end,day,platform from dc_daily_receivable where day = '{date.ToString("yyyy-MM-dd")}'";
var obj = cn.Page<dc_daily_receivable>(request.pageIndex, request.limit, sql, ref total, null, null, 2 * 60).ToList();
return obj;
}
}
/// <summary>
/// 借支单明细
/// </summary>
/// <param name="request"></param>
/// <param name="date"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<dc_daily_fee> ListBorrow(BtTableParameter request, DateTime date, ref int total)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var sql = $"select cost_no,company_name,create_username,((amount - ifnull(had_pay, 0) + ifnull(compensate, 0)) * to_rmb_rate) as amount,recoed_time from dc_daily_fee where is_lend=1 and lend_balance>0 and recoed_time = '{date.ToString("yyyy-MM-dd")}' and company_value in (53,3,5,60,66,59,50,8,1,61,2,70)";
var obj = cn.Page<dc_daily_fee>(request.pageIndex, request.limit, sql, ref total).ToList();
return obj;
}
}
#endregion #endregion
#region 付款主体 #region 付款主体
......
...@@ -2623,6 +2623,111 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2623,6 +2623,111 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
/// <summary>
/// 应收账款
/// </summary>
/// <param name="paycompanyid">付款主体id</param>
/// <param name="date">日期</param>
/// <returns></returns>
public ActionResult ReceivablesCount(int paycompanyid, DateTime date)
{
var m = new Services.FinanceReportServices().ReceivablesCount(date);
ViewBag.m = m;
ViewBag.date = date;
ViewBag.paycompanyid = paycompanyid;
return View();
}
public ActionResult ListReceivablesPlatform(int paycompanyid, DateTime date)
{
ViewBag.date = date;
ViewBag.paycompanyid = paycompanyid;
return View();
}
/// <summary>
/// 应收账款平台金额明细
/// </summary>
/// <param name="request"></param>
/// <param name="paycompanyid"></param>
/// <param name="date"></param>
/// <returns></returns>
public string ListReceivablesPlatformJson(BtTableParameter request, int paycompanyid, DateTime date)
{
var total = 0;
var obj = new Services.FinanceReportServices().ListReceivables(request, date, ref total);
var objCount = new Services.FinanceReportServices().ReceivablesCount(date);
var list = obj.Select(a => new {
a.id,
amount_end = a.amount_end.ToString("N2"),
a.platform,
day = a.day.ToString("yyyy-MM-dd")
});
return JsonConvert.SerializeObject(new
{
total = total,
rows = list,
count_row = new
{
platform = "总计",
amount_end = objCount.Item1,
}
});
}
public ActionResult ListReceivablesBorrow(int paycompanyid, DateTime date)
{
ViewBag.date = date;
ViewBag.paycompanyid = paycompanyid;
return View();
}
/// <summary>
/// 应收账款借支单金额明细
/// </summary>
/// <param name="request"></param>
/// <param name="paycompanyid"></param>
/// <param name="date"></param>
/// <returns></returns>
public string ListReceivablesBorrowJson(BtTableParameter request, int paycompanyid, DateTime date)
{
var total = 0;
var obj = new Services.FinanceReportServices().ListBorrow(request, date, ref total);
var objCount = new Services.FinanceReportServices().ReceivablesCount(date);
var list = obj.Select(a => new {
a.id,
a.cost_no,
a.company_name,
a.create_username,
amount = (a.amount??0).ToString("N2"),
recoed_time = a.recoed_time.Value.ToString("yyyy-MM-dd")
});
return JsonConvert.SerializeObject(new
{
total = total,
rows = list,
count_row = new
{
cost_no = "总计",
amount = objCount.Item2,
}
});
}
#endregion #endregion
#region 平台余额 #region 平台余额
......
...@@ -1572,6 +1572,9 @@ ...@@ -1572,6 +1572,9 @@
case 'amount_borrowed': case 'amount_borrowed':
showdetail(title + '借支金额明细', '@Url.Content("~/Reports/Finance/ListBorrowAmount?date=")' + title + '&paycompanyid=' + paycompany); showdetail(title + '借支金额明细', '@Url.Content("~/Reports/Finance/ListBorrowAmount?date=")' + title + '&paycompanyid=' + paycompany);
return false; return false;
case 'accounts_receivable':
showdetail(title + '应收帐款明细', '@Url.Content("~/Reports/Finance/ReceivablesCount?date=")' + title + '&paycompanyid=' + paycompany);
return false;
} }
return false; return false;
......

@{
ViewData["Title"] = "借支应收账款";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
}
@*<div class="ibox-content m-b-sm border-bottom">
<table id="tb" class="table table-hover table-bordered" style="width:100%;">
<thead>
<tr>
<th>付款主体</th>
<th>仓库名称</th>
<th>存货余额</th>
<th>日期</th>
</tr>
</thead>
@if (ViewBag.list.Count > 0)
{
foreach (var item in ViewBag.list)
{
<tr>
<td>@ViewBag.PayCompanyName</td>
<td>@item.warehouse_name</td>
<td>@item.balance_rmb.ToString("###,###.##")</td>
<td>@item.statistical_time.ToString("yyyy-MM-dd")</td>
</tr>
}
}
</table>
</div>*@
<div class="row">
<div class="col-sm-12">
@*<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<button type="button" class="btn btn-primary" onclick="exportFile();">导出</button>
</div>
</div>
</form>
</div>*@
<div class="ibox-content m-b-sm border-bottom">
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
@section scripts{
<script>
var tb;
$(document).ready(function () {
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 100));
list();
})
function list() {
var columns = [
{ field: 'cost_no', title: '费用单号', width: '140', sortable: false},
{ field: 'company_name', title: '付款主体名称', width: '110', sortable: false },
{ field: 'create_username', title: '创建人', width: '110', sortable: false },
{ field: 'amount', title: '待还金额', width: '110', sortable: true },
{ field: 'recoed_time', title: '记录日期', width: '110', sortable: false }
];
var url = '@Url.Content("~/Reports/Finance/ListReceivablesBorrowJson")' + '?date=@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)&t=@(ViewBag.t)';
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "");
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function exportFile() {
window.open('@Url.Content("~/Reports/Finance/InventoryBalanceExport?date=")' + '@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)&t=@(ViewBag.t)', "_blank");
}
</script>
}
\ No newline at end of file

@{
ViewData["Title"] = "平台应收账款";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
}
@*<div class="ibox-content m-b-sm border-bottom">
<table id="tb" class="table table-hover table-bordered" style="width:100%;">
<thead>
<tr>
<th>付款主体</th>
<th>仓库名称</th>
<th>存货余额</th>
<th>日期</th>
</tr>
</thead>
@if (ViewBag.list.Count > 0)
{
foreach (var item in ViewBag.list)
{
<tr>
<td>@ViewBag.PayCompanyName</td>
<td>@item.warehouse_name</td>
<td>@item.balance_rmb.ToString("###,###.##")</td>
<td>@item.statistical_time.ToString("yyyy-MM-dd")</td>
</tr>
}
}
</table>
</div>*@
<div class="row">
<div class="col-sm-12">
@*<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<button type="button" class="btn btn-primary" onclick="exportFile();">导出</button>
</div>
</div>
</form>
</div>*@
<div class="ibox-content m-b-sm border-bottom">
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
@section scripts{
<script>
var tb;
$(document).ready(function () {
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 100));
list();
})
function list() {
var columns = [
{ field: 'platform', title: '平台类型', width: '140', sortable: false, iscount: true},
{ field: 'amount_end', title: '期末金额', width: '110', sortable: true, iscount: true },
{ field: 'day', title: '日期', width: '110', sortable: false }
];
var url = '@Url.Content("~/Reports/Finance/ListReceivablesPlatformJson")' + '?date=@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)';
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
showfooter: true, loadsuccess: function (d) {
//替换汇总行的相关列值
var tr = $('.fixed-table-footer').find('tr');
for (var c in columns) {
var key = columns[c].field;
if (columns[c].iscount) {
for (var v in d.count_row) {
if (key == v) {
tr.find('td').eq(c).children('div').first().html(d.count_row[v]);
break;
}
}
}
}
}
});
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function exportFile() {
window.open('@Url.Content("~/Reports/Finance/InventoryBalanceExport?date=")' + '@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)&t=@(ViewBag.t)', "_blank");
}
</script>
}
\ No newline at end of file

@{
ViewData["Title"] = "应收帐号明细汇总";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
}
<div class="ibox-content m-b-sm border-bottom">
<table id="tb" class="table table-hover table-bordered" style="width:100%;">
<thead>
<tr>
<th>序号</th>
<th>类型</th>
<th>金额</th>
<th>操作</th>
</tr>
</thead>
<tr>
<td>1</td>
<td>平台应收账款</td>
<td>@(ViewBag.m.Item1.ToString("N2"))</td>
<td><a class="btn btn-xs btn-primary" onclick="showdetail('@ViewBag.date.ToString("yyyy-MM-dd") 平台应收账款','@Url.Content("~/Reports/Finance/ListReceivablesPlatform?date="+ViewBag.date+"&paycompanyid="+ViewBag.paycompanyid)')">查看明细</a></td>
</tr>
<tr>
<td>2</td>
<td>借支应收账款</td>
<td>@(ViewBag.m.Item2.ToString("N2"))</td>
<td><a class="btn btn-xs btn-primary" onclick="showdetail('@ViewBag.date.ToString("yyyy-MM-dd") 借支应收账款','@Url.Content("~/Reports/Finance/ListBorrowAmount?date="+ViewBag.date+"&paycompanyid="+ViewBag.paycompanyid)')">查看明细</a></td>
</tr>
</table>
</div>
<script>
function ShowDetails(title, url) {
dialogApply({
id: 'Form',
title: title,
url: url,
width: '1300px',
height: '650px',
callBack: function (iframeId) {
//top.frames[iframeId].AcceptClick();
}
});
}
</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