umsatzliste verbessert

This commit is contained in:
2026-04-28 10:23:20 +02:00
parent 2d2eb2fa1c
commit d0a5cebdcd
27 changed files with 37 additions and 23 deletions
Regular → Executable
View File
Regular → Executable
View File
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
+5 -3
View File
@@ -1,8 +1,10 @@
get_contact_choices <- function(conn) { get_contact_choices <- function(conn) {
tbl(conn, "contacts") |> contacts <- tbl(conn, "contacts") |>
select(id, display_name) |> select(id, display_name) |>
collect() |> collect() |>
arrange(display_name) |> arrange(display_name)
(\(df) setNames(df$id, df$display_name))()
choices <- setNames(as.character(contacts$id), contacts$display_name)
return(c("Kein Kontakt" = 0, choices))
} }
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
+2 -1
View File
@@ -15,7 +15,8 @@ read_hibiscus <- function(conn) {
datum = as.Date(datum), # einfach as.Date reicht da Text "2023-12-25" datum = as.Date(datum), # einfach as.Date reicht da Text "2023-12-25"
valuta = as.Date(valuta), valuta = as.Date(valuta),
gebucht = !is.na(posting_id) gebucht = !is.na(posting_id)
) ) %>%
filter(datum >= "2026-01-01")
} }
# R/read_functions.R — Kontakt aus bank_connections auflösen # R/read_functions.R — Kontakt aus bank_connections auflösen
Regular → Executable
+28 -19
View File
@@ -2,15 +2,20 @@ umsatzUI <- function(id) {
ns <- NS(id) ns <- NS(id)
tagList( tagList(
useShinyjs(), useShinyjs(),
# Sync-Button oben
div( div(
style = "display: flex; justify-content: flex-end; margin-bottom: 8px;", style = "display: flex; justify-content: flex-end; margin-bottom: 8px;",
actionBttn(ns("sync"), "Sync Hibiscus", actionBttn(ns("sync"), "Sync Hibiscus",
size = "xs", style = "minimal", size = "xs", style = "minimal",
icon = icon("rotate"), color = "primary") icon = icon("rotate"), color = "primary")
), ),
reactableOutput(ns("umsatz_table")), # Buchungspanel immer sichtbar unten
hr(), uiOutput(ns("buchungs_panel")),
uiOutput(ns("buchungs_panel")) # Tabelle mit begrenzter Höhe und Scroll
div(
style = "max-height: 70vh; overflow-y: auto;",
reactableOutput(ns("umsatz_table"))
)
) )
} }
@@ -18,7 +23,7 @@ umsatzServer <- function(id, conn, r_global) {
moduleServer(id, function(input, output, session) { moduleServer(id, function(input, output, session) {
ns <- session$ns ns <- session$ns
# ── Daten ────────────────────────────────────────────────────────────────── # ── Daten ----
refresh <- reactiveVal(0) refresh <- reactiveVal(0)
zeige_alle <- reactiveVal(FALSE) zeige_alle <- reactiveVal(FALSE)
@@ -30,7 +35,7 @@ umsatzServer <- function(id, conn, r_global) {
}) })
# ── Filter-Buttons ───────────────────────────────────────────────────────── # ── Filter-Buttons ----
observeEvent(input$filter_ungebucht, { zeige_alle(FALSE) }) observeEvent(input$filter_ungebucht, { zeige_alle(FALSE) })
observeEvent(input$filter_alle, { zeige_alle(TRUE) }) observeEvent(input$filter_alle, { zeige_alle(TRUE) })
@@ -55,6 +60,7 @@ umsatzServer <- function(id, conn, r_global) {
striped = TRUE, striped = TRUE,
highlight = TRUE, highlight = TRUE,
filterable = TRUE, # ← das reicht filterable = TRUE, # ← das reicht
pagination = F,
selection = "single", selection = "single",
onClick = "select", onClick = "select",
defaultSorted = list(valuta = "desc"), defaultSorted = list(valuta = "desc"),
@@ -110,34 +116,37 @@ umsatzServer <- function(id, conn, r_global) {
tagList( tagList(
h4("Buchen"), h4("Buchen"),
fluidRow( fluidRow(
column(6, column(4,
selectizeInput(ns("konto"), "Konto:", selectizeInput(ns("konto"), "Konto:",
choices = get_account_choices(conn), choices = get_account_choices(conn),
selected = 0, selected = 0,
width = "100%") width = "100%")
), ),
column(6, column(3,
selectizeInput(ns("projekt"), "Projekt:", selectizeInput(ns("projekt"), "Projekt:",
choices = get_project_choices(conn), choices = get_project_choices(conn),
width = "100%") width = "100%")
) ),
), column(3,
fluidRow(
column(6,
selectizeInput(ns("kontakt"), "Kontakt:", selectizeInput(ns("kontakt"), "Kontakt:",
choices = get_contact_choices(conn), choices = get_contact_choices(conn),
selected = resolve_contact(conn, u$empfaenger_name, u$empfaenger_konto), selected = resolve_contact(conn, u$empfaenger_name, u$empfaenger_konto),
width = "100%") width = "100%")
), ),
column(6, column(1,
br(), div(style = "margin-top: 25px;", # Label-Höhe ausgleichen
actionBttn(ns("new_contact"), "Neuer Kontakt", actionBttn(ns("new_contact"), "Neuer Kontakt",
size = "xs", style = "minimal", icon = icon("plus")) size = "xs", style = "minimal", icon = icon("plus"), color = "warning")
)
),
column(1,
div(style = "margin-top: 25px;",
actionBttn(ns("buchen"), "Buchen",
size = "sm", style = "minimal", color = "success",
icon = icon("check"))
)
) )
), )
actionBttn(ns("buchen"), "Buchen",
size = "sm", style = "minimal", color = "success",
icon = icon("check"))
) )
} }
}) })
Regular → Executable
View File
Regular → Executable
BIN
View File
Binary file not shown.
Regular → Executable
View File
Regular → Executable
+2
View File
@@ -5,6 +5,7 @@ library("shinyWidgets")
library("DBI") library("DBI")
library("RSQLite") library("RSQLite")
library("dbx") library("dbx")
library("RJDBC")
library("shinydashboard") library("shinydashboard")
library("reactable") library("reactable")
library("conflicted") library("conflicted")
@@ -17,5 +18,6 @@ conflicts_prefer(dplyr::filter)
conn <- dbConnect(RSQLite::SQLite(), "db/development.sqlite") conn <- dbConnect(RSQLite::SQLite(), "db/development.sqlite")
sourceDirectory("R/") sourceDirectory("R/")
source("~/R/rfunc/fehler_add.R")
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File