# AC Software

Laravel 11 accounting and financial management system built from the PRD.

## What Is Included

- Multi-business switcher with isolated data per business.
- Double-entry ledger engine with balanced debit/credit lines.
- Live dashboard cards for Income, Expenses, Profit, Cash, Capital, and Bank.
- Capital, Cash, Bank transfer, Income, Expenses, Purchase, Assets, A/C Receivable, A/C Payable, and Loan entry forms.
- Transaction ledger showing the generated double-entry lines.
- Daily, Weekly, Monthly reports.
- Trial Balance, Income Statement, and Financial Position Statement.
- Live calculation bar on every page for Income, Expenses, Profit, Cash, Capital, and Bank.
- Admin customization for software name, tagline, logo, favicon, and theme colors.
- Admin timezone setting so Today filters and transaction default dates match the selected country/timezone.
- Admin business management for adding/editing multiple isolated businesses.
- Admin data control for monthly CSV sheet export, branch data clearing, and branch deletion with typed confirmation.
- First-run web installer for cPanel/shared hosting database setup and owner account creation.
- Login/logout authentication with owner-only admin controls.
- Account Management for adding users, assigning roles, and granting business access.
- Clean USD starter data for two businesses: AC Manufacturing and AC Trading.

## Local Run With XAMPP PHP

From this folder:

```powershell
D:\xampp\php\php.exe artisan migrate:fresh --seed --force
D:\xampp\php\php.exe artisan serve --host=127.0.0.1 --port=8000
```

Open:

```text
http://127.0.0.1:8000
```

Admin pages:

```text
/admin/settings
/admin/businesses
/admin/accounts
/admin/data
```

## First-Run Installation On Hosting

Upload the project files to your hosting account, point the domain to the Laravel `public` folder, then open the domain.

If your hosting cannot point the domain to `public`, upload the full project into the domain folder and make sure these root files are also uploaded:

```text
index.php
.htaccess
```

The root `.htaccess` sends `/install`, `/login`, and all clean URLs into Laravel. In cPanel File Manager, enable hidden files so `.htaccess` is visible and uploaded.

If the software is not installed yet, it redirects to:

```text
/install
```

The installer checks PHP/server requirements, asks for database host/name/user/password, runs the SQL migrations automatically, then creates the first business and owner account. After installation it writes `APP_INSTALLED=true` and locks the installer.

## Tests

```powershell
D:\xampp\php\php.exe artisan test
```

## Database

The local `.env` is configured for SQLite so the app runs even if XAMPP MySQL is stopped.

To use XAMPP MySQL/MariaDB, create a database named `ac_software`, then change `.env`:

```env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=ac_software
DB_USERNAME=root
DB_PASSWORD=
```

Then run:

```powershell
D:\xampp\php\php.exe artisan migrate:fresh --seed --force
```

## Development Seeder Login

Only local development seeding creates:

```text
owner@acsoftware.test
password
```

Production installation uses the owner email and password entered in the installer.
