|
@@ -9,7 +9,8 @@ $(function () {
|
|
|
setTimeout(function () {
|
|
|
getLodop();
|
|
|
}, 800);
|
|
|
- $("#class_table").hide();
|
|
|
+ $("#kind_table").hide();
|
|
|
+ $("#class_sum_table").hide();
|
|
|
$(".selectpicker").selectpicker({
|
|
|
dropuAuto: false
|
|
|
});
|
|
@@ -30,8 +31,10 @@ $(function () {
|
|
|
let id = "";
|
|
|
if (statisticalMethod === "0") {
|
|
|
id = 'sum_table';
|
|
|
+ } else if (statisticalMethod === "2") {
|
|
|
+ id = 'class_sum_table';
|
|
|
} else {
|
|
|
- id = 'class_table';
|
|
|
+ id = 'kind_table';
|
|
|
}
|
|
|
$("#" + id).table2excel({
|
|
|
exclude: ".exclHide",
|
|
@@ -42,10 +45,16 @@ $(function () {
|
|
|
let statisticalMethod = $("#statisticalMethod").val();
|
|
|
if (statisticalMethod === "0") {
|
|
|
$("#sum_table").show();
|
|
|
- $("#class_table").hide();
|
|
|
+ $("#kind_table").hide();
|
|
|
+ $("#class_sum_table").hide();
|
|
|
+ }else if (statisticalMethod === "2") {
|
|
|
+ $("#sum_table").hide();
|
|
|
+ $("#kind_table").hide();
|
|
|
+ $("#class_sum_table").show();
|
|
|
} else {
|
|
|
- $("#class_table").show();
|
|
|
+ $("#kind_table").show();
|
|
|
$("#sum_table").hide();
|
|
|
+ $("#class_sum_table").hide();
|
|
|
}
|
|
|
$(".dateRange").html($('#reportrange span').html());
|
|
|
$(".printDate").html(format(new Date(), "yyyy-MM-dd HH:mm"));
|
|
@@ -84,50 +93,69 @@ function getRecordData() {
|
|
|
}
|
|
|
if (res.code == 0) {
|
|
|
let html = '';
|
|
|
+ let totalInMoneyBuy = 0;
|
|
|
let totalInMoneyRet = 0;
|
|
|
let totalOutMoneyRet = 0;
|
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
|
let data = res.data[i];
|
|
|
+ let inMoneyBuy = isEmpty(data.inMoneyBuy)?0:keepTwoDecimal(data.inMoneyBuy);
|
|
|
+ let inMoneyRet = isEmpty(data.inMoneyRet)?0:keepTwoDecimal(data.inMoneyRet);
|
|
|
+ let outMoneyRet = isEmpty(data.outMoneyRet)?0:keepTwoDecimal(data.outMoneyRet);
|
|
|
if (statisticalMethod == 0) {
|
|
|
- let inMoneyRet = isEmpty(data.inMoneyRet)?0:keepTwoDecimal(data.inMoneyRet);
|
|
|
- let outMoneyRet = isEmpty(data.outMoneyRet)?0:keepTwoDecimal(data.outMoneyRet);
|
|
|
html += '<tr class="sjh">';
|
|
|
html += '<td class="xtd" style="text-align: center;">' + (i + 1) + '</td>';
|
|
|
html += '<td class="xtd" style="text-align: center;">' + data.countDate + '</td>';
|
|
|
- html += '<td class="xtd" style="text-align: center;">' + data.inMoneyBuy + '</td>';
|
|
|
- html += '<td class="xtd" style="text-align: center;">' + inMoneyRet + '</td>';
|
|
|
- html += '<td class="xtd" style="text-align: center;">' + outMoneyRet + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: right;">' + inMoneyBuy + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: right;">' + inMoneyRet + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: right;">' + outMoneyRet + '</td>';
|
|
|
+ html += '</tr>';
|
|
|
+ totalInMoneyBuy += inMoneyBuy;
|
|
|
+ totalInMoneyRet += inMoneyRet;
|
|
|
+ totalOutMoneyRet += outMoneyRet;
|
|
|
+ }else if (statisticalMethod == 2) {
|
|
|
+ let inMoneyBuy = isEmpty(data.inMoneyBuy)?0:keepTwoDecimal(data.inMoneyBuy);
|
|
|
+ let inMoneyRet = isEmpty(data.inMoneyRet)?0:keepTwoDecimal(data.inMoneyRet);
|
|
|
+ let outMoneyRet = isEmpty(data.outMoneyRet)?0:keepTwoDecimal(data.outMoneyRet);
|
|
|
+ html += '<tr class="sjh">';
|
|
|
+ html += '<td colspan="2" class="xtd" style="text-align: left;">' + data.kindName + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: right;">' + inMoneyBuy + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: right;">' + inMoneyRet + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: right;">' + outMoneyRet + '</td>';
|
|
|
html += '</tr>';
|
|
|
+ totalInMoneyBuy += inMoneyBuy;
|
|
|
totalInMoneyRet += inMoneyRet;
|
|
|
totalOutMoneyRet += outMoneyRet
|
|
|
} else {
|
|
|
let inMoneyBuy = isEmpty(data.inMoneyBuy)?0:keepTwoDecimal(data.inMoneyBuy);
|
|
|
let inMoneyRet = isEmpty(data.inMoneyRet)?0:keepTwoDecimal(data.inMoneyRet);
|
|
|
html += '<tr class="sjh">';
|
|
|
- html += '<td class="xtd" style="text-align: center;">' + data.name + '</td>';
|
|
|
- html += '<td class="xtd" style="text-align: center;">' + inMoneyBuy + '</td>';
|
|
|
- html += '<td class="xtd" style="text-align: center;">' + inMoneyRet + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: left;">' + data.name + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: right;">' + inMoneyBuy + '</td>';
|
|
|
+ html += '<td class="xtd" style="text-align: right;">' + inMoneyRet + '</td>';
|
|
|
totalInMoneyRet += inMoneyBuy;
|
|
|
totalOutMoneyRet += inMoneyRet
|
|
|
}
|
|
|
}
|
|
|
- if (statisticalMethod == 0) {
|
|
|
+ if (statisticalMethod == 0 || statisticalMethod == 2) {
|
|
|
html += '<tr class="sjh">';
|
|
|
- html += '<td colspan="3" style="text-align: right;font-weight: 700;">总计:</td>';
|
|
|
- html += '<td style="text-align: center;">' + keepTwoDecimal(totalInMoneyRet) + '</td>';
|
|
|
- html += '<td style="text-align: center;">' + keepTwoDecimal(totalOutMoneyRet) + '</td>';
|
|
|
+ html += '<td colspan="2" style="text-align: right;font-weight: 700;">总计:</td>';
|
|
|
+ html += '<td style="text-align: right;">' + keepTwoDecimal(totalInMoneyBuy) + '</td>';
|
|
|
+ html += '<td style="text-align: right;">' + keepTwoDecimal(totalInMoneyRet) + '</td>';
|
|
|
+ html += '<td style="text-align: right;">' + keepTwoDecimal(totalOutMoneyRet) + '</td>';
|
|
|
html += '</tr>';
|
|
|
}else{
|
|
|
html += '<tr class="sjh">';
|
|
|
html += '<td style="text-align: right;font-weight: 700;">总计:</td>';
|
|
|
- html += '<td style="text-align: center;">' + keepTwoDecimal(totalInMoneyRet) + '</td>';
|
|
|
- html += '<td style="text-align: center;">' + keepTwoDecimal(totalOutMoneyRet) + '</td>';
|
|
|
+ html += '<td style="text-align: right;">' + keepTwoDecimal(totalInMoneyRet) + '</td>';
|
|
|
+ html += '<td style="text-align: right;">' + keepTwoDecimal(totalOutMoneyRet) + '</td>';
|
|
|
html += '</tr>';
|
|
|
}
|
|
|
if (statisticalMethod == 0) {
|
|
|
$("#sum_table").append(html);
|
|
|
- } else {
|
|
|
- $("#class_table").append(html);
|
|
|
+ }else if (statisticalMethod == 2) {
|
|
|
+ $("#class_sum_table").append(html);
|
|
|
+ }else {
|
|
|
+ $("#kind_table").append(html);
|
|
|
}
|
|
|
} else if (res.code == -1) {
|
|
|
new PNotify({
|
|
@@ -160,7 +188,8 @@ function cleanParams() {
|
|
|
$('#statisticalMethod').selectpicker('refresh');
|
|
|
$('#reportrange span').html(moment().subtract(1, 'days').format("YYYY-MM-DD") + ' - ' + moment().subtract(1, 'days').format("YYYY-MM-DD"));
|
|
|
$('#sum_table').show();
|
|
|
- $('#class_table').hide();
|
|
|
+ $('#kind_table').hide();
|
|
|
+ $('#class_sum_table').hide();
|
|
|
$('.sjh').remove();
|
|
|
}
|
|
|
|
|
@@ -178,7 +207,7 @@ function print() {
|
|
|
LODOP.SET_PRINT_STYLEA(0, "ItemType", 2);
|
|
|
//设置默认打印机
|
|
|
LODOP.SET_PRINTER_INDEX(defaultPrintIndex);
|
|
|
- LODOP.ADD_PRINT_TEXT('280mm', '100mm', '40mm', '40mm', '第#页/共&页');
|
|
|
+ LODOP.ADD_PRINT_TEXT('285mm', '100mm', '40mm', '40mm', '第#页/共&页');
|
|
|
LODOP.SET_PRINT_STYLEA(0, "ItemType", 2);
|
|
|
var strStyle = "<style>table,td,th {border-width: 1px;" +
|
|
|
"border-style: solid;border-collapse: collapse;table-layout:fixed;word-wrap:break-word;font-size: 14px}</style>";
|