Commit 0c8b72e7 by guanzhenshan

调整现金流量表服务

parent bd06bad8
...@@ -9,6 +9,7 @@ using System.Threading; ...@@ -9,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using System.Linq; using System.Linq;
using System.Data;
namespace Bailun.DC.DailyPayAndIncoming namespace Bailun.DC.DailyPayAndIncoming
{ {
...@@ -80,24 +81,25 @@ namespace Bailun.DC.DailyPayAndIncoming ...@@ -80,24 +81,25 @@ namespace Bailun.DC.DailyPayAndIncoming
//利息支出 //利息支出
var listInterest = ListInterestExpense(cwurl); var listInterest = ListInterestExpense(cwurl);
//管理成品 //管理成品
var list = ListOtherCost(url); var list = ListFinanceManageCost(start, start, "", "", "", null);//ListOtherCost(url);
//物流费支出 //物流费支出
var listlg = ListLogisticFee(lgurl); var listlg = ListLogisticFee(start,start);//ListLogisticFee(lgurl);
decimal costTotal = 0; decimal costTotal = 0;
costTotal = listInterest.Count > 0 ? listInterest.Sum(a => a.RepayInterestRMB):0; costTotal = listInterest.Count > 0 ? listInterest.Sum(a => a.RepayInterestRMB):0;
//管理成本 只取付款主体为广州百伦供应链科技有限公司、香港百伦科技有限公司、广州电子服装仓、阳山仓、深圳仓、广州哥戈尔生活科技有限公司、广州迪致美容科技有限公司的数据 //管理成本 只取付款主体为广州百伦供应链科技有限公司、香港百伦科技有限公司、广州电子服装仓、阳山仓、深圳仓、广州哥戈尔生活科技有限公司、广州迪致美容科技有限公司的数据
list = list.Where(a => a.companyName.Contains("广州歌戈儿生活科技有限公司") || a.companyValue == 5 || a.companyValue == 1 || a.companyValue == 3 || a.companyValue == 8 || a.companyValue == 2 || a.companyValue==7).ToList(); list = list.Where(a => a.company_name.Contains("广州歌戈儿生活科技有限公司") || a.company_value == 5 || a.company_value == 1 || a.company_value == 3 || a.company_value == 8 || a.company_value == 2 || a.company_value == 7).ToList();
if (list.Count > 0) if (list.Count > 0)
{ {
costTotal += list.Sum(a => a.amountRmb); costTotal += list.Sum(a => a.amount_rmb);
} }
//支出 物流费支出 //支出 物流费支出
if (listlg!=null && listlg.Count() > 0) if (listlg!=null && listlg.Count() > 0)
{ {
costTotal += listlg.Sum(a => a.amountRmb); costTotal += listlg.Sum(a => a.amount_rmb);
} }
...@@ -152,24 +154,24 @@ namespace Bailun.DC.DailyPayAndIncoming ...@@ -152,24 +154,24 @@ namespace Bailun.DC.DailyPayAndIncoming
//利息支出 //利息支出
var listInterest = ListInterestExpense(cwurl); var listInterest = ListInterestExpense(cwurl);
//管理成品 //管理成品
var list = ListOtherCost(url); var list = ListFinanceManageCost(start,start,"","","",null);//ListOtherCost(url);
//物流费支出 //物流费支出
var listlg = ListLogisticFee(lgurl); var listlg = ListLogisticFee(start, start); //ListLogisticFee(lgurl);
decimal costTotal = 0; decimal costTotal = 0;
costTotal = listInterest.Count > 0 ? listInterest.Sum(a => a.RepayInterestRMB) : 0; costTotal = listInterest.Count > 0 ? listInterest.Sum(a => a.RepayInterestRMB) : 0;
//管理成本 只取付款主体为广州百伦供应链科技有限公司、香港百伦科技有限公司、广州电子服装仓、阳山仓、深圳仓、广州哥戈尔生活科技有限公司、广州迪致美容科技有限公司的数据 //管理成本 只取付款主体为广州百伦供应链科技有限公司、香港百伦科技有限公司、广州电子服装仓、阳山仓、深圳仓、广州哥戈尔生活科技有限公司、广州迪致美容科技有限公司的数据
list = list.Where(a => a.companyName.Contains("广州歌戈儿生活科技有限公司") || a.companyValue == 5 || a.companyValue == 1 || a.companyValue == 3 || a.companyValue == 8 || a.companyValue == 2 || a.companyValue == 7).ToList(); list = list.Where(a => a.company_name.Contains("广州歌戈儿生活科技有限公司") || a.company_value == 5 || a.company_value == 1 || a.company_value == 3 || a.company_value == 8 || a.company_value == 2 || a.company_value == 7).ToList();
if (list.Count > 0) if (list.Count > 0)
{ {
costTotal += list.Sum(a => a.amountRmb); costTotal += list.Sum(a => a.amount_rmb);
} }
//支出 物流费支出 //支出 物流费支出
if (listlg != null && listlg.Count() > 0) if (listlg != null && listlg.Count() > 0)
{ {
costTotal += listlg.Sum(a => a.amountRmb); costTotal += listlg.Sum(a => a.amount_rmb);
} }
//采购下单 //采购下单
...@@ -292,6 +294,65 @@ namespace Bailun.DC.DailyPayAndIncoming ...@@ -292,6 +294,65 @@ namespace Bailun.DC.DailyPayAndIncoming
} }
/// <summary> /// <summary>
/// 管理成本列表(从数据中心表获取数据)
/// </summary>
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <returns></returns>
public List<Models.dc_base_finance_managecost> ListFinanceManageCost(DateTime start, DateTime end, string feesupertype, string feesubtype, string departmentname, int? paycompanyid)
{
var sqlparam = new DynamicParameters();
var list = new List<Models.dc_base_finance_managecost>();
var sql = $"select * from dc_base_finance_managecost where pay_time>='{start.ToString("yyyy-MM-dd")}' and pay_time<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
if (!string.IsNullOrEmpty(feesupertype))
{
sql += " and fee_super_type=@type";
sqlparam.Add("type", feesupertype);
}
if (!string.IsNullOrEmpty(feesubtype))
{
sql += " and fee_sub_type=@subtype";
sqlparam.Add("subtype", feesubtype);
}
if (!string.IsNullOrEmpty(departmentname))
{
sql += " and department_name=@department_name";
sqlparam.Add("department_name", departmentname);
}
if (paycompanyid.HasValue && paycompanyid.Value > 0)
{
if (paycompanyid.Value == 53)
{
sql += " and company_value in (53,59,60,61,66)";
}
else
{
sql += " and company_value=" + paycompanyid.Value;
}
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
list = cn.Query<dc_base_finance_managecost>(sql, sqlparam, null, true, 2 * 60).ToList();
return list.ToList();
}
}
/// <summary>
/// 获取物流费列表 /// 获取物流费列表
/// </summary> /// </summary>
/// <param name="url"></param> /// <param name="url"></param>
...@@ -312,6 +373,31 @@ namespace Bailun.DC.DailyPayAndIncoming ...@@ -312,6 +373,31 @@ namespace Bailun.DC.DailyPayAndIncoming
return list; return list;
} }
/// <summary>
/// 物流费用
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public List<Models.dc_base_finance_logistics> ListLogisticFee(DateTime start, DateTime end)
{
var sqlparam = new DynamicParameters();
var list = new List<Models.dc_base_finance_logistics>();
var sql = $"select if(manage_cost_type=1,amount_rmb,-amount_rmb) as amount_rmb from dc_base_finance_logistics where pay_time>='{start.ToString("yyyy-MM-dd")}' and pay_time<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
list = cn.Query<dc_base_finance_logistics>(sql, sqlparam, null, true, 2 * 60).ToList();
return list.ToList();
}
}
#endregion #endregion
} }
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models
{
/// <summary>
/// 物流商费用单
/// </summary>
public class dc_base_finance_logistics
{
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
/// 费用单
/// </summary>
public string no { get; set; }
/// <summary>
/// 收款单位
/// </summary>
public string receive_unit { get; set; }
/// <summary>
/// 收款银行
/// </summary>
public string receive_bank { get; set; }
/// <summary>
/// 收款帐号
/// </summary>
public string receive_card { get; set; }
/// <summary>
/// 收款人
/// </summary>
public string receive_card_user { get; set; }
/// <summary>
/// 付款理由
/// </summary>
public string reason { get; set; }
/// <summary>
/// 支付时间
/// </summary>
public DateTime pay_time { get; set; }
/// <summary>
/// 费用类 1付款 2收款 3借支/借还
/// </summary>
public int manage_cost_type { get; set; }
/// <summary>
/// 创建人所属部门
/// </summary>
public string department_name { get; set; }
/// <summary>
/// 公司主体value
/// </summary>
public string company_value { get; set; }
/// <summary>
/// 主体名称
/// </summary>
public string company_name { get; set; }
/// <summary>
/// 原管理成本表分类名
/// </summary>
public string fee_super_type { get; set; }
/// <summary>
/// 费用小类
/// </summary>
public string fee_sub_type { get; set; }
/// <summary>
/// 费用总金额
/// </summary>
public decimal amount { get; set; }
/// <summary>
/// 币种
/// </summary>
public string currency { get; set; }
/// <summary>
/// 人民币总金额
/// </summary>
public decimal amount_rmb { get; set; }
/// <summary>
/// 费用单详情id
/// </summary>
public int cost_id1 { get; set; }
/// <summary>
/// 费用单id
/// </summary>
public int cost_id { get; set; }
/// <summary>
/// 数据中心创建时间
/// </summary>
public DateTime gmt_create { get; set; }
/// <summary>
/// 数据中心更新时间
/// </summary>
public DateTime gmt_modified { get; set; }
}
}
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