Storage Boxx – Simple PHP Inventory Management System

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.

 

TABLE OF CONTENTS

Download & Notes How To Use Quick Reference
How To Develop Common Problems

 

 

DOWNLOAD & NOTES

First, here are the download links and a quick “setup guide” for the impatient folks who don’t have the patience to read through everything.

 

DOWNLOAD LINKS

Download Storage Boxx | GitHub | SourceForge

 

REQUIREMENTS

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

 

INSTALLATION

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

  • Create a database and import the lib/storage-boxx.sql file.
  • In lib/GO.php, change the host settings (A2), and database settings (A3) to your own.

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

 

 

HOW TO USE

So far so good? Let us now go through a quick crash course on how to use Storage Boxx.

 

STEP 1) REGISTER INVENTORY ITEMS

  • Go to the “Manage Inventory” section.
  • 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 (or do some mass import from CSV magic into the database on your own).

 

STEP 2) UPDATE STOCK LEVELS

  • Next, go to 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 type in the SKU or scan the bar code.

 

QUICK REFERENCE

This section is for the developers, a quick walkthrough of the general system structures.

 

FOLDER STRUCTURE

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

Yes, there are only 4 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.

 

 

THE FRAMEWORKS

Storage Boxx is built using Bootstrap and Core Boxx. In fact, Storage Boxx pretty much uses:

Go ahead and check those out if you want… The other “pre-developed” modules of Core Boxx should also snap right in.

 

DEVELOPING STORAGE BOXX

As simple as it 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”.

 

STEP 1) CREATE/MODIFY DATABASE TABLES

Add your new tables, modify the existing ones.

 

STEP 2) ADD/UPDATE SYSTEM MODULE

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

core/LIB-Report.php
class Report {
  function getMoveByUser ($id) {
    return $this->DB->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)

api/API-report.php
// (A) MUST BE SIGNED IN
if (!isset($_SESSION["user"])) {
  $_CORE->respond("E", "Please sign in first");
}
 
switch ($_REQ) {
  // (B) INVALID REQUEST
  default:
    $_CORE->respond(0, "Invalid request");
    break;
 
  // (C) MOVE BY USER REPORT
  case "getMoveByUser":
    $_CORE->autoGETAPI("Report", "getMoveByUser");
    break;
}

If you need an API endpoint for AJAX processes and mobile app support, create api/API-module.php. For this example, we simply $_POST["id"]=123 to http://site.com/api/report/getMoveByUser/ 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 OR DELETED ALL ADMIN ACCOUNTS

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

recover.php
require "lib/GO.php";
$_CORE->load("Users");
$_CORE->Users->save("NAME", "EMAIL", "PASSWORD", OPTIONAL-USER-ID);

Run and delete this afterward…

 

MIGRATED TO A NEW DOMAIN

  • Simply update HOST_BASE in lib/GO.php.
  • Delete .htaccess.
  • Clear the browser cache to prevent irritating cache redirects.

Done. The system will regenerate a new .htaccess file the next time you access the system. If you have some extra URL rewrite to add – Go ahead and modify index.php, section B.

 

NOT WORKING. DON’T KNOW WHY.

Open the developer’s console, 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 *