Inventory - RHMAccounting/spring-allacc GitHub Wiki

Inventory and Articles manipulations

There are multiple interactions involving components/articles, this is an essential requirement and we will describe the process of the different implications of an article's life.

Products or components are the main part of an enterprise, companies usually buy components and sell products, they represent the base of the sales revenue. In business management, tracking of all articles is mandatory to get a clear understanding of the development of all business branches. In accounting, we can decide to follow precise articles and/or categories/sub-categories to get a very clear involvement and adapt our strategy according to the results.

There are different types of products and the ones detailed here are part of the stock articles, that means products which are part of assets will be treated independently (see Assets section...).

Following we will describe the functionalities before entering into database integration. We will also cover the general article lifecycle for a company.

Prerequisites

The service makes references to the following :

  • chart of account,
  • sellers and buyers,
  • invoices, quotes...
  • location(s) of product

Besides these modules, products management involves interaction with :

  • the journal (not directly but rather the invoice/quoting system)
  • the Point of Sale
  • the websites/e-commerce API functions

Use case Diagram

This service will handle the CRUD operations for a product and a category of product. There is also an inventory system for this product, this might be split and managed by another module [YES DEFINITIVELY : prices, location, dates...]

https://github.com/RHMAccounting/spring-allacc/blob/master/DOC/static/images/product_management_use_case_diagram.jpg

Sequences diagrams

Following is a sequence diagram detailing all sequences involved within the product addition in the system :

https://github.com/RHMAccounting/spring-allacc/blob/master/DOC/static/images/add_product_sequence_diagram.jpg

Activity diagram

Class Diagram

https://github.com/RHMAccounting/spring-allacc/blob/master/DOC/static/images/components.jpg

Note : all dashes --- within the tables mark the field as to be removed during the next update, all +++ tags means that there will be a new field.

As you see on the graphic above, there are 6 tables which deal with the components' schema starting from the categories and brands and leading to the management of each article/product via inputs and outputs.

The relationship between those tables and the whole system will be made for these specific modules and functions :

Adding new product

During the lifecycle of a product, there must be a beginning, in other words, we need to add a product and ahead of this step we need to define a product category which will be handled by a specific type of company. Each enterprise will be able to set up its own categories.

For instance a computer reseller will define these ones :

  • Laptop computers
  • Motherboards
  • Keyboards
  • ...

To achieve this task the following functions are implemented :

Adding a category:

add_category(title_of_category,
             identification_tag,
             related_tags,
             accounting_code)
add_brand(name_of_brand, url, country)

The brand related function indicates the constructor, the name of the function can be replaced during later updates. The accounting code is used for tracking the products in the journal and accounting work. Related tags match related categories or sub categories.

Basically a form with a few fields will be filled by the end user and the corresponding tables will be filled using the above functions.

Within each category we are also able to add some type of configuration such as the financial margin.

Adding a product:

add_product(title_of_product, short_description, category_id, brand_id, stock_min, stock_max)

At this moment, the product/article is created and can be linked to a wholesaler and/or directly added in stock (the components table is being filled).

To be part of quotes and for wholesale prices tracking, we can update the purchase price using the function:

update_price(component_id, price, eco_price, wholesaler_id)

The above function won't just update the price but add a new entry in the database (components_prices) so we can track the evolution.

Of course a tool will be dedicated to adding multiple products at once to ease the process, usually a CSV file can be formatted for such procedure.

Additionnaly a product or component can have specific details independantly from other products, for this purpose a custom database table and scheme can be implemented but this task is beyond the scope of this project requirement.

Adding a product in stock:

add_product_stock(EAN, serial_number, component_id)

You may add a specific product in the stock, linking it to a specific location an invoice or an order from a seller, you can also receive the product for free or in exchange of a refund, it can also be returned, there are a few scenarios to implement :

  • receiving a product or a list of products after an order
  • receiving product(s) freely (you must indicate the price of each article)
  • products are being returned

Let's draw a chart to get a clear view of the life cycle of a product :

https://github.com/RHMAccounting/spring-allacc/blob/master/DOC/static/images/chart-article-life.jpg

From this point, we are able to generate some quotes to clients and invoice them as well. But so far we need to implement several pages and functions :

PAGE DESCRIPTION
New product We fill in details about the category, brand and details of the product.
Wholesaler Prices update We update the prices for purchasing products. At this time, we can make quotes
Receiving products Once we ordered some products to a wholesaler, we can assign the order to the list of products received. Each article is detailed for tracking purpose (ID, Serial, EAN..) We also fill details about their location.
Checking products A page list all available products and a search form to browse some particular ones. We can browse products by category as well.
Add a product to a quote From the quotation page we can add products by selecting them on a list or by browsing them. Favorite products can also be set up
Add a product to an order / invoice At any time in the Point Of Sale products can be added. Automatically the proper article identification number will be tracked using the type of schema set by the enterprise (FIFO...)

Once a product is being sold and thus added to an order or an invoice, the product is marked as out. The diagram belows shows the process :

https://github.com/RHMAccounting/spring-allacc/blob/master/DOC/static/images/out-article.jpg

Remove the product from the stock

The function used when a product leaves the stock is ::

remove_product_stock(ID,date,invoice_id/order_id)

The section about invoices and orders will take care of the accounting matters. For now we treated products so we can keep an inventory on a daily basis.

In the next section, we will cover other types of articles which can be included within invoices and orders : services.

⚠️ **GitHub.com Fallback** ⚠️