You are on page 1of 138

FINAL YEAR PROJECT

ON
Daily Stock Controller

Advisor: ZEBIBA YUSUF

SUBMITTED BY
HAMID SEID-------------------------------------1619/09
MUKTAR MUHAMED--------------------------1629/09
EDIDIYA ENGDAWORK------------------------1608/09
SEID MOHAMMED-----------------------------1640/09
NASR EBRAHIM---------------------------- 2219/10

In partial fulfillment of the requirement for the degree of


Bachelor of Science in computer science.

September, 2020
Dessie, Ethiopia
DAILY STOCK CONTROLLER
Approval Sheet

Advisor Sign
______________ ____________
Examiner,
______________ _____________
Examiner,
_______________ _____________

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 2
DAILY STOCK CONTROLLER

ACKNOWLEDGEMENT

This project is prepared in the partial fulfillment of the requirement for the degree of Bachelor
of Science in computer science. The satisfaction and success of completion of this task would be
incomplete without heartfelt thanks to people whose constant guidance, support and
encouragement made this work successful. On doing this undergraduate project we have been
fortunate to have help, support and encouragement from many people we would like to
acknowledge them for their cooperation.

Our first thanks goes to Unity University for designing such a worthy syllabus and making us do
this project. Our next batch of thanks goes to the department of computer science of unity
university Dessie special campus instructors without those help our project would have been
impossible.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 3
DAILY STOCK CONTROLLER

ABSTRACT

This project is aimed at developing an android based application named Daily Stock Controller
(DSC) for managing the inventory system of retail shop. The Daily stock controller refers to the
system and processes to manage the stock of organization with the involvement of Technology
system. This system can be used to store the details of the inventory, stock maintenance,
update the inventory based on the sales details, generate sales and inventory report daily. This
project is categorizing individual aspects for the sales and inventory management system. In
this system we are solving different problem affecting to direct sales management and
purchase management. Inventory Management System is important to ensure quality control
in businesses that handle transactions resolving around consumer goods. Without proper
inventory control, a large retail store may run out of stock on an important item. A good
inventory management system will alert the wholesaler when it is time to record. Daily stock
controller is also on important means of automatically tracking large stock data. An automated
Daily stock controller helps to minimize the errors while recording the stock.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 4
DAILY STOCK CONTROLLER

LIST OF FIGURE
Figure 1. 1 Work breakdown structure for DSC...........................................................................17

Figure 2. 1 Work Flow of Existing System....................................................................................20


Figure 2. 2 Essential use case modeling.......................................................................................26
Figure 2. 3 Class Responsibility Collaboration Diagram............................................................28

Figure 3. 1 Use case model...........................................................................................................29


Figure 3. 2Conceptual class diagram...........................................................................................45
Figure 3. 3 activity diagram for register.......................................................................................47
Figure 3. 4 activity diagram for login..........................................................................................48
Figure 3. 5 activity diagram for add items....................................................................................49
Figure 3. 6 activity diagram for sell items....................................................................................50
Figure 3. 7 activity diagram for All items.....................................................................................51
Figure 3. 8 activity diagram for available items...........................................................................52
Figure 3. 9 activity diagram for sold items...................................................................................53
Figure 3. 10 activity diagram for identical items..........................................................................54
Figure 3. 11 activity diagram for expired items...........................................................................55
Figure 3. 12 activity diagram for generate barcode.....................................................................56
Figure 3. 13 Register user interface prototype.............................................................................57
Figure 3. 14 Login user interface prototype.................................................................................58
Figure 3. 15 Menu user interface prototype..................................................................................59
Figure 3. 16 Add items user interface prototype...........................................................................60
Figure 3. 17 Sell items user interface prototype...........................................................................61
Figure 3. 18 All items user interface prototype.............................................................................62
Figure 3. 19 Available items user interface prototype..................................................................63
Figure 3. 20 Sold items user interface prototype..........................................................................64
Figure 3. 21 Identical items user interface prototype...................................................................65
Figure 3. 22 Available In items user interface prototype..............................................................66
Figure 3. 23 Sold Out items user interface prototype...................................................................67
Figure 3. 24 Expired date user interface prototype......................................................................68
Figure 3. 25 Expired items user interface prototype.....................................................................69
Figure 3. 26 Less than 3 months to expire user interface prototype.............................................70
Figure 3. 27 Less than 6 months to expire user interface prototype.............................................71
Figure 3. 28 Barcode generator menu user interface prototype..................................................72
Figure 3. 29 barcode generator user interface prototype............................................................73
Figure 3. 30 QR code generator User interface prototype...........................................................74

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 5
DAILY STOCK CONTROLLER

Figure 4. 1 Login Sequence diagram 76

Figure 4. 2 Add items Sequence diagram......................................................................................77


Figure 4. 3 Sell items Sequence diagram......................................................................................78
Figure 4. 4 All items Sequence diagram.......................................................................................79
Figure 4. 5 Available items sequence diagram.............................................................................80
Figure 4. 6 Sold items Sequence Diagram....................................................................................81
Figure 4. 7 Identical items Sequence diagram..............................................................................82
Figure 4. 8 Expired data Sequence diagram.................................................................................83
Figure 4. 9 barcode generator Sequence diagram........................................................................84
Figure 4. 10 Register and Login Class Diagram..........................................................................85
Figure 4. 11 Class Diagram for DSC............................................................................................86
Figure 4. 12 Register Collaboration Diagram..............................................................................88
Figure 4. 13 Login Collaboration Diagram..................................................................................89
Figure 4. 14 Add items Collaboration Diagram...........................................................................89
Figure 4. 15 Sell items Collaboration Diagram............................................................................90
Figure 4. 16 All items Collaboration Diagram.............................................................................90
Figure 4. 17 Available items Collaboration Diagram..................................................................91
Figure 4. 18 Sold items Collaboration Diagram..........................................................................91
Figure 4. 19 Identical items Collaboration diagram....................................................................92
Figure 4. 20 Expire date Collaboration diagram.........................................................................93
Figure 4. 21 Barcode generator Collaboration diagram..............................................................94
Figure 4. 22 Component Diagram for DSC..................................................................................95
Figure 4. 23 Deployment diagram for DSC..................................................................................96
Figure 4. 24 Persistence diagram for DSC...................................................................................97
Figure 4. 25 User interface design for DSC...............................................................................101

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 6
DAILY STOCK CONTROLLER

LIST OF TABLE
Table 3. 1 Register use case description.......................................................................................30
Table 3. 2 Login use case description...........................................................................................31
Table 3. 3 Add items use case description.....................................................................................32
Table 3. 4 sell items use case description.....................................................................................33
Table 3. 5 All items use case description......................................................................................34
Table 3. 6 Available items use case description............................................................................35
Table 3. 7 Sold items use case description....................................................................................36
Table 3. 8 Available in items use case description........................................................................37
Table 3. 9 Sold Out items use case description.............................................................................38
Table 3. 10 Expired items use case description............................................................................39
Table 3. 11 less than three months to expire use case description...............................................40
Table 3. 12 less than six months to expire use case description...................................................41
Table 3. 13 Generate barcode use case description.....................................................................42
Table 3. 14 Generate QR code use case description.....................................................................43

Table 4. 1 Login Table..................................................................................................................87


Table 4. 2 Stock_info Table...........................................................................................................87

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 7
DAILY STOCK CONTROLLER

Table of Contents
ACKNOWLEDGEMENT.................................................................................................................3
ABSTRACT......................................................................................................................................4
LIST OF FIGURE...........................................................................................................................5
LIST OF TABLE..............................................................................................................................7
CHAPTER ONE............................................................................................................................11
1: Introduction to Daily stock controller................................................................................................11
1.2 General Organizational Background................................................................................................11
1.3 Motivation and Justification............................................................................................................12
1.4 Statement of the problem...............................................................................................................12
1.5 Objective of the Project...................................................................................................................12
1.5.1 General Objectives....................................................................................................................12
1.5.2 Specific Objectives....................................................................................................................13
1.6 Significance of the Project...............................................................................................................13
1.7 Cost Benefit Analysis........................................................................................................................14
1.7.1 Tangible Benefits:.....................................................................................................................14
1.7.2: Intangible Benefits...................................................................................................................15
1.8 Scope of the Application..................................................................................................................15
1.9 Methodology...................................................................................................................................15
1.9.1 Data Source..............................................................................................................................15
1.9.2 Requirement Analysis...............................................................................................................16
1.10 Work Breakdown Structure...........................................................................................................16
1.11 Hardware and Software Requirements.........................................................................................18
1.11.1: Hardware Requirements........................................................................................................18
1.11.2 Software Requirements..........................................................................................................18
CHAPTER TWO............................................................................................................................18
Requirement Gathering.........................................................................................................................18
2.1 Existing System Description.............................................................................................................18
2.1.1 Description of the Major Activities in the Existing System........................................................18
2.1.2 Work Flow of Existing System...................................................................................................19
2.2 Problem Definition...........................................................................................................................20
2.3 Broad Alternative Solution...............................................................................................................21

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 8
DAILY STOCK CONTROLLER
2.4 Functional Requirements of the proposed System..........................................................................22
2.5 Nonfunctional Requirements...........................................................................................................23
2.6 Business Rule Documentation.........................................................................................................24
2.6.1 Business rules...........................................................................................................................24
2.7 Use case Modeling...........................................................................................................................25
2.7.1 Essential use case Modeling.....................................................................................................25
2.8 Class Responsibility Collaboration Diagram.....................................................................................28
CHAPTER THREE........................................................................................................................29
System Analysis.....................................................................................................................................29
3.1 System Use Case Modeling..............................................................................................................29
3.2 System Use Case Description...........................................................................................................30
3.3 Analysis Sequence Diagrams............................................................................................................44
3.4 Conceptual Modeling: Class Diagram..............................................................................................45
3.5 Analysis class Documentation..........................................................................................................46
3.6 Activity diagrams.............................................................................................................................46
3.7 Analysis User Interface Prototype...................................................................................................57
CHAPTER FOUR..........................................................................................................................75
System Design.......................................................................................................................................75
4.1 Design Sequence Diagrams..............................................................................................................75
4.2 Design Class Modeling.....................................................................................................................85
4.2.1 Design Class Diagram................................................................................................................85
4.2.2 Design Class Documentation....................................................................................................87
4.3 Collaboration Diagrams...................................................................................................................88
4.4 Component Diagrams......................................................................................................................95
4.5 Deployment Diagrams.....................................................................................................................96
4.6 Persistence Modeling......................................................................................................................97
4.7 User Interface Design......................................................................................................................98
CHAPTER FIVE..........................................................................................................................102
Testing and Implementations..............................................................................................................102
5.1 Testing...........................................................................................................................................102
5.2 Implementations...........................................................................................................................103
Conclusions..........................................................................................................................................136
Recommendations...............................................................................................................................136

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 9
DAILY STOCK CONTROLLER
Glossary...............................................................................................................................................137
Reference............................................................................................................................................138

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 10
DAILY STOCK CONTROLLER

CHAPTER ONE
Introduction
1: Introduction to Daily stock controller
The project Daily stock controller is a complete android-based application designed on Java
using android Studio Software. The main aim of the project is to develop Inventory
Management System Model software in which all the information regarding the stock of the
organization will be presented. It is fully offline based android application which has username
and password to manage the inventory and maintenance of the inventory system securely.

This android application is based on the management of stock of an organization. The


application contains login and registration system, sales details, Purchase details display all
transaction, display available items, display sold items, display identical items, notify expired
item, generate barcode, QR code and the remaining stock that are presented in the
organization. There is a provision of updating the inventory also. This application also provides
the remaining balance of the stock as well as the details of the balance of transaction.

Each new stock is created and entitled with the named and the entry date of that stock and it
can also be update any time when required as per the transaction or the sales is returned in
case. Here the login page is created in order to protect the management of the stock of
organization in order to prevent it from the threads and misuse of the inventory.

1.2 General Organizational Background


Products are considered as the business resources for the organization. This includes managing
the product with appropriate way to review any time as per the requirement.

Therefore, it is important to have an android based (DSC) which has the ability to generate
reports, maintain the balance of the stock, details about the purchase and sales in the
organization. Before developing this application, we came up with some Inventory

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 11
DAILY STOCK CONTROLLER
Management System existing in the market, which helps to give the knowledge for the
development of our project. This application software is only used by the large organization
but so we came up with the application which can be used by the small company for the
management of their stock in the production houses.

