2
0
mirror of https://github.com/frappe/books.git synced 2024-09-19 19:19:02 +00:00

Added date filter for a quater, added download path setup

This commit is contained in:
Piyush Singhania 2021-12-09 00:13:19 +05:30 committed by Alan
parent b7980c6a56
commit 482f7875bb
2 changed files with 37 additions and 3 deletions

View File

@ -1,10 +1,22 @@
const title = 'GSTR 1';
import baseConfig from './BaseViewConfig';
import { DateTime } from 'luxon';
const filterFields = baseConfig.filterFields;
filterFields.forEach((field) => {
if (field.fieldname === 'toDate') {
field.default = DateTime.local().toISODate();
}
else if(field.fieldname === 'fromDate') {
field.default = DateTime.local().minus({months: 3}).toISODate();
}
});
export default {
title: title,
method: 'gstr-1',
filterFields: baseConfig.filterFields,
filterFields,
linkFields: baseConfig.linkFields,
getColumns: baseConfig.getColumns
getColumns: baseConfig.getColumns,
};

View File

@ -102,6 +102,8 @@ import Row from '@/components/Row';
import WithScroll from '@/components/WithScroll';
import FormControl from '@/components/Controls/FormControl';
import reportViewConfig from '@/../reports/view';
import { ipcRenderer } from 'electron';
import { IPC_ACTIONS } from '@/messages';
export default {
name: 'Report',
@ -271,9 +273,29 @@ export default {
this.loading ? 'text-gray-100' : 'text-gray-900',
];
},
downloadAsJson() {
async downloadAsJson() {
const savePath = await this.getSavePath();
console.log('download complete');
},
async getSavePath() {
const options = {
title: this._('Select folder'),
defaultPath: `${this.reportName}.json`,
};
let { filePath } = await ipcRenderer.invoke(
IPC_ACTIONS.GET_SAVE_FILEPATH,
options
);
if (filePath) {
if (!filePath.endsWith('.json')) {
filePath = filePath + '.json';
}
}
return filePath;
},
},
computed: {
columns() {