Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

BUG: VAT report `chargesType` filter is inverted (EXPENSE returns only income, INCOME returns only expenses)

Open Beginner friendly
#4,604 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
api, backend

Research direction

Start in packages/server/src/modules/reports/resolvers/get-vat-records.resolver.ts, focusing on the chargesType guards and the getChargesByFilters call. Read the existing tests in packages/server/src/modules/reports/helpers/__tests__/vat-report.helper.test.ts and check coverage for ALL, INCOME, EXPENSE, and undefined. Done means each filter populates the intended income or expense bucket, while undefined keeps both.

Written by the indexing model from the issue text.

Description

Problem

The vatReport query's chargesType filter (ChargeFilterType: ALL | INCOME | EXPENSE) works backwards on the server:

  • chargesType: EXPENSE returns only income records.
  • chargesType: INCOME returns only expense records.
Where

packages/server/src/modules/reports/resolvers/get-vat-records.resolver.ts, in getVatRecords:

// ~line 168: document is an EXPENSE for the report issuer
includedChargeIDs.add(charge.id);
if (filters?.chargesType !== 'EXPENSE') {   // <-- line 174: drops expenses when EXPENSE is requested
  expenseRecords.push({ charge, doc, business });
}
...
// ~line 177: document is INCOME for the report issuer
includedChargeIDs.add(charge.id);
if (filters?.chargesType !== 'INCOME') {    // <-- line 186: drops income when INCOME is requested
  incomeRecords.push({ charge, doc, business });
}
Visible effect

The client already hides the other table based on the same filter (packages/client/src/components/reports/vat-monthly-report/index.tsx:143 hides income when EXPENSE, :151 hides expenses when INCOME). The server returns the wrong bucket and the client hides it, so filtering the VAT report by either type shows an empty report.

Suggested fix

  1. Swap the guards: keep expense records unless chargesType === 'INCOME', and keep income records unless chargesType === 'EXPENSE'.
  2. Check the second place chargesType is used: it is also passed to ChargesProvider.getChargesByFilters({ chargeType: filters?.chargesType }) (~line 97). That narrows the set of charges used for the missingInfo / differentMonthDoc / businessTrips buckets. Confirm that this direction is correct and intended.
  3. Add a resolver/helper test covering ALL, INCOME, EXPENSE (and undefined), asserting which of income / expenses is populated. Existing helper tests live in packages/server/src/modules/reports/helpers/__tests__/vat-report.helper.test.ts.

Other callers to keep in mind

getVatRecords is also called without chargesType by the PCN874 generator (reports/helpers/pcn.helper.ts → getPcn874String), ledger validation and charge-suggestion flows. Those are unaffected as long as undefined keeps returning both buckets.

Follow-up

Once fixed, the MCP VAT report tool (accounter_vat_report, planned in packages/mcp-server) can expose a chargesType input. It deliberately leaves the filter out until this is fixed.

Dominant language
TypeScript
Stars
30
Forks
8
Avg merge
2d 12h
Merged PRs (30d)
176

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Urigo/accounter-fullstack

All issues in Urigo/accounter-fullstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.