outer join for tenant-saldo-query
This commit is contained in:
parent
97dfcbe2fb
commit
b8083ec41e
@ -37,8 +37,7 @@ def get_tenant_with_saldo(user, token_info):
|
||||
return dbGetMany(user, token_info, {
|
||||
"statement": """
|
||||
SELECT t.id, t.firstname, t.lastname, t.address1, sum(a.amount) AS saldo
|
||||
FROM tenant_t t, account_entry_t a
|
||||
WHERE a.account = t.account
|
||||
FROM tenant_t t LEFT OUTER JOIN account_entry_t a ON a.account = t.account
|
||||
GROUP BY t.id, t.firstname, t.lastname, t.address1
|
||||
""",
|
||||
"params": ()
|
||||
|
@ -90,11 +90,18 @@ export class TenantDetailsComponent implements OnInit {
|
||||
async getTenant(): Promise<void> {
|
||||
try {
|
||||
const id = +this.route.snapshot.paramMap.get('id')
|
||||
this.messageService.add(`getTenant, id=${id}`)
|
||||
if (id != 0) {
|
||||
this.messageService.add("getTenant, not-0-branch")
|
||||
this.tenantId = id
|
||||
this.tenant = await this.tenantService.getTenant(id)
|
||||
this.account = await this.accountService.getAccount(this.tenant.account)
|
||||
this.getTenancies()
|
||||
} else {
|
||||
this.messageService.add("getTenant, 0-branch")
|
||||
this.tenant = NULL_Tenant
|
||||
this.account = NULL_Account
|
||||
this.tenancies = []
|
||||
}
|
||||
} catch (err) {
|
||||
this.messageService.add(JSON.stringify(err, undefined, 4))
|
||||
|
Loading…
x
Reference in New Issue
Block a user