After analyzing the other inventory management system, we decided to include some of
common and key features that should be included in every inventory management system. So
we decided to include those things that help the small organization in a way or other.

1.3 Motivation and Justification


As we Know many retail shops use backward selling system they manage their shop transaction
using paper this backward system has many problems for example it’s not reliable, it’s not fast,
and they calculate transaction manually so we motivate to develop a mobile application to help
small organization by using our system they can manage their shop transaction easily, fast and

reliably.

1.4 Statement of the problem


After analyzing many existing inventory managements system, we have now the obvious vision
of the project to be developed. Before we started to build the application team had many
challenges.

We defined our problem statement as:

 To make android based application of (DSC) for small organization.


 To make the system easily managed and can be secured.
 To cover all the areas of (DSC) like purchase details, sales details and stock
management.

1.5 Objective of the Project


1.5.1 General Objectives
The General Objectives of the project are mentioned below:

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 12
DAILY STOCK CONTROLLER
 To develop automated inventory management System for small organization.
 To fulfill the requirement for achieving the Bachelor’s degree of Computer Science.
 To know the fundamentals of the SQLite database and Android Studio

1.5.2 Specific Objectives


The Specific Objectives of this project are mentioned below:

 To develop an application that deals with the day to day requirement of any production
organization
 To develop the easy management of the inventory
 To handle the inventory details like sales details, purchase details and balance stock
details.
 To provide competitive advantage to the organization.
 To provide details information about the stock balance.
 To make the stock manageable and simplify the use of inventory in the organization.

1.6 Significance of the Project


This application is used to show the stock remaining and details about the sales and
purchase. It gives the details about the stock on daily based. The details components
are described below:
Login page: As application starts the login page appears. User login is determined by the
username and password that has all the authority to add and update the stock of the
organization as per the requirement.

Sales details: It show the details about the sales and the remaining stock of sales. It also
shows the details about the sales in return.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 13
DAILY STOCK CONTROLLER
Purchase details: It shows the details about the purchase made by the organization
along with the price.

Add items: It stores items information in to SQLite database like items name, items
barcode or QR code, items description, items category, items purchased value, items
sales value, supplier name, supplier phone and expired date.

Sell items: It can scan barcode or QR code and add items to cart based on scanner
information and calculate all items in cart and then display total price.

Expired Date: It show items that already expired and also notify items that will be expire
after three month or six months.

Identical items: it shows items by their group or category it’s important to count items
and then match the number of items in physical stock data and database.

barcode and QR code generator: it’s very important generating barcode and QR code.
As we know some local items haven’t barcode or QR code our app Daily stock controller
all system depends on barcode and QR code so we have to generate barcode or QR code
to be able to scan items;

1.7 Cost Benefit Analysis


1.7.1 Tangible Benefits:
Daily stock controller app will have many benefit to retail shops it will save time, It’s
portable and serve customer fastly.
We calculate tangible price based on current market price. Almost all retail Shop
manage their transaction manually, so almost there is no cost for manage their shop
transaction but If merchant wants to buy a cash register, it’s will cost him 15000 birrs,
because of its expensive many retailers do not use cash registers. our system only

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 14
DAILY STOCK CONTROLLER
requires a smartphone, if the merchant does not have smartphone, it’s will cost him
2180 birrs. So when we compare cash registration machine and our system, by using our
system the merchant will save 12820 birrs.

1.7.2: Intangible Benefits


 Increase reliability of storing transaction.
 Increase speed of serving customer fastly.
 Increase flexibility
 Increase security
 Daily transaction report

1.8 Scope of the Application


Daily Stock Controller (DSC) is targeted to the small or medium organization
which doesn’t have cash register machine i.e. only to those organizations that has single
power of authority. Some of the scope are:
 Only one person is responsible in assigning the details or records
 It is security driven.

 It is fast and reliable

1.9 Methodology
1.9.1 Data Source
We started research by identifying the need of IMS in the organization. Initially we bounded our
research to find the general reasons that emerged the needs of Inventory Management System.
We used different techniques to collect the data that can clearly give us the overall image of
the application. The techniques we used were interview with the Merchant, visiting online
websites that are presented as the templates and visiting some organization to see their IMS
application. Basically the following factors forced us to develop DSC application:

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 15
DAILY STOCK CONTROLLER
 Cost and affordability
 Lack of stock management.
 Effective flow of stock transfer and management.
 Difficulty in monitoring the stock management.

1.9.2 Requirement Analysis


We collected a number of requirements for project from our primitive research, website visits,
and interview to the concerned personnel and their experiences regarding the concepts of its
development. We have even visited some retail shop and analyze its importance and try to
develop the project by fulfilling all the weakness that were found in the retail Shop. We then
decided to build same type of application with different logic flow and new language which will
be suitable for the small organization.

1.10 Work Breakdown Structure


A Work Breakdown Structure (WBS) is a deliverable-oriented hierarchical decomposition of the
work to be executed by the project team to accomplish the project objectives and create the
required deliverables. A WBS is the cornerstone of effective project planning, execution,
controlling, monitoring, and reporting. All the work contained within the WBS is to be
identified, estimated, scheduled, and budgeted.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 16
DAILY STOCK CONTROLLER

Figure 1. 1 Work breakdown structure for DSC

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 17
DAILY STOCK CONTROLLER

1.11 Hardware and Software Requirements


1.11.1: Hardware Requirements
 core i3 processor and above
 1280 x 800 minimum Screen resolution.
 Android phone (Having Version Above or 4.0.1 and Having camera 8MP
and above)
 4 GB RAM minimum, 8 GB RAM recommended
 2 GB of available disk space minimum, 4 GB Recommended

1.11.2 Software Requirements


 Android Studio 4.0 as frontend
 MS word 2016 to write documentation
 MS Power Point 2016 for presentation of documentation
 Edraw max 9.0 to design diagrams

CHAPTER TWO
Requirement Gathering
2.1 Existing System Description
Almost all retail shops are currently using a manual system to store information about their
transaction, for example record new item information, record sell transaction and calculate
total sold items price are done manually.

2.1.1 Description of the Major Activities in the Existing System


 The merchant record sold item transaction on paper.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 18
DAILY STOCK CONTROLLER
 The merchant count items to verify items availability.
 The merchant checks whether items getting low from stock by counting every group of
items on the store.
 The merchant checks whether items getting out of date by looking every single items.

2.1.2 Work Flow of Existing System


 The merchant buys items from his supplier and store his items without record
their information.
 The merchant sells his items to customer and then record detail transaction of
sold items on paper.
 The merchant calculates his daily total income using calculator.
 The merchant checks his items for availability, low stock and out of date.

The flow of data from external entities into the manual document, showed how the data
moved from one process to another, as well as its logical storage. There are four symbols in the
data flow diagram of the following diagram:

 Squares representing external entities, which are sources or


destinations of data.
 Rounded rectangles representing processes, which take data as input,
do something to it, and output it.
 Arrows representing the data flows, which can either, be electronic
data or physical items and the decision process and terminals.
 The diagram data and functional flow diagram is represented as
follows:

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 19
DAILY STOCK CONTROLLER

Figure 2. 1 Work Flow of Existing System

2.2 Problem Definition


The present system of retail shops has many problems. These problem can be seen from the
following perspectives like performance, economic, control, efficiency, security and data storing
problem.

Performance
The performance of existing system does not serve customer fast because the merchant
calculates total transaction manually and also its not reliable.

Economical
The retail shop almost there is no cost for manage their shop transaction but If merchant wants
to buy a cash register, it’s very expensive, because of this reason many retailers does not use
cash registers.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 20
DAILY STOCK CONTROLLER

Controlling
Since all the records associated with the manual System are recorded and stored manually the
security that the system provides for the privacy of this records is not reliable. The system
cannot provide sufficient protection for access and manipulation of the records associated with
the system.

Data Storage problem


 Data are not easily accessible due to place in different location.
 Data redundancy that leads to inconsistency
 Difficult to change and edit.

Efficiency
As we mentioned earlier retail shop has many problems for example it’s not reliable, it’s not
fast, and they calculate transaction manually.

Security and Controls


For the proposed system, access to data/information must be controlled. No one login into the
system without a registered username and password. Unlike the existing system access to the
system services must be restricted and controlled.

2.3 Broad Alternative Solution


The merchant can use POS machine or cash registers to manage his retail shop. The point of
sale (POS) or point of purchase (POP) is the time and place where a retail transaction is
completed. At the point of sale, the merchant calculates the amount owed by the customer,
indicates that amount, may prepare an invoice for the customer (which may be a cash register
printout), and indicates the options for the customer to make payment. It is also the point at
which a customer makes a payment to the merchant in exchange for goods or after provision of
a service. After receiving payment, the merchant may issue a receipt for the transaction, which
is usually printed but can also be dispensed with or sent electronically.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 21
DAILY STOCK CONTROLLER
To calculate the amount owed by a customer, the merchant may use various devices such as
weighing scales, barcode scanners, and cash registers. To make a payment, payment terminals,
touch screens, and other hardware and software options are available.

The point of sale is often referred to as the point of service because it is not just a point of sale
but also a point of return or customer order. POS terminal software may also include features
for additional functionality, such as inventory management, CRM, financials, or warehousing.

2.4 Functional Requirements of the proposed System


Functional requirement is a description of activities and services a system must provide. This is
software requirement that define behavior of the proposed system, that is the fundamental
process or transformation that software and hardware components of the system performs on
inputs to produce outputs. It is also describing the interaction between the system and its
environment independent of its implementation. The environment includes the user and any
other external system with which the system interacts Therefore the proposed system has the
following functional requirement

Registration page: Its appear once when the user installs DSC app for first time. This form can
register the merchant username and password in to SQLite database.

Login page: As application starts the login page appears. User login is determined by the
username and password that has all the authority to add and update the stock of the
organization as per the requirement.

Sales details: It show the details about the sales and the remaining stock of sales. It also shows
the details about the sales in return.

Purchase details: It shows the details about the purchase made by the organization along with
the price.

Profit details: It shows the details about income profit of retail shop daily based.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 22
DAILY STOCK CONTROLLER
Update items info: a user can update items information easly.

Add items: It stores items information in to SQLite database like items name, items barcode or
QR code, items description, items category, items purchased value, items sales value, supplier
name, supplier phone and expired date.

Sell items: It can scan barcode or QR code and add items to cart based on scanner information
and calculate all items in cart and then display total price.

Expired Date: It show items that already expired and also notify items that will be expire after
three month or six months.

Identical items: it shows items by their group or category it’s important to count items and
then match the number of items in physical stock data and database.

barcode and QR code generator: it’s very important generating barcode and QR code. As we
mentioned some local items haven’t barcode or QR code our app Daily stock controller all
system depends on barcode and QR code so we have to generate barcode or QR code to be
able to scan items;

2.5 Nonfunctional Requirements


Nonfunctional requirements are the general requirement of system or gives additional
functions to the user of the system.

Nonfunctional requirement is also a requirement that specifies criteria that can be used to
judge the operation of the system, rather the specifies behaviors. It defines how a system is
supported. Nonfunctional requirement is often called qualities of a system.

Some of the nonfunctional requirements are:

 Performance: Focus should be kept on monitoring and managing the performance and
service availability of software.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 23
DAILY STOCK CONTROLLER
 User Interface: The designed user interface will be attractive. The user interface will be
light weight and easy to use and manage. The designed systems user interface graphics
will reflect the system.
 Security and Access permissions: - Security requirement are important factors in this
system as classified information will be store in the database. And should allow login to
only authorized users.
 Maintainability: The System should be as easy as possible to get maintained.
 Error handling Exception: The system recovers easily when a user enters
incorrect(error) data.
 User friendly Interface: User can easily input and retrieve items information’s.
 Efficiency: The system must ensure allocation and use of services being requested for
the users by using minimum memory storage, cost and time.
 Availability: All data in the system will be available all the time.
 No Redundancy: In the proposed system can be avoided reputation of data anywhere in
the database.
 Reliability: The reliability of the proposed system will be better due to proper storage of
information when users access the application.
 Accuracy: proposed system will be better due to reduction of error. All operation can be
done correctly and it ensures that whatever information is coming from the database is
accurate.

2.6 Business Rule Documentation


A business rule is a statement that defines or constrains some aspect of the business. A
business rule may be considered as a user requirement that is expressed in non-procedural and
non-technical form. A business rule repository is used to document and translate application
business rules into application functions.

