2 Commits

Author SHA1 Message Date
b748ba7a77 fiscal year 2022-01-24 16:11:02 +01:00
ab365c65a1 add fiscal_year, drop due_to 2022-01-21 20:46:28 +01:00
8 changed files with 24 additions and 31 deletions

View File

@ -1365,7 +1365,7 @@ SELECT
,description
,account
,created_at
,due_at
,fiscal_year
,amount
,document_no
,account_entry_category
@ -1383,7 +1383,7 @@ def insert_account_entry(user, token_info, **args):
v_description = body["description"]
v_account = body["account"]
v_created_at = body["created_at"]
v_due_at = body["due_at"]
v_fiscal_year = body["fiscal_year"]
v_amount = body["amount"]
v_document_no = body["document_no"]
v_account_entry_category = body["account_entry_category"]
@ -1394,7 +1394,7 @@ INSERT INTO account_entry_t
description
,account
,created_at
,due_at
,fiscal_year
,amount
,document_no
,account_entry_category
@ -1413,7 +1413,7 @@ INSERT INTO account_entry_t
v_description
,v_account
,v_created_at
,v_due_at
,v_fiscal_year
,v_amount
,v_document_no
,v_account_entry_category
@ -1432,7 +1432,7 @@ SELECT
,description
,account
,created_at
,due_at
,fiscal_year
,amount
,document_no
,account_entry_category
@ -1453,7 +1453,7 @@ SELECT
,description
,account
,created_at
,due_at
,fiscal_year
,amount
,document_no
,account_entry_category
@ -1474,7 +1474,7 @@ SELECT
,description
,account
,created_at
,due_at
,fiscal_year
,amount
,document_no
,account_entry_category

View File

@ -1793,9 +1793,8 @@ components:
type: integer
created_at:
type: string
due_at:
type: string
nullable: true
fiscal_year:
type: integer
amount:
type: number
document_no:

View File

@ -5,6 +5,6 @@ from flask_cors import CORS
logging.basicConfig(level=logging.DEBUG)
app = connexion.App('hv2-api')
app.add_api('./openapi.yaml')
app.add_api('./openapi.yaml', options = {"swagger_ui": True})
CORS(app.app)
app.run(port=8080)

View File

@ -138,7 +138,7 @@
{ "name": "description", "sqltype": "varchar(1024)", "notnull": true },
{ "name": "account", "sqltype": "integer", "notnull": true, "foreignkey": true },
{ "name": "created_at", "sqltype": "timestamp", "notnull": true, "default": "now()", "selector": 0 },
{ "name": "due_at", "sqltype": "timestamp", "notnull": false },
{ "name": "fiscal_year", "sqltype": "integer", "notnull": true },
{ "name": "amount", "sqltype": "numeric(10,2)", "notnull": true },
{ "name": "document_no", "sqltype": "integer", "unique": true },
{ "name": "account_entry_category", "sqltype": "integer", "notnull": true, "foreignkey": true }

View File

@ -150,7 +150,7 @@ CREATE TABLE account_entry_t (
,description varchar(1024) not null
,account integer not null references account_t (id)
,created_at timestamp not null default now()
,due_at timestamp
,fiscal_year integer not null
,amount numeric(10,2) not null
,document_no integer unique
,account_entry_category integer not null references account_entry_category_t (id)

View File

@ -6,11 +6,9 @@
<mat-datepicker-toggle matSuffix [for]="createdAtPicker"></mat-datepicker-toggle>
<mat-datepicker #createdAtPicker></mat-datepicker>
</mat-form-field>
<mat-form-field appearance="outline" id="addEntryfield">
<mat-label>Fälligkeit</mat-label>
<input matInput ngModel name="dueAt" [matDatepicker]="dueAtPicker" [formControl]="presetDueAt"/>
<mat-datepicker-toggle matSuffix [for]="dueAtPicker"></mat-datepicker-toggle>
<mat-datepicker #dueAtPicker></mat-datepicker>
<mat-form-field appearance="outline">
<mat-label>Jahr</mat-label>
<input matInput type="number" name="fiscalYear" [formControl]="presetFiscalYear" ngModel/>
</mat-form-field>
<mat-form-field appearance="outline" *ngIf="!shallBeRentPayment">
<mat-label>Kategorie</mat-label>
@ -38,9 +36,9 @@ Saldo: {{saldo?.saldo | number:'1.2-2'}} €
<th mat-header-cell *matHeaderCellDef>Datum</th>
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.created_at | date}}</td>
</ng-container>
<ng-container matColumnDef="dueAt">
<th mat-header-cell *matHeaderCellDef>Fälligkeit</th>
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.due_at | date}}</td>
<ng-container matColumnDef="fiscalYear">
<th mat-header-cell *matHeaderCellDef>Jahr</th>
<td mat-cell *matCellDef="let element">{{element.rawAccountEntry.fiscal_year}}</td>
</ng-container>
<ng-container matColumnDef="description">
<th mat-header-cell *matHeaderCellDef>Beschreibung</th>

View File

@ -34,14 +34,14 @@ export class AccountComponent implements OnInit {
account: Account
accountEntries: DN_AccountEntry[]
accountEntriesDataSource: MatTableDataSource<DN_AccountEntry>
accountEntriesDisplayedColumns: string[] = [ "description", "document_no", "amount", "createdAt", "dueAt", "category", "overhead_relevant" ]
accountEntriesDisplayedColumns: string[] = [ "description", "document_no", "amount", "createdAt", "fiscalYear", "category", "overhead_relevant" ]
saldo: Saldo
accountEntryCategories: AccountEntryCategory[]
accountEntryCategoriesMap: Map<number, AccountEntryCategory>
accountEntryCategoriesInverseMap: Map<string, AccountEntryCategory>
presetDueAt: FormControl
presetFiscalYear: FormControl
constructor(
private accountService: AccountService,
@ -99,7 +99,7 @@ export class AccountComponent implements OnInit {
description: formData.value.description,
account: this.account.id,
created_at: formData.value.createdAt,
due_at: formData.value.dueAt,
fiscal_year: formData.value.fiscalYear,
amount: formData.value.amount,
id: 0,
document_no: uniquenumber.number,
@ -148,11 +148,7 @@ export class AccountComponent implements OnInit {
private async init(): Promise<void> {
let currentDate = new Date()
let y = currentDate.getFullYear().toString()
let m = (currentDate.getMonth()+1).toString()
if (m.length == 1) {
m = `0${m}`
}
this.presetDueAt = new FormControl(`${y}-${m}-01`)
this.presetFiscalYear = new FormControl(`${y}`)
this.messageService.add(`AccountComponent.init, account: ${this.selectedAccountId}`)
this.getAccount()
await this.getAccountEntryCategories()

View File

@ -193,7 +193,7 @@ export interface AccountEntry {
description: string
account: number
created_at: string
due_at: string
fiscal_year: number
amount: number
document_no: number
account_entry_category: number
@ -203,7 +203,7 @@ export const NULL_AccountEntry: AccountEntry = {
,description: ''
,account: undefined
,created_at: ''
,due_at: ''
,fiscal_year: undefined
,amount: undefined
,document_no: undefined
,account_entry_category: undefined