diff --git a/schema/changes02.sql b/schema/changes02.sql
index baead02..7a9424b 100644
--- a/schema/changes02.sql
+++ b/schema/changes02.sql
@@ -116,7 +116,7 @@ $$;
CREATE TRIGGER maintain_ledger_trigger
AFTER INSERT ON account_entry_t
FOR EACH ROW
- WHEN (NEW.account != 1000 AND NEW.account_entry_category NOT IN (3, 4))
+ WHEN (NEW.account != 1000 AND NEW.account_entry_category NOT IN (3, 4, 29))
EXECUTE FUNCTION maintain_ledger();
diff --git a/ui/hv2-ui/src/app/account/account.component.html b/ui/hv2-ui/src/app/account/account.component.html
index 2a10ed4..b09b647 100644
--- a/ui/hv2-ui/src/app/account/account.component.html
+++ b/ui/hv2-ui/src/app/account/account.component.html
@@ -10,9 +10,9 @@
Jahr
-
+
Kategorie
-
+
{{p.description}}
@@ -22,7 +22,7 @@
Beschreibung
-
+
@@ -31,13 +31,13 @@
Saldo: {{saldo?.saldo | number:'1.2-2'}} €
-
+
- Datum |
+ Datum |
{{element.rawAccountEntry.created_at | date}} |
- Jahr |
+ Jahr |
{{element.rawAccountEntry.fiscal_year}} |
@@ -45,7 +45,7 @@ Saldo: {{saldo?.saldo | number:'1.2-2'}} €
{{element.rawAccountEntry.description}} |
- Belegnummer |
+ Belegnummer |
{{element.rawAccountEntry.document_no}} |
@@ -53,11 +53,11 @@ Saldo: {{saldo?.saldo | number:'1.2-2'}} €
{{element.rawAccountEntry.amount | number:'1.2-2'}} € |
- Kategorie |
+ Kategorie |
{{element.accountEntryCategory}} |
- BK relevant |
+ BK relevant |
{{element.overheadRelevant}} |
diff --git a/ui/hv2-ui/src/app/account/account.component.ts b/ui/hv2-ui/src/app/account/account.component.ts
index ba9333b..129e39e 100644
--- a/ui/hv2-ui/src/app/account/account.component.ts
+++ b/ui/hv2-ui/src/app/account/account.component.ts
@@ -31,6 +31,7 @@ export class AccountComponent implements OnInit {
@Input() shallBeRentPayment: boolean
@ViewChild('addAccountEntryButton') addAccountEntryButton: MatButton
+
account: Account
accountEntries: DN_AccountEntry[]
accountEntriesDataSource: MatTableDataSource
@@ -42,6 +43,8 @@ export class AccountComponent implements OnInit {
accountEntryCategoriesInverseMap: Map
presetFiscalYear: FormControl
+ presetCategory: FormControl
+ presetDescription: FormControl
constructor(
private accountService: AccountService,
@@ -96,23 +99,14 @@ export class AccountComponent implements OnInit {
let uniquenumber: UniqueNumber = await this.extApiService.getUniqueNumber();
this.messageService.add(`Got unique number as document_no: ${uniquenumber.number}`)
let newAccountEntry: AccountEntry = {
- description: formData.value.description,
+ description: this.presetDescription.value,
account: this.account.id,
created_at: formData.value.createdAt,
fiscal_year: this.presetFiscalYear.value,
amount: formData.value.amount,
id: 0,
document_no: uniquenumber.number,
- account_entry_category: 0
- }
-
- if (this.shallBeRentPayment) {
- newAccountEntry.account_entry_category = this.accountEntryCategoriesInverseMap.get('Mietzahlung').id
- newAccountEntry.description = "Miete"
- this.messageService.add(`shall be rentpayment, category is ${newAccountEntry.account_entry_category}`)
- } else {
- newAccountEntry.account_entry_category = formData.value.category
- this.messageService.add(`category is ${newAccountEntry.account_entry_category}`)
+ account_entry_category: this.presetCategory.value
}
this.messageService.add(`addAccountEntry: ${ JSON.stringify(newAccountEntry, undefined, 4) }`)
@@ -146,12 +140,28 @@ export class AccountComponent implements OnInit {
}
private async init(): Promise {
+ this.messageService.add(`AccountComponent.init start, account: ${this.selectedAccountId}`)
let currentDate = new Date()
let y = currentDate.getFullYear()
this.presetFiscalYear = new FormControl(y)
+
+ this.messageService.add(`AccountComponent.init a, account: ${this.selectedAccountId}`)
+ await this.getAccountEntryCategories()
+
+ if (this.shallBeRentPayment) {
+ this.messageService.add(`AccountComponent.init b, account: ${this.selectedAccountId}`)
+ this.presetCategory = new FormControl(this.accountEntryCategoriesInverseMap.get('Mietzahlung').id)
+ this.messageService.add(`AccountComponent.init c, account: ${this.selectedAccountId}`)
+ this.presetDescription = new FormControl("Miete")
+ this.messageService.add(`shall be rentpayment`)
+ this.messageService.add(`AccountComponent.init d, account: ${this.selectedAccountId}`)
+ } else {
+ this.presetCategory = new FormControl()
+ this.presetDescription = new FormControl()
+ }
+
this.messageService.add(`AccountComponent.init, account: ${this.selectedAccountId}`)
this.getAccount()
- await this.getAccountEntryCategories()
}
@@ -163,5 +173,4 @@ export class AccountComponent implements OnInit {
this.init()
}
-
}
diff --git a/ui/hv2-ui/src/app/app.module.ts b/ui/hv2-ui/src/app/app.module.ts
index ecd68e8..e5439aa 100644
--- a/ui/hv2-ui/src/app/app.module.ts
+++ b/ui/hv2-ui/src/app/app.module.ts
@@ -50,6 +50,7 @@ import { EnterPaymentComponent } from './enter-payment/enter-payment.component';
import { HomeComponent } from './home/home.component';
import { LedgerComponent } from './ledger/ledger.component';
import { ErrorDialogComponent } from './error-dialog/error-dialog.component'
+import { MatSortModule } from '@angular/material/sort';
registerLocaleData(localeDe)
@@ -102,7 +103,8 @@ registerLocaleData(localeDe)
MatSelectModule,
MatDatepickerModule,
MatNativeDateModule,
- MatExpansionModule
+ MatExpansionModule,
+ MatSortModule
],
exports: [
MatMomentDateModule
diff --git a/ui/hv2-ui/src/app/ledger/ledger.component.html b/ui/hv2-ui/src/app/ledger/ledger.component.html
index 0698b09..dd1981f 100644
--- a/ui/hv2-ui/src/app/ledger/ledger.component.html
+++ b/ui/hv2-ui/src/app/ledger/ledger.component.html
@@ -5,6 +5,16 @@
-
+
+ Konto auswählen:
+
+
+ Mieter
+ {{p.description}}
+
+
+
+
+
\ No newline at end of file
diff --git a/ui/hv2-ui/src/app/ledger/ledger.component.ts b/ui/hv2-ui/src/app/ledger/ledger.component.ts
index 711f5d1..c8871ef 100644
--- a/ui/hv2-ui/src/app/ledger/ledger.component.ts
+++ b/ui/hv2-ui/src/app/ledger/ledger.component.ts
@@ -1,5 +1,6 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { AccountComponent } from '../account/account.component';
+import { AccountService } from '../data-object-service';
import { Account } from '../data-objects';
import { ExtApiService } from '../ext-data-object-service';
import { MessageService } from '../message.service';
@@ -11,23 +12,23 @@ import { MessageService } from '../message.service';
})
export class LedgerComponent implements OnInit {
- fallbackAccount: Account
- fallbackAccountId: number
+ accounts: Account[]
+ accountId: number
- @ViewChild('fallbackAccountComponent') fallbackAccountComponent: AccountComponent
+ @ViewChild('accountComponent') accountComponent: AccountComponent
constructor(
- private extApiService: ExtApiService,
+ private accountService: AccountService,
private messageService: MessageService
) { }
async getAccount(): Promise {
try {
- this.messageService.add("Trying to load fallback account")
- this.fallbackAccount = await this.extApiService.getAccountByDescription('fallback_account')
- this.messageService.add("Account loaded")
+ this.messageService.add("Trying to load accounts")
+ this.accounts = await this.accountService.getAccounts()
+ this.messageService.add("Accounts loaded")
} catch (err) {
this.messageService.add(JSON.stringify(err, undefined, 4))
}
@@ -35,7 +36,6 @@ export class LedgerComponent implements OnInit {
async ngOnInit(): Promise {
await this.getAccount()
- this.fallbackAccountId = this.fallbackAccount.id
}
}