2.6.1 Business rules


 BR#1: The merchant must enter the correct information of items.
 BR#2: The merchant must scan barcode before selling items.
 BR#3: The merchant must generate barcode when items does not have barcode.
 BR#4: The merchant must enter expire date of items in the form of “yyyymmdd”.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 24
DAILY STOCK CONTROLLER

2.7 Use case Modeling


A use case is a list of actions or event steps typically defining the interactions between a role of
an actor and a system to achieve a goal. A use case is a useful technique for identifying,
clarifying, and organizing system requirements. A use case is made up of a set of possible
sequences of interactions between systems and users that defines the features to be
implemented and the resolution of any errors that may be encountered.

While a use case itself might drill into a lot of detail (such as, flow of events and scenarios)
about every possibility, a use-case diagram can help provide a higher-level view of the system,
providing the simplified and graphical representation of what the system must actually do.

The actors are merchant he has all permissions to access, modify and add items into database.

2.7.1 Essential use case Modeling


An essential use case sometimes called a business use case, is simplified, abstract, generalized
use case that captures the intentions of user in a technology and implementation independent
manner. A fully documented essential use case is a structured narrative, expressed in the
language of the application domain and of user, comprising a simplified abstract, technology
free and implementation independent description of on task or interaction. An essential use
case is complete, meaningful, and well designed the point of view of user in some role or roles
in relation to a system and that embodies the purpose or intentions underlying the interaction.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 25
DAILY STOCK CONTROLLER

Figure 2. 2 Essential use case modeling

2.7.1.1 Essential Use Case Documentation


The use case begins when the merchant goes to the Register page. There, the merchant type
new username and password on the form and submits it. The system then stores username and
password into database and display login page to the merchant. The merchant enters username
and password and click on login button. The system verifies username and password and then
open menu page. The menu page includes the following activity: -

 If user click on add items: - The system open add items activity to the user.
 If user click on sell items: - The system open sell items activity to the user.
 If user click on all items: - The system opens all items activity to the user.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 26
DAILY STOCK CONTROLLER
 If user click on available items: - The system opens available items activity to the user.
 If user click on sold items: - The system opens sold items activity to the user.
 If user click on identical items: - The system opens identical items activity to the user.
 If user click on expire date: - The system open expire date activity to the user.
 If user click on Generate barcode: - The system open generate barcode activity to the
user.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 27
DAILY STOCK CONTROLLER
2.8 Class Responsibility Collaboration Diagram

Figure 2. 3 Class Responsibility Collaboration Diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 28
DAILY STOCK CONTROLLER

CHAPTER THREE
System Analysis

3.1 System Use Case Modeling


Its purpose is to present a graphical overview of the functionality provided by a system in terms
of actors and their goals.
The main purpose of a use case diagram is to show what system function are performed for
which actors.
The actor is merchant who control the overall activity of DSC app.

Figure 3. 1 Use case model

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 29
DAILY STOCK CONTROLLER
3.2 System Use Case Description

Use case name Register

Requirement id UC1

This use case describes the process of registering user into database
Description

Actor Merchant

The merchant must fill username and password


Pre-condition

The merchant is registered in the system


Post-condition

User intention System Responsibility

Step 2: The user types new Step 1: The system request


username and password and click username and password.
on register button.
Step 3: The system stores
username and password into
database and open login page.
Course of Action

Alternative If a password conformation does not match the system display error
course of action message.
Table
3. 1 Register use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 30
DAILY STOCK CONTROLLER

Use case name Login

Requirement id UC2

Description This use case describes the process of login into the system.

Actor Merchant
Pre-condition The merchant should registered in the system

Post-condition The merchant is logged in the system


User intention System responsibility

Step 2: The user enter Step 1: The system request


his/her username and username and password
password and click on login
Course of action button Step 3: The system verifies
his/her username and
password and open menu.

Alternative course of action If username and password is incorrect the system display
error message.

Table 3. 2 Login use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 31
DAILY STOCK CONTROLLER

Use case name Add items

Requirement id UC3

This use case describes the process of registering new items into
Description database.

Actor Merchant

The merchant should login to the system


Pre-condition

Post-condition The merchant should register new item into database.

User intention System responsibility

Step 1: The merchant should Step 2: The system redirect


click on add items button to the add items page and
display form.
Step 3: The merchant types
Course of action items information and click on Step 4: The system save
done button items information into
database.

Alternative course of If some of the fields are not filled, the system send notification
action to merchant to fill unfilled fields.

Table 3. 3 Add items use case description

Use case name Sell items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 32
DAILY STOCK CONTROLLER
Requirement id UC4

Actor Merchant

This use case describes the process of calculating total


Description transaction price and update items status into Sold or
available
Pre-condition The merchant should login to the system

Post-condition The system display Total transaction and update item status

User intention System responsibility

Step 1: The merchant should Step 2: The system redirect


click on sell items button to sell items page and
Course of action request barcode or QR code
of items.
Step 3: The merchant scan
barcode or QR code before Step 4: The system add the
selling items to customer and scanned items into cart and
then click on add to cart then calculate total
button. transaction price.

User intention System responsibility

Step 1: The merchant should Step 2: The system redirect


click on sell items button to sell items page and
request barcode or QR code
Alternative course of action of items.
Step 3: The merchant scan
barcode or QR code before Step 4: The system remove
selling items to customer and the scanned items into cart
then click on Remove from and then calculate total
cart button. transaction price.

Table 3. 4 sell items use case description

Use case name All items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 33
DAILY STOCK CONTROLLER
Requirement id UC5

Actor Merchant

This use case describes the process of displaying all items


Description from database .

The merchant should login to system


Pre-condition
The merchant can view all items that stored in database and
Post-condition also can view estimated income and profit.
User intention System responsibility

Step 1: The merchant should Step 2: The system select all


Course of action click on All items button items from database,
calculate total income and
profit and then display to the
user.

If there is no data in database the system display message.


Alternative course of action

Table 3. 5 All items use case description

Use case name Available items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 34
DAILY STOCK CONTROLLER
Requirement id UC6

Actor Merchant
This use case describes the process of selecting available
Description items from database.

Pre-condition The merchant should login to the system


The merchant can view available items that stored in
Post-condition database and also can view estimated income and profit.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on Available items button select available items
from database,
Course of action calculate total income
and profit and then
display to the user.

Alternative course of action If there is no data in database the system display message.

Table 3. 6 Available items use case description

Use case name Sold items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 35
DAILY STOCK CONTROLLER
Requirement id UC7

Actor Merchant
This use case describes the process of selecting sold items
Description from database.

Pre-condition The merchant should login to the system


The merchant can view sold items that stored in database and
Post-condition also can view total income and profit.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on Sold items button select sold items from
database, calculate total
Course of action income and profit and
then display to the user.

Alternative course of action If there is no data in database the system display message.

Table 3. 7 Sold items use case description

Use case name Available In items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 36
DAILY STOCK CONTROLLER
Requirement id UC8

Actor Merchant
This use case describes the process of selecting available
Description items from database which is the same type of items.

Pre-condition The merchant should login to the system


The merchant can view available items that stored in
Post-condition database and also can view estimated income and profit.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on Available in items button request barcode or QR
code
Course of action Step 3: The merchant scan items Step 4: The system
barcode or QR code select available items
from database which is
the same type of
scanned items ,
calculate total income
and profit and then
display to the user.
Alternative course of action If there is no data in database the system display message.

Table 3. 8 Available in items use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 37
DAILY STOCK CONTROLLER
Use case name Sold out items

Requirement id UC9

Actor Merchant
This use case describes the process of selecting sold items
Description from database which is the same type of items.

Pre-condition The merchant should login to the system


The merchant can view sold items that stored in database and
Post-condition also can view total income and profit.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on Sold out items button request barcode or QR
code
Course of action Step 3: The merchant scan items Step 4: The system
barcode or QR code select sold items from
database which is the
same type of scanned
items , calculate total
income and profit and
then display to the user.
Alternative course of action If there is no data in database the system display message.

Table 3. 9 Sold Out items use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 38
DAILY STOCK CONTROLLER
Use case name Expired items

Requirement id UC10

Actor Merchant
This use case describes the process of selecting expired items
Description from database.

Pre-condition The merchant should login to the system


The merchant can view expired items that stored in database
Post-condition and also can view total lost income and profit.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on Expired items button select expired items
from database,
Course of action calculate total lost
income and profit and
then display to the user.

Alternative course of action If there is no data in database the system display message.

Table 3. 10 Expired items use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 39
DAILY STOCK CONTROLLER
Use case name less than three months to expire

Requirement id UC11

Actor Merchant
This use case describes the process of selecting items from
Description database which have less than three months to expire.

Pre-condition The merchant should login to the system


The merchant can view items that stored in database which
Post-condition have less than three months to expire and also can view total
income and profit that will be lost.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on less than three months to select items from
expire button database which have
Course of action less than three months
to expire, calculate total
income and profit that
will be lost and then
display to the user.

Alternative course of action If there is no data in database the system display message.

Table 3. 11 less than three months to expire use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 40
DAILY STOCK CONTROLLER
Use case name less than six months to expire

Requirement id UC12

Actor Merchant
This use case describes the process of selecting items from
Description database which have less than six months to expire.

Pre-condition The merchant should login to the system


The merchant can view items that stored in database which
Post-condition have less than six months to expire and also can view total
income and profit that will be lost.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on less than six months to expire select items from
button database which have
Course of action less than six months to
expire, calculate total
income and profit that
will be lost and then
display to the user.

Alternative course of action If there is no data in database the system display message.

Table 3. 12 less than six months to expire use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 41
DAILY STOCK CONTROLLER
Use case name Generate barcode

Requirement id UC13

Actor Merchant
This use case describes the process of generating barcode.
Description

Pre-condition The merchant should login to the system


The merchant can generate barcode and store into internal
Post-condition storage.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on Generate barcode button request how many
barcode he went to
Course of action Step 3: The merchant types generate
number that he went to generate Step 4: The system
and click on generate button. generate barcode and
store into internal
storage.

Alternative course of action If the field is not filled, the system send notification to the
merchant to fill unfilled field.

Table 3. 13 Generate barcode use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 42
DAILY STOCK CONTROLLER
Use case name Generate QR code

Requirement id UC14

Actor Merchant
This use case describes the process of generating QR code.
Description

Pre-condition The merchant should login to the system


The merchant can generate QR code and store into internal
Post-condition storage.
User intention System responsibility

Step 1: The merchant should click Step 2: The system


on Generate QR code button request how many QR
code he went to
Course of action Step 3: The merchant types generate
number that he went to generate Step 4: The system
and click on generate button. generate QR code and
store into internal
storage.

Alternative course of action If the field is not filled, the system send notification to the
merchant to fill unfilled field.

Table 3. 14 Generate QR code use case description

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 43
DAILY STOCK CONTROLLER
3.3 Analysis Sequence Diagrams
A sequence diagram shows object interactions arranged in time sequence. It depicts the
objects involved in the scenario and the sequence of messages exchanged between the objects
needed to carry out the functionality of the scenario. Sequence diagrams are typically
associated with use case realizations in the Logical View of the system under development.
Sequence diagrams are sometimes called event diagrams or event scenarios.

A sequence diagram shows, as parallel vertical lines (lifelines), different processes or objects
that live simultaneously, and, as horizontal arrows, the messages exchanged between them, in
the order in which they occur. This allows the specification of simple runtime scenarios in a
graphical manner.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 44
DAILY STOCK CONTROLLER
3.4 Conceptual Modeling: Class Diagram

Figure 3. 2Conceptual class diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 45
DAILY STOCK CONTROLLER
3.5 Analysis class Documentation
Class diagram is a static diagram. It represents the static view of an application. Class diagram is
not only used for visualizing, describing, and documenting different aspects of a system but also
for constructing executable code of the software application.

Class diagram describes the attributes and operations of a class and also the constraints
imposed on the system. The class diagrams are widely used in the modeling of object oriented
systems because they are the only UML diagrams, which can be mapped directly with object-
oriented languages.

Class diagram shows a collection of classes, interfaces, associations, collaborations, and


constraints. It is also known as a structural diagram.

3.6 Activity diagrams


Activity diagram is basically a flowchart to represent the flow from one activity to another
activity. The activity can be described as an operation of the system.

The control flow is drawn from one operation to another. This flow can be sequential,
branched, or concurrent. Activity diagrams deal with all type of flow control by using different
elements such as fork, join, etc.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 46
DAILY STOCK CONTROLLER

Figure 3. 3 activity diagram for register

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 47
DAILY STOCK CONTROLLER

