Commit 9a8cfe45 by guanzhenshan

管理成本增加手续费用

parent fdd81eb6
......@@ -22,8 +22,8 @@ namespace Bailun.DC.DailyPayAndIncoming
//{
// var _services = new Services();
// var start = DateTime.Parse("2020-02-19");
// while (start < DateTime.Now)
// var start = DateTime.Parse("2020-04-01");
// while (start.AddDays(1) < DateTime.Now)
// {
// Console.WriteLine(start);
// _services.Init(start, start.AddDays(1));
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models
{
/// <summary>
/// 手续费
/// </summary>
public class dc_base_finance_handlefee
{
public int id { get; set; }
public int cw_id { get; set; }
public string trad_code { get; set; }
public int subject_value_from { get; set; }
public string subject_name_from { get; set; }
public int pay_account_iDFrom { get; set; }
public string bank_name_from { get; set; }
public string bank_card_from { get; set; }
public string bank_card_user_from { get; set; }
public int supplier_iDFrom { get; set; }
public string supplier_name_from { get; set; }
public int trade_type { get; set; }
public string subject_value_to { get; set; }
public string subject_name_to { get; set; }
public int pay_account_iDTo { get; set; }
public string bank_name_to { get; set; }
public string bank_card_to { get; set; }
public string bank_card_user_to { get; set; }
public int supplier_iDTo { get; set; }
public string supplier_name_to { get; set; }
public string unit_nameto { get; set; }
public string unit_codeto { get; set; }
public decimal rate { get; set; }
public decimal pay_moneyto { get; set; }
public string unit_name { get; set; }
public string unit_code { get; set; }
public decimal pay_money { get; set; }
public decimal pay_money_rMB { get; set; }
public decimal old_money { get; set; }
public decimal new_money { get; set; }
public decimal before_day_money { get; set; }
public string remark { get; set; }
public string annex { get; set; }
public int has_delete { get; set; }
public string delete_remark { get; set; }
public int create_user_iD { get; set; }
public string create_user_name { get; set; }
public DateTime? create_time { get; set; }
public int fetter_trade_iD { get; set; }
public string fetter_trade_code { get; set; }
public string source { get; set; }
public string trade_category { get; set; }
public int payment_iD { get; set; }
public int pur_category_iD { get; set; }
public string pur_category_name { get; set; }
public string apply_code { get; set; }
public decimal original_rate { get; set; }
public string cashier_source_name { get; set; }
public string cashier_detail_name { get; set; }
public string cashier_code { get; set; }
public string casher_transaction_type { get; set; }
public int cashier_id { get; set; }
public string cashier_other_order_code { get; set; }
}
}
......@@ -742,6 +742,36 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 手续费
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="paycompanyid"></param>
/// <returns></returns>
public List<dc_base_finance_handlefee> ListFinanceHandleFee(DateTime start, DateTime end, int? paycompanyid)
{
var sql = $"select * from dc_base_finance_handlefee where has_delete=0 and create_time>='{start.ToString("yyyy-MM-dd")}' and create_time<'{end.AddDays(1).ToString("yyyy-MM-dd")}'";
if (paycompanyid.HasValue && paycompanyid.Value > 0)
{
sql += " and subject_value_from=" + paycompanyid.Value;
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var list = cn.Query<dc_base_finance_handlefee>(sql).ToList();
return list;
}
}
#endregion
#region 平台余额
......
......@@ -7,27 +7,27 @@ namespace Bailun.DC.SkuDailyPurchaseAndSales
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("进入保存每日采购数和售出数");
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Services>();
});
await builder.RunConsoleAsync();
}
//static void Main(string[] args)
//static async Task Main(string[] args)
//{
// var start = DateTime.Parse("2020-04-01");
// while (start.AddDays(1) < DateTime.Now)
// Console.WriteLine("进入保存每日采购数和售出数");
// var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
// {
// Console.WriteLine(start.ToString("yyyy-MM-dd"));
// new Services().Init(start, start.AddDays(1));
// start = start.AddDays(1);
// }
// services.AddHostedService<Services>();
// });
// await builder.RunConsoleAsync();
//}
static void Main(string[] args)
{
var start = DateTime.Parse("2020-05-01");
while (start.AddDays(1) < DateTime.Now)
{
Console.WriteLine(start.ToString("yyyy-MM-dd"));
new Services().Init(start, start.AddDays(1));
start = start.AddDays(1);
}
}
}
}
......@@ -554,6 +554,10 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
//Edit by Allan at 20191217 for 更改数据源
var list = new Services.FinanceReportServices().ListFinanceManageCost(start,end,"","","",paycompanyid); //new Services.FinanceReportServices().ListOtherCost(url);
//手续费 Add by Allan at 20200514
var listHandleFee = new Services.FinanceReportServices().ListFinanceHandleFee(start, end, paycompanyid);
var listValue = new List<Tuple<string, List<decimal>>>();
var listCol = new List<string>();
var listColVal = new List<int>();
......@@ -625,6 +629,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var listCount = new List<decimal>();
//利息支出
if (listInterest.Count > 0)
{
var obj = listValue.Where(a => a.Item1 == "利息支出").FirstOrDefault();
......@@ -840,6 +845,224 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
}
//手续费支出
if (listHandleFee.Count > 0)
{
var obj = listValue.Where(a => a.Item1 == "手续费支出").FirstOrDefault();
var index_Interest_h = -1;
if (t == 2) //按付款主体
{
var gogirlindex_h = -1; //广州歌戈儿生活科技有限公司
var gogirlindexarr_h = new List<int>(); //广州歌戈儿 相关付款主体
var clothindex_h = -1;
for (var i = 0; i < listCol.Count; i++)
{
if (listCol[i] == "广州电子服装仓")
{
clothindex_h = i;
}
if (listCol[i] == "广州百伦供应链科技有限公司")
{
index_Interest_h = i;
}
if (listCol[i] == "广州歌戈儿生活科技有限公司")
{
gogirlindex_h = i;
}
else if (listCol[i].Contains("歌戈儿"))
{
gogirlindexarr_h.Add(i);
}
}
//广州电子服装仓
var clothVal = 0.00M;
var objCloth = listHandleFee.Where(a => a.subject_value_from != 1);
if (objCloth.Count() > 0)
{
clothVal = objCloth.Sum(a => a.pay_money_rMB);
}
//广州百伦
var gzblVal = 0.00M;
var objGZBL = listHandleFee.Where(a => a.subject_value_from == 1);
if (objGZBL.Count() > 0)
{
gzblVal = objGZBL.Sum(a => a.pay_money_rMB);
}
if (clothVal > 0 && clothindex_h == -1)
{
listCol.Add("广州电子服装仓");
clothindex_h = listCol.Count - 1;
foreach (var item in listValue)
{
item.Item2.Add(0);
}
}
if (gzblVal > 0 && index_Interest_h == -1)
{
listCol.Add("广州百伦供应链科技有限公司");
index_Interest_h = listCol.Count - 1;
foreach (var item in listValue)
{
item.Item2.Add(0);
}
}
if (obj == null)
{
var _list = new List<decimal>();
for (var j = 0; j < listCol.Count; j++)
{
if (j == clothindex_h)
{
_list.Add(clothVal);
}
else if (j == index_Interest_h)
{
_list.Add(gzblVal);
}
else
{
_list.Add(0);
}
}
listValue.Add(new Tuple<string, List<decimal>>("手续费支出", _list));
}
else
{
obj.Item2[clothindex_h] = clothVal;
obj.Item2[index_Interest_h] = gzblVal;
}
//Add by Allan at 201907091500
//合并广州歌戈儿相关付款主体到 广州歌戈儿生活科技有限公司
if (gogirlindexarr_h.Count > 0)
{
//降序排序,方便下面的删除操作,从数据后面开始删除
gogirlindexarr_h = gogirlindexarr_h.OrderByDescending(a => a).ToList();
if (gogirlindex_h > -1)
{
//附加数据到 广州歌戈儿生活科技有限公司
foreach (var item in listValue)
{
foreach (var index in gogirlindexarr_h)
{
item.Item2[gogirlindex_h] += item.Item2[index];
}
}
//按索引删除 值集合里面的值
foreach (var item in listValue)
{
foreach (var index in gogirlindexarr_h)
{
item.Item2.RemoveAt(index);
}
}
//按索引删除 列头
foreach (var index in gogirlindexarr_h)
{
listCol.RemoveAt(index);
}
}
else
{
listCol.Add("广州歌戈儿生活科技有限公司");
//增加一列
foreach (var item in listValue)
{
item.Item2.Add(0);
}
foreach (var index in gogirlindexarr_h)
{
foreach (var item in listValue)
{
item.Item2[item.Item2.Count - 1] += item.Item2[index];
}
}
//按索引删除 值集合里面的值
foreach (var item in listValue)
{
foreach (var index in gogirlindexarr_h)
{
item.Item2.RemoveAt(index);
}
}
//按索引删除 列头
foreach (var index in gogirlindexarr_h)
{
listCol.RemoveAt(index);
}
}
}
//End Add
}
else //按部门
{
for (var i = 0; i < listCol.Count; i++)
{
if (listCol[i] == "财务部")
{
index_Interest_h = i;
}
}
var val = listHandleFee.Sum(a => a.pay_money_rMB);
if (index_Interest_h == -1 && val > 0)
{
listCol.Add("财务部");
index_Interest_h = listCol.Count - 1;
foreach (var item in listValue)
{
item.Item2.Add(0);
}
}
if (obj == null)
{
var _list = new List<decimal>();
for (var j = 0; j < listCol.Count; j++)
{
if (j == index_Interest_h)
{
_list.Add(val);
}
else
{
_list.Add(0);
}
}
listValue.Add(new Tuple<string, List<decimal>>("手续费支出", _list));
}
else
{
obj.Item2[index_Interest_h] = val;
}
}
}
foreach (var item in listValue)
{
for (var i = 0; i < item.Item2.Count; i++)
......@@ -868,7 +1091,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
msg = list.Count>0?"":"成本接口返回了空记录。",
col = listCol,
list = listValue,
amount = Math.Round(list.Sum(a=>a.amount_rmb)+ listInterest.Sum(a=>a.RepayInterestRMB), 2),
amount = Math.Round(list.Sum(a=>a.amount_rmb)+ listInterest.Sum(a=>a.RepayInterestRMB)+ listHandleFee.Sum(a => a.pay_money_rMB), 2),
isexport = Services.UserAuthorityServices.checkUserExportAuthority("ExportListInterestExpense", HttpContextHelper.Current.User.GetUserName()),
});
}
......
......@@ -41,7 +41,9 @@ namespace Bailun.DC.Web
{
options.ValueLengthLimit = 1024 * 1024 * 100;
options.ValueCountLimit = int.MaxValue;
});
//עsession
//services.AddSession();
......
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