# CHECKLABS POS — Branch Stock & Bulk Inventory Update

## Changes
- Stock transfer now deducts the source branch balance and increases the destination branch balance in one database transaction. Both signed stock movements are recorded.
- Stock transfer supports multiple products in one submission, with product-name/category search and per-product quantities.
- Stock adjustment supports multiple products in one submission, with product-name/category search, per-product movement type, direction and quantity.
- Inventory is consolidated to one stock location per business branch. Restaurant and Bar products share that branch stock balance; their categories and department assignment continue to determine their menu classification and permissions.
- Product/menu section selection and product section filtering have been removed. POS product browsing is category-based. Legacy staff-area section allocations are retained for access-control compatibility.
- Existing branch stock rows are consolidated by product; their quantities and expected quantities are added together. Purchase orders, supplier returns, stock movements, stock takes and butchery batch references are remapped to the branch's Main Stock record. Former department stores are deactivated rather than deleted.
- Sales, held-order billing, M-Pesa billing, bar tabs, purchases, stock takes and branch product-copy workflows now use the branch stock record.

## Installation
1. Back up the database and website files first.
2. Upload and extract this ZIP over the existing application, preserving the live `.env` file.
3. Run the migration on the hosting terminal:

   ```bash
   php artisan migrate --force
   php artisan optimize:clear
   php artisan optimize
   ```

4. Confirm each branch has one active `Main Stock` record, then test a small transfer between two branches and verify the source and destination quantities.
5. Test a multi-product adjustment, a purchase receipt, restaurant sale, bar sale and stock take.

## Important data note
The migration merges quantities for the same product across the former department-specific stores within each branch. This is intentional for the requested branch-level stock model. It keeps the former store rows inactive for historical foreign-key references; they are not physically deleted.

## Validation
- PHP syntax checked across 225 application, migration, seeder and route files.
- ZIP integrity checked after packaging.
- Laravel artisan/Blade runtime checks could not be run in the build environment because the local PHP runtime lacks the `mbstring` extension. Run the migration and browser checks on the cPanel PHP environment after taking a backup.
