add ability to show different columns based on filter in reports

This commit is contained in:
Ankit Singhaniya
2021-12-29 10:52:31 +05:30
parent 21dace3e03
commit 5a460aebeb
5 changed files with 19 additions and 15 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ export default {
},
],
actions: getCommonExportActions('balance-sheet'),
getColumns(data) {
getColumns({ data }) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 },
];
+14 -8
View File
@@ -55,14 +55,8 @@ export default {
},
],
getColumns() {
return [
{
label: 'GSTIN No.',
fieldname: 'gstin',
fieldtype: 'Data',
width: 1.5,
},
getColumns({ filters }) {
const columns = [
{
label: 'Party',
fieldtype: 'Data',
@@ -121,5 +115,17 @@ export default {
fieldtype: 'Currency',
},
];
const transferType = filters.transferType || 'B2B';
if (transferType === 'B2B') {
columns.unshift({
label: 'GSTIN No.',
fieldname: 'gstin',
fieldtype: 'Data',
width: 1.5,
});
}
return columns;
},
};
+1 -1
View File
@@ -41,7 +41,7 @@ export default {
},
],
actions: getCommonExportActions('profit-and-loss'),
getColumns(data) {
getColumns({ data }) {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 },
];
+1 -1
View File
@@ -32,7 +32,7 @@ export default {
},
],
actions: getCommonExportActions('trial-balance'),
getColumns(data) {
getColumns() {
const columns = [
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 },
{
+2 -4
View File
@@ -138,7 +138,7 @@ export default {
};
},
async activated() {
this.reportData.columns = this.report.getColumns();
this.reportData.columns = this.report.getColumns({ filters: this.filters });
await this.setDefaultFilters();
await this.fetchReportData();
},
@@ -161,9 +161,7 @@ export default {
rows = data;
}
if (data.columns) {
this.reportData.columns = this.report.getColumns(data);
}
this.reportData.columns = this.report.getColumns({ filters: this.filters, data });
if (!rows) {
rows = [];