2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/reports/Register/RegisterView.js
2018-06-11 16:50:34 +05:30

35 lines
983 B
JavaScript

const ReportPage = require('frappejs/client/desk/reportpage');
const frappe = require('frappejs');
const { DateTime } = require('luxon');
const { unique } = require('frappejs/utils');
module.exports = class RegisterView extends ReportPage {
constructor({ title }) {
super({
title,
filterFields: [
{fieldtype: 'Date', fieldname: 'fromDate', label: 'From Date', required: 1},
{fieldtype: 'Date', fieldname: 'toDate', label: 'To Date', required: 1}
]
});
this.datatableOptions = {
layout: 'fixed'
}
}
async setDefaultFilterValues() {
const today = DateTime.local();
const oneMonthAgo = today.minus({ months: 1 });
this.filters.setValue('fromDate', oneMonthAgo.toISODate());
this.filters.setValue('toDate', today.toISODate());
this.run();
}
getRowsForDataTable(data) {
return data.rows || [];
}
}