Skip to main content

Inventory management system project.

 Objective: 

    Enable efficient tracking and management of store inventory to ensure products are available when needed.

Technology: 

  1. PHP 8.2
  2. Codeigniter framework 4.6.1
  3. Codeigniter shield (Auth library) 1.1.0 
  4. Firecamp for restAPI testing 
  5. Notepad++ code writing (light weight)
  6. mySQL

 Plan:

  1. First people will authenticate using email and password then, Other API access by using Bearer token.

 


 Challenges:

  1. Product can measured by different property - {weight, size or volume}
  2. Product amount will vary occasionally - {festival, demand}
  3. Types of inventory operation - {add, sale, return, remove, adjust, transfer}
1.First challenge: 
    Whenever measure one material in different measurement then, That material is different product because, It may be in different phase [solid, liquid, gas]. Example- when buying fruit in solid measured as kg , if buying fruit measured in volume. So, same fruit come under different product - fruit, juice. But, if buy oil it can measured in volume and weight also, this is the actual issue. Here i just fixed or assigned quantity_type (measuring) and Unit (kg, ltr) on creating product. So, if need to mention same product in different unit should create each product for each unit. 
 
2.Second challenge:
    Product amount change occasionally (festival, offer, etc.) and another currency (INR, USD etc,). So, I created currency table to mention different currency. It solve whenever user request amount for different currency it will get respective amount. That not only solved issue, after amount change remain. So, I created amount table as ledger with currency_id, amount and effective_from(date) it solved issue by getting last record for respective currency id.
 
3. Third challenge:
    Whenever new(add) product come from supplier it will increase the stock, Like if product damaged it will remove from stock. Whenever product sale to user it will decrease the stock, Like that if product return from customer it will increase stock. Whenever product transfer from one warehouse to another it will decrease stock. If human accreditation or counting error happen should adjust stock value (increase or decrease) . So, Every operation as recorded as a new record with changing quantity, change_type and current_val.
 

 RestAPI's:

1. Auth:
    Login:  
                method - POST
                url - /api/login
      header - content-type: application/x-www-form-urlencoded
      body - form-data - email
                                 - password
 
    Logout:  
                method - POST
                url - /api/logout 
                header - Authorization: Bearer $access_token
 
2.First step or initialization 
   Create category:
                method - POST
                url - /api/category
                header -  Authorization: Bearer $access_token;
                               content-type: application/x-www-form-urlencoded
                body - name: $category_name
                           description: $description
                           parent: $parent_category_id
     
 Get all product category details:
              method - GET
              url - /api/category
              header -  Authorization: Bearer $access_token;
Get single product category details:
              method - GET
              url - /api/category/$category_id
              header -  Authorization: Bearer $access_token;
Update product category details:
              method - PUT
              url - /api/category/$category_id
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -  category_id: $category_id 
                           name: $category_name
                           description: $description
                           parent: $parent_category_id
Create currency:
              method - POST
              url - /api/currency
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -   name: $currency_name
                           code : $currency_code
                           symbol: $currency_symbol
Create Quantity Unit:
              method - POST
              url - /api/unit
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -   name: $unit_name
                           symbol: $unit_symbol
Create Quantity Type:
             method -  POST
              url - /api/quantity-type
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -   name: $quantity_type_name
3. Product 
Create product:
              method -  POST
              url - /api/product
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -   name: $product_name
                           description: $product_description
                           sku_id: $product_sku_id
                           category_id: $category_id
                           amount: $product_amount
                           currency_code: $currency_code
                           quantity_name: $quantity_name
                           unit_name: $unit_name
Modify product details:
              method -  PUT
              url - /api/product
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -   product_id: $product_id
                           name: $product_name
                           description: $product_description
                           sku_id: $product_sku_id
                           category_id: $category_id
                           amount: $product_amount
                           currency_code: $currency_code
                           status: $product_status
Get All product:
              method -  GET
              url - /api/product
              header -  Authorization: Bearer $access_token;
Get single product:
              method -  GET
              url - /api/product/$product_id
              header -  Authorization: Bearer $access_token;
Delete product:
              method -  DELETE
              url - /api/product
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -   product_id: $product_id
 4. Inventory:
Add or modify product inventory:
              method -  POST
              url - /api/product
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -   product_id: $product_id
                           change_type : $inventory_change_type
                           operation: $inventory_operation
                           change_quantity: $change_value
                           inventory_note: $inventory_note
Get single product inventory:
              method -  GET
              url - /api/product
              header -  Authorization: Bearer $access_token;
                             content-type: application/x-www-form-urlencoded;
              body -   product_id: $product_id
 

Comments