mirror of
https://github.com/frappe/books.git
synced 2026-08-24 10:04:45 -05:00
add ability to show different columns based on filter in reports
This commit is contained in:
@@ -27,7 +27,7 @@ export default {
|
||||
},
|
||||
],
|
||||
actions: getCommonExportActions('balance-sheet'),
|
||||
getColumns(data) {
|
||||
getColumns({ data }) {
|
||||
const columns = [
|
||||
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 },
|
||||
];
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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 },
|
||||
];
|
||||
|
||||
@@ -32,7 +32,7 @@ export default {
|
||||
},
|
||||
],
|
||||
actions: getCommonExportActions('trial-balance'),
|
||||
getColumns(data) {
|
||||
getColumns() {
|
||||
const columns = [
|
||||
{ label: 'Account', fieldtype: 'Data', fieldname: 'account', width: 2 },
|
||||
{
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user