Figure 3. 4 activity diagram for login

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 48
DAILY STOCK CONTROLLER

Figure 3. 5 activity diagram for add items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 49
DAILY STOCK CONTROLLER

Figure 3. 6 activity diagram for sell items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 50
DAILY STOCK CONTROLLER

Figure 3. 7 activity diagram for All items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 51
DAILY STOCK CONTROLLER

Figure 3. 8 activity diagram for available items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 52
DAILY STOCK CONTROLLER

Figure 3. 9 activity diagram for sold items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 53
DAILY STOCK CONTROLLER

Figure 3. 10 activity diagram for identical items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 54
DAILY STOCK CONTROLLER

Figure 3. 11 activity diagram for expired items

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 55
DAILY STOCK CONTROLLER

Figure 3. 12 activity diagram for generate barcode

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 56
DAILY STOCK CONTROLLER
3.7 Analysis User Interface Prototype
User interface (UI) prototyping is an iterative analysis technique in which users are actively
involved in the mocking-up of the UI for a system.

Figure 3. 13 Register user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 57
DAILY STOCK CONTROLLER

Figure 3. 14 Login user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 58
DAILY STOCK CONTROLLER

Figure 3. 15 Menu user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 59
DAILY STOCK CONTROLLER

Figure 3. 16 Add items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 60
DAILY STOCK CONTROLLER

Figure 3. 17 Sell items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 61
DAILY STOCK CONTROLLER

Figure 3. 18 All items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 62
DAILY STOCK CONTROLLER

Figure 3. 19 Available items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 63
DAILY STOCK CONTROLLER

Figure 3. 20 Sold items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 64
DAILY STOCK CONTROLLER

Figure 3. 21 Identical items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 65
DAILY STOCK CONTROLLER

Figure 3. 22 Available In items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 66
DAILY STOCK CONTROLLER

Figure 3. 23 Sold Out items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 67
DAILY STOCK CONTROLLER

Figure 3. 24 Expired date user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 68
DAILY STOCK CONTROLLER

Figure 3. 25 Expired items user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 69
DAILY STOCK CONTROLLER

Figure 3. 26 Less than 3 months to expire user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 70
DAILY STOCK CONTROLLER

Figure 3. 27 Less than 6 months to expire user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 71
DAILY STOCK CONTROLLER

Figure 3. 28 Barcode generator menu user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 72
DAILY STOCK CONTROLLER

Figure 3. 29 barcode generator user interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 73
DAILY STOCK CONTROLLER

Figure 3. 30 QR code generator User interface prototype

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 74
DAILY STOCK CONTROLLER

CHAPTER FOUR
System Design
System design is the phase that bridges the gap between problem domain and the existing
system in a manageable way. This phase focuses on the solution domain, i.e. “how to
implement?”

It is the phase where the SRS document is converted into a format that can be implemented
and decides how the system will operate.

In this phase, the complex activity of system development is divided into several smaller sub-
activities, which coordinate with each other to achieve the main objective of system
development.

4.1 Design Sequence Diagrams


A sequence diagram shows object interactions arranged in time sequence. It depicts the
objects involved in the scenario and the sequence of messages exchanged between the objects
needed to carry out the functionality of the scenario. Sequence diagrams are typically
associated with use case realizations in the Logical View of the system under development.
Sequence diagrams are sometimes called event diagrams or event scenarios.

A sequence diagram shows, as parallel vertical lines (lifelines), different processes or objects
that live simultaneously, and, as horizontal arrows, the messages exchanged between them, in
the order in which they occur. This allows the specification of simple runtime scenarios in a
graphical manner.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 75
DAILY STOCK CONTROLLER

Figure 4. 1 Login Sequence diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 76
DAILY STOCK CONTROLLER

Figure 4. 2 Add items Sequence diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 77
DAILY STOCK CONTROLLER

Figure 4. 3 Sell items Sequence diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 78
DAILY STOCK CONTROLLER

Figure 4. 4 All items Sequence diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 79
DAILY STOCK CONTROLLER

Figure 4. 5 Available items sequence diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 80
DAILY STOCK CONTROLLER

Figure 4. 6 Sold items Sequence Diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 81
DAILY STOCK CONTROLLER

Figure 4. 7 Identical items Sequence diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 82
DAILY STOCK CONTROLLER

Figure 4. 8 Expired data Sequence diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 83
DAILY STOCK CONTROLLER

Figure 4. 9 barcode generator Sequence diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 84
DAILY STOCK CONTROLLER

4.2 Design Class Modeling


Class diagram is a static diagram. It represents the static view of an application. Class diagram is
not only used for visualizing, describing, and documenting different aspects of a system but also
for constructing executable code of the software application.

Class diagram describes the attributes and operations of a class and also the constraints
imposed on the system. The class diagrams are widely used in the modeling of object oriented
systems because they are the only UML diagrams, which can be mapped directly with object-
oriented languages.

Class diagram shows a collection of classes, interfaces, associations, collaborations, and


constraints. It is also known as a structural diagram.

4.2.1 Design Class Diagram

Figure 4. 10 Register and Login Class Diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 85
DAILY STOCK CONTROLLER

Figure 4. 11 Class Diagram for DSC

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 86
DAILY STOCK CONTROLLER
4.2.2 Design Class Documentation
Login Table

Login
Column Type Null Default
Id Integer(Auto Increment) No
Username Text No
Password Text No
Table 4. 1 Login Table

Stock information Table

Stock
Column Type Null Default
Id Integer(Auto increment) No
Product Name Text No
Barcode Long No
Description Text No
Category Text No
Purchased Price Float No
Sales Price Float No
Items Status Text No
Supplier Name Text No
Expired date Long No

Table 4. 2 Stock info Table

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 87
DAILY STOCK CONTROLLER
4.3 Collaboration Diagrams
The collaboration diagram is used to show the relationship between the objects in a system.
Both the sequence and the collaboration diagrams represent the same information but
differently. Instead of showing the flow of messages, it depicts the architecture of the object
residing in the system as it is based on object-oriented programming. An object consists of
several features. Multiple objects present in the system are connected to each other. The
collaboration diagram, which is also known as a communication diagram, is used to portray the
object's architecture in the system.

Figure 4. 12 Register Collaboration Diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 88
DAILY STOCK CONTROLLER

Figure 4. 13 Login Collaboration Diagram

Figure 4. 14 Add items Collaboration Diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 89
DAILY STOCK CONTROLLER

Figure 4. 15 Sell items Collaboration Diagram

Figure 4. 16 All items Collaboration Diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 90
DAILY STOCK CONTROLLER

Figure 4. 17 Available items Collaboration Diagram

Figure 4. 18 Sold items Collaboration Diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 91
DAILY STOCK CONTROLLER

Figure 4. 19 Identical items Collaboration diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 92
DAILY STOCK CONTROLLER

Figure 4. 20 Expire date Collaboration diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 93
DAILY STOCK CONTROLLER

Figure 4. 21 Barcode generator Collaboration diagram

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 94
DAILY STOCK CONTROLLER
4.4 Component Diagrams
A component diagram is used to break down a large object-oriented system into the smaller
components, so as to make them more manageable. It models the physical view of a system
such as executables, files, libraries, etc. that resides within the node.

It visualizes the relationships as well as the organization between the components present in
the system. It helps in forming an executable system. A component is a single unit of the
system, which is replaceable and executable. The implementation details of a component are
hidden, and it necessitates an interface to execute a function. It is like a black box whose
behavior is explained by the provided and required interfaces.

Figure 4. 22 Component Diagram for DSC

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 95
DAILY STOCK CONTROLLER
4.5 Deployment Diagrams
The deployment diagram visualizes the physical hardware on which the software will be
deployed. It portrays the static deployment view of a system. It involves the nodes and their
relationships.

It ascertains how software is deployed on the hardware. It maps the software architecture
created in design to the physical system architecture, where the software will be executed as a
node. Since it involves many nodes, the relationship is shown by utilizing communication paths.

Figure 4. 23 Deployment diagram for DSC

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 96
DAILY STOCK CONTROLLER
4.6 Persistence Modeling
Persistent modeling describes the persistent data stored by the system and the data
management infrastructure required for it. This section typically includes the description of
data schemes, the selection of a database, and the description of the encapsulation of the
database.

Figure 4. 24 Persistence diagram for DSC

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 97
DAILY STOCK CONTROLLER
4.7 User Interface Design
User Interface (UI) Design focuses on anticipating what users might need to do and ensuring
that the interface has elements that are easy to access, understand, and use to facilitate those
actions. UI brings together concepts from interaction design, visual design, and information
architecture

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 98
DAILY STOCK CONTROLLER

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 99
DAILY STOCK CONTROLLER

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 100
DAILY STOCK CONTROLLER

Figure 4. 25 User interface design for DSC

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 101
DAILY STOCK CONTROLLER

CHAPTER FIVE
Testing and Implementations
5.1 Testing
The purpose of software testing is to access or evaluate the capabilities or attributes of a
software program’s ability to adequately meet the applicable standards and application need.
Testing does not ensure quality and the purpose of testing is not to find bugs. Testing can be
verification and validation or reliability estimation. The primary objective if testing includes:

 To identifying defects in the application.


 The most important role of testing is simply to provide information.
 to check the proper working of the application.

Type of Testing

We have used one type of testing to ensure the error free features of our mobile application:

Units Test

This type of testing is the testing of individual software components. It is typically done by the
programmer and not by the testers. It requires details information and knowledge about the
internal program design and code to perform this.

During unit testing, we carried out various testing task such as the reflection of the unit data on
database and its interface. Various types of bugs associated with the component were
identified and fixed.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 102
DAILY STOCK CONTROLLER
5.2 Implementations

Code for register:

package unity.universityfinalproject.dailystockcontroller;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;

public class RegisterActivity extends AppCompatActivity {

MyDatabaseHelper db;
EditText mTextUsername, mTextPassword, mTextConfPassword;
Button mButtonRegister;
TextView mTextViewLogin;

@Override
protected void onCreate(Bundle savedInstanceState) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);

db = new MyDatabaseHelper(this);
mTextUsername = (EditText) findViewById(R.id.editText_username);
mTextPassword = (EditText) findViewById(R.id.editText_password);
mTextConfPassword = (EditText) findViewById(R.id.editText_Conf_password);
mButtonRegister = (Button) findViewById(R.id.button_register);
mTextViewLogin = (TextView) findViewById(R.id.login_txt);

mTextViewLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent loginIntent = new
Intent(RegisterActivity.this,MainActivity.class);
startActivity(loginIntent);
}
});
mButtonRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String user = mTextUsername.getText().toString().trim();
String password = mTextPassword.getText().toString().trim();
String conf_password = mTextConfPassword.getText().toString().trim();
if(password.equals(conf_password)){

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 103
DAILY STOCK CONTROLLER
long val = db.addUser(user,password);
if(val > 0){
Toast.makeText(RegisterActivity.this,"You have
registered",Toast.LENGTH_SHORT).show();
Intent moveToLogin = new
Intent(RegisterActivity.this,MainActivity.class);
startActivity(moveToLogin);
} else{
Toast.makeText(RegisterActivity.this,"Registration
failed",Toast.LENGTH_SHORT).show();

}else{
Toast.makeText(RegisterActivity.this,"Password is not
Matching",Toast.LENGTH_SHORT).show();

}
}
});
}
}

Code for login:

package unity.universityfinalproject.dailystockcontroller;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;

import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

MyDatabaseHelper db;
EditText mTextUsername, mTextPassword;
Button mButtonLogin;

@Override
protected void onCreate(Bundle savedInstanceState) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

db = new MyDatabaseHelper(this);
getRegisterdUser();

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 104
DAILY STOCK CONTROLLER
mTextUsername =(EditText) findViewById(R.id.editText_username);
mTextPassword =(EditText) findViewById(R.id.editText_password);
mButtonLogin = (Button) findViewById(R.id.button_login);
mButtonLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String user = mTextUsername.getText().toString().trim();
String password = mTextPassword.getText().toString().trim();
Boolean result = db.checkUser(user, password);
if(result == true){
Toast.makeText(MainActivity.this,"Successfully
Login",Toast.LENGTH_SHORT).show();
Intent menuIntent = new
Intent(MainActivity.this,MenuActivity.class);
startActivity(menuIntent);

}else{
Toast.makeText(MainActivity.this,"Login
failed",Toast.LENGTH_SHORT).show();

}
}
});
}
void getRegisterdUser(){
Cursor cursor = db.readRegisterUser();
if(cursor.getCount() == 0) {
Intent registerIntent = new
Intent(MainActivity.this,RegisterActivity.class);
startActivity(registerIntent);
// Toast.makeText(this,"No data.",Toast.LENGTH_SHORT).show();
}
else{
while (cursor.moveToNext()){

}
}
}
}

