|
@@ -162,12 +162,37 @@ $(document).ready(() => {
|
|
|
this.calculateAll();
|
|
|
this.resortData();
|
|
|
}
|
|
|
+ sum () {
|
|
|
+ const result = {
|
|
|
+ total_price: 0,
|
|
|
+ tp: 0,
|
|
|
+ end_tp: 0,
|
|
|
+ };
|
|
|
+ for (const d of this.data) {
|
|
|
+ result.total_price = ZhCalc.add(result.total_price, d.total_price);
|
|
|
+ result.tp = ZhCalc.add(result.tp, d.tp);
|
|
|
+ result.end_tp = ZhCalc.add(result.end_tp, d.end_tp);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
const seOtherObj = new SeOther();
|
|
|
+ const refreshSum = function () {
|
|
|
+ const sum = seOtherObj.sum();
|
|
|
+ const html = [];
|
|
|
+ const getTrHtml = function (name, value) {
|
|
|
+ return '<tr><td>' + name + '</td><td class="text-right">' + (!checkZero(value) ? value : '') + ' </td></tr>';
|
|
|
+ };
|
|
|
+ html.push(getTrHtml('金额', sum.total_price));
|
|
|
+ html.push(getTrHtml('本期金额', sum.tp));
|
|
|
+ html.push(getTrHtml('截止本期金额', sum.end_tp));
|
|
|
+ $('#sum').html(html.join(' '));
|
|
|
+ };
|
|
|
|
|
|
postData(window.location.pathname + '/load', null, function (result) {
|
|
|
seOtherObj.loadDatas(result);
|
|
|
SpreadJsObj.loadSheetData(otherSheet, SpreadJsObj.DataType.Data, seOtherObj.data);
|
|
|
+ refreshSum();
|
|
|
});
|
|
|
|
|
|
if (!readOnly) {
|
|
@@ -211,6 +236,7 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/update', {update: datas}, function (result) {
|
|
|
seOtherObj.loadUpdateData(result);
|
|
|
SpreadJsObj.reLoadSheetData(otherSheet);
|
|
|
+ refreshSum();
|
|
|
}, function () {
|
|
|
SpreadJsObj.reLoadSheetData(otherSheet);
|
|
|
});
|
|
@@ -245,6 +271,7 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/update', {del: datas}, function (result) {
|
|
|
seOtherObj.loadUpdateData(result);
|
|
|
SpreadJsObj.reLoadSheetData(otherSheet);
|
|
|
+ refreshSum();
|
|
|
}, function () {
|
|
|
SpreadJsObj.reLoadSheetData(otherSheet);
|
|
|
});
|
|
@@ -282,6 +309,7 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/update', data, function (result) {
|
|
|
seOtherObj.loadUpdateData(result);
|
|
|
SpreadJsObj.reLoadSheetData(info.sheet);
|
|
|
+ refreshSum();
|
|
|
}, function () {
|
|
|
SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
});
|
|
@@ -362,6 +390,7 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/update', updateData, function (result) {
|
|
|
seOtherObj.loadUpdateData(result);
|
|
|
SpreadJsObj.reLoadSheetData(info.sheet);
|
|
|
+ refreshSum();
|
|
|
});
|
|
|
} else {
|
|
|
SpreadJsObj.reLoadSheetData(info.sheet);
|