Files
gemfin-shiny/R/postings/buchungen.R
T
2026-03-09 17:34:56 +01:00

23 lines
862 B
R

read_buch_tabelle <- function(conn){
postings <- tbl(conn, "postings")
entries <- tbl(conn, "entries")
accounts <- tbl(conn, "accounts")
projects <- tbl(conn, "projects")
contacts <- tbl(conn, "contacts")
result <- postings |>
left_join(entries, by = c("entry_id" = "id")) |>
left_join(contacts, by = c("contact_id" = "id")) |> # contact_id jetzt verfügbar
left_join(accounts, by = c("account_id" = "id")) |>
left_join(projects, by = c("project_id" = "id")) |>
select(id, valuta, kontoname, projektname, display_name, amount, entry_id) |>
collect()
}
read_posting <- function(conn, id){
dbxSelect(conn, paste0("SELECT * FROM postings WHERE id =", id))
}
read_postings_by_entry <- function(conn, id){
dbxSelect(conn, paste0("SELECT * FROM postings WHERE entry_id =", id))
}
tbl(conn, "accounts") %>% collect %>% str