Commit 94084277 by guanzhenshan

增加应付账款

parent 5d9083f4
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models
{
/// <summary>
/// 物流供应商往来数据表
/// </summary>
public class dc_logistics_supplier_transaction
{
public int id { get; set; }
/// <summary>
/// 统计日期
/// </summary>
public DateTime? day { get; set; }
/// <summary>
///
/// </summary>
public string type { get; set; }
/// <summary>
/// 公司主体value
/// </summary>
public int pay_company_value { get; set; }
/// <summary>
/// 公司主体名称
/// </summary>
public string pay_company_name { get; set; }
/// <summary>
/// 供应商ID
/// </summary>
public int supplier_id { get; set; }
/// <summary>
/// 供应商名称
/// </summary>
public string supplier_name { get; set; }
/// <summary>
/// 期初金额
/// </summary>
public decimal start_amount { get; set; }
/// <summary>
/// 借方发生额
/// </summary>
public decimal borrow_amount { get; set; }
/// <summary>
/// 贷方发生额
/// </summary>
public decimal loan_amount { get; set; }
/// <summary>
/// 期末金额
/// </summary>
public decimal end_amount { get; set; }
/// <summary>
/// 取数时间
/// </summary>
public DateTime update_time { get; set; }
}
}
......@@ -817,6 +817,62 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 预付款总计(分商品供应商和物流供应商)
/// </summary>
/// <param name="day"></param>
/// <param name="payid"></param>
/// <param name="repay">是否预付款,1:预付款,0:应付款</param>
/// <returns></returns>
public List<decimal> ListPrePayCount(DateTime day, int payid, int prepay)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var sql = "select sum(end_amount) from dc_supplier_transaction where day='" + day.ToString("yyyy-MM-dd") + "' ";// and pay_company_value=" + payid;
var logissql = "select sum(end_amount) from dc_logistics_supplier_transaction where day='" + day.ToString("yyyy-MM-dd") + "' ";
if (prepay == 1)
{
sql += " and end_amount<0";
logissql += " and end_amount<0";
}
else if (prepay == 0)
{
sql += " and end_amount>0";
logissql += " and end_amount>0";
}
if (payid == 2) //香港百伦的取一级供应商数据
{
sql += " and types=1";
//logissql += " and type=1";
}
else
{
sql += " and types=2";
//logissql += " and type=2";
}
var list = new List<decimal>();
var obj1 = cn.QueryFirstOrDefault<decimal?>(sql);
var obj2 = cn.QueryFirstOrDefault<decimal?>(logissql);
list.Add((prepay==1?-1:1)*(obj1??0));
list.Add((prepay == 1 ? -1 : 1) * (obj2 ??0));
return list;
}
}
/// <summary>
/// 预付款明细||应付账款明细
/// </summary>
/// <param name="day"></param>
......@@ -863,6 +919,55 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 物流供应商 预付款明细||应付账款明细
/// </summary>
/// <param name="request"></param>
/// <param name="day"></param>
/// <param name="payid"></param>
/// <param name="prepay">是否预付款,1:预付款,0:应付款</param>
/// <param name="total"></param>
/// <returns></returns>
public List<dc_logistics_supplier_transaction> ListPrePayLogistics(BtTableParameter request, DateTime day, int payid, int prepay, ref int total)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var sql = "select * from dc_logistics_supplier_transaction where day='" + day.ToString("yyyy-MM-dd") + "' ";// and pay_company_value=" + payid;
if (prepay == 1)
{
sql += " and end_amount<0";
}
else if (prepay == 0)
{
sql += " and end_amount>0";
}
if (!string.IsNullOrEmpty(request.sort))
{
sql += " order by " + request.sort + " " + request.order;
}
try
{
var list = cn.Page<dc_logistics_supplier_transaction>(request.pageIndex, request.limit, sql, ref total);
return list.ToList();
}
catch (Exception ex)
{
throw;
}
}
}
/// <summary>
/// 其他费用,应收和应付费用明细
/// </summary>
/// <param name="day">统计日期</param>
......
......@@ -792,8 +792,19 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return JsonConvert.SerializeObject(new { total = total, rows = list });
}
public ActionResult PrePayCount(DateTime date, int paycompanyid)
{
var _services = new Services.FinanceReportServices();
var list = _services.ListPrePayCount(date, paycompanyid, 1);
ViewBag.date = date;
ViewBag.paycompanyid = paycompanyid;
ViewBag.list = list;
return View();
}
/// <summary>
/// 预付款明细
/// 商品供应商 预付款明细
/// </summary>
/// <param name="date"></param>
/// <param name="paycompanyid"></param>
......@@ -828,6 +839,57 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
/// <summary>
/// 物流供应商 预付款明细
/// </summary>
/// <param name="date"></param>
/// <param name="paycompanyid"></param>
/// <returns></returns>
public ActionResult PrePayLogistics(DateTime date, int paycompanyid)
{
ViewBag.date = date;
ViewBag.paycompanyid = paycompanyid;
return View();
}
public string PrePayLogisticsJson(BtTableParameter request,DateTime date, int paycompanyid)
{
var total = 0;
var _services = new Services.FinanceReportServices();
//var paycompany = _services.GetPayCompany(paycompanyid);
var obj = _services.ListPrePayLogistics(request, date, paycompanyid, 1, ref total);
var list = obj.Select(a => new {
a.supplier_name,
a.pay_company_name,
start_amount = a.start_amount.ToString("N2"),
borrow_amount = a.borrow_amount.ToString("N2"),
loan_amount = a.loan_amount.ToString("N2"),
end_amount = a.end_amount.ToString("N2"),
day = a.day.Value.ToString("yyyy-MM-dd"),
});
return JsonConvert.SerializeObject(new { total = total, rows = list });
}
/// <summary>
/// 应付款统计
/// </summary>
/// <param name="date"></param>
/// <param name="paycompanyid"></param>
/// <returns></returns>
public ActionResult CopeWithCount(DateTime date, int paycompanyid)
{
var _services = new Services.FinanceReportServices();
var list = _services.ListPrePayCount(date, paycompanyid, 0);
ViewBag.date = date;
ViewBag.paycompanyid = paycompanyid;
ViewBag.list = list;
return View();
}
/// <summary>
/// 应付款明细
/// </summary>
/// <param name="date"></param>
......@@ -862,6 +924,47 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return JsonConvert.SerializeObject(new { total=total,rows=list});
}
/// <summary>
/// 物流供应商应付款明细
/// </summary>
/// <param name="date"></param>
/// <param name="paycompanyid"></param>
/// <returns></returns>
public ActionResult CopeWithLogistics(DateTime date, int paycompanyid)
{
ViewBag.date = date;
ViewBag.paycompanyid = paycompanyid;
return View();
}
/// <summary>
/// 物流供应商应付账款
/// </summary>
/// <param name="request"></param>
/// <param name="date"></param>
/// <param name="paycompanyid"></param>
/// <returns></returns>
public string CopeWithLogisticsJson(BtTableParameter request, DateTime date, int paycompanyid)
{
var total = 0;
var _services = new Services.FinanceReportServices();
var paycompany = _services.GetPayCompany(paycompanyid);
var obj = _services.ListPrePayLogistics(request, date, paycompanyid, 0, ref total);
var list = obj.Select(a => new {
a.supplier_name,
a.pay_company_name,
start_amount = a.start_amount.ToString("N2"),
borrow_amount = a.borrow_amount.ToString("N2"),
loan_amount = a.loan_amount.ToString("N2"),
end_amount = a.end_amount.ToString("N2"),
day = a.day.Value.ToString("yyyy-MM-dd"),
});
return JsonConvert.SerializeObject(new { total = total, rows = list });
}
/// <summary>
/// 其他应收款明细
......

