Feature Request: Report (Invoice) -> Group by Date (Quarterly #569

This commit is contained in:
Hillel Coren 2023-10-30 23:20:49 +02:00
parent 5f21d90340
commit d3ec7a6769
4 changed files with 24 additions and 0 deletions

View File

@ -737,6 +737,7 @@ const String kTaxRegionAustralia = 'AU';
const String kReportGroupDay = 'day'; const String kReportGroupDay = 'day';
const String kReportGroupWeek = 'week'; const String kReportGroupWeek = 'week';
const String kReportGroupMonth = 'month'; const String kReportGroupMonth = 'month';
const String kReportGroupQuarter = 'quarter';
const String kReportGroupYear = 'year'; const String kReportGroupYear = 'year';
const int kModuleRecurringInvoices = 1; const int kModuleRecurringInvoices = 1;

View File

@ -190,6 +190,10 @@ class ReportsScreen extends StatelessWidget {
child: Text(localization.month), child: Text(localization.month),
value: kReportGroupMonth, value: kReportGroupMonth,
), ),
DropdownMenuItem(
child: Text(localization.quarter),
value: kReportGroupQuarter,
),
DropdownMenuItem( DropdownMenuItem(
child: Text(localization.year), child: Text(localization.year),
value: kReportGroupYear, value: kReportGroupYear,

View File

@ -652,6 +652,19 @@ GroupTotals calculateReportTotals({
group = group.substring(0, 4) + '-01-01'; group = group.substring(0, 4) + '-01-01';
} else if (reportState.subgroup == kReportGroupMonth) { } else if (reportState.subgroup == kReportGroupMonth) {
group = group.substring(0, 7) + '-01'; group = group.substring(0, 7) + '-01';
} else if (reportState.subgroup == kReportGroupQuarter) {
final parts = group.split('-');
final month = parseInt(parts[1]) ?? 0;
group = parts[0] + '-';
if (month <= 3) {
group += '01-01';
} else if (month <= 6) {
group += '04-01';
} else if (month <= 9) {
group += '07-01';
} else {
group += '10-01';
}
} else if (reportState.subgroup == kReportGroupWeek) { } else if (reportState.subgroup == kReportGroupWeek) {
final date = DateTime.parse(group); final date = DateTime.parse(group);
final dateWeek = final dateWeek =

View File

@ -18,6 +18,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = { static final Map<String, Map<String, String>> _localizedValues = {
'en': { 'en': {
// STARTER: lang key - do not remove comment // STARTER: lang key - do not remove comment
'quarter': 'Quarter',
'item_description': 'Item Description', 'item_description': 'Item Description',
'task_item': 'Task Item', 'task_item': 'Task Item',
'record_state': 'Record State', 'record_state': 'Record State',
@ -109940,6 +109941,11 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]!['task_item'] ?? _localizedValues[localeCode]!['task_item'] ??
_localizedValues['en']!['task_item']!; _localizedValues['en']!['task_item']!;
String get quarter =>
_localizedValues[localeCode]!['quarter'] ??
_localizedValues['en']!['quarter']!;
// STARTER: lang field - do not remove comment // STARTER: lang field - do not remove comment
String lookup(String? key) { String lookup(String? key) {