Commit fd837313 by guanzhenshan

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

parent 7d2480ba
...@@ -232,7 +232,7 @@ namespace Bailun.DC.DailyPurchaseSellStock ...@@ -232,7 +232,7 @@ namespace Bailun.DC.DailyPurchaseSellStock
} }
else else
{ {
Console.WriteLine("出现异常次数大于"+count+"次,服务关闭重跑"); Console.WriteLine("出现异常次数大于"+ count + "次,服务关闭重跑");
} }
} }
} }
......
...@@ -3555,10 +3555,10 @@ group by currency"; ...@@ -3555,10 +3555,10 @@ group by currency";
if (!string.IsNullOrEmpty(end)) 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)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
if (cn.State == ConnectionState.Closed) if (cn.State == ConnectionState.Closed)
......
...@@ -5592,43 +5592,43 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -5592,43 +5592,43 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
a.month a.month
}); });
var head = new List<Tuple<string, string>>(); var head = new List<Tuple<string, string,string>>();
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">销售额</td>")); head.Add(new Tuple<string, string, string>("amount_sale", "<td style=\"font-weight:bold;text-align:center;\">销售额</td>", "<span class=\"lbl_amount_sale\">{amount_sale}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">成本</td>")); head.Add(new Tuple<string, string, string>("cost_sale", "<td style=\"font-weight:bold;text-align:center;\">成本</td>", "<span class=\"lbl_cost_sale\">{cost_sale}</span><a class=\"cost_sale_\" onclick=\"Edit('cost_sale_','成本','{month}','{cost_sale_}')\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">平台扣费及退款</td>")); head.Add(new Tuple<string, string, string>("pt_count", "<td style=\"font-weight:bold;text-align:center;\">平台扣费及退款</td>", "<span class=\"lbl_pt_count\">{pt_count}</span>"));
head.Add(new Tuple<string, string>("", "<td>平台费</td>")); head.Add(new Tuple<string, string, string>("pt_platformfee", "<td>平台费</td>", "<span class=\"lbl_pt_platformfee\">{pt_platformfee}</span>"));
head.Add(new Tuple<string, string>("", "<td>ebay刊登费</td>")); head.Add(new Tuple<string, string, string>("pt_ebay_postingfee", "<td>ebay刊登费</td>", "<span class=\"lbl_pt_ebay_postingfee\">{pt_ebay_postingfee}</span>"));
head.Add(new Tuple<string, string>("", "<td>paypal费用</td>")); head.Add(new Tuple<string, string, string>("pt_paypal_fee", "<td>paypal费用</td>", "<span class=\"lbl_pt_paypal_fee\">{pt_paypal_fee}</span>"));
head.Add(new Tuple<string, string>("", "<td>平台的物流费</td>")); head.Add(new Tuple<string, string, string>("pt_platform_logistics_fee", "<td>平台的物流费</td>", "<span class=\"lbl_pt_platform_logistics_fee\">{pt_platform_logistics_fee}</span><a class=\"pt_platform_logistics_fee_\" onclick=\"Edit('pt_platform_logistics_fee_','平台的物流费','{month}','{pt_platform_logistics_fee_}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>广告及宣传费-订阅费</td>")); head.Add(new Tuple<string, string, string>("pt_platform_ad_subscribe_fee", "<td>广告及宣传费-订阅费</td>", "<span class=\"lbl_pt_platform_ad_subscribe_fee\">{pt_platform_ad_subscribe_fee}</span><a class=\"pt_platform_ad_subscribe_fee_\" onclick=\"Edit('pt_platform_ad_subscribe_fee_','广告及宣传费-订阅费','{month}','{pt_platform_ad_subscribe_fee_}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>平台的仓储费</td>")); head.Add(new Tuple<string, string, string>("pt_platform_storage_fee", "<td>平台的仓储费</td>", "<span class=\"lbl_pt_platform_storage_fee\">{pt_platform_storage_fee}</span><a class=\"pt_platform_storage_fee\" onclick=\"Edit('pt_platform_storage_fee','平台的仓储费','{month}','{pt_platform_storage_fee}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>退款</td>")); head.Add(new Tuple<string, string, string>("pt_refund_amount", "<td>退款</td>", "<span class=\"lbl_pt_refund_amount\">{pt_refund_amount}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;\">回款</td>")); head.Add(new Tuple<string, string, string>("pt_incoming", "<td style=\"font-weight:bold;\">回款</td>", "<span class=\"lbl_pt_incoming\">{pt_incoming}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">物流仓储费用</td>")); head.Add(new Tuple<string, string, string>("ls_count", "<td style=\"font-weight:bold;text-align:center;\">物流仓储费用</td>", "<span class=\"lbl_ls_count\">{ls_count}</span>"));
head.Add(new Tuple<string, string>("", "<td>头程运输</td>")); head.Add(new Tuple<string, string, string>("ls_head_cost", "<td>头程运输</td>", "<span class=\"lbl_ls_head_cost\">{ls_head_cost}</span><a class=\"ls_head_cost_\" onclick=\"Edit('ls_head_cost_','头程运输','{month}','{ls_head_cost_}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>尾程物流</td>")); head.Add(new Tuple<string, string, string>("ls_tail_cost", "<td>尾程物流</td>", "<span class=\"lbl_ls_tail_cost\">{ls_tail_cost}</span><a class=\"ls_tail_cost_\" onclick=\"Edit('ls_tail_cost_','尾程物流','{month}','{ls_tail_cost_}')\" val =\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>海外仓的仓储费</td>")); head.Add(new Tuple<string, string, string>("ls_oversea_storage", "<td>海外仓的仓储费</td>", "<span class=\"lbl_ls_oversea_storage\">{ls_oversea_storage}</span><a class=\"ls_oversea_storage\" onclick=\"Edit('ls_oversea_storage','海外仓的仓储费','{month}','{ls_oversea_storage}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>平台操作费</td>")); head.Add(new Tuple<string, string, string>("ls_platform_operation_fee", "<td>平台操作费</td>", "<span class=\"lbl_ls_platform_operation_fee\">{ls_platform_operation_fee}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">销售费用合计</td>")); head.Add(new Tuple<string, string, string>("sale_fee_count", "<td style=\"font-weight:bold;text-align:center;\">销售费用合计</td>", "<span class=\"lbl_sale_fee_count\">{sale_fee_count}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">销售利润</td>")); head.Add(new Tuple<string, string, string>("sale_profit", "<td style=\"font-weight:bold;text-align:center;\">销售利润</td>", "<span class=\"lbl_sale_profit\">{sale_profit}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">销售毛利率</td>")); head.Add(new Tuple<string, string, string>("sale_profit_rate", "<td style=\"font-weight:bold;text-align:center;\">销售毛利率</td>", "<span class=\"lbl_sale_profit_rate\">{sale_profit_rate}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">销售相关的管理成本</td>")); head.Add(new Tuple<string, string, string>("sale_manager_cost", "<td style=\"font-weight:bold;text-align:center;\">销售相关的管理成本</td>", "<span class=\"lbl_sale_manager_cost\">{sale_manager_cost}</span>"));
head.Add(new Tuple<string, string>("", "<td>处理费</td>")); head.Add(new Tuple<string, string, string>("handlingcharges", "<td>处理费</td>", "<span class=\"lbl_handlingcharges\">{handlingcharges}</span><a class=\"handlingcharges\" onclick=\"Edit('handlingcharges','处理费','{month}','{handlingcharges}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>直接支付的与销售平台相关费用</td>")); head.Add(new Tuple<string, string, string>("payfor_platform_related_fee", "<td>直接支付的与销售平台相关费用</td>", "<span class=\"lbl_payfor_platform_related_fee\">{payfor_platform_related_fee}</span><a class=\"payfor_platform_related_fee\" onclick=\"Edit('payfor_platform_related_fee','直接支付的与销售平台相关费用','{month}','{payfor_platform_related_fee}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">直接管理成本</td>")); head.Add(new Tuple<string, string, string>("direct_manager_cost", "<td style=\"font-weight:bold;text-align:center;\">直接管理成本</td>", "<span class=\"lbl_direct_manager_cost\">{direct_manager_cost}</span>"));
head.Add(new Tuple<string, string>("", "<td>管理成本-香港百伦(不含直接支付的与销售平台相关的费用)</td>")); head.Add(new Tuple<string, string, string>("manager_cost_hkbailun", "<td>管理成本-香港百伦(不含直接支付的与销售平台相关的费用)</td>", "<span class=\"lbl_manager_cost_hkbailun\">{manager_cost_hkbailun}</span><a class=\"manager_cost_hkbailun\" onclick=\"Edit('manager_cost_hkbailun','管理成本-香港百伦(不含直接支付的与销售平台相关的费用)','{month}','{manager_cost_hkbailun}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>管理成本-广州百伦</td>")); head.Add(new Tuple<string, string, string>("manager_cost_gzbailun", "<td>管理成本-广州百伦</td>", "<span class=\"lbl_manager_cost_gzbailun\">{manager_cost_gzbailun}</span><a class=\"manager_cost_gzbailun\" onclick=\"Edit('manager_cost_gzbailun','管理成本-广州百伦','{month}','{manager_cost_gzbailun}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>管理成本-成品仓(不含直接支付的与销售平台相关的费用)</td>")); head.Add(new Tuple<string, string, string>("manager_cost_finish_wh", "<td>管理成本-成品仓(不含直接支付的与销售平台相关的费用)</td>", "<span class=\"lbl_manager_cost_finish_wh\">{manager_cost_finish_wh}</span><a class=\"manager_cost_finish_wh\" onclick=\"Edit('manager_cost_finish_wh','管理成本-成品仓(不含直接支付的与销售平台相关的费用)','{month}','{manager_cost_finish_wh}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>财务费用</td>")); head.Add(new Tuple<string, string, string>("finance_fee", "<td>财务费用</td>", "<span class=\"lbl_finance_fee\">{finance_fee}</span><a class=\"finance_fee\" onclick=\"Edit('finance_fee','财务费用','{month}','{finance_fee}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">管理成本合计</td>")); head.Add(new Tuple<string, string, string>("manager_cost_count", "<td style=\"font-weight:bold;text-align:center;\">管理成本合计</td>", "<span class=\"lbl_manager_cost_count\">{manager_cost_count}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">营业利润</td>")); head.Add(new Tuple<string, string, string>("business_profit", "<td style=\"font-weight:bold;text-align:center;\">营业利润</td>", "<span class=\"lbl_business_profit\">{business_profit}</span>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">营业毛利率</td>")); head.Add(new Tuple<string, string, string>("business_profit_rate", "<td style=\"font-weight:bold;text-align:center;\">营业毛利率</td>", "<span class=\"lbl_business_profit_rate\">{business_profit_rate}</span>"));
head.Add(new Tuple<string, string>("", "<td>加:其他收入</td>")); head.Add(new Tuple<string, string, string>("other_incoming", "<td>加:其他收入</td>", "<span class=\"lbl_other_incoming\">{other_incoming}</span><a class=\"other_incoming\" onclick=\"Edit('other_incoming','加:其他收入','{month}','{other_incoming}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>加:营业外收入</td>")); head.Add(new Tuple<string, string, string>("nonbusiness_income", "<td>加:营业外收入</td>", "<span class=\"lbl_nonbusiness_income\">{nonbusiness_income}</span><a class=\"nonbusiness_income\" onclick=\"Edit('nonbusiness_income','加:营业外收入','{month}','{nonbusiness_income}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td>减:营业外支出</td>")); head.Add(new Tuple<string, string, string>("nonbusiness_pay", "<td>减:营业外支出</td>", "<span class=\"lbl_nonbusiness_pay\">{nonbusiness_pay}</span><a class=\"nonbusiness_pay\" onclick=\"Edit('nonbusiness_pay','减:营业外支出','{month}','{nonbusiness_pay}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">实际利润</td>")); head.Add(new Tuple<string, string, string>("actual_profit", "<td style=\"font-weight:bold;text-align:center;\">实际利润</td>", "<span class=\"lbl_actual_profit\">{actual_profit}</span>"));
head.Add(new Tuple<string, string>("", "<td>减:分红</td>")); head.Add(new Tuple<string, string, string>("participation_in_profit", "<td>减:分红</td>", "<span class=\"lbl_participation_in_profit\">{participation_in_profit}</span><a class=\"participation_in_profit\" onclick=\"Edit('participation_in_profit','减:营业外支出','{month}','{participation_in_profit}')\" val=\"\">编辑</a>"));
head.Add(new Tuple<string, string>("", "<td style=\"font-weight:bold;text-align:center;\">利润结余</td>")); head.Add(new Tuple<string, string, string>("balance_of_profit", "<td style=\"font-weight:bold;text-align:center;\">利润结余</td>", "<span class=\"lbl_balance_of_profit\">{balance_of_profit}</span>"));
return Json(new { return Json(new {
success = true, success = true,
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="alert alert-warning">
说明:数据从9月份开始
</div>
<div class="ibox-content m-b-sm border-bottom"> <div class="ibox-content m-b-sm border-bottom">
<form id="toolbar"> <form id="toolbar">
<div class="form-inline" style="line-height:40px;"> <div class="form-inline" style="line-height:40px;">
...@@ -17,21 +20,21 @@ ...@@ -17,21 +20,21 @@
<div class="form-group"> <div class="form-group">
<label>&nbsp;</label> <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-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>
</div> </div>
</form> </form>
</div> </div>
<div class="ibox-content m-b-sm border-bottom"> <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="bootstrap-table">
<div class="fixed-table-container"> <div class="fixed-table-container">
<div class="fixed-table-body"> <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> <thead>
<tr> <tr>
<td>月份</td> <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> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -300,33 +303,69 @@ ...@@ -300,33 +303,69 @@
function list() { function list() {
$.submit({ $.submit({
url: '@Url.Content("~/Reports/Finance/ListMonthSaleProfit")', url: '@Url.Content("~/Reports/Finance/ListMonthSaleProfit")',
type:'POST', type: 'POST',
paramData: $("#toolbar").serialize(), paramData: $("#toolbar").serialize(),
func: function (result) { func: function (result) {
if (result.success) { if (result.success) {
$('#tb').find('thead').html('');
$('#tb').find('tbody').html('');
if (result.data.length > 0) { 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) { for (var c in result.data[i]) {
var _temp = i.substr(i.length - 1, 1); if (c == result.head[h].item1) {
if (_temp == '_') { var str_template = result.head[h].item3;
$('.' + i).attr('val', obj[i]); str_template = str_template.replace('{' + result.head[h].item1 + '}', result.data[i][c]);
$('.' + i).attr('mon', obj['month']); str_template = str_template.replace('{' + result.head[h].item1 + '}', result.data[i][c]);
} str_template = str_template.replace('{month}', result.data[i]['month']);
else { try {
$('.lbl_' + i).html(obj[i]); str_template = str_template.replace('{' + result.head[h].item1 + '_}', result.data[i][c+'_']);
$('.lbl_' + i).attr('mon', obj['month']); } catch (e) {
try {
$('.' + i).attr('val', obj[i]);
$('.' + i).attr('mon', obj['month']);
} 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 { else {
layer.msg('没有' + $('#month').val()+'月份的销售利润数据。'); layer.msg('没有' + $('#month').val()+'月份的销售利润数据。');
...@@ -341,9 +380,7 @@ ...@@ -341,9 +380,7 @@
}) })
} }
function Edit(col, name) { function Edit(col, name,mon,v) {
var v = $('.' + col).attr('val');
var mon = $('.' + col).attr('mon');
layer.prompt({ title: '编辑' + name, value:v}, function (text, index) { layer.prompt({ title: '编辑' + name, value:v}, function (text, index) {
layer.close(index); layer.close(index);
Save(col, text, mon); 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