Commit 803a0196 by guanzhenshan

解决订单流水出错的问题

parent 74524b1b
...@@ -1022,6 +1022,63 @@ namespace Bailun.DC.Services ...@@ -1022,6 +1022,63 @@ namespace Bailun.DC.Services
} }
/// <summary> /// <summary>
/// (预付款明细||应付账款明细)按付款主体统计
/// </summary>
/// <param name="parameter"></param>
/// <param name="day"></param>
/// <param name="payid"></param>
/// <param name="prepay"></param>
/// <param name="finish"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<dc_supplier_transaction> ListPrePayGroup(BtTableParameter parameter, DateTime day, int payid, int prepay, int? finish, ref int total)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
//付款主体,借方发生额,贷方发生额,日期 a.putting_amount + a.express_amount + a.adjust_amount - a.return_amount - a.return_express
var sql = "select pay_company_name,sum(putting_amount) putting_amount,sum(pay_amount) pay_amount,day,sum(express_amount) express_amount,sum(adjust_amount) adjust_amount,sum(return_amount) return_amount,sum(return_express) return_express,sum(receive_amount) receive_amount from dc_supplier_transaction where types=2 and day='" + day.ToString("yyyy-MM-dd") + "' ";// and pay_company_value=" + payid;
if (prepay == 1)
{
sql += " and end_amount<0";
}
else if (prepay == 0)
{
sql += " and end_amount>0";
}
if (finish.HasValue)
{
sql += " and is_finish=" + finish.Value;
}
//if (payid == 2) //香港百伦的取一级供应商数据
//{
// sql += " and types=1";
//}
//else
//{
// sql += " and types=2";
//}
sql += " group by pay_company_value ";
if (!string.IsNullOrEmpty(parameter.sort))
{
sql += " order by " + parameter.sort + " " + parameter.order;
}
var list = cn.Page<dc_supplier_transaction>(parameter.pageIndex, parameter.limit, sql, ref total); //只取二级供应商的数据
return list.ToList();
}
}
/// <summary>
/// 物流供应商 预付款明细||应付账款明细 /// 物流供应商 预付款明细||应付账款明细
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
......
...@@ -1886,6 +1886,34 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -1886,6 +1886,34 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return JsonConvert.SerializeObject(new { total=total,rows=list}); return JsonConvert.SerializeObject(new { total=total,rows=list});
} }
public ActionResult CopeWithPayCompany(DateTime date,int paycompanyid,int? finish)
{
ViewBag.date = date.ToString("yyyy-MM-dd");
ViewBag.paycompanyid = paycompanyid;
ViewBag.finish = finish ?? 0;
return View();
}
public string CopeWithPayCompanyJson(BtTableParameter parameter, DateTime date, int paycompanyid, int? finish)
{
var total = 0;
var _services = new Services.FinanceReportServices();
var paycompany = _services.GetPayCompany(paycompanyid);
var obj = _services.ListPrePayGroup(parameter, date, paycompanyid, 0, finish, ref total);
var list = obj.Select(a => new {
a.pay_company_name,
putting_amount = (a.putting_amount + a.express_amount + a.adjust_amount - a.return_amount - a.return_express).ToString("N2"),
pay_amount = (a.pay_amount - a.receive_amount).ToString("N2"),
day = a.day.Value.ToString("yyyy-MM-dd"),
});
return JsonConvert.SerializeObject(new { total = total, rows = list });
}
public ActionResult CopeWithExport(DateTime date, int paycompanyid, int? finish) public ActionResult CopeWithExport(DateTime date, int paycompanyid, int? finish)
{ {
var total = 0; var total = 0;
......
...@@ -1053,7 +1053,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -1053,7 +1053,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
create_time = p.create_time.ToString("yyyy-MM-dd HH:mm:ss"), create_time = p.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
order_update_time = p.order_update_time.ToString("yyyy-MM-dd HH:mm:ss"), order_update_time = p.order_update_time.ToString("yyyy-MM-dd HH:mm:ss"),
p.salecount, p.salecount,
profit_rate = ((p.profit_oms/p.amount_total) * 100).ToString("N2"), profit_rate = (p.amount_total>0?((p.profit_oms/p.amount_total) * 100).ToString("N2"):"0"),
item_id = objItemid.Where(a=>a.bailun_order_id==p.bailun_order_id).FirstOrDefault()?.item_id, item_id = objItemid.Where(a=>a.bailun_order_id==p.bailun_order_id).FirstOrDefault()?.item_id,
profit_oms = (p.profit_oms-p.cost_handle_bailun-p.cost_handle_platform).ToString("N2"), profit_oms = (p.profit_oms-p.cost_handle_bailun-p.cost_handle_platform).ToString("N2"),
cost_handle_bailun = p.cost_handle_bailun.ToString("N2"), cost_handle_bailun = p.cost_handle_bailun.ToString("N2"),
......
...@@ -4,40 +4,6 @@ ...@@ -4,40 +4,6 @@
Layout = "~/Pages/Shared/_MainLayout.cshtml"; Layout = "~/Pages/Shared/_MainLayout.cshtml";
} }
@*<div class="ibox-content m-b-sm border-bottom">
<table id="tb" class="table table-hover table-bordered" style="width:100%;">
<thead>
<tr>
<th>供应商名称</th>
<th>是否成品</th>
<th>公司主体</th>
<th>期初金额</th>
<th>借方发生额</th>
<th>贷方发生额</th>
<th>期末金额</th>
<th>日期</th>
</tr>
</thead>
@if (ViewBag.list.Count > 0)
{
foreach (var item in ViewBag.list)
{
<tr>
<td>@item.supplier_name</td>
<td>@(item.is_finish == 0 ? "半成品" : "成品")</td>
<td>@item.pay_company_name</td>
<td>@item.start_amount</td>
<td>@(item.putting_amount + item.express_amount + item.adjust_amount - item.return_amount - item.return_express)</td>
<td>@(item.pay_amount - item.receive_amount)</td>
<td>@(item.end_amount.ToString("###,###.##"))</td>
<td>@item.day.ToString("yyyy-MM-dd")</td>
</tr>
}
}
</table>
</div>*@
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="ibox-content m-b-sm border-bottom"> <div class="ibox-content m-b-sm border-bottom">
......

@{
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">
@*<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>
var tb;
$(document).ready(function () {
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 100));
list();
})
function list() {
var columns = [
{
field: 'pay_company_name', title: '公司主体', width: '180', sortable: true, formatter: function (idx, data) {
return '<div class="mules" title="' + data.pay_company_name + '">' + data.pay_company_name + '</div>';
}
},
{ field: 'putting_amount', title: '借方发生额', width: '110', sortable: false },
{ field: 'pay_amount', title: '贷方发生额', width: '110', sortable: false },
{ field: 'day', title: '统计日期', width: '90', sortable: true }
];
var url = '@Url.Content("~/Reports/Finance/CopeWithPayCompanyJson")' + '?finish=@(ViewBag.finish)&date=@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)';
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "");
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function exportFile() {
window.open('@Url.Content("~/Reports/Finance/CopeWithExport?finish=")'+'@(ViewBag.finish)&date=@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)', "_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