Commit e80759b6 by guanzhenshan

数据中心-现金流量表-支出 增加成品采购退货收款费用,使用负数相加

parent 04e9f9e2
...@@ -8,7 +8,7 @@ namespace Bailun.DC.DailyPayAndIncoming ...@@ -8,7 +8,7 @@ namespace Bailun.DC.DailyPayAndIncoming
class Program class Program
{ {
/// <summary> /// <summary>
/// /// 现金流量表
/// </summary> /// </summary>
/// <param name="args"></param> /// <param name="args"></param>
/// <returns></returns> /// <returns></returns>
...@@ -27,11 +27,11 @@ namespace Bailun.DC.DailyPayAndIncoming ...@@ -27,11 +27,11 @@ namespace Bailun.DC.DailyPayAndIncoming
//{ //{
// var _services = new Services(); // var _services = new Services();
// var start = DateTime.Parse("2020-05-18"); // var start = DateTime.Parse("2020-06-01");
// _services.Init(start, start.AddDays(1)); // //_services.Init(start, start.AddDays(1));
// _services.SaveMoneyFlowCount(start, start.AddDays(1)); // //_services.SaveMoneyFlowCount(start, start.AddDays(1));
// return; // //return;
// while (start.AddDays(1) < DateTime.Now) // while (start.AddDays(1) < DateTime.Now)
// { // {
// Console.WriteLine(start); // Console.WriteLine(start);
......
...@@ -115,6 +115,12 @@ namespace Bailun.DC.DailyPayAndIncoming ...@@ -115,6 +115,12 @@ namespace Bailun.DC.DailyPayAndIncoming
var obj = cn.QueryFirstOrDefault<decimal?>(sql, null, null, 2 * 60); var obj = cn.QueryFirstOrDefault<decimal?>(sql, null, null, 2 * 60);
//Add by Allan at 20200704, 成品退货收款 放在支出里面,改为负数
sql = $"select sum(-cashier_paymoneyrmb) as amount from dc_base_finance_cashier where cashier_type=2 and sourcecode='Buy' and cashier_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and cashier_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}' and companymain_value_from !=14 and companymain_value_from!=48";
var objFinishRefund = cn.QueryFirstOrDefault<decimal?>(sql, null, null, 2 * 60);
costTotal += (objFinishRefund ?? 0);
//End Add
//收入 提现到账的资金 去掉1688的收入 //收入 提现到账的资金 去掉1688的收入
sql = $"select sum(other_to_cny_money) amount from dc_base_finance_cashierdetail where collection_platform!=1 and daozhang_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and daozhang_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}'"; sql = $"select sum(other_to_cny_money) amount from dc_base_finance_cashierdetail where collection_platform!=1 and daozhang_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and daozhang_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}'";
...@@ -191,6 +197,12 @@ namespace Bailun.DC.DailyPayAndIncoming ...@@ -191,6 +197,12 @@ namespace Bailun.DC.DailyPayAndIncoming
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')))"; 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')))";
var objPayed = cn.QueryFirstOrDefault<decimal?>(sql, null, null, 2 * 60); var objPayed = cn.QueryFirstOrDefault<decimal?>(sql, null, null, 2 * 60);
//Add by Allan at 20200704, 成品退货收款 放在支出里面,改为负数
sql = $"select sum(-cashier_paymoneyrmb) as amount from dc_base_finance_cashier where cashier_type=2 and sourcecode='Buy' and cashier_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and cashier_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}' and companymain_value_from !=14 and companymain_value_from!=48";
var objFinishRefund = cn.QueryFirstOrDefault<decimal?>(sql, null, null, 2 * 60);
costTotal += (objFinishRefund ?? 0);
//End Add
//到货入库 //到货入库
sql = $@"select sum(t1.count*t2.unit_price) amount from dc_base_purchase_inbound t1 sql = $@"select sum(t1.count*t2.unit_price) amount from dc_base_purchase_inbound t1
join dc_base_purchase_details t2 on t1.purchase_id=t2.purchase_id and t1.bailun_sku=t2.bailun_sku join dc_base_purchase_details t2 on t1.purchase_id=t2.purchase_id and t1.bailun_sku=t2.bailun_sku
......
...@@ -6208,9 +6208,20 @@ group by currency"; ...@@ -6208,9 +6208,20 @@ group by currency";
/// <param name="start">开始日期</param> /// <param name="start">开始日期</param>
/// <param name="end">结束日期</param> /// <param name="end">结束日期</param>
/// <returns></returns> /// <returns></returns>
public List<dc_base_finance_cashier> ListPurchaseCost(DateTime start,DateTime end) public List<dc_base_finance_cashier> ListPurchaseCost(DateTime start,DateTime end,int ispay=1)
{ {
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')))"; var sql = "";
if (ispay == 1)
{
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')))";
}
else
{
sql = $"select code,detail_name,type_name,companymain_name_from,cashier_paymoneyrmb,cashier_time from dc_base_finance_cashier where cashier_type=2 and sourcecode='Buy' and cashier_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and cashier_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}' and companymain_value_from !=14 and companymain_value_from!=48";
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
...@@ -6224,6 +6235,7 @@ group by currency"; ...@@ -6224,6 +6235,7 @@ group by currency";
return obj; return obj;
} }
} }
#endregion #endregion
......
...@@ -6936,7 +6936,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -6936,7 +6936,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
cwurl += "BeginRepayTime=" + start.ToString("yyyy-MM-dd") + "&EndRepayTime=" + end.ToString("yyyy-MM-dd"); cwurl += "BeginRepayTime=" + start.ToString("yyyy-MM-dd") + "&EndRepayTime=" + end.ToString("yyyy-MM-dd");
lgurl += "startDate=" + start.ToString("yyyy-MM-dd") + "&endDate=" + end.ToString("yyyy-MM-dd"); lgurl += "startDate=" + start.ToString("yyyy-MM-dd") + "&endDate=" + end.ToString("yyyy-MM-dd");
//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;
...@@ -6962,23 +6962,23 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -6962,23 +6962,23 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
if (t == 1) //管理成本 if (t == 1) //管理成本
{ {
//管理成品 //管理成品
var list = new Services.FinanceReportServices().ListFinanceManageCost(start,end,"","","",null); var list = new Services.FinanceReportServices().ListFinanceManageCost(start, end, "", "", "", null);
var colNames = new List<string>() { "费用单号", "管理成本单类型", "部门名称", "付款主体名称", "父级分类", "金额", "付款时间" }; var colNames = new List<string>() { "费用单号", "管理成本单类型", "部门名称", "付款主体名称", "父级分类", "金额", "付款时间" };
//管理成本 只取付款主体为广州百伦供应链科技有限公司、香港百伦科技有限公司、广州电子服装仓、阳山仓、深圳仓、广州哥戈尔生活科技有限公司、广州迪致美容科技有限公司的数据 //管理成本 只取付款主体为广州百伦供应链科技有限公司、香港百伦科技有限公司、广州电子服装仓、阳山仓、深圳仓、广州哥戈尔生活科技有限公司、广州迪致美容科技有限公司的数据
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(); 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();
var listval = new List<string>(); var listval = new List<string>();
foreach (var item in list) foreach (var item in list)
{ {
listval.Add(item.no + "|" + item.manage_cost_type + "|" + item.department_name + "|" + item.company_name + "|" + item.fee_super_type + "|" + item.amount_rmb + "|" + listval.Add(item.no + "|" + item.manage_cost_type + "|" + item.department_name + "|" + item.company_name + "|" + item.fee_super_type + "|" + item.amount_rmb + "|" +
(item.pay_time.HasValue?item.pay_time.Value.ToString("yyyy-MM-dd HH:mm:ss"):"") (item.pay_time.HasValue ? item.pay_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")
); );
} }
var guid = Guid.NewGuid().ToString(); var guid = Guid.NewGuid().ToString();
var filename = start.ToString("yyyy-MM-dd")+"至"+ end.ToString("yyyy-MM-dd") + " 现金流量表-管理成本支出"; var filename = start.ToString("yyyy-MM-dd") + "至" + end.ToString("yyyy-MM-dd") + " 现金流量表-管理成本支出";
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\"; var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(listval, colNames, guid, filepath); ToCSV(listval, colNames, guid, filepath);
...@@ -6999,7 +6999,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -6999,7 +6999,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var colNames = new List<string>() { "借款公司", "借款帐号", "借款持卡人", "债权方", "本期归还利息", "实际还款时间" }; var colNames = new List<string>() { "借款公司", "借款帐号", "借款持卡人", "债权方", "本期归还利息", "实际还款时间" };
var listval = new List<string>(); var listval = new List<string>();
foreach (var item in listInterest) foreach (var item in listInterest)
{ {
...@@ -7032,7 +7032,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -7032,7 +7032,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var listval = new List<string>(); var listval = new List<string>();
foreach (var item in listlg) foreach (var item in listlg)
{ {
listval.Add(item.no + "|" + item.receive_unit + "|" + item.pay_time.ToString("yyyy-MM-dd HH:mm:ss") + "|" + item.manage_cost_type + "|" + item.department_name + "|" + item.company_name+"|"+item.fee_super_type+"|"+item.amount_rmb listval.Add(item.no + "|" + item.receive_unit + "|" + item.pay_time.ToString("yyyy-MM-dd HH:mm:ss") + "|" + item.manage_cost_type + "|" + item.department_name + "|" + item.company_name + "|" + item.fee_super_type + "|" + item.amount_rmb
); );
} }
...@@ -7081,6 +7081,32 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -7081,6 +7081,32 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
ms.Position = 0; ms.Position = 0;
return File(ms, "text/csv", filename + ".csv"); return File(ms, "text/csv", filename + ".csv");
} }
else if (t == 5)
{
var listpurchase = new Services.FinanceReportServices().ListPurchaseCost(start, end,0);
var colNames = new List<string>() { "出纳单编号", "申请标题", "费用大类", "公司主体名称", "金额", "出纳时间" };
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 = start.ToString("yyyy-MM-dd") + "至" + end.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(); return View();
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<button id="btnexport" type="button" class="btn btn-primary" onclick="exportlist(2);">导出利息支出</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-success" onclick="exportlist(3);">导出物流费支出</button>
<button id="btnexport" type="button" class="btn btn-primary" onclick="exportlist(4);">导出采购成本支出</button> <button id="btnexport" type="button" class="btn btn-primary" onclick="exportlist(4);">导出采购成本支出</button>
<button id="btnexport" type="button" class="btn btn-success" onclick="exportlist(5);">导出成品采购退货收款</button>
</div> </div>
</div> </div>
</form> </form>
......
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