Sample code for menu:

package unity.universityfinalproject.dailystockcontroller;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.google.zxing.client.result.ProductParsedResult;

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 105
DAILY STOCK CONTROLLER

public class MenuActivity extends AppCompatActivity {


ImageView goToAddActivity, goToSellActivity;
Button goToBarcodeGenerator, goToAllProducts, goToProductsIn, goToProductsOut,
goToItemsCounter, goToExpiredActivity;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
goToAddActivity = findViewById(R.id.goToAddimage);
goToAddActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent addActivityIntent = new
Intent(MenuActivity.this,AddActivity.class);
startActivity(addActivityIntent);
}
});

goToSellActivity = findViewById(R.id.goToSellimage);
goToSellActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToSellActivity = new
Intent(MenuActivity.this,SellActivity.class);
startActivity(goToSellActivity);
}
});
goToBarcodeGenerator = findViewById(R.id.generateBarcodeBtn);
goToBarcodeGenerator.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

Intent goToBarcodeGenActivity = new


Intent(MenuActivity.this,BarcodeGenActivity.class);
startActivity(goToBarcodeGenActivity);
}
});
goToAllProducts = findViewById(R.id.goToAllProducts);
goToAllProducts.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToAllProductsActivity = new
Intent(MenuActivity.this,AllProductActivity.class);
startActivity(goToAllProductsActivity);
}
});
goToProductsIn = findViewById(R.id.goToProductsIn);
goToProductsIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToProductsInActivity = new Intent(MenuActivity.this,
ProductInActivity.class);
startActivity(goToProductsInActivity);

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 106
DAILY STOCK CONTROLLER
}
});
goToProductsOut = findViewById(R.id.goToProductOut);
goToProductsOut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToProductsOutActivity = new
Intent(MenuActivity.this,ProductOutActivity.class);
startActivity(goToProductsOutActivity);
}
});
goToItemsCounter = findViewById(R.id.goToItemsCounter);
goToItemsCounter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToItemCounter = new
Intent(MenuActivity.this,CounterMenuActivity.class);
startActivity(goToItemCounter);
}
});
goToExpiredActivity = findViewById(R.id.goToExpiredActivity);
goToExpiredActivity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToExpiredMenuActivity = new
Intent(MenuActivity.this,ExpiredMenuActivity.class);
startActivity(goToExpiredMenuActivity);
}
});

}
}

Code for Add items:

package unity.universityfinalproject.dailystockcontroller;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.service.autofill.RegexValidator;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.basgeekball.awesomevalidation.AwesomeValidation;
import com.basgeekball.awesomevalidation.ValidationStyle;
import com.basgeekball.awesomevalidation.utility.RegexTemplate;
import com.google.android.material.floatingactionbutton.FloatingActionButton;

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 107
DAILY STOCK CONTROLLER
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;

public class AddActivity extends AppCompatActivity {


//Image scanner
ImageView scanToAdd;
EditText addBarcode, product_name_Input, description_Input,
purchased_price_Input, sales_price_Input, category_Input,
supplier_name_Input,
supplier_phone_Input, exp_date_Input;
TextView item_status;
FloatingActionButton addDoneBtn;
AwesomeValidation awesomeValidation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add);
ImageScannerToAdd();
scanToAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
scanCode();
}
});
//add to database
addDoneBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

if(awesomeValidation.validate()){
MyDatabaseHelper myDB = new MyDatabaseHelper(AddActivity.this);

myDB.addItemTomyDB(product_name_Input.getText().toString().trim(),
Long.parseLong(addBarcode.getText().toString().trim()),
description_Input.getText().toString().trim(),
category_Input.getText().toString().trim(),

Float.parseFloat(purchased_price_Input.getText().toString().trim()),

Float.parseFloat(sales_price_Input.getText().toString().trim()),
item_status.getText().toString().trim(),
supplier_name_Input.getText().toString().trim(),

Long.parseLong(supplier_phone_Input.getText().toString().trim()),

Long.parseLong(exp_date_Input.getText().toString().trim()));

Intent intent = new Intent(AddActivity.this, MenuActivity.class);


startActivity(intent);
finish();
}else
{
Toast.makeText(AddActivity.this,"Please fill all all required
information",Toast.LENGTH_SHORT).show();
}

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 108
DAILY STOCK CONTROLLER

});

}
void ImageScannerToAdd(){
addDoneBtn = findViewById(R.id.addDonebtnOk);
scanToAdd = findViewById(R.id.ScanToAddImage);
addBarcode = findViewById(R.id.AddBarcodeEditText);
product_name_Input = findViewById(R.id.editProduct_name);
description_Input = findViewById(R.id.editDesc);
purchased_price_Input = findViewById(R.id.editPurch_Price);
sales_price_Input = findViewById(R.id.editSell_Price);
category_Input = findViewById(R.id.editCategory);
supplier_name_Input = findViewById(R.id.editSupplier_Name);
supplier_phone_Input = findViewById(R.id.editSupplier_Phone);
exp_date_Input = findViewById(R.id.editExp_date);
item_status = findViewById(R.id.item_status_add);

awesomeValidation = new AwesomeValidation(ValidationStyle.BASIC);


awesomeValidation.addValidation(this,R.id.editProduct_name,
RegexTemplate.NOT_EMPTY,R.string.invalid_item_name);
awesomeValidation.addValidation(this,R.id.AddBarcodeEditText,
RegexTemplate.NOT_EMPTY,R.string.invalid_Barcode);
awesomeValidation.addValidation(this,R.id.editDesc,
RegexTemplate.NOT_EMPTY,R.string.invalid_desc);
awesomeValidation.addValidation(this,R.id.editPurch_Price,
RegexTemplate.NOT_EMPTY,R.string.invalid_price);
awesomeValidation.addValidation(this,R.id.editSell_Price,
RegexTemplate.NOT_EMPTY,R.string.invalid_price);
awesomeValidation.addValidation(this,R.id.editCategory,
RegexTemplate.NOT_EMPTY,R.string.invalid_catagory);
awesomeValidation.addValidation(this,R.id.editSupplier_Name,
RegexTemplate.NOT_EMPTY,R.string.invalid_supp_name);
awesomeValidation.addValidation(this,R.id.editSupplier_Phone,
RegexTemplate.NOT_EMPTY,R.string.invalid_Supp_phone);
awesomeValidation.addValidation(this,R.id.editExp_date,
RegexTemplate.NOT_EMPTY,R.string.invalid_exp);

private void scanCode() {

IntentIntegrator integrator = new IntentIntegrator(this);


integrator.setCaptureActivity(CaptureActivity.class);
integrator.setOrientationLocked(false);
integrator.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES);
integrator.setPrompt("Scanning Code");
integrator.initiateScan();

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 109
DAILY STOCK CONTROLLER
data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode,
resultCode, data);
if(result != null){
if(result.getContents() != null){
addBarcode.setText(result.getContents());
}
else
{
Toast.makeText(this,"No Result", Toast.LENGTH_LONG).show();

}
}
else
{
super.onActivityResult(requestCode, resultCode, data);

}
}

Code for Sell items:

package unity.universityfinalproject.dailystockcontroller;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;

import java.util.ArrayList;

public class SellActivity extends AppCompatActivity {


EditText scanResultAndSearch;
TextView dispResultTxt;
ImageView sellScanImage, addToCart, removeToCart;
MyDatabaseHelper myDB;
CustomAdapter customAdapter;

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 110
DAILY STOCK CONTROLLER
//database view
long singId;
long statusId;
ArrayList<String> col_id,
product_name_Input,addBarcode,description_Input,category_Input,purchased_price_Input,
sales_price_Input,item_status,supplier_name_Input,supplier_phone_Input,gen_barcode,
exp_date_Input;
RecyclerView sellRecyclerView;
FloatingActionButton sellDone;
float sellPrice;
float total = 0;
String itemInfo;
String sold = "Sold";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sell);
sellItemScannerActivity();
sellViewId();
addToCart.setVisibility(View.INVISIBLE);
removeToCart.setVisibility(View.INVISIBLE);
sellScanImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { scanCode(); }});

//go to menuActivity
sellViewId();
sellDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToMenuActivity = new
Intent(SellActivity.this,MenuActivity.class);
startActivity(goToMenuActivity);
}
});
addToCart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(scanResultAndSearch.length() == 0 || scanResultAndSearch == null)
{

Toast.makeText(SellActivity.this,"No Item In
Cart",Toast.LENGTH_SHORT).show();

}else{
scanResultAndSearch.getText().clear();
scanResultAndSearch.setText("");
calculateItems();
updateStatus();
addToCart.setVisibility(View.GONE);
removeToCart.setVisibility(View.GONE);
}

}
});

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 111
DAILY STOCK CONTROLLER
removeToCart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(scanResultAndSearch.length() == 0 || scanResultAndSearch == null)
{

Toast.makeText(SellActivity.this,"No Item In
Cart",Toast.LENGTH_SHORT).show();

}else{
scanResultAndSearch.getText().clear();
scanResultAndSearch.setText("");
calculateRemoveItems();
updateRemoveStatus();
addToCart.setVisibility(View.GONE);
removeToCart.setVisibility(View.GONE);
}

}
});
}
void sellItemScannerActivity(){

sellScanImage = findViewById(R.id.sellScanImage);
scanResultAndSearch = findViewById(R.id.scanResultEditText);
addToCart = findViewById(R.id.addToCart);
removeToCart = findViewById(R.id.removeToCart);
dispResultTxt = findViewById(R.id.dispResultTxt);

}
private void scanCode() {

IntentIntegrator integrator = new IntentIntegrator(this);


integrator.setCaptureActivity(CaptureActivity.class);
integrator.setOrientationLocked(false);
integrator.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES);
integrator.setPrompt("Scanning Code");
integrator.initiateScan();

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent
data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode,
resultCode, data);
if(result != null){
if(result.getContents() != null){
scanResultAndSearch.setText(result.getContents());
col_id = new ArrayList<>();
product_name_Input = new ArrayList<>();
addBarcode = new ArrayList<>();
description_Input = new ArrayList<>();

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 112
DAILY STOCK CONTROLLER
category_Input = new ArrayList<>();
purchased_price_Input = new ArrayList<>();
sales_price_Input = new ArrayList<>();
item_status = new ArrayList<>();
supplier_name_Input = new ArrayList<>();
supplier_phone_Input = new ArrayList<>();
gen_barcode = new ArrayList<>();
exp_date_Input = new ArrayList<>();

if(scanResultAndSearch.length() == 0 || scanResultAndSearch == null){


Toast.makeText(SellActivity.this,"first Scan your item barcode
before you search",Toast.LENGTH_SHORT).show();
}
else
{
singId =
Long.parseLong(scanResultAndSearch.getText().toString().trim());
myDB = new MyDatabaseHelper(SellActivity.this);

displaySingleData();
setToRecyclerView();
}
}
else
{
Toast.makeText(this,"No Result", Toast.LENGTH_LONG).show();

}
}
else
{
super.onActivityResult(requestCode, resultCode, data);

}
}

