How configuroweb/farmacia works
1. This is a classic PHP/MySQL admin system for pharmacy management, not a framework-based app. The server renders pages directly with PHP, and the browser uses JavaScript for most CRUD interactions.
2. The main business areas are:
- Providers/brands
- Categories
- Products/medicines
- Orders/invoices
- Users/admin accounts
- Sales and product reports, including expired products
3. The application is split into two clear layers:
- Page layer: top-level PHP files like dashboard.php, product.php, categories.php, orders/report pages, plus add-* and edit* forms.
- Action layer: php_action/* scripts that perform create/read/update/delete operations and return data for tables, forms, and AJAX requests.
4. The primary data flow is browser → page → JavaScript → php_action endpoint → MySQL → response back to the page. Most listing screens are likely driven by AJAX rather than full page reloads, especially for products, brands, categories, orders, and users.
5. Database access is centralized through connection files in constant/connect.php, constant/connect1.php, and php_action/db_connect.php. There is no ORM; the architecture is direct PHP-to-MySQL.
6. Authentication and account management are handled separately from the main inventory flow:
- login.php, constant/logout.php
- app/changepassword.php, php_action/changePassword.php, php_action/changeUsername.php
- constant/forgot_password.php
- email_config.php suggests password reset or notification email support
7. Presentation is organized around reusable layout fragments in constant/layout/:
- head.php, header.php, sidebar.php, footer.php
These provide the shared admin shell for all management pages.
8. Frontend behavior is mostly in custom/js/*.js, with one script per domain area:
- brand.js, categories.js, product.js, order.js, report.js, user.js, setting.js, import.js
These scripts coordinate forms, tables, validation, modals, and AJAX calls into php_action.
9. The UI stack is heavily vendor-based and dashboard-oriented:
- Bootstrap and jQuery for structure and interaction
- DataTables for searchable/sortable lists
- SweetAlert and Toastr for user feedback
- Chart libraries like Chart.js, Morris, Google Charts, Highcharts, ECharts, and amCharts for dashboard/report visualizations
10. Inventory and catalog management are the core bounded contexts:
- Brands/proveedores: brand.php, add-brand.php, editbrand.php, php_action/createBrand.php, php_action/removeBrand.php
- Categories: categories.php, add-category.php, editcategory.php
- Products: product.php, add-product.php, editproduct.php, image handling via php_action/editProductImage.php
11. Order/invoice processing is another distinct flow:
- add-order.php, editorder.php, Order.php, invoiceprint.php
- Endpoint scripts such as php_action/order.php, fetchOrder.php, fetchOrderData.php, editOrder.php, editPayment.php, printOrder.php
This indicates order creation, payment update, listing, and printable invoice output.
12. Reporting is separated from transactional editing:
- report.php, sales_report.php, salesreport.php, productreport.php, expreport.php, getproductreport.php
- Backend report endpoints like php_action/getsalereport.php, php_action/getOrderReport.php, php_action/getexpproduct.php
Reports likely aggregate by date range and category/product status.
13. There is also a small import path:
- assets/import/proveedores.xlsx
- custom/js/import.js
- php_action/createBrandImport.php
This suggests bulk loading of providers/brands from Excel into the catalog.
14. Static assets are fully bundled inside the repo under assets/, including images, icons, CSS, JS plugins, and uploaded files under assets/uploadImage/. That makes the project self-contained and deployable as a PHP site with local asset hosting.
15. Overall, the architecture is a monolithic admin application with:
- shared PHP layout templates
- domain-specific CRUD pages
- AJAX-backed action scripts
- direct MySQL persistence
- client-side dashboard widgets and reporting charts
This is the key structure to capture in an architecture diagram.
Main entry points: db_connect.php DB connect · header.php Layout shell · product.php Catalog pages · product.js Catalog JS
Components 21
Page layer
Top-level PHP pages that render the admin UI and host forms, dashboards, and listings.
- Home · Entry point that routes into the admin application.
index.php - Dashboard · Main overview screen with widgets and charts.
dashboard.php - Catalog pages · Brand, category, and product screens plus add/edit forms.
product.php - Order pages · Order entry, edit, and invoice-printing screens.
add-order.php - Report pages · Sales, product, and expired-product reporting screens.
report.php - User pages · Login and user-management screens for admin accounts.
login.php
Action layer
PHP endpoints that handle CRUD, fetch data, and process AJAX requests.
- Brand actions · Create, fetch, edit, remove, and import provider/brand data.
php_action/createBrand.php - Category actions · Create, fetch, edit, and remove categories.
php_action/createCategories.php - Product actions · Create, fetch, edit, image update, and remove medicines/products.
php_action/createProduct.php - Order actions · Order creation, fetch, payment edit, printing, and removal endpoints.
php_action/order.php - Report actions · Sales, order, and expired-product aggregation endpoints.
php_action/getsalereport.php - User actions · User creation, fetch, edit, remove, and credential update endpoints.
php_action/createUser.php
Shared runtime
Authentication, layout fragments, and database connection files reused across pages.
- Layout shell · Shared head, header, sidebar, and footer fragments for the admin UI.
constant/layout/header.php - Auth & config · Login, logout, password recovery, and account-change helpers.
constant/check.php - DB connect · Central direct PHP-to-MySQL connection files.
php_action/db_connect.php
Client scripts
Domain JavaScript that drives tables, forms, validation, and AJAX calls.
- Brand JS · Client logic for brand CRUD, tables, and AJAX calls.
custom/js/brand.js - Catalog JS · Client logic for categories and products.
custom/js/product.js - Order JS · Client logic for order entry, payment updates, and invoice interactions.
custom/js/order.js - Report JS · Client logic for report filtering and dashboard/report charts.
custom/js/report.js - User JS · Client logic for user administration and settings.
custom/js/user.js
Bundled assets
Static CSS/JS libraries and uploads shipped with the application.
- UI assets · Bundled CSS, JS libraries, icons, and uploads used by the admin UI.
assets/css/style.css
Connections 25
- Home → Auth & config: login gate · Entry pages pass through authentication checks.
- Dashboard → Layout shell: renders with · Admin pages share the common shell.
- Catalog pages → Layout shell: renders with · Catalog screens use shared templates.
- Order pages → Layout shell: renders with · Order screens use shared templates.
- Report pages → Layout shell: renders with · Report screens use shared templates.
- User pages → Layout shell: renders with · Account screens use shared templates.
- Dashboard → UI assets: loads · Dashboard UI depends on bundled CSS, JS, and chart libraries.
- Catalog pages → Brand JS: drives · Brand screens are coordinated by client-side scripts.
- Catalog pages → Catalog JS: drives · Category and product screens are coordinated by client-side scripts.
- Order pages → Order JS: drives · Order screens are coordinated by client-side scripts.
- Report pages → Report JS: drives · Report screens are coordinated by client-side scripts.
- User pages → User JS: drives · User screens are coordinated by client-side scripts.
- Brand JS → Brand actions: AJAX · Brand operations call action endpoints.
- Catalog JS → Category actions: AJAX · Category operations call action endpoints.
- Catalog JS → Product actions: AJAX · Product operations call action endpoints.
- Order JS → Order actions: AJAX · Order operations call action endpoints.
- Report JS → Report actions: AJAX · Reporting screens request aggregated data.
- User JS → User actions: AJAX · User management operations call action endpoints.
- Brand actions → DB connect: SQL · Brand CRUD persists directly to MySQL.
- Category actions → DB connect: SQL · Category CRUD persists directly to MySQL.
- Product actions → DB connect: SQL · Product CRUD and image updates persist directly to MySQL.
- Order actions → DB connect: SQL · Order processing and invoice data persist directly to MySQL.
- Report actions → DB connect: SQL · Reports read aggregated data from MySQL.
- User actions → DB connect: SQL · Account management persists directly to MySQL.
- Auth & config → DB connect: SQL · Authentication and password flows use the shared connection.