BUG: VAT report `chargesType` filter is inverted (EXPENSE returns only income, INCOME returns only expenses)
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
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: EXPENSEreturns only income records.chargesType: INCOMEreturns 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
- Swap the guards: keep expense records unless
chargesType === 'INCOME', and keep income records unlesschargesType === 'EXPENSE'. - Check the second place
chargesTypeis used: it is also passed toChargesProvider.getChargesByFilters({ chargeType: filters?.chargesType })(~line 97). That narrows the set of charges used for themissingInfo/differentMonthDoc/businessTripsbuckets. Confirm that this direction is correct and intended. - Add a resolver/helper test covering
ALL,INCOME,EXPENSE(andundefined), asserting which ofincome/expensesis populated. Existing helper tests live inpackages/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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Urigo/accounter-fullstack
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Urigo/accounter-fullstack#4583 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Urigo/accounter-fullstack#4580 ·
Maintainers usually reply within 2 days
-
Document PG18 migration conventions: NOT NULL NOT VALID, and generated columns default to VIRTUALOpen
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Urigo/accounter-fullstack#4366 ·
Maintainers usually reply within 2 days
-
documentation
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Urigo/accounter-fullstack#4619 ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
Urigo/accounter-fullstack#4618 ·
Maintainers usually reply within 2 days
All issues in Urigo/accounter-fullstack
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
umbraco/Umbraco-CMS-MCP-Dev#512 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
wimpysworld/sidra#290 ·
Maintainers usually reply within 1 day
-
defuFn invokes function values for inherited default propertiesPossibly taken @xiehuanyi claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
feature request good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
TabularisDB/tabularis#853 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 Under an hour Newbie friendliness 85/100
capricorn86/happy-dom#2474 ·
Maintainers usually reply within 2 days