Commit 471e671e by GhostUI

明细

parent dc5a8260
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Dtos.Finance
{
public class FinanceDetailsDto
{
/// <summary>
/// 金额
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// 人民币
/// </summary>
public decimal AmountRmb { get; set; }
/// <summary>
/// 公司
/// </summary>
public string CompanyName { get; set; }
/// <summary>
/// 币种
/// </summary>
public string Currency { get; set; }
/// <summary>
/// 部门
/// </summary>
public string DepartmentName { get; set; }
/// <summary>
/// 费用单号
/// </summary>
public string FeeId { get; set; }
/// <summary>
/// 收款单位
/// </summary>
public string ReceiveUnit { get; set; }
/// <summary>
/// 付款理由
/// </summary>
public string Reason { get; set; }
/// <summary>
/// 付款时间
/// </summary>
public string PayTime { get; set; }
/// <summary>
/// 费用类型
/// </summary>
public string FeeSuperType { get; set; }
/// <summary>
/// 会计科目
/// </summary>
public string Accounting { get; set; }
}
}
...@@ -15,7 +15,5 @@ namespace Bailun.DC.Models.Dtos.Finance ...@@ -15,7 +15,5 @@ namespace Bailun.DC.Models.Dtos.Finance
{ {
public string title { get; set; } public string title { get; set; }
public string key { get; set; } public string key { get; set; }
public bool show { get; set; } = true;
public string width { get; set; } = "120";
} }
} }
...@@ -19,5 +19,9 @@ namespace Bailun.DC.Models.Dtos.Finance ...@@ -19,5 +19,9 @@ namespace Bailun.DC.Models.Dtos.Finance
/// 公司主体 /// 公司主体
/// </summary> /// </summary>
public string CorporateEntity { get; set; } public string CorporateEntity { get; set; }
#region 明细
public string CompanyName { get; set; }
public string FeeType { get; set; }
#endregion
} }
} }
...@@ -23,37 +23,7 @@ namespace Bailun.DC.Services.WebApiService ...@@ -23,37 +23,7 @@ namespace Bailun.DC.Services.WebApiService
try try
{ {
var dtos = new FinanceDto(); var dtos = new FinanceDto();
var sql = $@"select * from dc_base_finance_fee s1 var data = GetFinanceFeeList(input);
left JOIN dc_base_finance_company s2
ON s1.company_name = s2.company_name
where s1.cost_status = 4
and (s1.is_lend is null or s1.is_lend = 1
or (s1.is_lend = 2 and s1.lend_balance > 0) or (s1.is_lend = 2 and s1.cost_form = 1))
and s1.pay_time >= @PaymentTimeStart and s1.pay_time < @PaymentTimeEnd
and s2.company_type = @CorporateEntity";
var para = new DynamicParameters();
para.Add("PaymentTimeStart", input.PaymentTimeStart.Date);
para.Add("PaymentTimeEnd", input.PaymentTimeEnd.Date);
para.Add("CorporateEntity", input.CorporateEntity);
var data = SimpleCRUD.Query<dc_base_finance_fee>(sql, para, GlobalConfig.ConnectionString).ToList();
foreach (var item in data)
{
if (item.cost_form == 2)
{
item.amount = -(item.amount);
item.amount_rmb = -(item.amount_rmb);
}
//借支单待还余额
if (item.cost_form == 3)
{
if (item.is_lend.HasValue && item.is_lend.Value == 2 && ((item.lend_balance ?? 0) > 0)) //归还金额
{
item.amount = -(item.amount);
item.amount_rmb = -(item.amount_rmb);
}
}
}
if (data.Count > 0) if (data.Count > 0)
{ {
var url = ConfigHelper.AppSetting("cwUrl"); var url = ConfigHelper.AppSetting("cwUrl");
...@@ -105,10 +75,10 @@ and s2.company_type = @CorporateEntity"; ...@@ -105,10 +75,10 @@ and s2.company_type = @CorporateEntity";
for (int i = 0; i < listValue.Count; i++) for (int i = 0; i < listValue.Count; i++)
{ {
jsonStr += "{"; jsonStr += "{";
jsonStr += "\"key\":\"" + listValue[i].Item1 + "\","; jsonStr += "\"key\":\"" + listValue[i].Item1 + "\",";//第一条费用类型
for (int j = 1; j < listValue[i].Item2.Count; j++) for (int j = 0; j < listValue[i].Item2.Count; j++)//第一条类型里所有数据
{ {
jsonStr += "\"" + dtos.Col[j].key + "\":\"" + listValue[i].Item2[j] + "\","; jsonStr += "\"" + dtos.Col[j+1].key + "\":\"" + listValue[i].Item2[j] + "\",";
} }
jsonStr = jsonStr.Trim(','); jsonStr = jsonStr.Trim(',');
jsonStr += "},"; jsonStr += "},";
...@@ -182,5 +152,74 @@ and s2.company_type = @CorporateEntity"; ...@@ -182,5 +152,74 @@ and s2.company_type = @CorporateEntity";
return sqlText.ToString(); return sqlText.ToString();
} }
#endregion #endregion
private List<dc_base_finance_fee> GetFinanceFeeList(GetCashFlowStatementInput input)
{
var sql = $@"select * from dc_base_finance_fee s1
left JOIN dc_base_finance_company s2
ON s1.company_name = s2.company_name
where s1.cost_status = 4
and (s1.is_lend is null or s1.is_lend = 1
or (s1.is_lend = 2 and s1.lend_balance > 0) or (s1.is_lend = 2 and s1.cost_form = 1))
and s1.pay_time >= @PaymentTimeStart and s1.pay_time < @PaymentTimeEnd
and s2.company_type = @CorporateEntity ";
var para = new DynamicParameters();
para.Add("PaymentTimeStart", input.PaymentTimeStart.Date);
para.Add("PaymentTimeEnd", input.PaymentTimeEnd.Date);
para.Add("CorporateEntity", input.CorporateEntity);
if (!string.IsNullOrWhiteSpace(input.CompanyName)
&& !string.IsNullOrWhiteSpace(input.FeeType))
{
sql += " and s1.type_name=@type and s1.company_name = @companyname";
para.Add("type", input.FeeType);
para.Add("companyname", input.CompanyName);
}
var data = SimpleCRUD.Query<dc_base_finance_fee>(sql, para, GlobalConfig.ConnectionString).ToList();
foreach (var item in data)
{
if (item.cost_form == 2)
{
item.amount = -(item.amount);
item.amount_rmb = -(item.amount_rmb);
}
//借支单待还余额
if (item.cost_form == 3)
{
if (item.is_lend.HasValue && item.is_lend.Value == 2 && ((item.lend_balance ?? 0) > 0)) //归还金额
{
item.amount = -(item.amount);
item.amount_rmb = -(item.amount_rmb);
}
}
}
return data;
}
public CommonApiResponseDto<List<FinanceDetailsDto>> GetFinanceDetails(GetCashFlowStatementInput input)
{
try
{
var data = GetFinanceFeeList(input);
var dto = data.Select(x => new FinanceDetailsDto
{
Amount = Convert.ToDecimal(x.amount),
AmountRmb = Convert.ToDecimal(x.amount),
CompanyName = x.company_name,
Currency = x.dic,
DepartmentName = x.department_name,
FeeSuperType = x.type_name,
FeeId = x.cost_no,
Accounting = x.accounting_subject_name,
Reason = string.IsNullOrEmpty(x.cost_reason) ? x.cost_remark : x.cost_reason,
PayTime = x.pay_time.HasValue ?
x.pay_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
ReceiveUnit = x.bank_company
}).ToList();
return new CommonApiResponseDto<List<FinanceDetailsDto>> { Data = dto };
}
catch (Exception e)
{
return new CommonApiResponseDto<List<FinanceDetailsDto>> { IsSuccess = false, Message = e.Message };
}
}
} }
} }
...@@ -1374,7 +1374,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -1374,7 +1374,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="PayName"></param> /// <param name="PayName"></param>
/// <param name="ismanager">是否管理成本</param> /// <param name="ismanager">是否管理成本</param>
/// <returns></returns> /// <returns></returns>
//[BailunAuthentication(LoginMode.Enforce)] [BailunAuthentication(LoginMode.Enforce)]
[HttpPost] [HttpPost]
[BrowseLog("Bailun_data", "访问【百伦数据中心】->【财务报表】->【管理成本报表】->【查询】页面", 0)] [BrowseLog("Bailun_data", "访问【百伦数据中心】->【财务报表】->【管理成本报表】->【查询】页面", 0)]
public JsonResult AdministrativeCostJson(int t, DateTime start,DateTime end,int? paycompanyid,int? ismanager) public JsonResult AdministrativeCostJson(int t, DateTime start,DateTime end,int? paycompanyid,int? ismanager)
...@@ -2009,7 +2009,6 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2009,7 +2009,6 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="start"></param> /// <param name="start"></param>
/// <param name="end"></param> /// <param name="end"></param>
/// <returns></returns> /// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string ListAdministrativeCostJson(DateTime start, DateTime end, int? paycompanyid, string headname, string categoryname, int type, int issub,int? ismanager) public string ListAdministrativeCostJson(DateTime start, DateTime end, int? paycompanyid, string headname, string categoryname, int type, int issub,int? ismanager)
{ {
var user = HttpContextHelper.Current?.User; var user = HttpContextHelper.Current?.User;
......
...@@ -56,5 +56,14 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -56,5 +56,14 @@ namespace Bailun.DC.WebApi.Controllers
return new FinanceService().GetFinanceFeeDetailsPage(input); return new FinanceService().GetFinanceFeeDetailsPage(input);
} }
#endregion #endregion
/// <summary>
/// 获取付现流水报表明细
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("getFinanceDetails")]
public CommonApiResponseDto<List<FinanceDetailsDto>> GetFinanceDetails(GetCashFlowStatementInput input)
=> new FinanceService().GetFinanceDetails(input);
} }
} }
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