Commit 3dceb06b by guanzhenshan

资产负债表调整自产采购发货在途明细

parent bbad558c
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models
{
public class dc_daily_purchase_semi_deliveronway
{
public int id { get; set; }
public DateTime day { get; set; }
public string purchase_id { get; set; }
public string bailun_sku { get; set; }
public int count { get; set; }
public decimal price { get; set; }
public DateTime createtime { get; set; }
public string buyer_name { get; set; }
}
}
...@@ -2360,6 +2360,44 @@ namespace Bailun.DC.Services ...@@ -2360,6 +2360,44 @@ namespace Bailun.DC.Services
} }
} }
/// <summary>
/// 自产采购发货在途明细
/// </summary>
/// <param name="request">分页信息</param>
/// <param name="date">统计日期</param>
/// <param name="total">符合条件的记录数</param>
/// <returns></returns>
public List<dc_daily_purchase_semi_deliveronway> ListSelfProductShippingOnway(BtTableParameter request, DateTime date, ref int total)
{
var sql = $@"select t1.*,t2.buyer_name from dc_daily_purchase_semi_deliveronway t1
join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku
where t1.day='{date}'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
if (request.limit > 0)
{
var obj = cn.Page<dc_daily_purchase_semi_deliveronway>(request.pageIndex, request.limit, sql, ref total);
return obj.ToList();
}
else
{
var obj = cn.Query<dc_daily_purchase_semi_deliveronway>(sql);
return obj.ToList();
}
}
}
#endregion #endregion
#region 付款主体 #region 付款主体
......
...@@ -2250,6 +2250,78 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2250,6 +2250,78 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return File(ms, "text/csv", filename + ".csv"); return File(ms, "text/csv", filename + ".csv");
} }
/// <summary>
/// 自产采购发货在途
/// </summary>
/// <param name="date">日期</param>
/// <param name="paycompanyid"></param>
/// <returns></returns>
public ActionResult ListSelfProductShippingOnway(DateTime date, int paycompanyid)
{
ViewBag.date = date.ToString("yyyy-MM-dd");
ViewBag.paycompanyid = paycompanyid;
return View();
}
/// <summary>
/// 自产采购在途数据
/// </summary>
/// <param name="request">分页信息</param>
/// <param name="date">统计日期</param>
/// <param name="paycompanyid"></param>
/// <returns></returns>
public string ListSelfProductShippingOnwayJson(BtTableParameter request, DateTime date)
{
var total = 0;
var obj = new Services.FinanceReportServices().ListSelfProductShippingOnway(request, date, ref total);
var list = obj.Select(a => new {
a.purchase_id,
a.bailun_sku,
a.buyer_name,
a.count,
a.price,
amount = a.count * a.price,
record_time = a.day.ToString("yyyy-MM-dd")
});
return JsonConvert.SerializeObject(new { total = total, rows = list });
}
/// <summary>
/// 自产采购在途数据导出
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public ActionResult ListSelfProductShippingOnwayExport(DateTime date)
{
var total = 0;
var obj = new Services.FinanceReportServices().ListSelfProductShippingOnway(new BtTableParameter { limit = 0 }, date, ref total);
var colNames = new List<string> { "统计日期", "采购单号", "Sku编码", "发货在途数量", "采购价", "总金额", "采购员名称" };
var list = new List<string>();
foreach (var item in obj)
{
list.Add(item.day.ToString("yyyy-MM-dd") + "|" + item.purchase_id + "|" + item.bailun_sku + "|" + item.count + "|" + item.price + "|" + (item.count * item.price) + "|" + item.buyer_name);
}
var guid = Guid.NewGuid().ToString();
var filename = date.ToString("yyyy-MM-dd") + "自产采购发货在途" + DateTime.Now.ToString("yyyyMMddHHmmss");
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(list, 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");
}
/// <summary> /// <summary>
/// 短期借款明细 /// 短期借款明细
......
...@@ -1753,7 +1753,7 @@ ...@@ -1753,7 +1753,7 @@
showdetail(title + ' 生产库存', '@Url.Content("~/Reports/Finance/SemiProductionStock?type=semi_prod_inventory_amount")&date=' + title + '&paycompanyid=' + paycompany); showdetail(title + ' 生产库存', '@Url.Content("~/Reports/Finance/SemiProductionStock?type=semi_prod_inventory_amount")&date=' + title + '&paycompanyid=' + paycompany);
return false; return false;
case 'purchase_pro_amount': case 'purchase_pro_amount':
//showdetail(title + ' 自产采购发货在途', '@Url.Content("~/Reports/Finance/ListProductOnway?date=")' + title + '&paycompanyid=' + paycompany); showdetail(title + ' 自产采购发货在途', '@Url.Content("~/Reports/Finance/ListSelfProductShippingOnway?date=")' + title + '&paycompanyid=' + paycompany);
return false; return false;
} }
......

@{
ViewData["Title"] = "自产采购发货在途";
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>日期</label>
<input id="date" name="date" type="text" class="form-control" style="width:130px;" value="@(ViewBag.date)" />
</div>
<div class="form-group">
<button type="button" class="btn btn-success" onclick="list();">搜索</button>
<button type="button" class="btn btn-primary" onclick="exportFile();">导出</button>
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
@section css{
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
}
@section scripts{
<script type="text/javascript">
var tb;
$(document).ready(function () {
laydate.render({ elem: '#date' });
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 170));
list();
})
function list() {
var date = $('#date').val();
if (date == '') {
alert('请选择日期');
return false;
}
var columns = [
{ field: 'record_time', title: '统计日期', width: '120' },
{ field: 'purchase_id', title: '采购单号', width: '150' },
{ field: 'bailun_sku', title: 'Sku编码', width: '130' },
{ field: 'count', title: '发货在途数量', width: '130' },
{ field: 'price', title: '采购价', width: '110' },
{ field: 'amount', title: '总金额', width: '110' },
{ field: 'buyer_name', title: '采购员名称', width: '130' }
];
var url = '@Url.Content("~/Reports/Finance/ListSelfProductShippingOnwayJson")' + '?date=' + date;
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "");
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function exportFile() {
var date = $('#date').val();
if (date == '') {
alert('请选择日期');
return false;
}
window.open('@Url.Content("~/Reports/Finance/ListSelfProductShippingOnwayExport?date=")' + date, '_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