Bakery POS — Phase 7 Costing & Pricing Deployment
==================================================

BASELINE USED
- Exact current Bakery POS supplied by user: bakery(3).zip
- Latest database export supplied by user: engrgolk_bakery(3).sql
- Target database: engrgolk_bakery

IMPORTANT
The full integrated ZIP preserves every file from the user-supplied Phase 6 package.
No baseline file was intentionally removed.
The supplied config/database.php is preserved unchanged in the full integrated package.
Login, Email OTP and active authentication files were not changed.

DEPLOYMENT ORDER
1. Back up the complete current /bakery/ folder.
2. Back up the engrgolk_bakery database.
3. In phpMyAdmin, select engrgolk_bakery.
4. Import sql/008_phase7_costing_pricing.sql ONCE.
5. Upload/extract bakery_full_phase7_updated.zip over the existing application location.
   - The ZIP contains a top-level bakery/ folder, matching the supplied current ZIP.
   - Do not accidentally create /bakery/bakery/.
6. Confirm config/database.php is present and retains the correct hosting credentials.
7. Login and test Bakery > Costing, then Bakery > Pricing.

DO NOT IMPORT ON THE EXISTING LIVE DATABASE
- sql/001_master_schema.sql
- sql/002_seed_core.sql
These are synchronized consolidated files for future clean installation only.

PHASE 7 NEW FUNCTIONALITY
- Actual raw-material cost from material issues less physical returns
- Estimated vs actual production costs
- Configurable cost categories
- Manufacturing vs distribution cost separation
- Fixed, Per Unit, Labour Hour and Percentage calculation types
- Allocation by Material Cost, Good Output Qty or Equal Share
- Void-with-reason rather than destructive cost deletion
- Finalized manufacturing unit cost written back to production/finished stock
- Distribution cost kept outside inventory value but included in pricing cost basis
- Retail and Wholesale pricing
- Markup and Gross Margin shown separately
- Suggested price with configurable rounding
- Authorized manual final-price override with mandatory reason when different
- Company/default price + outlet-specific overrides
- Price history with cost snapshot, user and effective dates
- Configurable tax-readiness settings (not forced)

RECOMMENDED FIRST TEST
A. Open Bakery > Costing.
B. Open the completed production batch used in Phase 6 testing.
C. Confirm Actual Raw Material Cost is shown from issue/return history.
D. Add an ACTUAL Labour cost (for example Fixed Amount).
E. Add an ACTUAL Electricity/Gas/Packaging cost if desired.
F. Add Transport as a DISTRIBUTION cost.
G. Finalize Actual Costing.
H. Confirm Product Cost Allocation shows:
   - Actual manufacturing cost/unit
   - Distribution allocation
   - Pricing cost/unit
I. Open Bakery > Pricing.
J. Set a Retail markup, review Suggested Price and Gross Margin, then save.
K. Set Wholesale price if required.
L. Test an Outlet Override and confirm it appears in Current Outlet Price Overrides.
M. Open Price History and verify the previous/current price records.

CACHE
Phase 7 increments app asset_version and the service-worker cache name. Normally a regular reload is enough after deployment. If a browser was left open during deployment, reload it once.

ROLLBACK
If a deployment problem occurs:
- restore the application-folder backup;
- restore the database backup if migration 008 had already been imported.
Do not try to reverse financial/costing data manually on a live database.
