Commit f7035f21 by guanzhenshan

调整进销存报表,增加差异字段排序,调整总金额改为统计差异总计

parent 21b29ab4
......@@ -3184,7 +3184,7 @@ group by currency";
{
var sqlparam = new DynamicParameters();
var sqlcount = $@"select count(DISTINCT t1.warehouse_code) from dc_daily_purchase_sell_stock t1 ";
var sql = $@"select t1.warehouse_code,t1.warehouse_name,sum(t2.start_onway_count) start_onway_count,sum(t2.start_stock_count) start_stock_count,sum(t2.start_onway_amount) start_onway_amount,sum(t2.start_stock_amount) start_stock_amount,sum(t3.end_onway_count) end_onway_count,sum(t3.end_stock_count) end_stock_count,sum(t3.end_onway_amount) end_onway_amount,sum(t3.end_stock_amount) end_stock_amount,t4.end_stock_amount as amount,t4.end_stock_count as count from (select DISTINCT t1.bailun_sku,t1.warehouse_code,t1.warehouse_name from dc_daily_purchase_sell_stock t1
var sql = $@"select t1.warehouse_code,t1.warehouse_name,sum(t2.start_onway_count) start_onway_count,sum(t2.start_stock_count) start_stock_count,sum(t2.start_onway_amount) start_onway_amount,sum(t2.start_stock_amount) start_stock_amount,sum(t3.end_onway_count) end_onway_count,sum(t3.end_stock_count) end_stock_count,sum(t3.end_onway_amount) end_onway_amount,sum(t3.end_stock_amount) end_stock_amount,t4.end_stock_amount as amount,t4.end_stock_count as count,sum(if(t3.end_stock_count is null,0,t3.end_stock_count)-if(t2.start_stock_count is null,0,t2.start_stock_count)) diff_stock_count,sum(if(t3.end_stock_amount is null,0,t3.end_stock_amount)-if(t2.start_stock_amount is null,0,t2.start_stock_amount)) diff_stock_amount,sum(if(t3.end_onway_count is null,0,t3.end_onway_count)-if(t2.start_onway_count is null,0,t2.start_onway_count)) diff_onway_count,sum(if(t3.end_onway_amount is null,0,t3.end_onway_amount)-if(t2.end_onway_amount is null,0,t2.end_onway_amount)) diff_onway_amount from (select DISTINCT t1.bailun_sku,t1.warehouse_code,t1.warehouse_name from dc_daily_purchase_sell_stock t1
";
if (!string.IsNullOrEmpty(warehousetype))
......@@ -3214,7 +3214,7 @@ group by currency";
left join dc_daily_purchase_sell_stock t3 on t1.bailun_sku=t3.bailun_sku and t1.warehouse_code=t3.warehouse_code and t3.record_time='{end.ToString("yyyy-MM-dd")}'";
}
sql += $"left join (select t01.bailun_sku,t01.warehouse_code,sum(t01.end_stock_count) end_stock_count,sum(t01.end_stock_amount) end_stock_amount from dc_daily_purchase_sell_stock t01 ";
sql += $"left join (select t01.bailun_sku,t01.warehouse_code,sum((t01.end_stock_count-t01.start_stock_count)+(t01.end_onway_count-t01.start_onway_count)) end_stock_count,sum((t01.end_stock_amount-t01.start_stock_amount)+(t01.end_onway_amount-t01.start_onway_amount)) end_stock_amount from dc_daily_purchase_sell_stock t01 ";
if (!string.IsNullOrEmpty(warehousetype))
{
sql += " join dc_base_warehouse t02 on t01.warehouse_code=t02.warehouse_code and t02.hq_type='" + warehousetype + "'";
......@@ -3267,7 +3267,7 @@ group by currency";
public dc_daily_purchase_sell_stock ListWHPurchaseSellStockCount(string warehousetype, string warehouse, DateTime start, DateTime end,string sku=null)
{
var sqlparam = new DynamicParameters();
var sql = $@"select sum(t2.start_onway_count) start_onway_count,sum(t2.start_stock_count) start_stock_count,sum(t2.start_onway_amount) start_onway_amount,sum(t2.start_stock_amount) start_stock_amount,sum(t3.end_onway_count) end_onway_count,sum(t3.end_stock_count) end_stock_count,sum(t3.end_onway_amount) end_onway_amount,sum(t3.end_stock_amount) end_stock_amount,sum(t4.end_stock_amount) as amount,sum(t4.end_stock_count) as count from (select DISTINCT t1.bailun_sku,t1.warehouse_code,t1.warehouse_name from dc_daily_purchase_sell_stock t1
var sql = $@"select sum(t2.start_onway_count) start_onway_count,sum(t2.start_stock_count) start_stock_count,sum(t2.start_onway_amount) start_onway_amount,sum(t2.start_stock_amount) start_stock_amount,sum(t3.end_onway_count) end_onway_count,sum(t3.end_stock_count) end_stock_count,sum(t3.end_onway_amount) end_onway_amount,sum(t3.end_stock_amount) end_stock_amount,sum(t4.end_stock_amount) as amount,sum(t4.end_stock_count) as count,sum(t3.end_stock_count-t2.start_stock_count) diff_stock_count,sum(t3.end_stock_amount-t2.start_stock_amount) diff_stock_amount,sum(t3.end_onway_count-t2.start_onway_count) diff_onway_count,sum(t3.end_onway_amount-t2.end_onway_amount) diff_onway_amount from (select DISTINCT t1.bailun_sku,t1.warehouse_code,t1.warehouse_name from dc_daily_purchase_sell_stock t1
";
if (!string.IsNullOrEmpty(warehousetype))
......@@ -3295,7 +3295,7 @@ group by currency";
left join dc_daily_purchase_sell_stock t3 on t1.bailun_sku=t3.bailun_sku and t1.warehouse_code=t3.warehouse_code and t3.record_time='{end.ToString("yyyy-MM-dd")}'";
}
sql += $"left join (select t01.bailun_sku,t01.warehouse_code,sum(t01.end_stock_count) end_stock_count,sum(t01.end_stock_amount) end_stock_amount from dc_daily_purchase_sell_stock t01 ";
sql += $"left join (select t01.bailun_sku,t01.warehouse_code,sum((t01.end_stock_count-t01.start_stock_count)+(t01.end_onway_count-t01.start_onway_count)) end_stock_count,sum((t01.end_stock_amount-t01.start_stock_amount)+(t01.end_onway_amount-t01.start_onway_amount)) end_stock_amount from dc_daily_purchase_sell_stock t01 ";
if (!string.IsNullOrEmpty(warehousetype))
{
sql += " join dc_base_warehouse t02 on t01.warehouse_code=t02.warehouse_code and t02.hq_type='" + warehousetype + "'";
......@@ -3369,7 +3369,7 @@ group by currency";
left join dc_daily_purchase_sell_stock t3 on t1.bailun_sku = t3.bailun_sku and t1.warehouse_code = t3.warehouse_code and t3.record_time = '{end.ToString("yyyy-MM-dd")}'
left join dc_base_sku t4 on t1.bailun_sku = t4.bailun_sku ";
sql += $"left join (select t01.bailun_sku,t01.warehouse_code,sum(t01.end_stock_count) end_stock_count,sum(t01.end_stock_amount) end_stock_amount from dc_daily_purchase_sell_stock t01 ";
sql += $"left join (select t01.bailun_sku,t01.warehouse_code,sum((t01.end_stock_count-t01.start_stock_count)+(t01.end_onway_count-t01.start_onway_count)) end_stock_count,sum((t01.end_stock_amount-t01.start_stock_amount)+(t01.end_onway_amount-t01.start_onway_amount)) end_stock_amount from dc_daily_purchase_sell_stock t01 ";
if (!string.IsNullOrEmpty(warehousetype))
{
sql += " join dc_base_warehouse t02 on t01.warehouse_code=t02.warehouse_code and t02.hq_type='" + warehousetype + "'";
......
......@@ -105,12 +105,12 @@
{ field: 'end_stock_count', title: '期末-在库数量', width: '130', iscount: true, sortable: true },
{ field: 'end_onway_amount', title: '期末-在途金额', width: '130', iscount: true, sortable: true },
{ field: 'end_onway_count', title: '期末-在途数量', width: '130', iscount: true, sortable: true },
{ field: 'diff_stock_amount', title: '差异-在库金额', width: '130', iscount: true },
{ field: 'diff_stock_count', title: '差异-在库数量', width: '130', iscount: true },
{ field: 'diff_onway_amount', title: '差异-在途金额', width: '130', iscount: true },
{ field: 'diff_onway_count', title: '差异-在途数量', width: '130', iscount: true },
{ field: 'amount', title: '总金额(期末)', width: '130', iscount: true, sortable: true },
{ field: 'count', title: '总数量(期末)', width: '130', iscount: true, sortable: true }
{ field: 'diff_stock_amount', title: '差异-在库金额', width: '130', iscount: true, sortable: true },
{ field: 'diff_stock_count', title: '差异-在库数量', width: '130', iscount: true, sortable: true },
{ field: 'diff_onway_amount', title: '差异-在途金额', width: '130', iscount: true, sortable: true },
{ field: 'diff_onway_count', title: '差异-在途数量', width: '130', iscount: true, sortable: true },
{ field: 'amount', title: '总金额(差异)', width: '130', iscount: true, sortable: true },
{ field: 'count', title: '总数量(差异)', width: '130', iscount: true, sortable: true }
];
var url = '@Url.Content("~/Reports/Finance/SkuPurchaseSellStockJson")' + '?' + $("#toolbar").serialize();
......
......@@ -92,12 +92,12 @@
{ field: 'end_stock_count', title: '期末-在库数量', width: '130', iscount: true, sortable: true },
{ field: 'end_onway_amount', title: '期末-在途金额', width: '130', iscount: true, sortable: true },
{ field: 'end_onway_count', title: '期末-在途数量', width: '130', iscount: true, sortable: true },
{ field: 'diff_stock_amount', title: '差异-在库金额', width: '130', iscount: true },
{ field: 'diff_stock_count', title: '差异-在库数量', width: '130', iscount: true },
{ field: 'diff_onway_amount', title: '差异-在途金额', width: '130', iscount: true },
{ field: 'diff_onway_count', title: '差异-在途数量', width: '130', iscount: true },
{ field: 'amount', title: '总金额(期末)', width: '130', iscount: true, sortable: true },
{ field: 'count', title: '总数量(期末)', width: '130', iscount: true, sortable: true }
{ field: 'diff_stock_amount', title: '差异-在库金额', width: '130', iscount: true, sortable: true },
{ field: 'diff_stock_count', title: '差异-在库数量', width: '130', iscount: true, sortable: true },
{ field: 'diff_onway_amount', title: '差异-在途金额', width: '130', iscount: true, sortable: true },
{ field: 'diff_onway_count', title: '差异-在途数量', width: '130', iscount: true, sortable: true },
{ field: 'amount', title: '总金额(差异)', width: '130', iscount: true, sortable: true },
{ field: 'count', title: '总数量(差异)', width: '130', iscount: true, sortable: true }
];
var url = '@Url.Content("~/Reports/Finance/WHPurchaseSellStockJson")' + '?' + $("#toolbar").serialize();
......
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