void sellViewId(){
sellRecyclerView = findViewById(R.id.sellRecyclerView);
sellDone = findViewById(R.id.sellDone);

}
void displaySingleData(){

Cursor cursor = myDB.readSingleData(singId);


if (cursor.getCount() == 0){
addToCart.setVisibility(View.INVISIBLE);
removeToCart.setVisibility(View.INVISIBLE);
Toast.makeText(this,"No data",Toast.LENGTH_SHORT).show();
}else {
while (cursor.moveToNext()){
col_id.add((cursor.getString(0)));
product_name_Input.add(cursor.getString(1));
addBarcode.add(cursor.getString(2));
statusId = Long.parseLong(cursor.getString(2));
description_Input.add(cursor.getString(3));

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 113
DAILY STOCK CONTROLLER
category_Input.add(cursor.getString(4));
purchased_price_Input.add(cursor.getString(5));
sales_price_Input.add(cursor.getString(6));
sellPrice = Float.parseFloat(cursor.getString(6));
item_status.add(cursor.getString(7));
itemInfo = String.valueOf(cursor.getString(7));
supplier_name_Input.add(cursor.getString(8));
supplier_phone_Input.add(cursor.getString(9));
gen_barcode.add(cursor.getString(10));
exp_date_Input.add(cursor.getString(11));
if(itemInfo.equals(sold)){
addToCart.setVisibility(View.INVISIBLE);
removeToCart.setVisibility(View.VISIBLE);}
else
{
addToCart.setVisibility(View.VISIBLE);
removeToCart.setVisibility(View.INVISIBLE);
}

}
void setToRecyclerView(){
customAdapter = new CustomAdapter(SellActivity.this,this,col_id,
product_name_Input,addBarcode,description_Input,category_Input,purchased_price_Input,
sales_price_Input,item_status,supplier_name_Input,supplier_phone_Input,gen_barcode,ex
p_date_Input);
sellRecyclerView.setAdapter(customAdapter);
sellRecyclerView.setLayoutManager(new
LinearLayoutManager(SellActivity.this));
}
void calculateItems(){
float result = Float.parseFloat(dispResultTxt.getText().toString());
total = result + sellPrice;
dispResultTxt.setText(String.valueOf(total));
}

void updateStatus(){
MyDatabaseHelper myDB = new MyDatabaseHelper(SellActivity.this);
myDB.updateItem(statusId);
}
void calculateRemoveItems(){
float result = Float.parseFloat(dispResultTxt.getText().toString());
total = result - sellPrice;
dispResultTxt.setText(String.valueOf(total));
}
void updateRemoveStatus(){
MyDatabaseHelper myDB = new MyDatabaseHelper(SellActivity.this);
myDB.updateAvaliableItem(statusId);
}
}

Code for All items, Available items, Sold items:

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 114
DAILY STOCK CONTROLLER

package unity.universityfinalproject.dailystockcontroller;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;

public class AllProductActivity extends AppCompatActivity {


RecyclerView itemsRecycler4;
MyDatabaseHelper myDB;
ArrayList<String> col_id,
product_name_Input,addBarcode,description_Input,category_Input,purchased_price_Input,
sales_price_Input,item_status,supplier_name_Input,supplier_phone_Input,gen_barcode,
exp_date_Input;
CustomAdapter customAdapter;
TextView expiredCounterTxt4, lossBirrCounterTxt4, lossProfitCounterTxt4,
expsoldTxt4, currentTimeTxt4;
long currentDate, fixedDate;
float purchBirr,soldBirr,purchLoss;
float total = 0;
float lossTotal = 0;
float profitTotal = 0;
float profitResult = 0;
String soldCounter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_all_product);

expiredCounterTxt4 = findViewById(R.id.expiredCounterTxt4);
lossBirrCounterTxt4 = findViewById(R.id.lossBirrCounterTxt4);
lossProfitCounterTxt4 = findViewById(R.id.lossProfitCounterTxt4);
expsoldTxt4 = findViewById(R.id.expsoldTxt4);
currentTimeTxt4 = findViewById(R.id.currentTimeTxt4);

myDB = new MyDatabaseHelper(AllProductActivity.this);


col_id = new ArrayList<>();
product_name_Input = new ArrayList<>();
addBarcode = new ArrayList<>();
description_Input = new ArrayList<>();
category_Input = new ArrayList<>();
purchased_price_Input = new ArrayList<>();
sales_price_Input = new ArrayList<>();
item_status = new ArrayList<>();
supplier_name_Input = new ArrayList<>();
supplier_phone_Input = new ArrayList<>();

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 115
DAILY STOCK CONTROLLER
gen_barcode = new ArrayList<>();
exp_date_Input = new ArrayList<>();

dispAllItemDataToRec();
dispAllProfitItem();
expiredCounterTxt4.setText(soldCounter);
itemsRecycler4 = findViewById(R.id.dispAllRecycler);
customAdapter = new CustomAdapter(AllProductActivity.this,this,col_id,
product_name_Input,addBarcode,description_Input,category_Input,purchased_price_Input,
sales_price_Input,item_status,supplier_name_Input,supplier_phone_Input,gen_barcode,ex
p_date_Input);
itemsRecycler4.setAdapter(customAdapter);
itemsRecycler4.setLayoutManager(new
LinearLayoutManager(AllProductActivity.this));

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent
data) {
super.onActivityResult(requestCode, resultCode, data);

if(requestCode == 1){
recreate();
}
}

void dispAllItemDataToRec(){
Cursor cursor = myDB.readAllData();
if(cursor.getCount() == 0) {

Toast.makeText(this,"No data.",Toast.LENGTH_SHORT).show();
}
else{
while (cursor.moveToNext()){
col_id.add((cursor.getString(0)));
product_name_Input.add(cursor.getString(1));
addBarcode.add(cursor.getString(2));
description_Input.add(cursor.getString(3));
category_Input.add(cursor.getString(4));
purchased_price_Input.add(cursor.getString(5));
purchBirr = Float.parseFloat(cursor.getString(5));
purchLoss = Float.parseFloat(cursor.getString(5));
sales_price_Input.add(cursor.getString(6));
soldBirr = Float.parseFloat(cursor.getString(6));
item_status.add(cursor.getString(7));
supplier_name_Input.add(cursor.getString(8));
supplier_phone_Input.add(cursor.getString(9));
gen_barcode.add(cursor.getString(10));
exp_date_Input.add(cursor.getString(11));
soldCounter = String.valueOf(cursor.getCount());
calculateAllItems();
}
}
}

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 116
DAILY STOCK CONTROLLER
void calculateAllItems(){

float lossResult =
Float.parseFloat(lossBirrCounterTxt4.getText().toString());
lossTotal = lossResult + soldBirr;
lossBirrCounterTxt4.setText(String.valueOf(lossTotal));

float resultProfit =
Float.parseFloat(lossProfitCounterTxt4.getText().toString());
profitTotal =resultProfit + purchLoss;
lossProfitCounterTxt4.setText(String.valueOf(profitTotal));

}
void dispAllProfitItem(){
profitResult = Float.parseFloat(lossBirrCounterTxt4.getText().toString()) -
Float.parseFloat(lossProfitCounterTxt4.getText().toString());
lossProfitCounterTxt4.setText(String.valueOf(profitResult));
}

Code for Identical items:

package unity.universityfinalproject.dailystockcontroller;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class CounterMenuActivity extends AppCompatActivity {


Button goToSoldItems,goToAvailableItems;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_counter_menu);

goToSoldItems = findViewById(R.id.goToSoldItems);
goToSoldItems.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToSoldActivity = new
Intent(CounterMenuActivity.this,SoldItemsCounterActivity.class);
startActivity(goToSoldActivity);
}
});
goToAvailableItems = findViewById(R.id.goToAvailableItems);
goToAvailableItems.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 117
DAILY STOCK CONTROLLER
Intent goToAvailableActivity = new
Intent(CounterMenuActivity.this,AvailableItemsCounterActivity.class);
startActivity(goToAvailableActivity);
}
});
}
}

Code for available In items and Sold Out items:

package unity.universityfinalproject.dailystockcontroller;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.zxing.integration.android.IntentIntegrator;
import com.google.zxing.integration.android.IntentResult;

import java.util.ArrayList;

public class AvailableItemsCounterActivity extends AppCompatActivity {

RecyclerView unsoldItemRecyclerView;
EditText unsoldItemEdit;
ImageView unsoldItemScanImg;
TextView itemCounterTxt2, birrCounterTxt2, catagoryTxt2, profitCounterTxt2;
long singId2, soldsingleId2;
long statusId2;
float total = 0;
float profitTotal = 0;
float profitResult = 0;
float sellPrice, purchPrice;
String categoryunSold, unsoldCounter;
MyDatabaseHelper myDB;
ArrayList<String> col_id,
product_name_Input,addBarcode,description_Input,category_Input,purchased_price_Input,
sales_price_Input,item_status,supplier_name_Input,supplier_phone_Input,gen_barcode,
exp_date_Input;
CustomAdapter customAdapter;

@Override

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 118
DAILY STOCK CONTROLLER
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_available_items_counter);

soldItemsId();
unsoldItemScanImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) { scanSoldCode(); }});

}
void soldItemsId(){
unsoldItemRecyclerView = findViewById(R.id.soldItemRecyclerView2);
unsoldItemEdit = findViewById(R.id.soldItemEdit2);
unsoldItemScanImg = findViewById(R.id.soldItemScanImg2);
itemCounterTxt2 = findViewById(R.id.itemCounterTxt2);
birrCounterTxt2 = findViewById(R.id.birrCounterTxt2);
catagoryTxt2 = findViewById(R.id.catagoryTxt2);
profitCounterTxt2 = findViewById(R.id.profitCounterTxt2);
}
void unsoldRecyclerView(){
customAdapter = new
CustomAdapter(AvailableItemsCounterActivity.this,this,col_id,
product_name_Input,addBarcode,description_Input,category_Input,purchased_price_Input,
sales_price_Input,item_status,supplier_name_Input,supplier_phone_Input,gen_barcode,ex
p_date_Input);
unsoldItemRecyclerView.setAdapter(customAdapter);
unsoldItemRecyclerView.setLayoutManager(new
LinearLayoutManager(AvailableItemsCounterActivity.this));
}
void displayUnsoldData(){

Cursor cursor = myDB.readSingleData(singId2);


if (cursor.getCount() == 0){
Toast.makeText(this,"No data",Toast.LENGTH_SHORT).show();
}else {
while (cursor.moveToNext()){

categoryunSold = cursor.getString(4);

}
void displayUpdateUnsoldData(){

Cursor cursor = myDB.readUnsoldData(categoryunSold);


if (cursor.getCount() == 0){
Toast.makeText(this,"No data",Toast.LENGTH_SHORT).show();
}else {
while (cursor.moveToNext()){
col_id.add((cursor.getString(0)));
product_name_Input.add(cursor.getString(1));
addBarcode.add(cursor.getString(2));
statusId2 = Long.parseLong(cursor.getString(2));

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 119
DAILY STOCK CONTROLLER
description_Input.add(cursor.getString(3));
category_Input.add(cursor.getString(4));
purchased_price_Input.add(cursor.getString(5));
purchPrice = Float.parseFloat(cursor.getString(5));
sales_price_Input.add(cursor.getString(6));
sellPrice = Float.parseFloat(cursor.getString(6));
item_status.add(cursor.getString(7));
supplier_name_Input.add(cursor.getString(8));
supplier_phone_Input.add(cursor.getString(9));
gen_barcode.add(cursor.getString(10));
exp_date_Input.add(cursor.getString(11));
unsoldCounter = String.valueOf(cursor.getCount());

calculateUnsoldItems();
}

}
}
private void scanSoldCode() {

IntentIntegrator integrator = new IntentIntegrator(this);


integrator.setCaptureActivity(CaptureActivity.class);
integrator.setOrientationLocked(false);
integrator.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES);
integrator.setPrompt("Scanning Code");
integrator.initiateScan();

}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent
data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode,
resultCode, data);
if(result != null){
if(result.getContents() != null){
unsoldItemEdit.setText(result.getContents());
col_id = new ArrayList<>();
product_name_Input = new ArrayList<>();
addBarcode = new ArrayList<>();
description_Input = new ArrayList<>();
category_Input = new ArrayList<>();
purchased_price_Input = new ArrayList<>();
sales_price_Input = new ArrayList<>();
item_status = new ArrayList<>();
supplier_name_Input = new ArrayList<>();
supplier_phone_Input = new ArrayList<>();
gen_barcode = new ArrayList<>();
exp_date_Input = new ArrayList<>();

if(unsoldItemEdit.length() == 0 || unsoldItemEdit == null){


Toast.makeText(AvailableItemsCounterActivity.this,"Scanner result
is empty",Toast.LENGTH_SHORT).show();
}
else
{

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 120
DAILY STOCK CONTROLLER
singId2 =
Long.parseLong(unsoldItemEdit.getText().toString().trim());
myDB = new MyDatabaseHelper(AvailableItemsCounterActivity.this);
displayUnsoldData();
displayUpdateUnsoldData();
ProfitUnsoldItem();
unsoldRecyclerView();
itemCounterTxt2.setText(unsoldCounter);
catagoryTxt2.setText(categoryunSold);
unsoldItemScanImg.setVisibility(View.INVISIBLE);
unsoldItemEdit.setVisibility(View.INVISIBLE);
}
}
else
{
Toast.makeText(this,"No Result", Toast.LENGTH_LONG).show();

}
}
else
{
super.onActivityResult(requestCode, resultCode, data);

}
}
void calculateUnsoldItems(){
float result = Float.parseFloat(birrCounterTxt2.getText().toString());
total = result + sellPrice;
birrCounterTxt2.setText(String.valueOf(total));

float resultPtofit =
Float.parseFloat(profitCounterTxt2.getText().toString());
profitTotal = resultPtofit + purchPrice;
profitCounterTxt2.setText(String.valueOf(profitTotal));
}
void ProfitUnsoldItem(){
profitResult = Float.parseFloat(birrCounterTxt2.getText().toString()) -
Float.parseFloat(profitCounterTxt2.getText().toString());
profitCounterTxt2.setText(String.valueOf(profitResult));
}
}

