Storage Boxx – Simple PHP Inventory Management System

 

TABLE OF CONTENTS

Download & License Requirements & Installation What Is Storage Boxx?
How To Use For The Developers Common Problems

 

 

DOWNLOAD & LICENSE

Download Storage Boxx | GitHub | SourceForge

Storage Boxx is released under the MIT License. You are free to use it for your own personal and commercial projects, modify it as you see fit. On the condition that there the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.

 

REQUIREMENTS & INSTALLATION

Storage Boxx has not been extensively tested, but it is developed and works on a WAMP8 (Apache MySQL PHP 8) server. The requirements:

  • Apache Mod Rewrite
  • PHP PDO Extension
  • Best to have at least PHP 7

As for the “installation”, sorry… There is no installer. But this should be simple enough for the developers:

  • Create a database and import the core/storage-boxx.sql file.
  • In core/Core.php, change the database settings (A2), host (A4), email (A5) to your own.

That’s all. The default user is “admin@sb.com” and the password is “123456”. Remember to change it later.

 

 

WHAT IS STORAGE BOXX?

Storage Boxx is a simple PHP Inventory Management System. Yep, this is not the “super professional crazy bloated with a lot of features” kind of system. But it does cover the basics and should help the small businesses better keep track of their inventory stock.

 

HOW TO USE

STEP 1) REGISTER INVENTORY ITEMS

  • Go under the “Inventory” menu item.
  • Click on “Add”.
  • Register the item.
  • Print out the bar code if you want – It does speed things up and makes things easier to manage. Get yourself a USB barcode scanner if you do not already have one. A simple one only costs like… 20~30 bucks these days.
  • Rinse-and-repeat. Register all your items.

 

 

STEP 2) UPDATE STOCK LEVELS

  • Next, go under the “Stock Movement” section.
  • This should be self-explanatory. Fill in and update the stock levels whenever required.

 

STEP 3) CHECKING STOCK LEVELS

  • To check the stock levels, simply go under the “Inventory” section for a quick overview.
  • Or go under “Check Item” and scan a bar code to check the stock movement history.

 

 

FOR THE DEVELOPERS

As simple as Storage Boxx may be, going through the entire system is still going to take some time. So instead of “explaining line-by-line”, here is a condensed version of “how to quickly customize and upgrade Storage Boxx”.

 

FOLDER STRUCTURE

  • lib Core library files and API handlers.
  • pages HTML pages.
  • public Public images, CSS, Javascript, and whatever else.

Yes, there are only 3 folders in the entire system.

 

THE DATABASE

stock – The list of inventory items.
Field Description
stock_sku The SKU of the item, primary key.
stock_name Name of the item.
stock_desc Description of the item.
stock_unit Unit of measurement.
stock_qty Current quantity in stock.
stock_mvt – Stock movement history.
Field Description
stock_sku The SKU of the item. Primary key.
mvt_date Date of movement entry. Primary key.
mvt_direction The direction of the movement.

  • I – Stock In (receive)
  • O – Stock Out (release)
  • T – Stock Take (audit)
user_id The user who made this movement entry.
mvt_qty Quantity moved.
mvt_notes Notes, if any.
users – The users.
Field Description
user_id The user ID, primary key.
user_name
The user name.
user_email
The user’s email address.
user_password
The password. Encrypted.

 

 

DEVELOPING STORAGE BOXX

Storage Boxx is actually a variant of Core Boxx. If you want to modify or improve it, it’s a 4 steps process.

STEP 1) CREATE/MODIFY DATABASE TABLES

Add your new tables, modify the existing ones.

 

STEP 2) ADD/UPDATE SYSTEM MODULE

Create a core/LIB-Module.php, define class Module, add functions inside. For example, to add a new report module – Create core/LIB-Report.php.

core/LIB-Report.php
class Report {
  function getMoveByUser ($id) {
    return $this->core->fetchAll(
      "SELECT * FROM `stock_mvt` WHERE `user_id`=? ORDER BY `mvt_date` DESC",
      [$id]
    );
  }
}

That’s it. The new module can now be loaded via $_CORE->load("Report") and the new function can be accessed via $_CORE->Report->getMoveByUser().

 

STEP 3) ADD/UPDATE API ENDPOINT (OPTIONAL)

Create core/API-Module.php. For example, core/API-Report.php can be accessed at http://site.com/api/Report. How the API work is simple, we just send a $_POST['req'] OR $_POST['reqA'] followed by the required parameters.

  • $_POST['req'] is for open requests, needs no user verification.
  • $_POST['reqA'] for registered users only.
core/API-Report.php
// (A) ADMIN REQUESTS
$_CORE->load("Report");
if (isset($_POST['reqT'])) { switch ($_POST['reqT']) {
  // (A0) INVALID
  default:
    $_CORE->respond(0, "Invalid request");
    break;
 
  // (A1) GET USER MOVEMENT
  case "getMovtUserr":
    $records = $_CORE->Report->getMoveByUser($_POST['id']);
    $_CORE->respond(1, "OK", $records);
    break;
}}

That’s all. We can now send $_POST['reqA']="getMoveByUser" and $_POST['id']=123 to http://site.com/api/Report to fetch the report in a JSON-encoded string.

 

STEP 4) ADD/UPDATE HTML CSS JAVASCRIPT

  • Add new pages with pages/PAGE-name.php. For example, pages/PAGE-report.php will be accessed from http://site.com/report.
  • Take note – PAGE-name.php can only be accessed by users who are signed in.

That’s about it. Just reverse engineer and copy from the existing libraries, API, and pages… You will see the development pattern here.

 

COMMON PROBLEMS & FIXING THEM

Storage Boxx is “not working”? Here are a few of the common problems and how to “fix” them.

 

I FORGOT THE PASSWORD/DELETED ALL ADMIN ACCOUNTS

Create an “account recovery” script to create a new account, or update an existing one.

recover.php
require "core/Core.php";
$_CORE->load("User");
$_CORE->User->save("NAME", "EMAIL", "PASSWORD", OPTIONAL-USER-ID);

Run and delete this afterward…

 

MIGRATED TO A NEW DOMAIN

  • Simply update URL_BASE in core/Core.php.
  • Delete .htaccess.

Done. The system will regenerate a new one. If you have some extra URL rewrite to add – Go ahead and modify __construct() in core/LIB-Core.php.

 

NOT WORKING. DON’T KNOW WHY.

Update public/common.js section E1 – opt.debug = true. Reload the page and see the error message.

How To Debug Javascript – A Very Simple Guide

How to Debug PHP Code – A Very Simple Guide

9 thoughts on “Storage Boxx – Simple PHP Inventory Management System”

  1. Hi, I installed in base path and can’t get past login screen. It seems to be dropping me at “(B4) USERS NOT LOGGED IN + INVALID PATH”

    What do you think is the problem?

Leave a Comment

Your email address will not be published. Required fields are marked *