Reports
This commit is contained in:
parent
adf8ce3a78
commit
f39e21a085
|
|
@ -76,7 +76,15 @@ ReportResult clientReport(UserCompanyEntity userCompany,
|
|||
if (reportsUIState.filters.containsKey(column)) {
|
||||
final filter = reportsUIState.filters[column];
|
||||
if (filter.isNotEmpty) {
|
||||
if (getReportColumnType(column) == ReportColumnType.dateTime) {
|
||||
if (getReportColumnType(column) == ReportColumnType.number) {
|
||||
final String range = filter.replaceAll(',', '-') + '-';
|
||||
final List<String> parts = range.split('-');
|
||||
final min = parseDouble(parts[0]);
|
||||
final max = parseDouble(parts[1]);
|
||||
if (amount < min || (max > 0 && amount > max)) {
|
||||
skip = true;
|
||||
}
|
||||
} else if (getReportColumnType(column) == ReportColumnType.dateTime) {
|
||||
final startDate = calculateStartDate(
|
||||
dateRange: DateRange.valueOf(filter),
|
||||
company: userCompany.company,
|
||||
|
|
@ -89,7 +97,6 @@ ReportResult clientReport(UserCompanyEntity userCompany,
|
|||
customStartDate: reportsUIState.customStartDate,
|
||||
customEndDate: reportsUIState.customEndDate,
|
||||
);
|
||||
print('## datetime: $filter, $startDate, $endDate');
|
||||
if (reportsUIState.customStartDate.isNotEmpty &&
|
||||
reportsUIState.customEndDate.isNotEmpty) {
|
||||
if (!(startDate.compareTo(value) <= 0 &&
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import 'package:invoiceninja_flutter/ui/app/dialogs/multiselect_dialog.dart';
|
|||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/app_dropdown_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/history_drawer_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/menu_drawer_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/reports/reports_screen_vm.dart';
|
||||
|
|
@ -253,11 +254,14 @@ class _ReportDataTableState extends State<ReportDataTable> {
|
|||
enum ReportColumnType {
|
||||
string,
|
||||
dateTime,
|
||||
number,
|
||||
}
|
||||
|
||||
ReportColumnType getReportColumnType(String column) {
|
||||
if (['updated_at', 'created_at'].contains(column)) {
|
||||
return ReportColumnType.dateTime;
|
||||
} else if (['balance', 'paid_to_date'].contains(column)) {
|
||||
return ReportColumnType.number;
|
||||
} else {
|
||||
return ReportColumnType.string;
|
||||
}
|
||||
|
|
@ -298,7 +302,14 @@ class ReportResult {
|
|||
final localization = AppLocalization.of(context);
|
||||
return DataRow(cells: [
|
||||
for (String column in columns)
|
||||
if (getReportColumnType(column) == ReportColumnType.dateTime)
|
||||
if (getReportColumnType(column) == ReportColumnType.number)
|
||||
DataCell(
|
||||
DecoratedFormField(
|
||||
controller: textEditingControllers[column],
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
)
|
||||
)
|
||||
else if (getReportColumnType(column) == ReportColumnType.dateTime)
|
||||
DataCell(AppDropdownButton<DateRange>(
|
||||
labelText: null,
|
||||
showBlank: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue