Commit fd837313 by guanzhenshan

完成月度利润报表增加多月份显示

parent 7d2480ba
......@@ -232,7 +232,7 @@ namespace Bailun.DC.DailyPurchaseSellStock
}
else
{
Console.WriteLine("出现异常次数大于"+count+"次,服务关闭重跑");
Console.WriteLine("出现异常次数大于"+ count + "次,服务关闭重跑");
}
}
}
......
......@@ -3555,10 +3555,10 @@ group by currency";
if (!string.IsNullOrEmpty(end))
{
sql += (" and month<='"+end+"' order by month desc limit 6");
sql += (" and month<='"+end+"'");
}
sql += " order by month desc limit 6";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
......
......@@ -7,6 +7,9 @@
<div class="row">
<div class="col-sm-12">
<div class="alert alert-warning">
说明:数据从9月份开始
</div>
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
......@@ -17,21 +20,21 @@
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
<button type="button" class="btn btn-danger" onclick="exportxls();">导出</button>
@*<button type="button" class="btn btn-danger" onclick="exportxls();">导出</button>*@
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<h2 id="lbl_title" style="text-align:center;">X月份销售利润表</h2>
<h2 style="text-align:center;">月份销售利润表</h2>
<div class="bootstrap-table">
<div class="fixed-table-container">
<div class="fixed-table-body">
<table style="table-layout: fixed;" class="table table-border table-bordered table-hover table-bg table-sort form-inline">
<table id="tb" style="table-layout: fixed;" class="table table-border table-bordered table-hover table-bg table-sort form-inline">
<thead>
<tr>
<td>月份</td>
<td id="lbl_title" style="font-size:1.1em;font-weight:bold;">X月份销售利润表</td>
<td id="lbl_title" style="font-size:1.1em;font-weight:bold;"></td>
</tr>
</thead>
<tbody>
......@@ -300,33 +303,69 @@
function list() {
$.submit({
url: '@Url.Content("~/Reports/Finance/ListMonthSaleProfit")',
type:'POST',
type: 'POST',
paramData: $("#toolbar").serialize(),
func: function (result) {
if (result.success) {
$('#tb').find('thead').html('');
$('#tb').find('tbody').html('');
if (result.data.length > 0) {
var obj = result.data[0];
var s = '';
for (var h in result.head) {
s = '<tr>' + result.head[h].item2; //项目名称
$('#lbl_title').html($('#month').val() + '月销售利润表');
for (var i in result.data) {
for (var i in obj) {
var _temp = i.substr(i.length - 1, 1);
if (_temp == '_') {
$('.' + i).attr('val', obj[i]);
$('.' + i).attr('mon', obj['month']);
}
else {
$('.lbl_' + i).html(obj[i]);
$('.lbl_' + i).attr('mon', obj['month']);
for (var c in result.data[i]) {
if (c == result.head[h].item1) {
var str_template = result.head[h].item3;
str_template = str_template.replace('{' + result.head[h].item1 + '}', result.data[i][c]);
str_template = str_template.replace('{' + result.head[h].item1 + '}', result.data[i][c]);
str_template = str_template.replace('{month}', result.data[i]['month']);
try {
$('.' + i).attr('val', obj[i]);
$('.' + i).attr('mon', obj['month']);
str_template = str_template.replace('{' + result.head[h].item1 + '_}', result.data[i][c+'_']);
} catch (e) {
}
s += ('<td>' + str_template + '</td>');
break;
}
}
}
s += '</tr>';
$('#tb').find('tbody').append(s);
}
var m = '<tr><th style="height:40px;text-align: center;line-height: 40px;">项目</th>';
for (var i in result.data) {
m += ('<th style="height:40px;text-align: center;line-height: 40px;">' + result.data[i]['month']+'</th>');
}
m += '</tr>';
$('#tb').find('thead').html(m);
//var obj = result.data[0];
//$('#lbl_title').html($('#month').val());
//for (var i in obj) {
// var _temp = i.substr(i.length - 1, 1);
// if (_temp == '_') {
// $('.' + i).attr('val', obj[i]);
// $('.' + i).attr('mon', obj['month']);
// }
// else {
// $('.lbl_' + i).html(obj[i]);
// $('.lbl_' + i).attr('mon', obj['month']);
// try {
// $('.' + i).attr('val', obj[i]);
// $('.' + i).attr('mon', obj['month']);
// } catch (e) {
// }
// }
//}
}
else {
layer.msg('没有' + $('#month').val()+'月份的销售利润数据。');
......@@ -341,9 +380,7 @@
})
}
function Edit(col, name) {
var v = $('.' + col).attr('val');
var mon = $('.' + col).attr('mon');
function Edit(col, name,mon,v) {
layer.prompt({ title: '编辑' + name, value:v}, function (text, index) {
layer.close(index);
Save(col, text, mon);
......
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