# Manager SST Excel report

Manager → Tax settings → SST sales report → **Download Excel**. The date/time
range uses the vendor timezone, with an inclusive start and exclusive end.
For example, the supplied August sample's close-up period can be entered as
`2026-07-31T22:00` through `2026-08-31T22:00`.

`POST manager-app/tax/report.php` accepts `from`, `until`, and `format` (`json`
for preview, `xlsx` for download). Dates may be `YYYY-MM-DD` or local ISO date
and time. Ranges must be positive and no longer than one year. Vendor scope
comes exclusively from authenticated Manager credentials.

## Workbook

- Summary: outlet and registration identity, period, bill counts, sales,
  discounts, voids, credit notes, payment counts/amounts, service charge, tax,
  delivery/pickup and sales source summaries, cash receipts, and rounding.
- Daily sales: local calendar dates, totals, and dynamic payment-method columns.
- SST by category: registration, service category, tax code, stored rate and
  treatment, accounting basis, taxable value, exempt value, and payable tax.
- Payment summary: configured and historically used methods, gross collections,
  refunds, processing fees, and payment-basis tax.
- Receipts: document references, seller identity snapshots, financial amounts,
  all payments, and reconciliation differences.
- Payment detail: actual payment timestamps, methods, fees, and tax allocations.
- Receipt tax detail: stored receipt tax summaries, including retained voids.
- Payment tax allocations: receipt/item/payment references supporting each
  payment-basis category total.
- Review notes: definitions, data exceptions, and fields not retained by the app.

## Accounting behavior

The report sums stored amounts in integer cents. It does not infer tax rates
from current menu configuration or assume all payments are cash/card. Historical
methods remain present even when removed from vendor settings. Payment processing
fees do not reduce customer collections or the taxable selling value.

Sales use receipt closing time. Collections use payment-received time, including
payments whose receipts closed outside the selected period. SST uses stored
payment allocations for payment-basis registrations and stored receipt summaries
for invoice-basis registrations. Receipt and payment summaries can therefore
differ legitimately. All queries run in one consistent read transaction.

Credit notes reverse their stored values once; both positive-magnitude and signed
credit documents are supported. Voids remain in detail and are excluded from
sales and payable tax. Split-payment rounding follows the receipt viewer's
authoritative sum of actual payments. Draft/out-of-registration-period snapshots
and unclassified legacy tax are identified and excluded from classified payable
SST. Missing or unreconciled allocations are flagged, not reconstructed.

This is a supporting working paper for one outlet, not an SST-02 submission or
an entity-wide return. Review other outlets, external adjustments/refunds,
unfinalized sessions, and unpaid services reaching 12 months separately. The
current schema does not retain receipt pax, drawer cash-in/out, member-store
movements, or separate delivery/other fees; those sample fields are explicitly
unavailable. Registration eligibility uses the registration's current active
state and effective dates; seller identity is preserved from receipt snapshots.

Official accounting-basis and adjustment reference:
[RMCD issuing invoices](https://mysst.customs.gov.my/issuing-invoices/).
Return/recordkeeping reference:
[RMCD Service Tax FAQ](https://mysst.customs.gov.my/faq-services-tax/).

## Deployment and verification

Deploy the API endpoint and all `lib/Tax/TaxReport*.php` files plus
`lib/Tax/report-bootstrap.php`, and rebuild Manager. The explicit bootstrap fixes
the previous report error on deployments whose shared Composer installation
does not register the repository's namespace. No database migration or new
Composer dependency is needed. Existing tax migration 42 and PHP's zip and
mbstring extensions are required.

The workbook is genuine OOXML (`.xlsx`), with numeric money cells, text identifiers,
frozen headers, filters, and print settings. Text is always stored as text,
including values beginning with `=`, so exported names cannot become formulas.

Verification commands:

```text
php vendor/bin/phpunit tests/Unit/Tax/TaxReportTest.php
php vendor/bin/phpunit tests/Integration/Tax/TaxReportEndpointTest.php
php vendor/bin/phpunit tests/Integration/Tax/ShadowReceiptTaxWriterTest.php
```

The integration suite uses the isolated local testing database configured in
`.env.testing`. Manager validation uses `npm run build -- --configuration local`
and `npm test -- --watch=false --browsers=ChromeHeadlessNoGpu`.
