STINV 2.10.241 — PERIODIC SOURCE INTEGRATION / PRODUCTION INSTALLATION PACKAGE
================================================================================
VERSION.txt AND CHANGELOG ARE UNCHANGED.
SOURCE: STINV_2.10.241_FULL_PERIODIC_PRODUKSI_CODE_ONLY.zip
OUTPUT: Full source and smaller patch, created from the above production guarded build.

IMPLEMENTED IN THIS PACKAGE
- Official valuation and COGS remain from pve_* Periodic Weighted Average; source
  fingerprint does NOT use sale/sales-return/adjustment-out Moving Average amounts.
- Approval purchase invoices, stock-out/SJ and returns refresh Periodic in same DB
  transaction (retained from production guarded base).
- NEW: Approved-correction reversal and approved delete for purchase invoices,
  SJ and returns refresh affected OPEN months before COMMIT; failure rolls back.
- NEW: Editing an Approved return refreshes Periodic within edit transaction.
- NEW: When an approved purchase invoice or SJ is reverted to Pending, recalculation
  starts at earliest affected old/new date; failures revert the entire edit.
- Improved: operational refresh starts at affected month, requires previous month's
  PVE fingerprint to be valid, and prevents edits to immutable FINAL months.
- NEW: tool_audit_periodic_produksi.php: read-only admin audit of fingerprints,
  row counts, monetary conservation, and current quantity difference.
- Existing guarded cutover tool: tool_full_periodic_rebuild_produksi.php.

IMPORTANT SCOPE / NOT AN ONLINE EXECUTION
- Package source has been prepared offline. Neither server nor production database
  are accessible from this build environment. MySQL/MariaDB transactional approval,
  Preview and Apply have NOT been tested on live data.
- Moving Average still computes in legacy compatibility shadows. This MUST NOT
  be interpreted as physically deleting the Moving Average from all PHP modules.
  Legacy correction/import scripts that bypass supported endpoints can still
  cause PVE to become stale; periodic reports should reject stale sources.
- Historical Mode 2 importer, separate administrator correction scripts and
  external custom PHP interfaces may still require integration/testing.
- This rebuild tool is HARD-CODED for database `stinv` and ONLY through October
  2026, rejects source stock movements after 31 October 2026 and FINAL/closed
  periods. If there are November stock movements, DO NOT bypass that guard.
- On failure: restore externally verified full SQL + embedded PVE snapshot.
  The original 31 October backup must be retained as a separate archive.
- Embedded PVE snapshot is not a substitute for backing up physical Tax XLSX.

INSTALLATION
1. Copy current PHP, SQL with PVE, tax-export files, and a full filesystem backup
   to an EXTERNAL and verified location. Test a restore in a clone database.
2. Extract patch into STINV web root (same as /stinv241026 inside full ZIP),
   preserving config files and never copying the unconfigured example into live.
3. Check VERSION.txt still equals 2.10.241. Do NOT run patch on other versions.
4. Visit tool_audit_periodic_produksi.php (Admin, read-only). Any BLOCKED result
   must be investigated before production changes.
5. Visit tool_full_periodic_rebuild_produksi.php (Admin); run PREVIEW and compare
   September/October balances with independent spreadsheet/accounting records.
6. After testing successfully against a restored clone, plan maintenance downtime,
   acquire another verified backup, execute guarded APPLY on live production.
7. Revisit audit tool, test purchase approved/SJ/returns and correction reversals,
   validate Kartu Stok, inventory, profit & loss, period close, and tax archives.
8. Remove or deny HTTP access to cutover tool after completed audit.

ROLLBACK
- If an InnoDB operation fails, entire approval/return/edit/delete rolls back.
- PREVIEW is rolled back; APPLY requires a verified SQL backup. Following APPLY,
  recover using the official PVE-aware restore on a clone first.

NO CHANGES TO: version, changelog, historical PO/invoices/payment/tax export data.
