Split a Posted Document's VAT by Product Group
The auditor reviewing your client's VAT return wants one number pair per rate: for a given posted sales document, how much taxable base and how much VAT was recorded under each VAT product posting group. The document printout is not good enough — mixed-rate invoices (reduced-rate books next to full-rate shipping on the same document) have to be split exactly the way the posting routine recorded them in the VAT ledger, because the ledger is what gets reported to the authorities.
Requirements
Create a codeunit named "VAT Entry Summary" with a public procedure:
procedure GetGroupTotals(DocumentNo: Code[20]; PostingDate: Date; VATProdPostingGroupCode: Code[20]; var TotalBase: Decimal; var TotalAmount: Decimal)Rules:
TotalBaseandTotalAmountreturn the sums of theBaseandAmountfields over every record in the"VAT Entry"table whose"Document No."equalsDocumentNo, whose"Posting Date"equalsPostingDate, and whose"VAT Prod. Posting Group"equalsVATProdPostingGroupCode.
Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 7 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in