Commit f06ed1c1 by guanzhenshan

现金流量表总支出增加导出明细功能

parent 0345d926
...@@ -13,7 +13,7 @@ using System.Linq; ...@@ -13,7 +13,7 @@ using System.Linq;
namespace Bailun.DC.DailyPayAndIncoming namespace Bailun.DC.DailyPayAndIncoming
{ {
/// <summary> /// <summary>
/// 每日收支统计 /// 跨境电商现金流量表
/// </summary> /// </summary>
public class Services : BackgroundService public class Services : BackgroundService
{ {
......
...@@ -7,29 +7,29 @@ namespace Bailun.DC.DailySemiPurchaseSellStock ...@@ -7,29 +7,29 @@ namespace Bailun.DC.DailySemiPurchaseSellStock
{ {
class Program class Program
{ {
static async Task Main(string[] args) //static async Task Main(string[] args)
{ //{
Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); // Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
var builder = new HostBuilder().ConfigureServices((hostContext, services) => // var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{ // {
services.AddHostedService<Services>(); // services.AddHostedService<Services>();
}); // });
await builder.RunConsoleAsync(); // await builder.RunConsoleAsync();
} //}
//static void Main(string[] args) static void Main(string[] args)
//{ {
// var _services = new Services(); var _services = new Services();
// var start = DateTime.Parse("2019-11-27"); var start = DateTime.Parse("2020-04-10");
_services.Init(start);
//while (start.AddDays(1) < DateTime.Now)
//{
// Console.WriteLine(start);
// _services.Init(start); // _services.Init(start);
// //while (start.AddDays(1) < DateTime.Now) // start = start.AddDays(1);
// //{
// // Console.WriteLine(start);
// // _services.Init(start);
// // start = start.AddDays(1);
// //}
//} //}
} }
}
} }
...@@ -5756,5 +5756,32 @@ group by currency"; ...@@ -5756,5 +5756,32 @@ group by currency";
#endregion #endregion
#region 现金流量表 采购支出明细
/// <summary>
/// 采购支出明细
/// </summary>
/// <param name="start">开始日期</param>
/// <param name="end">结束日期</param>
/// <returns></returns>
public List<dc_base_finance_cashier> ListPurchaseCost(DateTime start,DateTime end)
{
var sql = $"select code,detail_name,type_name,companymain_name_from,cashier_paymoneyrmb,cashier_time from dc_base_finance_cashier where cashier_status=1 and cashier_type=1 and cashier_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and cashier_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and ((sourcecode in ('Buy','SemiFinishedProduct') and companymain_value_from !=14 and companymain_value_from!=48) or (tradeb_bjectname in ('广州哈倪蔓生物科技有限公司','广州拉古娜生物科技有限公司','广州美甲生产仓') and companymain_value_from in (1,2,5,7,8) and sourcecode in ('newCost','IncomeAndExpenditure')))";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.Query<dc_base_finance_cashier>(sql).AsList();
return obj;
}
}
#endregion
} }
} }
...@@ -6436,6 +6436,178 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -6436,6 +6436,178 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
} }
public ActionResult TotalIncomePay_PayDetail(DateTime date)
{
ViewBag.date = date.ToString("yyyy-MM-dd");
return View();
}
public ActionResult ExportTotalIncomePay_PayDetail(DateTime date, int t)
{
//支出包含两部分,一部分是百伦管理费,一部分是产品成本支出
//管理成本 广州百伦、香港百伦、电子服装厂、阳山仓、深圳仓的管理成本
var url = "http://api.fee.bailuntec.com/purchase/other/cost/api/manageCostList?o=0";
var cwurl = "http://cw.bailuntec.com/api/api/GetRepayPlanDetails?";
var lgurl = "http://api.fee.bailuntec.com/fee/api/cost/api/logisticsCostList?";
url += "&startDate=" + date.ToString("yyyy-MM-dd") + "&endDate=" + date.ToString("yyyy-MM-dd");
cwurl += "BeginRepayTime=" + date.ToString("yyyy-MM-dd") + "&EndRepayTime=" + date.ToString("yyyy-MM-dd");
lgurl += "startDate=" + date.ToString("yyyy-MM-dd") + "&endDate=" + date.ToString("yyyy-MM-dd");
//decimal costTotal = 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();
//if (list.Count > 0)
//{
// costTotal += list.Sum(a => a.amountRmb);
//}
////支出 物流费支出
//if (listlg != null && listlg.Count() > 0)
//{
// costTotal += listlg.Sum(a => a.amountRmb);
//}
////支出 2、成品采购+半成品采购+百伦(广州、香港)支付给哈倪曼和拉古娜的费用+百伦管理费用
//var sql = $@"select sum(cashier_paymoneyrmb) as amount from dc_base_finance_cashier where cashier_status=1 and cashier_type=1 and cashier_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and cashier_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}' and ((sourcecode in ('Buy','SemiFinishedProduct') and companymain_value_from !=14 and companymain_value_from!=48) or (tradeb_bjectname in ('广州哈倪蔓生物科技有限公司','广州拉古娜生物科技有限公司','广州美甲生产仓') and companymain_value_from in (1,2,5,7,8) and sourcecode in ('newCost','IncomeAndExpenditure')))";
if (t == 1) //管理成本
{
//管理成品
var list = new Services.FinanceReportServices().ListOtherCost(url);
var colNames = new List<string>() { "费用单号", "管理成本单类型", "部门名称", "付款主体名称", "父级分类", "金额", "付款时间" };
var listval = new List<string>();
foreach (var item in list)
{
listval.Add(item.no + "|" + item.manageCostType + "|" + item.departmentName + "|" + item.companyName + "|" + item.feeSuperType + "|" + item.amountRmb + "|" +
(item.payTime.HasValue?item.payTime.Value.ToString("yyyy-MM-dd HH:mm:ss"):"")
);
}
var guid = Guid.NewGuid().ToString();
var filename = date.ToString("yyyy-MM-dd")+" 现金流量表-管理成本支出";
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");
}
else if (t == 2) //利息
{
//利息支出
var listInterest = new Services.FinanceReportServices().ListInterestExpense(cwurl);
var colNames = new List<string>() { "借款公司", "借款帐号", "借款持卡人", "债权方", "本期归还利息", "实际还款时间" };
var listval = new List<string>();
foreach (var item in listInterest)
{
listval.Add(item.Company + "|" + item.BankCard + "|" + item.BankName + "|" + item.Creditor + "|" + item.RepayInterestRMB + "|" + (item.ActualRepayTime.HasValue ? item.ActualRepayTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
);
}
var guid = Guid.NewGuid().ToString();
var filename = date.ToString("yyyy-MM-dd") + " 现金流量表-利息成本支出";
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");
}
else if (t == 3) //物流
{
//物流费支出
var listlg = new Services.FinanceReportServices().ListLogisticFee(lgurl);
var colNames = new List<string>() { "单号", "被出纳公司名", "出纳时间", "类型", "部门", "付款主体", "费用主类型", "金额" };
var listval = new List<string>();
foreach (var item in listlg)
{
listval.Add(item.no + "|" + item.receiveUnit + "|" + item.payTime.ToString("yyyy-MM-dd HH:mm:ss") + "|" + item.manageCostType + "|" + item.departmentName + "|" + item.companyName+"|"+item.feeSuperType+"|"+item.amountRmb
);
}
var guid = Guid.NewGuid().ToString();
var filename = date.ToString("yyyy-MM-dd") + " 现金流量表-物流费支出";
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");
}
else if (t == 4) //采购成本
{
var listpurchase = new Services.FinanceReportServices().ListPurchaseCost(date, date);
var colNames = new List<string>() { "出纳单编号", "申请标题", "费用大类", "公司主体名称", "金额", "出纳时间" };
//code,detail_name,type_name,companymain_name_from,cashier_paymoneyrmb,cashier_time
var listval = new List<string>();
foreach (var item in listpurchase)
{
listval.Add(item.code + "|" + item.detail_name + "|" + item.type_name + "|" + item.companymain_name_from + "|" + item.cashier_paymoneyrmb + "|" + item.cashier_time.ToString("yyyy-MM-dd HH:mm:ss")
);
}
var guid = Guid.NewGuid().ToString();
var filename = date.ToString("yyyy-MM-dd") + " 现金流量表-采购成本支出";
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");
}
return View();
}
/// <summary> /// <summary>
/// 现金流动态分析明细 /// 现金流动态分析明细
/// </summary> /// </summary>
...@@ -7691,7 +7863,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -7691,7 +7863,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
a.avg_weighting_day_sales a.avg_weighting_day_sales
}); });
var colNames = new List<string>() { "仓库类型", "仓库名称", "sku","百伦简单分录", "出库数量", "出库金额", "入库数量", "入途金额", "(入库-出库)数量", "(入库-出库)金额" }; ; var colNames = new List<string>() { "仓库类型", "仓库名称", "sku","百伦简单分录", "出库数量", "出库金额", "入库数量", "入途金额", "(入库-出库)数量", "(入库-出库)金额" };
colNames.AddRange(new List<string> { "是否清货", "是否新品", "是否Aims下单","可用库存", "7日日均", "14日日均", "30日日均","加权日均", "可消耗天数","是否合理"}); colNames.AddRange(new List<string> { "是否清货", "是否新品", "是否Aims下单","可用库存", "7日日均", "14日日均", "30日日均","加权日均", "可消耗天数","是否合理"});
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
var obj = result.list[i]; var obj = result.list[i];
head+= '<th style="width:120px;">' + obj.record_time+'</th>'; head+= '<th style="width:120px;">' + obj.record_time+'</th>';
row1 += '<td style="width:120px;">' + obj.amount_payed+'</td>'; row1 += '<td style="width:120px;"><span onclick="showpaydetail(\'' + obj.record_time+'\')">' + obj.amount_payed+'</span></td>';
row2 += '<td style="width:120px;">' + obj.amount_income+'</td>'; row2 += '<td style="width:120px;">' + obj.amount_income+'</td>';
} }
...@@ -239,6 +239,10 @@ ...@@ -239,6 +239,10 @@
}) })
} }
function showpaydetail(date) {
layer_show(date + "的支出明细导出", '@Url.Content("~/Reports/Finance/TotalIncomePay_PayDetail?date=")'+date, '90%', '90%');
}
</script> </script>
} }
......

@{
ViewData["Title"] = "TotalIncomePay_PayDetail";
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">
<label>&nbsp;</label>
<button id="btnexport" type="button" class="btn btn-success" onclick="exportlist(1);">导出管理成本支出</button>
<button id="btnexport" type="button" class="btn btn-primary" onclick="exportlist(2);">导出利息支出</button>
<button id="btnexport" type="button" class="btn btn-success" onclick="exportlist(3);">导出物流费支出</button>
<button id="btnexport" type="button" class="btn btn-primary" onclick="exportlist(4);">导出采购成本支出</button>
</div>
</div>
</form>
</div>
</div>
</div>
@section scripts{
<script>
function exportlist (t)
{
var url = '@Url.Content("~/Reports/Finance/ExportTotalIncomePay_PayDetail?date="+ ViewBag.date)&t=' + t;
window.open(url, '_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