|
@@ -84,6 +84,42 @@ class rptMemChange extends RptMemBase {
|
|
|
return changeBills;
|
|
|
}
|
|
|
|
|
|
+ async getChangeLedgerBillsData(showLevel) {
|
|
|
+ try {
|
|
|
+ await this.ctx.service.tender.checkTender(tid);
|
|
|
+
|
|
|
+ const billsData = await this.ctx.service.ledger.getData(this.ctx.tender.id);
|
|
|
+ const changeBillsData = await this.ctx.service.changeLedger.getAllDataByCondition({ where: { ccid: this.ctx.change.id } });
|
|
|
+ billsData.push(...changeBillsData);
|
|
|
+
|
|
|
+ const billsTree = this._getNewBillsTree();
|
|
|
+ billsTree.loadDatas(billsData);
|
|
|
+ billsTree.calculateAll();
|
|
|
+
|
|
|
+ if (this._checkFieldsExist(fields, [''])) {
|
|
|
+ this._calcLeafXmjRela(billsTree);
|
|
|
+ }
|
|
|
+
|
|
|
+ return showLevel ? billsTree.getDefaultDatasByLevel(this.ctx.tender.rpt_show_level) : billsTree.getDefaultDatas();
|
|
|
+ } catch(err) {
|
|
|
+ this.ctx.log(err);
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ async getChangeLedgerPosData() {
|
|
|
+ try {
|
|
|
+ const posData = await this.ctx.service.pos.getAllDataByCondition({ where: {tid: this.ctx.tender.id }});
|
|
|
+ const changePosData = await this.ctx.service.changePos.getAllDataByCondition({ where: { ccid: this.ctx.change.id } });
|
|
|
+ posData.push(...changePosData);
|
|
|
+ this.pos.loadDatas(posData);
|
|
|
+ this.pos.calculateAll();
|
|
|
+
|
|
|
+ return this.pos.getDatas();
|
|
|
+ } catch (err) {
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
getCommonData(params, tableName, fields, customDefine, customSelect) {
|
|
|
switch (tableName) {
|
|
|
case 'mem_change':
|
|
@@ -100,6 +136,12 @@ class rptMemChange extends RptMemBase {
|
|
|
return [this.ctx.tender.data];
|
|
|
case 'mem_tender_info':
|
|
|
return [this.ctx.tender.info];
|
|
|
+ case 'mem_change_ledger_bills':
|
|
|
+ return this.getChangeLedgerBillsData();
|
|
|
+ case 'mem_change_ledger_bills_filter':
|
|
|
+ return this.getChangeLedgerBillsData(true);
|
|
|
+ case 'mem_change_ledger_pos':
|
|
|
+ return this.getChangeLedgerPosData();
|
|
|
default:
|
|
|
return [];
|
|
|
}
|