Berichte: Kostenstelle als Filter und als Gruppierung
Im Bestand laesst sich nach Kostenstelle filtern ("Alle Kostenstellen")
und gruppieren ("Kostenstelle", Planstellen ohne Kontierung als eigene
Gruppe). Gemeint ist die Kontierung der Planstelle, auf der jemand am
Stichtag sitzt. Der Filter gilt auch fuer die Exporte dieser Seite.
Geprueft: lint, tsc, 950 Tests, Uebergabe-Waechter
This commit is contained in:
@@ -31,6 +31,7 @@ type SearchParams = Record<string, string | string[] | undefined> & {
|
||||
split?: string;
|
||||
division?: string;
|
||||
location?: string;
|
||||
kostenstelle?: string;
|
||||
status?: string;
|
||||
asOf?: string;
|
||||
eventType?: string;
|
||||
@@ -66,8 +67,8 @@ export default async function ReportsPage({ searchParams }: { searchParams: Prom
|
||||
|
||||
// Alles in einer Transaktion — dort gilt der Sitzungskontext, und der
|
||||
// Lesestand ist über alle Abfragen hinweg derselbe.
|
||||
const { lookups, units, locations, events, employees, savedReports } = await withUser(userId, async (tx) => {
|
||||
const [{ lookups, units, locations }, events, employees, savedReports] = await Promise.all([
|
||||
const { lookups, units, locations, events, employees, savedReports, kostenstellen } = await withUser(userId, async (tx) => {
|
||||
const [{ lookups, units, locations }, events, employees, savedReports, kostenstellen] = await Promise.all([
|
||||
loadOrgLookups(tx),
|
||||
mode === "events"
|
||||
? loadEventHistory(tx, {
|
||||
@@ -83,6 +84,7 @@ export default async function ReportsPage({ searchParams }: { searchParams: Prom
|
||||
? loadSnapshotEmployees(tx, {
|
||||
division: params.division,
|
||||
location: params.location,
|
||||
kostenstelle: params.kostenstelle,
|
||||
status: params.status,
|
||||
criteria,
|
||||
asOf,
|
||||
@@ -96,8 +98,11 @@ export default async function ReportsPage({ searchParams }: { searchParams: Prom
|
||||
.orderBy("created_at", "desc")
|
||||
.execute()
|
||||
: Promise.resolve([]),
|
||||
// Für den Filter: alle Kostenstellen, auch beendete — ein Stichtag in
|
||||
// der Vergangenheit kann eine meinen, die es heute nicht mehr gibt.
|
||||
tx.selectFrom("cost_centers").select(["id", "code", "name"]).orderBy("code").execute(),
|
||||
]);
|
||||
return { lookups, units, locations, events, employees, savedReports };
|
||||
return { lookups, units, locations, events, employees, savedReports, kostenstellen };
|
||||
});
|
||||
|
||||
if (mode === "events") {
|
||||
@@ -136,6 +141,7 @@ export default async function ReportsPage({ searchParams }: { searchParams: Prom
|
||||
filters={{
|
||||
division: params.division ?? "",
|
||||
location: params.location ?? "",
|
||||
kostenstelle: params.kostenstelle ?? "",
|
||||
status: params.status ?? "",
|
||||
}}
|
||||
criteria={criteria}
|
||||
@@ -144,6 +150,7 @@ export default async function ReportsPage({ searchParams }: { searchParams: Prom
|
||||
recordCount={employees.length}
|
||||
units={units}
|
||||
locations={locations}
|
||||
kostenstellen={kostenstellen}
|
||||
savedReports={savedReports}
|
||||
/>
|
||||
</Suspense>
|
||||
|
||||
@@ -73,6 +73,7 @@ export async function GET(request: NextRequest) {
|
||||
const employees = await loadSnapshotEmployees(tx, {
|
||||
division: params.get("division") ?? undefined,
|
||||
location: params.get("location") ?? undefined,
|
||||
kostenstelle: params.get("kostenstelle") ?? undefined,
|
||||
status: params.get("status") ?? undefined,
|
||||
criteria: parseCriteria((k) => params.get(k)),
|
||||
asOf,
|
||||
|
||||
Reference in New Issue
Block a user