Code for expired date:

package unity.universityfinalproject.dailystockcontroller;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class ExpiredMenuActivity extends AppCompatActivity {

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 121
DAILY STOCK CONTROLLER
Button expiredItemBtn, lessThreeMonthBtn, lessSixMonthBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_expired_menu);
expiredItemBtn = findViewById(R.id.expiredItemBtn);
expiredItemBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToExpiredDateActivity = new Intent(ExpiredMenuActivity.this,
ExpiredDateActivity.class);
startActivity(goToExpiredDateActivity);
}
});
lessThreeMonthBtn = findViewById(R.id.threeMonthBtn);
lessThreeMonthBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToLessThanThreeActivity = new
Intent(ExpiredMenuActivity.this,LessThanThreeActivity.class);
startActivity(goToLessThanThreeActivity);
}
});
lessSixMonthBtn = findViewById(R.id.sixMonthBtn);
lessSixMonthBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToLessThanSixActivity = new
Intent(ExpiredMenuActivity.this,LessThanSixActivity.class);
startActivity(goToLessThanSixActivity);
}
});
}
}

Code for Expired items, Less than 3 month to expire and Less than 6
month to expire:

package unity.universityfinalproject.dailystockcontroller;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.database.Cursor;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 122
DAILY STOCK CONTROLLER
import java.util.Locale;

public class ExpiredDateActivity extends AppCompatActivity {


RecyclerView expiredItemsRecycler;
MyDatabaseHelper myDB;
ArrayList<String> col_id,
product_name_Input,addBarcode,description_Input,category_Input,purchased_price_Input,
sales_price_Input,item_status,supplier_name_Input,supplier_phone_Input,gen_barcode,
exp_date_Input;
CustomAdapter customAdapter;
TextView expiredCounterTxt, lossBirrCounterTxt, lossProfitCounterTxt, expsoldTxt,
currentTimeTxt;
long currentDate;
float purchBirr,soldBirr,purchLoss;
float total = 0;
float lossTotal = 0;
float profitTotal = 0;
float profitResult = 0;
String soldCounter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_expired_date);
expiredItemsRecycler = findViewById(R.id.expiredItemsRecycler);
expiredCounterTxt = findViewById(R.id.expiredCounterTxt);
lossBirrCounterTxt = findViewById(R.id.lossBirrCounterTxt);
lossProfitCounterTxt = findViewById(R.id.lossProfitCounterTxt);
expsoldTxt = findViewById(R.id.expsoldTxt);
currentTimeTxt = findViewById(R.id.currentTimeTxt);
dispDate();
myDB = new MyDatabaseHelper(ExpiredDateActivity.this);
col_id = new ArrayList<>();
product_name_Input = new ArrayList<>();
addBarcode = new ArrayList<>();
description_Input = new ArrayList<>();
category_Input = new ArrayList<>();
purchased_price_Input = new ArrayList<>();
sales_price_Input = new ArrayList<>();
item_status = new ArrayList<>();
supplier_name_Input = new ArrayList<>();
supplier_phone_Input = new ArrayList<>();
gen_barcode = new ArrayList<>();
exp_date_Input = new ArrayList<>();

expiredItemDataToRec();
lossProfitExpiredItem();
expiredCounterTxt.setText(soldCounter);
expiredItemsRecycler = findViewById(R.id.expiredItemsRecycler);
customAdapter = new CustomAdapter(ExpiredDateActivity.this,this,col_id,
product_name_Input,addBarcode,description_Input,category_Input,purchased_price_Input,
sales_price_Input,item_status,supplier_name_Input,supplier_phone_Input,gen_barcode,ex
p_date_Input);
expiredItemsRecycler.setAdapter(customAdapter);
expiredItemsRecycler.setLayoutManager(new
LinearLayoutManager(ExpiredDateActivity.this));

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 123
DAILY STOCK CONTROLLER

}
void expiredItemDataToRec(){
Cursor cursor = myDB.readExpiredData(currentDate);
if(cursor.getCount() == 0) {

Toast.makeText(this,"No data.",Toast.LENGTH_SHORT).show();
}
else{
while (cursor.moveToNext()){
col_id.add((cursor.getString(0)));
product_name_Input.add(cursor.getString(1));
addBarcode.add(cursor.getString(2));
description_Input.add(cursor.getString(3));
category_Input.add(cursor.getString(4));
purchased_price_Input.add(cursor.getString(5));
purchBirr = Float.parseFloat(cursor.getString(5));
purchLoss = Float.parseFloat(cursor.getString(5));
sales_price_Input.add(cursor.getString(6));
soldBirr = Float.parseFloat(cursor.getString(6));
item_status.add(cursor.getString(7));
supplier_name_Input.add(cursor.getString(8));
supplier_phone_Input.add(cursor.getString(9));
gen_barcode.add(cursor.getString(10));
exp_date_Input.add(cursor.getString(11));
soldCounter = String.valueOf(cursor.getCount());
calculateExpiredItems();
}
}
}
void calculateExpiredItems(){

float lossResult = Float.parseFloat(lossBirrCounterTxt.getText().toString());


lossTotal = lossResult + purchBirr;
lossBirrCounterTxt.setText(String.valueOf(lossTotal));

float resultProfit =
Float.parseFloat(lossProfitCounterTxt.getText().toString());
profitTotal =resultProfit + purchLoss;
lossProfitCounterTxt.setText(String.valueOf(profitTotal));

float result = Float.parseFloat(expsoldTxt.getText().toString());


total = result + soldBirr;
expsoldTxt.setText(String.valueOf(total));

}
void lossProfitExpiredItem(){
profitResult = Float.parseFloat(expsoldTxt.getText().toString()) -
Float.parseFloat(lossProfitCounterTxt.getText().toString());
lossProfitCounterTxt.setText(String.valueOf(profitResult));
}

void dispDate(){
Date c = Calendar.getInstance().getTime();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 124
DAILY STOCK CONTROLLER
String formattedData = df.format(c);
currentTimeTxt.setText(formattedData);
currentDate = Long.parseLong(currentTimeTxt.getText().toString());

}
}

Code for Generate barcode menu:


package unity.universityfinalproject.dailystockcontroller;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class BarcodeGenActivity extends AppCompatActivity {


ImageView barcodeGenImg, QR codeGenImg;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_barcode_gen);
barcodeGenImg = findViewById(R.id.barcodeGenImg);
QR codeGenImg = findViewById(R.id.QR codeGenImg);
barcodeGenImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToBarcodeGen = new
Intent(BarcodeGenActivity.this,BarcodeGen.class);
startActivity(goToBarcodeGen);
}
});
QR codeGenImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent goToQR codeGen = new Intent(BarcodeGenActivity.this, QR
codeGen.class);
startActivity(goToQR codeGen);
}
});

}
}

Code for barcode Generator:


package unity.universityfinalproject.dailystockcontroller;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 125
DAILY STOCK CONTROLLER
import android.Manifest;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.journeyapps.barcodescanner.BarcodeEncoder;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;