@{
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.list[0].ToString("N2"))</td>
<td><a class="btn btn-xs btn-primary" onclick="showdetail('@ViewBag.date.ToString("yyyy-MM-dd") 商品供应商应付款','@Url.Content("~/Reports/Finance/CopeWith?date="+ViewBag.date+"&paycompanyid="+ViewBag.paycompanyid)')">查看明细</a></td>
</tr>
<tr>
<td>2</td>
<td>物流供应商</td>
<td>@(ViewBag.list[1].ToString("N2"))</td>
<td><a class="btn btn-xs btn-primary" onclick="showdetail('@ViewBag.date.ToString("yyyy-MM-dd") 物流供应商应付款','@Url.Content("~/Reports/Finance/CopeWithLogistics?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>

@{
ViewData["Title"] = "物流供应商应付账款";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
}
<div class="row">
<div class="col-sm-12">
<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: 'supplier_name', title: '供应商名称', width: '180', sortable: true, formatter: function (idx, data) {
return '<div class="mules" title="' + data.supplier_name + '">' + data.supplier_name + '</div>';
}
},
{
field: 'pay_company_name', title: '公司主体', width: '180', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.pay_company_name + '">' + data.pay_company_name + '</div>';
}
},
{ field: 'start_amount', title: '期初金额', width: '100', sortable: true },
{ field: 'borrow_amount', title: '借方发生额', width: '110', sortable: false },
{ field: 'loan_amount', title: '贷方发生额', width: '110', sortable: false },
{ field: 'end_amount', title: '期末金额', width: '100', sortable: true },
{ field: 'day', title: '日期', width: '90', sortable: true }
];
var url = '@Url.Content("~/Reports/Finance/PrePayLogisticsJson")' + '?date=@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)';
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "");
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
</script>
}
......@@ -963,10 +963,10 @@
showdetail(title + ' 短期借款明细', '@Url.Content("~/Reports/Finance/ShortBorrow?date=")' + title + '&paycompanyid=' + paycompany); //ShortBorrow
return false;
case 'prepayment':
showdetail(title + ' 预付帐款明细', '@Url.Content("~/Reports/Finance/PrePay?date=")' + title + '&paycompanyid=' + paycompany);
showdetail(title + ' 预付帐款明细', '@Url.Content("~/Reports/Finance/PrePayCount?date=")' + title + '&paycompanyid=' + paycompany);
return false;
case 'accounts_payable':
showdetail(title + ' 应付帐款明细', '@Url.Content("~/Reports/Finance/CopeWith?date=")' + title + '&paycompanyid=' + paycompany);
showdetail(title + ' 应付帐款明细', '@Url.Content("~/Reports/Finance/CopeWithCount?date=")' + title + '&paycompanyid=' + paycompany);
return false;
case 'other_accounts_receivable':
showdetail(title + ' 其他应收款明细', '@Url.Content("~/Reports/Finance/OtherReceivable?date=")' + title + '&paycompanyid=' + paycompany);
......

