Commit 08a6f114 by guanzhenshan

资产负债表 应收账款增加借款金额和明细数据

parent 2321eccb
......@@ -67,6 +67,12 @@ namespace Bailun.DC.Models
public decimal accounts_receivable { get; set; }
/// <summary>
/// 借支金额
/// </summary>
[Description("借支金额")]
public decimal amount_borrowed { get; set; }
/// <summary>
/// 预付款项
/// </summary>
[Description("预付款项")]
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models
{
/// <summary>
/// 借支单明细
/// </summary>
public class dc_daily_fee
{
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
///
/// </summary>
public string cost_plan_no { get; set; }
/// <summary>
///
/// </summary>
public string cost_no { get; set; }
/// <summary>
///
/// </summary>
public string cost_reason { get; set; }
/// <summary>
///
/// </summary>
public int? cost_form { get; set; }
/// <summary>
///
/// </summary>
public string company_no { get; set; }
/// <summary>
/// /
/// </summary>
public string company_name { get; set; }
/// <summary>
///
/// </summary>
public string type_no { get; set; }
/// <summary>
///
/// </summary>
public string type_name { get; set; }
/// <summary>
///
/// </summary>
public string kind_no { get; set; }
/// <summary>
///
/// </summary>
public string kind_name { get; set; }
/// <summary>
///
/// </summary>
public int? create_userid { get; set; }
/// <summary>
///
/// </summary>
public string create_usercode { get; set; }
/// <summary>
///
/// </summary>
public string create_username { get; set; }
/// <summary>
///
/// </summary>
public string cost_remark { get; set; }
/// <summary>
///
/// </summary>
public DateTime? create_time { get; set; }
/// <summary>
///
/// </summary>
public int? cost_status { get; set; }
/// <summary>
///
/// </summary>
public string file_path { get; set; }
/// <summary>
///
/// </summary>
public string mor_file_path { get; set; }
/// <summary>
///
/// </summary>
public decimal? amount { get; set; }
/// <summary>
///
/// </summary>
public string bank_name { get; set; }
/// <summary>
///
/// </summary>
public string bank_card { get; set; }
/// <summary>
///
/// </summary>
public string bank_card_user { get; set; }
/// <summary>
///
/// </summary>
public string bank_company { get; set; }
/// <summary>
///
/// </summary>
public string mor_remark { get; set; }
/// <summary>
///
/// </summary>
public string son_cost_no { get; set; }
/// <summary>
///
/// </summary>
public string sup_cost_no { get; set; }
/// <summary>
///
/// </summary>
public int? is_lend { get; set; }
/// <summary>
///
/// </summary>
public decimal? had_pay { get; set; }
/// <summary>
///
/// </summary>
public int? lend_status { get; set; }
/// <summary>
///
/// </summary>
public decimal? compensate { get; set; }
/// <summary>
///
/// </summary>
public decimal? counteract { get; set; }
/// <summary>
///
/// </summary>
public decimal? lend_balance { get; set; }
/// <summary>
///
/// </summary>
public string reject_reason { get; set; }
/// <summary>
///
/// </summary>
public string dic { get; set; }
/// <summary>
///
/// </summary>
public decimal? pay_counteract { get; set; }
/// <summary>
///
/// </summary>
public decimal? pay_lend_balance { get; set; }
/// <summary>
///
/// </summary>
public decimal? pay_plan_amount { get; set; }
/// <summary>
///
/// </summary>
public string pay_dic { get; set; }
/// <summary>
///
/// </summary>
public decimal? pay_cur { get; set; }
/// <summary>
///
/// </summary>
public int? is_tax { get; set; }
/// <summary>
///
/// </summary>
public string detail_key { get; set; }
/// <summary>
///
/// </summary>
public int? pay_user_id { get; set; }
/// <summary>
///
/// </summary>
public DateTime? pay_time { get; set; }
/// <summary>
///
/// </summary>
public decimal? amount_rmb { get; set; }
/// <summary>
///
/// </summary>
public decimal? to_rmb_rate { get; set; }
/// <summary>
///
/// </summary>
public int? sub_logistics_supplier_id { get; set; }
/// <summary>
///
/// </summary>
public int? logistics_supplier_id { get; set; }
/// <summary>
///
/// </summary>
public string subject_code { get; set; }
/// <summary>
///
/// </summary>
public int? company_value { get; set; }
/// <summary>
///
/// </summary>
public DateTime? audit_time { get; set; }
/// <summary>
///
/// </summary>
public DateTime? recoed_time { get; set; }
/// <summary>
///
/// </summary>
public DateTime? last_modify_date { get; set; }
/// <summary>
///
/// </summary>
public DateTime? bj_create { get; set; }
/// <summary>
///
/// </summary>
public DateTime? bj_modified { get; set; }
}
public enum Enum_cost_form
{
付款 = 1,
收款 = 2,
借支or借还 = 3
}
}
......@@ -161,6 +161,8 @@ namespace Bailun.DC.Services
finished_accounts_payable=0,
semi_accounts_payable=0,
amount_borrowed = 0
};
list.Add(m);
......@@ -1563,6 +1565,76 @@ namespace Bailun.DC.Services
}
}
/// <summary>
/// 获取借支单明细
/// </summary>
/// <param name="request"></param>
/// <param name="date"></param>
/// <param name="companyvalue"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<dc_daily_fee> ListBorrowAmount(BtTableParameter request, DateTime date, int? companyvalue, ref int total)
{
var sql = "select * from dc_daily_fee where cost_status>-1 and recoed_time='"+date.ToString("yyyy-MM-dd")+"'";
if (companyvalue.HasValue && companyvalue.Value>0)
{
sql += " and company_value="+companyvalue.Value;
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
if (!string.IsNullOrEmpty(request.sort))
{
sql += " order by " + request.sort + " " + request.order;
}
if (request.limit == 0)
{
var obj = cn.Query<dc_daily_fee>(sql);
return obj.AsList();
}
else
{
var obj = cn.Page<dc_daily_fee>(request.pageIndex, request.limit, sql, ref total);
return obj.AsList();
}
}
}
public dc_daily_fee ListBorrowAmountCount(DateTime date, int? companyvalue)
{
var sql = "select sum((amount - had_pay + ifnull(compensate, 0)) * to_rmb_rate) amount from dc_daily_fee where cost_status>-1 and recoed_time='" + date.ToString("yyyy-MM-dd") + "'";
if (companyvalue.HasValue && companyvalue.Value > 0)
{
sql += " and company_value=" + companyvalue.Value;
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.QueryFirstOrDefault<dc_daily_fee>(sql);
return obj;
}
}
#endregion
#region 付款主体
......
......@@ -165,6 +165,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
m.semi_accounts_payable = m.semi_accounts_payable ?? 0;
//m.amount_borrowed = m.amount_borrowed; //借支金额
//Add by Allan at 2019-01-30 16:04
m.prepayment = Math.Abs(m.prepayment);
......@@ -2524,6 +2527,102 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return File(ms, "text/csv", filename + ".csv");
}
/// <summary>
/// 借支金额
/// </summary>
/// <param name="companyvalue"></param>
/// <param name="date"></param>
/// <returns></returns>
public ActionResult ListBorrowAmount(int companyvalue, DateTime date)
{
ViewBag.date = date;
ViewBag.companyvalue = companyvalue;
return View();
}
/// <summary>
/// 借支金额
/// </summary>
/// <param name="request"></param>
/// <param name="companyvalue"></param>
/// <param name="date"></param>
/// <returns></returns>
public string ListBorrowAmountJson(BtTableParameter request, int? companyvalue, DateTime date)
{
var total = 0;
var obj = new Services.FinanceReportServices().ListBorrowAmount(request, date, companyvalue, ref total);
var objCount = new Services.FinanceReportServices().ListBorrowAmountCount(date, companyvalue);
var list = obj.Select(a => new {
a.id,
a.cost_no,
cost_form = Enum.GetName(typeof(Enum_cost_form),a.cost_form.Value),
a.company_name,
a.type_name,
a.kind_name,
a.create_username,
create_time = a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
amount = (a.amount - a.had_pay + (a.compensate??0)) * a.to_rmb_rate,
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.amount,
}
});
}
public ActionResult ListBorrowAmountExport(int? companyvalue, DateTime date)
{
var total = 0;
var obj = new Services.FinanceReportServices().ListBorrowAmount(new BtTableParameter {offset=0,limit=0}, date, companyvalue, ref total);
var list = obj.Select(a => new {
a.id,
a.cost_no,
cost_form = Enum.GetName(typeof(Enum_cost_form), a.cost_form.Value),
a.company_name,
a.type_name,
a.kind_name,
a.create_username,
create_time = a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
amount = (a.amount - a.had_pay + (a.compensate ?? 0)) * a.to_rmb_rate,
recoed_time = a.recoed_time.Value.ToString("yyyy-MM-dd")
});
var colNames = new List<string> { "费用单号", "费用类型", "付款主体", "费用大类", "费用小类", "创建人", "创建时间", "待还金额", "记录日期" };
var listval = new List<string>();
foreach (var item in list)
{
listval.Add(item.cost_no + "|" + item.cost_form + "|" + item.company_name + "|" + item.type_name + "|" + item.kind_name + "|" + item.create_username + "|" + item.create_time+"|"+item.amount+"|"+item.recoed_time);
}
var guid = Guid.NewGuid().ToString();
var filename = date.ToString("yyyy-MM-dd") + " 借款明细" + DateTime.Now.ToString("yyyyMMddHHmmss");
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(listval, colNames, guid, filepath);
var ms = new System.IO.MemoryStream();
using (var f = new System.IO.FileStream(filepath + guid + ".csv", System.IO.FileMode.Open))
{
f.CopyTo(ms);
}
ms.Position = 0;
return File(ms, "text/csv", filename + ".csv");
}
#endregion
#region 平台余额
......
......@@ -183,6 +183,20 @@
</div>
</div>
<div class="item-row fa fa1" style="width:100%;">
<div style="width:11.5%;color:#bbb;">1.借支金额</div>
<div style="width:11.5%;" class="amount_borrowed">0</div>
<div style="width:11.5%;" class="amount_borrowed">0</div>
<div style="width:11.5%;" class="amount_borrowed">0</div>
<div style="width:11.5%;" class="amount_borrowed">0</div>
<div style="width:11.5%;" class="amount_borrowed">0</div>
<div style="width:11.5%;" class="amount_borrowed">0</div>
<div style="width:11.5%;">
<input id="amount_borrowed" class="txtinput" type="number" value="0" style="width:110px;height:24px;line-height:24px;" />
</div>
<div style="width:8%;">
</div>
</div>
<div class="item-row fa fa1" style="width:100%;">
<div style="width:11.5%;">预付款项</div>
<div style="width:11.5%;" class="prepayment">0</div>
<div style="width:11.5%;" class="prepayment">0</div>
......@@ -509,7 +523,7 @@
<div style="width:8%;"><a class="btn btn-primary btn-xs" onclick="UpdateData('fa_other_assets');">更新</a></div>
</div>
<div class="item-row" style="width:100%;">
<div style="width:11.5%;font-weight:bold;" onclick="showitem('fa1', this,990,'ldzc');">
<div style="width:11.5%;font-weight:bold;" onclick="showitem('fa1', this,1023,'ldzc');">
流动资产合计
<img src="@Url.Content("~/img/downicon.png")" style="width:10px;position:absolute;float:right;margin-top:10px;right:5px;" />
</div>
......@@ -1545,6 +1559,10 @@
return false;
case 'semi_transfer_amount':
showdetail(title + '半成品在途明细', '@Url.Content("~/Reports/Finance/SemiTransferStock?date=")' + title + '&paycompanyid=' + paycompany);
return false;
case 'amount_borrowed':
showdetail(title + '借支金额明细', '@Url.Content("~/Reports/Finance/ListBorrowAmount?date=")' + title + '&paycompanyid=' + paycompany);
return false;
}
return false;
......
@{
ViewData["Title"] = "借支金额明细";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
}
<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 css{
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
}
@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: '150', iscount: true
},
{ field: 'cost_form', title: '费用类型', width: '150' },
{ field: 'company_name', title: '付款主体', width: '180' },
{ field: 'type_name', title: '费用大类', width: '110' },
{ field: 'kind_name', title: '费用小类', width: '110' },
{ field: 'create_username', title: '创建人', width: '110' },
{ field: 'create_time', title: '创建时间', width: '110' },
{ field: 'amount', title: '待还金额', width: '110', iscount: true },
{ field: 'recoed_time', title: '记录日期', width: '110' }
];
var pvalue = $('#companyvalue').val();
var url = '@Url.Content("~/Reports/Finance/ListBorrowAmountJson")' + '?date=@(ViewBag.date)&companyvalue=@(ViewBag.companyvalue)';
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/ListBorrowAmountExport?date=")' + '@(ViewBag.date)&companyvalue=@(ViewBag.companyvalue)', "_blank");
}
</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