public class BarcodeGen extends AppCompatActivity {


TextView notificationTxt, barGentxt;
EditText editBarNum;
ImageView barGenImg;
Button genBarcodeButton;
OutputStream outputStream;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.barcode_gen);
ActivityCompat.requestPermissions(BarcodeGen.this, new String[]
{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
ActivityCompat.requestPermissions(BarcodeGen.this, new String[]
{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
barcodeViewId();
genBarcodeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
notificationTxt.setVisibility(View.VISIBLE);

if (editBarNum.getText().toString().trim().length() > 0) {

Integer no = Integer.parseInt(editBarNum.getText().toString());
StringBuilder ans = new StringBuilder();
for (int i = 1; i <= no; i++) {
randomNumGen();
getCode();
saveToInternalDisk();
ans.append(i + "\n");
if (i == no) {

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 126
DAILY STOCK CONTROLLER
Toast.makeText(getApplicationContext(), i+" Barcode
Image's Saved to Internal Storage", Toast.LENGTH_SHORT).show();
editBarNum.setText("");
notificationTxt.setText(i+" Barcode Image's generated
successfully,you can get it in internal storage folder name Suqepad");
} else {
}
}

//textLoop.setText(ans);
}
else{
Toast.makeText(getApplicationContext(), "Please fill the blank
text ", Toast.LENGTH_LONG).show();

}
});
}
void barcodeViewId(){
notificationTxt = findViewById(R.id.notificationTxt);
editBarNum =findViewById(R.id.editBarNum);
barGentxt = findViewById(R.id.barGentxt);
barGenImg = findViewById(R.id.barGenImg);
genBarcodeButton = findViewById(R.id.genBarcodeButton);
}
void randomNumGen(){
Random random = new Random();
int number = random.nextInt(1000000000)+1;
barGentxt.setText(String.valueOf(number));
}
private void getCode() {

try{
barcode();
}catch (Exception e)
{
e.printStackTrace();
}

}
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();

private void barcode() throws WriterException {


BitMatrix bitMatrix =
multiFormatWriter.encode(barGentxt.getText().toString(),
BarcodeFormat.CODE_128,400,170,null);
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
Bitmap bitmap = barcodeEncoder.createBitmap(bitMatrix);
barGenImg.setImageBitmap(bitmap);
}

void saveToInternalDisk(){

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 127
DAILY STOCK CONTROLLER
BitmapDrawable drawable = (BitmapDrawable) barGenImg.getDrawable();
Bitmap bitmap = drawable.getBitmap();

File filepath = Environment.getExternalStorageDirectory();


File dir = new File(filepath.getAbsolutePath()+"/SuqePad/");
dir.mkdir();
File file = new File(dir,System.currentTimeMillis()+".jpg");
try {
outputStream = new FileOutputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
bitmap.compress(Bitmap.CompressFormat.JPEG,100,outputStream);
try {
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

Code for QR code Generator:


package unity.universityfinalproject.dailystockcontroller;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import android.Manifest;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.journeyapps.barcodescanner.BarcodeEncoder;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 128
DAILY STOCK CONTROLLER
import java.util.Random;

public class QR codeGen extends AppCompatActivity {


TextView notificationQRTxt, qrGentxt;
EditText editQRNum;
ImageView qrGenImg;
Button genQR codeButton;
OutputStream outputStream;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.barcode_gen);
ActivityCompat.requestPermissions(QR codeGen.this, new String[]
{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
ActivityCompat.requestPermissions(QR codeGen.this, new String[]
{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
barcodeViewId();
genQR codeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
notificationQRTxt.setVisibility(View.VISIBLE);

if (editQRNum.getText().toString().trim().length() > 0) {

Integer no = Integer.parseInt(editQRNum.getText().toString());
StringBuilder ans = new StringBuilder();
for (int i = 1; i <= no; i++) {
randomNumGen();
getCode();
saveToInternalDisk();
ans.append(i + "\n");
if (i == no) {
Toast.makeText(getApplicationContext(), i+" QR code
Image's Saved to Internal Storage", Toast.LENGTH_SHORT).show();
editQRNum.setText("");
notificationQRTxt.setText(i+" QR code Image's generated
successfully,you can get it in internal storage folder name Suqepad");
} else {
}
}

//textLoop.setText(ans);
}
else{
Toast.makeText(getApplicationContext(), "Please fill the blank
text ", Toast.LENGTH_LONG).show();

}
});
}
void barcodeViewId(){
notificationQRTxt = findViewById(R.id.notificationTxt);
editQRNum =findViewById(R.id.editBarNum);

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 129
DAILY STOCK CONTROLLER
qrGentxt = findViewById(R.id.barGentxt);
qrGenImg = findViewById(R.id.barGenImg);
genQR codeButton = findViewById(R.id.genBarcodeButton);
}
void randomNumGen(){
Random random = new Random();
int number = random.nextInt(1000000000)+1;
qrGentxt.setText(String.valueOf(number));
}
private void getCode() {

try{
QR code();
}catch (Exception e)
{
e.printStackTrace();
}

}
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();

private void QR code() throws WriterException {


BitMatrix bitMatrix = multiFormatWriter.encode(qrGentxt.getText().toString(),
BarcodeFormat.QR_CODE, 350,300);
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
Bitmap bitmap = barcodeEncoder.createBitmap(bitMatrix);
qrGenImg.setImageBitmap(bitmap);
}

void saveToInternalDisk(){

BitmapDrawable drawable = (BitmapDrawable) qrGenImg.getDrawable();


Bitmap bitmap = drawable.getBitmap();

File filepath = Environment.getExternalStorageDirectory();


File dir = new File(filepath.getAbsolutePath()+"/SuqePad/");
dir.mkdir();
File file = new File(dir,System.currentTimeMillis()+".jpg");
try {
outputStream = new FileOutputStream(file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
bitmap.compress(Bitmap.CompressFormat.JPEG,100,outputStream);
try {
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
try {
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 130
DAILY STOCK CONTROLLER
}
}

Code for MyDatabaseHelper:


package unity.universityfinalproject.dailystockcontroller;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.ContactsContract;
import android.widget.Toast;

import androidx.annotation.Nullable;

import java.text.SimpleDateFormat;

public class MyDatabaseHelper extends SQLiteOpenHelper {

private Context context;


private static final String DATABASE_NAME = "AllStock.db";
private static final int DATABASE_VERSION = 1;

//login table
private static final String TABLE_REGISTER = "My_Login";
private static final String COLUMN_1_ID = "_ID";
private static final String COLUMN_2_USER = "username";
private static final String COLUMN_3_PASSWORD = "Password";
//stock data table
private static final String TABLE_STOCK = "My_Stock";
private static final String COL_1_ID = "_IDno";
private static final String COL_2_PROD_NAME = "Product_name";
private static final String COL_3_BARCODE = "Barcode";
private static final String COL_4_DESC = "Description";
private static final String COL_5_CATEGORY = "Category";
private static final String COL_6_PURC_PRICE = "Purchased_Price";
private static final String COL_7_SALE_PRICE = "Sales_Price";
private static final String COL_8_ITEM_STATUS = "Item_Status";
private static final String COL_9_SEPP_NAME = "Supplier_Name";
private static final String COL_10_SEPP_PHONE = "Supplier_phone";
private static final String COL_11_GEN_BAR= "Gen_Barcode";
private static final String COL_12_EXP_DATE= "Exp_Date";

MyDatabaseHelper(@Nullable Context context) {


super(context, DATABASE_NAME, null, DATABASE_VERSION);
this.context = context;
}

@Override
public void onCreate(SQLiteDatabase db) {
// Create table for registration

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 131
DAILY STOCK CONTROLLER
String query = "CREATE TABLE " + TABLE_REGISTER +
" (" + COLUMN_1_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
COLUMN_2_USER + " TEXT, " +
COLUMN_3_PASSWORD + " TEXT);";
//create table for stock data
String stockData = "CREATE TABLE " + TABLE_STOCK + " (" + COL_1_ID + " INTEGER
PRIMARY KEY AUTOINCREMENT, " +
COL_2_PROD_NAME + " TEXT, " +
COL_3_BARCODE + " TEXT, " +
COL_4_DESC + " TEXT, " +
COL_5_CATEGORY + " TEXT, " +
COL_6_PURC_PRICE + " TEXT, " +
COL_7_SALE_PRICE + " TEXT, " +
COL_8_ITEM_STATUS + " TEXT, " +
COL_9_SEPP_NAME + " TEXT," +
COL_10_SEPP_PHONE + " TEXT, " +
COL_11_GEN_BAR + " TEXT, " +
COL_12_EXP_DATE + " Text);";
db.execSQL(query);
db.execSQL(stockData);

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

db.execSQL("DROP TABLE IF EXISTS " + TABLE_REGISTER);


db.execSQL("DROP TABLE IF EXISTS " + TABLE_STOCK);
onCreate(db);

}
public long addUser(String user, String password){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("username", user);
contentValues.put("Password", password);
long result = db.insert(TABLE_REGISTER, null, contentValues);
db.close();
return result;
}
public boolean checkUser(String username, String password){
String[] columns = {COLUMN_1_ID};
SQLiteDatabase db = getReadableDatabase();
String selection = COLUMN_2_USER + "=?" + " and " + COLUMN_3_PASSWORD +
"=?";
String[] selectionArgs = {username, password };
Cursor cursor =
db.query(TABLE_REGISTER,columns,selection,selectionArgs,null,null,null,null);
int count = cursor.getCount();
cursor.close();
db.close();
if(count > 0){
return true;
}else{
return false;

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 132
DAILY STOCK CONTROLLER
}
}
Cursor readRegisterUser(){
String query = "SELECT * FROM " + TABLE_REGISTER;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = null;

if (db != null) {
cursor = db.rawQuery(query, null);
}
return cursor;
}

void addItemTomyDB(String product_name_Input, Long addBarcode, String


description_Input, String category_Input,
float purchased_price_Input, float sales_price_Input,
String item_status, String supplier_name_Input, Long supplier_phone_Input,
Long exp_date_Input){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues cv = new ContentValues();

cv.put(COL_2_PROD_NAME, product_name_Input);
cv.put(COL_3_BARCODE, addBarcode);
cv.put(COL_4_DESC, description_Input);
cv.put(COL_5_CATEGORY, category_Input);
cv.put(COL_6_PURC_PRICE, purchased_price_Input);
cv.put(COL_7_SALE_PRICE, sales_price_Input);
cv.put(COL_8_ITEM_STATUS, item_status);
cv.put(COL_9_SEPP_NAME, supplier_name_Input);
cv.put(COL_10_SEPP_PHONE, supplier_phone_Input);
// cv.put(COL_11_GEN_BAR, gen_barcode);
cv.put(COL_12_EXP_DATE, exp_date_Input);

long result = db.insert(TABLE_STOCK,null, cv);

if(result == -1) {
Toast.makeText(context, "Failed to add", Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(context, "Added Successfully!", Toast.LENGTH_SHORT).show();

Cursor readAllData(){
String query = "SELECT * FROM " + TABLE_STOCK;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = null;

if (db != null) {
cursor = db.rawQuery(query, null);
}
return cursor;
}
Cursor readSingleData(long singId){

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 133
DAILY STOCK CONTROLLER
String query = "SELECT * FROM " + TABLE_STOCK + " WHERE " + COL_3_BARCODE + "
= '"+ singId + "'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query,null);

return cursor;

}
Cursor readSoldData(String categorySold){
String query = "SELECT * FROM " + TABLE_STOCK + " WHERE " + COL_5_CATEGORY +
" = '"+ categorySold +"' " + "AND " + COL_8_ITEM_STATUS + " = 'Sold'" ;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query,null);

return cursor;

}
Cursor readUnsoldData(String categorySold){
String query = "SELECT * FROM " + TABLE_STOCK + " WHERE " + COL_5_CATEGORY +
" = '"+ categorySold +"' " + "AND " + COL_8_ITEM_STATUS + " = 'available'" ;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query,null);

return cursor;

}
Cursor readExpiredData(long currentDate){
String query = "SELECT * FROM " + TABLE_STOCK + " WHERE " + COL_12_EXP_DATE +
" <= '"+ currentDate +"' " + "AND " + COL_8_ITEM_STATUS + " = 'available'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query,null);

return cursor;

}
Cursor readLessThreeData(long currentDate, long fixedDate){
String query = "SELECT * FROM " + TABLE_STOCK + " WHERE " + COL_12_EXP_DATE +
" >= '"+ fixedDate +"' " + "AND " + COL_8_ITEM_STATUS + " = 'available' " + "AND " +
COL_12_EXP_DATE + " <= '"+ currentDate +"'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query,null);

return cursor;

}
Cursor readLessSixData(long currentDate, long fixedDate){
String query = "SELECT * FROM " + TABLE_STOCK + " WHERE " + COL_12_EXP_DATE +
" >= '"+ fixedDate +"' " + "AND " + COL_8_ITEM_STATUS + " = 'available' " + "AND " +
COL_12_EXP_DATE + " <= '"+ currentDate +"'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query,null);

return cursor;

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 134
DAILY STOCK CONTROLLER
}
Cursor readProductInData(){
String query = "SELECT * FROM " + TABLE_STOCK + " WHERE " +
COL_8_ITEM_STATUS + " = 'available'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query,null);

return cursor;

}
Cursor readProductOutData(){
String query = "SELECT * FROM " + TABLE_STOCK + " WHERE " +
COL_8_ITEM_STATUS + " = 'Sold'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(query,null);

return cursor;
}
void updateItem(long statusId) {
SQLiteDatabase db = this.getWritableDatabase();
String query = "UPDATE " + TABLE_STOCK + " SET " + COL_8_ITEM_STATUS + " =
'Sold' "+ "WHERE "+ COL_3_BARCODE + " = '"+ statusId + "'";
db.execSQL(query);

}
void updateAvaliableItem(long statusId) {
SQLiteDatabase db = this.getWritableDatabase();
String query = "UPDATE " + TABLE_STOCK + " SET " + COL_8_ITEM_STATUS + " =
'available' "+ "WHERE "+ COL_3_BARCODE + " = '"+ statusId + "'";
db.execSQL(query);

void updateData(String row_id, String product_name_Inputtxt, String


addBarcodetxt, String description_Inputtxt,
String category_Inputtxt,String purchased_price_Inputtxt, String
sales_price_Inputtxt,
String supplier_name_Inputtxt, String supplier_phone_Inputtxt,
String exp_date_Inputtxt) {

SQLiteDatabase db = this.getWritableDatabase();
ContentValues cv = new ContentValues();

cv.put(COL_2_PROD_NAME, product_name_Inputtxt);
cv.put(COL_3_BARCODE, addBarcodetxt);
cv.put(COL_4_DESC, description_Inputtxt);
cv.put(COL_5_CATEGORY, category_Inputtxt);
cv.put(COL_6_PURC_PRICE, purchased_price_Inputtxt);
cv.put(COL_7_SALE_PRICE, sales_price_Inputtxt);
cv.put(COL_9_SEPP_NAME, supplier_name_Inputtxt);
cv.put(COL_10_SEPP_PHONE, supplier_phone_Inputtxt);
cv.put(COL_12_EXP_DATE, exp_date_Inputtxt);

long result = db.update(TABLE_STOCK, cv, "_IDno=?", new String[]{row_id});


if (result == -1) {

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 135
DAILY STOCK CONTROLLER
Toast.makeText(context, "Failed", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(context, "Updated Successfully!",
Toast.LENGTH_SHORT).show();
}
}
}

Conclusions
To conclude, Daily Stock Controller is simple android based application basically suitable for
small organization. It has every basic items which are used for the small organization. Our team
is successful in making the application where we can add new items, update sold items status,
generate barcode and QR code as per requirement. This application also provides a simple
report on daily basic to know the daily sales and purchase details.

This application matches for small organization where retailer shop’s. Our team believes that
the implementation of the system will surely benefit the organization.

Recommendations

Since this project was started with very little knowledge about the Inventory Management
System, we came to know about the enhancement capability during the process of building it.
Some of the scope we can increase for the betterment and effectiveness are listed below:
 Use Firebase database to store data in the cloud this prevents data loss when the phone
lost, broken, or Stolen and also allow multiple users to access database.
 Making for IOS phone.
 Add backup and restore
 Making the system flexible in any type.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 136
DAILY STOCK CONTROLLER

Glossary

DSC: - Daily Stock Controller is android based inventory management System.


IMS: - Inventory management system is the process by which you track your goods throughout
your entire supply chain, from purchasing to production to end sales.
Barcode: - barcode or bar code is method of representing data in visual, machine-readable
form. Initially barcodes represented data by varying the width and spacing of parallel lines.
QR code: - A QR code (abbreviated from Quick Response code) is a type of matrix barcode (or
two dimensional barcode) first designed in 1994 for the automotive industry in japan.
SQLite database: - SQLite is a relational database management system contained in a C library.
In contrast to many other database management systems. SQLite is not a client – server
database engine. Rather, it is embedded into the end program.

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 137
DAILY STOCK CONTROLLER

Reference

https://www.tutorialspoint.com/
https://www.javatpoint.com/
https://en.wikipedia.org/
https://www.workbreakdownstructure.com/
https://creately.com/
https://www.geeksforgeeks.org/
https://stackoverflow.com/

August 31, 2020


UNITY UNIVERSITY DESSIE SPECIAL CUMPUS 138

You might also like