@{
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.list[0].ToString("N2"))</td>
<td><a class="btn btn-xs btn-primary" onclick="showdetail('@ViewBag.date.ToString("yyyy-MM-dd") 商品供应商预付款','@Url.Content("~/Reports/Finance/PrePay?date="+ViewBag.date+"&paycompanyid="+ViewBag.paycompanyid)')">查看明细</a></td>
</tr>
<tr>
<td>2</td>
<td>物流供应商</td>
<td>@(ViewBag.list[1].ToString("N2"))</td>
<td><a class="btn btn-xs btn-primary" onclick="showdetail('@ViewBag.date.ToString("yyyy-MM-dd") 物流供应商预付款','@Url.Content("~/Reports/Finance/PrePayLogistics?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>

@{
ViewData["Title"] = "物流供应商预付款";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
}
<div class="row">
<div class="col-sm-12">
<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: 'supplier_name', title: '供应商名称', width: '180', sortable: true, formatter: function (idx, data) {
return '<div class="mules" title="' + data.supplier_name + '">' + data.supplier_name + '</div>';
}
},
{
field: 'pay_company_name', title: '公司主体', width: '180', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.pay_company_name + '">' + data.pay_company_name + '</div>';
}
},
{ field: 'start_amount', title: '期初金额', width: '100', sortable: true },
{ field: 'borrow_amount', title: '借方发生额', width: '110', sortable: false },
{ field: 'loan_amount', title: '贷方发生额', width: '110', sortable: false },
{ field: 'end_amount', title: '期末金额', width: '100', sortable: true },
{ field: 'day', title: '日期', width: '90', sortable: true }
];
var url = '@Url.Content("~/Reports/Finance/PrePayLogisticsJson")' + '?date=@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)';
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "");
}
else {
tb.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