|
@@ -777,6 +777,7 @@ const addSumChapter = {
|
|
|
if (!gclData || !data.tender_info) return;
|
|
|
|
|
|
const chapters = ctx.helper._.uniq(ctx.helper._.map(gclData, options.chapter));
|
|
|
+ const finalSum = options.sum ? {name: options.sum.name, chapterNum: 100000, chapterPart: 1} : null;
|
|
|
for (const chapter of chapters) {
|
|
|
const chapterInfo = data.tender_info.chapter.find(function (x) { return x.code === chapter});
|
|
|
const chapterOptions = chapterInfo ? options.stdChapter : options.otherChapter;
|
|
@@ -790,6 +791,9 @@ const addSumChapter = {
|
|
|
cg.chapterNum = parseInt(cg[options.chapter]);
|
|
|
for (const f of options.fields) {
|
|
|
sum[f] = ctx.helper.add(sum[f], cg[f]);
|
|
|
+ if (finalSum) {
|
|
|
+ finalSum[f] = ctx.helper.add(finalSum[f], cg[f]);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (chapterOptions.sum !== undefined) {
|
|
@@ -808,6 +812,9 @@ const addSumChapter = {
|
|
|
gclData.push(title);
|
|
|
}
|
|
|
}
|
|
|
+ if (finalSum) {
|
|
|
+ gclData.push(finalSum);
|
|
|
+ }
|
|
|
gclData.sort(function (a, b) {
|
|
|
if (a.chapter !== b.chapter) {
|
|
|
return a.chapterNum - b.chapterNum;
|