This page summarizes the validated results from the Confluence testing matrix for VAT custom labels, Tax_BA behavior, and VAT rendering combinations across Portrait and Landscape invoice PDFs.
Scope: 24 executed scenarios (CX-01 to CX-24), covering VAT Type 1 and VAT Type 2 across 6 VAT configuration patterns and 2 PDF templates.
Important context: These results are the cleaned and validated outcomes after re-running the tests with the correct VAT setup and matching records.
Executive summary
The overall logic is consistent in many areas, but the PDF output changes depending on three factors: template type (Portrait vs Landscape), whether VAT (B) is null or populated, and whether External Name VAT Classification is empty or populated.
Portrait behaves correctly for calculations in all tested cases, but label rendering varies by scenario.
Landscape consistently uses Tax_BA as a visible prefix/label source.
When Classification is populated and both A+B exist, both templates collapse the tax rows into a single combined row.
The main functional difference between VAT Type 1 and VAT Type 2 appears in the single-row scenario where VAT (B) = null and Classification is populated: Type 2 ignores Classification, while Type 1 shows it.
Key findings
1. Custom label behavior by template
Portrait: the VAT prefix behavior is not fully driven by the expected label logic in every scenario. In particular, when there is only one tax row and Classification is empty, Portrait does not show External Name A.
Landscape: Tax_BA is consistently reflected in the rendered output and appears as a prefix or first label component.
2. Portrait behavior
When VAT (B) = null and Classification is empty, Portrait shows a single generic label such as VAT 13,00% of net.
When there are two tax rows, Portrait correctly renders the external labels, for example VAT HST, VAT PST, VAT GST.
When Classification is populated and A+B both exist, Portrait collapses the rates into one row and uses Classification as the label.
When Classification is populated and B = null, Portrait shows Classification for Type 1, but not for Type 2.
3. Landscape behavior
Landscape consistently shows Tax_BA in the output.
When Classification is empty and two rows exist, Landscape may render labels such as HST GST and HST PST.
When Classification is populated and A+B both exist, Landscape collapses to one row and renders Tax_BA + Classification.
When Classification is populated and B = null, Landscape shows Tax_BA + Classification for Type 1, but ignores Classification for Type 2.
4. Confirmed Type 1 vs Type 2 difference
Confirmed difference: In the scenario where VAT (B) = null and Classification is populated, VAT Type 2 ignores Classification in both Portrait and Landscape, while VAT Type 1 displays it correctly.
Case | Type | Template | Classification | Rendered label | Result |
|---|---|---|---|---|---|
CX-11 | 1 | Portrait | Canadian Tax | VAT Canadian Tax (13,00%) of net | Expected |
CX-12 | 1 | Landscape | Canadian Tax | HST Canadian Tax (13,00%) | Expected |
CX-23 | 2 | Portrait | Canadian Tax | VAT 13,00% of net | Classification ignored |
CX-24 | 2 | Landscape | Canadian Tax | HST 13,00% | Classification ignored |
Validated results by case
VAT Type 1 — CX-01 to CX-12
Case | Scenario | Template | Observed result | Status |
|---|---|---|---|---|
CX-01 | B=null, no Classification | Portrait | VAT 13,00% of net | OK |
CX-02 | B=null, no Classification | Landscape | HST 13,00% | OK |
CX-03 | B=0, no Classification | Portrait | VAT HST (13,00%) of net / VAT PST (0,00%) of net | OK |
CX-04 | B=0, no Classification | Landscape | HST 13,00% / PST 0,00% | OK |
CX-05 | A=5, B=8, no Classification | Portrait | VAT GST (5,00%) of net / VAT PST (8,00%) of net | OK |
CX-06 | A=5, B=8, no Classification | Landscape | HST GST (5,00%) / HST PST (8,00%) | PARTIAL |
CX-07 | A=5, B=8, Classification=HST | Portrait | VAT HST (13,00%) of net | PARTIAL |
CX-08 | A=5, B=8, Classification=HST | Landscape | HST HST (13,00%) | PARTIAL |
CX-09 | A=5, B=8, Classification=Canadian Tax | Portrait | VAT Canadian Tax (13,00%) of net | PARTIAL |
CX-10 | A=5, B=8, Classification=Canadian Tax | Landscape | HST Canadian Tax (13,00%) | PARTIAL |
CX-11 | B=null, Classification=Canadian Tax | Portrait | VAT Canadian Tax (13,00%) of net | OK |
CX-12 | B=null, Classification=Canadian Tax | Landscape | HST Canadian Tax (13,00%) | OK |
VAT Type 2 — CX-13 to CX-24
Case | Scenario | Template | Observed result | Status |
|---|---|---|---|---|
CX-13 | B=null, no Classification | Portrait | VAT 13,00% of net | OK |
CX-14 | B=null, no Classification | Landscape | HST 13,00% | OK |
CX-15 | B=0, no Classification | Portrait | VAT HST (13,00%) of net / VAT PST (0,00%) of net | OK |
CX-16 | B=0, no Classification | Landscape | HST HST (13,00%) / HST PST (0,00%) | PARTIAL |
CX-17 | A=5, B=8, no Classification | Portrait | VAT GST (5,00%) of net / VAT PST (8,00%) of net | OK |
CX-18 | A=5, B=8, no Classification | Landscape | HST GST (5,00%) / HST PST (8,00%) | PARTIAL |
CX-19 | A=5, B=8, Classification=HST | Portrait | VAT HST (13,00%) of net | PARTIAL |
CX-20 | A=5, B=8, Classification=HST | Landscape | HST HST (13,00%) | PARTIAL |
CX-21 | A=5, B=8, Classification=Canadian Tax | Portrait | VAT Canadian Tax (13,00%) of net | PARTIAL |
CX-22 | A=5, B=8, Classification=Canadian Tax | Landscape | HST Canadian Tax (13,00%) | PARTIAL |
CX-23 | B=null, Classification=Canadian Tax | Portrait | VAT 13,00% of net | PARTIAL |
CX-24 | B=null, Classification=Canadian Tax | Landscape | HST 13,00% | PARTIAL |
Interpretation by scenario pattern
Pattern | Type 1 | Type 2 | Observation |
|---|---|---|---|
B=null, Classification empty | Portrait generic; Landscape shows HST | Same | No meaningful difference between types |
B=0, Classification empty | Portrait normal; Landscape may prefix with Tax_BA depending on template behavior | Same Portrait; Landscape prefixes with Tax_BA | Landscape label format is noisier |
A+B, Classification empty | Portrait shows GST/PST; Landscape shows HST GST / HST PST | Same | Landscape adds Tax_BA prefix |
A+B, Classification populated | Both templates collapse to one combined row | Same | Classification drives grouping |
B=null, Classification populated | Classification shown in both templates | Classification ignored in both templates | Main Type 2 issue |
Suggested message to Liga
The tests are now fully validated in Confluence. The main conclusion is that VAT Type 1 and VAT Type 2 behave the same in most scenarios. The confirmed difference is the single-row case with VAT(B)=null and Classification populated: Type 1 shows the Classification in both Portrait and Landscape, while Type 2 ignores it. Landscape also consistently renders Tax_BA as part of the visible label, which explains outputs like “HST GST” or “HST Canadian Tax”.
Reference
Source Confluence page: https://advendio.atlassian.net/wiki/spaces/SO/pages/5363597315
Step-by-step execution guide for the 24 CX tests
Purpose: This section documents the exact execution steps used for the 24-test matrix, so the scenarios can be reproduced consistently.
General setup before running the matrix
Make sure there is only one active VAT record matching the test criteria for the selected period. For these tests, use the CA/CA VAT record, for example CA_HST.
Confirm the VAT record validity dates cover the Campaign Item and invoice dates.
Confirm Country Buyer = CA and Country Seller = CA.
Use a Canadian Account as buyer/debtor and a Canadian Legal Entity as seller.
Prepare two Invoice Preferences:
Portrait with Show Gross Campaign Cost enabled.
Landscape with Show Gross Campaign Cost enabled.
Prepare two Ad Specs:
One with VAT Type = 1.
One with VAT Type = 2.
For each new scenario, first update the VAT record, then create a new Campaign Item. This is important because VAT values are copied/frozen on the Campaign Item at creation time.
After creating each Campaign Item, verify that the VAT fields on the Campaign Item reflect the VAT record values before generating the Pre-Invoice/PDF.
For each pair of tests, use the same Campaign Item for Portrait and Landscape. Change only the Invoice Preference, delete the Pre-Invoice/Invoice as needed, regenerate, and capture the PDF result.
Custom label setup used for the original cross-validation
Go to Setup → Custom Labels.
Set VATId_BA / VAT Id to the desired prefix value, for example HST, when validating Portrait custom label behavior.
Set Tax_BA to the desired prefix value, for example HST, when validating Landscape custom label behavior.
Save both labels.
If the goal is to validate clean baseline output without custom-label prefixes, remove or clear these custom-label overrides before re-running Landscape cases.
Execution steps by case
Case | VAT Type | Template | VAT record setup before creating CI | Execution steps | What to verify in PDF |
|---|---|---|---|---|---|
CX-01 | 1 | Portrait | Type=1; VAT(A)=13; VAT(B)=null; External Name(A)=HST; External Name(B)=empty; Classification=empty. | Update VAT record → create new CI with VAT Type 1 Ad Spec → verify CI VAT fields → set Invoice Preference to Portrait → generate Pre-Invoice/Invoice/PDF. | One tax row, 13,00%, correct amount. Confirm whether Portrait renders External Name A. |
CX-02 | 1 | Landscape | Same CI/setup as CX-01. | Change Invoice Preference to Landscape → delete/regenerate Pre-Invoice/Invoice/PDF. | One tax row, 13,00%, correct amount. Confirm Landscape label rendering. |
CX-03 | 1 | Portrait | Type=1; VAT(A)=13; VAT(B)=0; External Name(A)=HST; External Name(B)=PST; Classification=empty. | Update VAT record → create new CI with VAT Type 1 Ad Spec → verify A=13 and B=0 on CI → set Invoice Preference to Portrait → generate PDF. | Two tax rows: HST 13,00% and PST 0,00%; correct amounts. |
CX-04 | 1 | Landscape | Same CI/setup as CX-03. | Change Invoice Preference to Landscape → delete/regenerate Pre-Invoice/Invoice/PDF. | Two tax rows: HST 13,00% and PST 0,00%; correct amounts. |
CX-05 | 1 | Portrait | Type=1; VAT(A)=5; VAT(B)=8; External Name(A)=GST; External Name(B)=PST; Classification=empty. | Update VAT record → create new CI with VAT Type 1 Ad Spec → verify GST/PST and rates on CI → set Invoice Preference to Portrait → generate PDF. | Two rows: GST 5,00% and PST 8,00%; total tax equals 13,00%. |
CX-06 | 1 | Landscape | Same CI/setup as CX-05. | Change Invoice Preference to Landscape → delete/regenerate Pre-Invoice/Invoice/PDF. | Two rows: GST 5,00% and PST 8,00%. If Tax_BA is populated, verify whether it appears as prefix. |
CX-07 | 1 | Portrait |
Re-execution of the 24 CX tests in a fresh org (
VATscratch org) — results and one confirmed root causeRe-ran the full CX-01 to CX-24 matrix end-to-end in a clean org, following the "Step-by-step execution guide" on this page exactly (VAT record updated before each new Campaign Item, Portrait/Landscape pair reusing the same CI, Show Gross Campaign Cost enabled on both Invoice Preferences).
Summary: 22/24 reproduced the documented result exactly. 2 did not (CX-11, CX-12) — root cause identified below.
Result
Cases
OK (matches documented result)
CX-01, CX-02, CX-03, CX-05, CX-13, CX-14, CX-15, CX-17
Partial (matches documented result — known label-prefix behavior)
CX-06, CX-07, CX-08, CX-09, CX-10, CX-16, CX-18, CX-19, CX-20, CX-21, CX-22, CX-23, CX-24
Discrepancy vs. documented result
CX-11, CX-12
CX-11 (Type 1, Portrait, VAT(B)=null, Classification="Canadian Tax")
Documented expected: "VAT Canadian Tax (13,00%) of net" — OK.
Actual: "VAT 13,00% of net" — Classification not shown.
CX-12 (Type 1, Landscape, same setup)
Documented expected: "HST Canadian Tax (13,00%)" — OK.
Actual: "HST 13,00%" — Classification not shown.
Root cause (confirmed in code, not a data setup issue):
Verified the underlying data is correct —
ADvendio__VatExternalNameType1GroupName__c(the field that carries the Classification value) is correctly populated on the Invoice record ("Canadian Tax"), andADvendio__VATRate1Total__c/ADvendio__VatTotalType1__care also populated.The problem is in
PdfPortrait.page(Visualforce, used for the Portrait template —PDFControlleris shared with Landscape). The tax rows are split into two branches based onpdf.showTaxLayoutWithB:showTaxLayoutWithB = false(our case — VAT(B) is null): rendered via the block at approx. lines 871–1030. This branch only ever referencespdf.tax1,pdf.tax2,pdf.tax3,pdf.tax4— it never referencespdf.tax1TotalExternalName(the Classification/GroupName value).showTaxLayoutWithB = true(A+B both present): rendered via the block starting around line 1030. This branch does checkpdf.tax1TotalExternalName != null && pdf.tax1Total != null(line ~1097) and correctly renders the Classification-based label — this is why CX-07/08/09/10/19/20/21/22 (all A+B populated) correctly show Classification.So this isn't a VAT Type 1 vs. Type 2 distinction as originally interpreted — it's specifically that the single-row (VAT(B)=null) code path never reads the Classification field, for either type. This also explains why CX-23/24 (Type 2, same B=null + Classification setup) matched the documented "Partial / Classification ignored" result — for Type 2 that happens to be the expected behavior anyway, so the same underlying gap in the code produces a result that looks correct by coincidence.
Suggested fix: in the
NOT(showTaxLayoutWithB)branch ofPdfPortrait.page(and the equivalent Landscape template, sincePDFControllerpopulatestax1TotalExternalNameregardless of template), add the samepdf.tax1TotalExternalName != nullcheck used in theshowTaxLayoutWithBbranch so the single-row case can also show the Classification label when populated.All other 22 cases (including CX-04 and CX-16, which both show the "HST HST (13,00%) / HST PST (0,00%)" duplicated-prefix pattern) matched the documented results exactly.