Intro

Download as pdf or txt
Download as pdf or txt
You are on page 1of 83

Contents

1 Introduction 1
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 System Analysis 2
2.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.1 Existing System . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.2 Proposed System . . . . . . . . . . . . . . . . . . . . . . . 2
2.2 Problem definition . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3 Feasibility Study . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.3.1 Technical Feasibility . . . . . . . . . . . . . . . . . . . . . 2
2.3.2 Economical Feasibility . . . . . . . . . . . . . . . . . . . . 3
2.3.3 Operational Feasibility . . . . . . . . . . . . . . . . . . . . 3

3 Software Requirement Specification 4


3.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.3 Overall Description . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.3.1 Product Perspective . . . . . . . . . . . . . . . . . . . . . 4
3.3.2 Product Functionality . . . . . . . . . . . . . . . . . . . . 4
3.3.3 Users and Characteristics . . . . . . . . . . . . . . . . . . 4
3.4 Specific Requirements . . . . . . . . . . . . . . . . . . . . . . . . 5
3.4.1 Hardware Requirements . . . . . . . . . . . . . . . . . . . 5
3.4.2 Software Requirements . . . . . . . . . . . . . . . . . . . . 5
3.5 Functional Requirements . . . . . . . . . . . . . . . . . . . . . . . 5
3.6 Non Functional Requirements . . . . . . . . . . . . . . . . . . . . 6
3.7 Interface Requirements . . . . . . . . . . . . . . . . . . . . . . . . 7
3.7.1 Hardware interfaces . . . . . . . . . . . . . . . . . . . . . 7
3.7.2 Software interfaces . . . . . . . . . . . . . . . . . . . . . . 7
3.7.3 Communication interfaces . . . . . . . . . . . . . . . . . . 7
3.8 Security Requirements . . . . . . . . . . . . . . . . . . . . . . . . 7
3.9 Platform Used . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.10 Technologies Used . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4 Design Document 10
4.1 Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.3 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.4 Data Flow Diagram . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.4.1 External source or receiver . . . . . . . . . . . . . . . . . 11
4.4.2 Transform process . . . . . . . . . . . . . . . . . . . . . . 11
4.4.3 Data Store . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.4.4 Data flow . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.5 ER Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.5.1 Cardinality . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.6 Data Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5 Development of the System 18

6 System Testing 19
6.1 Test Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.1.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.1.2 Software risk issues . . . . . . . . . . . . . . . . . . . . . . 20
6.1.3 Features to be tested . . . . . . . . . . . . . . . . . . . . . 20
6.2 Test consolidation . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2.1 Test item . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2.2 Input specifications . . . . . . . . . . . . . . . . . . . . . . 20

7 System Implementation and Maintenance 21


7.1 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.2 Maintenance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.2.1 Corrective Maintenance . . . . . . . . . . . . . . . . . . . 21
7.2.2 Adaptive Maintenance . . . . . . . . . . . . . . . . . . . . 22
7.2.3 Enhanced Maintenance . . . . . . . . . . . . . . . . . . . 22
7.2.4 Preventive Maintenance . . . . . . . . . . . . . . . . . . . 22

8 Future Scope and Conclusion 23


8.1 Future Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.2 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Appendix 24

A Data Flow Diagram 24


A.1 Level 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
A.2 Level 1 - ADMIN . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
A.3 Level 2.1 - SHOPKEEPER . . . . . . . . . . . . . . . . . . . . . 26
A.4 Level 2.2 - USER . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

B Use Case Diagram 28

C ER Diagram 29

D Interfaces 30
D.1 Admin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
D.2 Add User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
D.3 Add Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
D.4 Kit Added . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
D.5 Shopkeeper Approval . . . . . . . . . . . . . . . . . . . . . . . . . 32
D.6 Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
D.7 Application Interface . . . . . . . . . . . . . . . . . . . . . . . . . 34
D.8 Application Login . . . . . . . . . . . . . . . . . . . . . . . . . . 35
D.9 User Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
D.10 OTP Notification . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
D.11 User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
D.12 Booking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
D.13 View Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
D.14 User Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
D.15 Shopkeeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
D.16 Add Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
D.17 Booking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
D.18 Product Purchased . . . . . . . . . . . . . . . . . . . . . . . . . . 45
D.19 Application Logout . . . . . . . . . . . . . . . . . . . . . . . . . . 46

E CODE 47
Christ College(Autonomous) GRABMYRATION

Chapter 1
1 Introduction
This is an android application that helps the users to get the details related
to their ration shop. The users can register with the ration card number and
the account is verified by an OTP send to the linked phone number. Users
can view nearby ration shops and available item’s list that are available for
their ration card. They can select the items from the list to get an estimated
receipt. The users will be notified on the availability of ration kits and on the
last date available to buy them. Users can also book available convenient date
and time slot for buying the items, which will give them a system-generated
token number. This app will really help the people to get details about the
available items in ration shop for them and for not forgetting the special dates
like on which the ration kits are distributed for their card.
.

1.1 Overview
The objective of this Android application is to avoid dealer communication and
to reduces the time spending in the shops.The user and shopkeeper can register
through the application and after the successful approval from admin they can
login to the application. This Application provides the details and price of the
product,details about the kit.This Application includes many functions such as
admin login, shopkeeper login and user login to perform different functions.

Department of Computer Science 1


Christ College(Autonomous) GRABMYRATION

Chapter 2
2 System Analysis
2.1 Purpose
The main purpose of this Application RATION KADA helps the users to get
the details related to their ration shop.Can avoid dealer communication, manual
calculation and it’s reduces the time spending in the shops.
.

2.1.1 Existing System


No existing application like this developed until now.The current existing system
is offline ration purchase.Presently users have to choose the ration shop manual.

2.1.2 Proposed System


We are expected to design and develop any program that works efficiently with-
out any delays.For a convenience and effective purpose admin panel is given in
the website.Gives all the details about the ration shop and the available items
based on their card number .Notify when the product buyed.Get an estimate
receipt with a token number after selecting the items.

2.2 Problem definition


To know what the problem is and what the needs are before developing it. Here
we developed an application RATION KADA to helps the users to know about
their near by ration shops and shopkeeper to add and delete products based on
the availability of them in shop.

2.3 Feasibility Study


After the problem is clearly understood and solutions proposed, the next step
is to conduct the feasibility study. Feasibility study is defined as evaluation
or analysis of the potential impact of the proposed project or program. The
objective is to determine whether the proposed system is feasible. There are
three aspects of feasibility study to which the proposed system is subjected as
discussed below.

2.3.1 Technical Feasibility


Technical feasibility assess whether the current technical resources are sufficient
for the new system. We can upgrade the level of technology for supporting our
website. We check whether the proposed system can be implemented in the
present system without supporting the existing hardware.

Department of Computer Science 2


Christ College(Autonomous) GRABMYRATION

2.3.2 Economical Feasibility


Economic feasibility determines whether the time and money are available to
develop the system. There is no additional hardware used to develop the site,
it is inexpensive to build.

2.3.3 Operational Feasibility


Operational feasibility determines if the human resources are available to oper-
ate the system once it has been installed. No extra training is needed to use
this system. Anyone who has knowledge in internet in english language can
easily use the system. The resources that are required to implement or install
are already available with the organization.

Department of Computer Science 3


Christ College(Autonomous) GRABMYRATION

Chapter 3
3 Software Requirement Specification
3.1 Purpose
The purpose of this document is to give a detailed description of the require-
ments for the application RATION KADA. It illustrate the purpose and com-
plete description for the development of the system. It explain system con-
straints, interface and interactions with other external applications. This doc-
ument is primarily intended to be proposed to a user to know the ration shop
details and shopkeeper to update their product details.

3.2 Scope
Our project has made it easier to the society to avoid the dealer communica-
tion,manual calculation and spending a lot of time in the shop,shopkeeper can
avoid rush in the shops. In the future online payment can also be included.

3.3 Overall Description


This section give an overview of our application, RATION KADA. This system
enables user to register and login from their homes.It also enables user to view
the near by shops and view the products in the shop. User can select the
items and get estimate receipt,and also select the convenient date and time for
the purchase. Admin and shopkeeper are also have role,admin want to add
the user and approve the shopkeeper. Shopkeeper want to add the product
details.Admin,Shopkeeper,User have separate login.

3.3.1 Product Perspective


RATION KADA is mainly used for automating Ration Shop. The application
can used for the whole control of Ration shop . The shopkeeper, user can know
the details about the ration shop.

3.3.2 Product Functionality


Through this application admin can add user,approve shopkeeper,add kit,view
kit and feedback. User can view shop and products,add feedback,view kit.Shopkeeper
can add product,view booking,view kit.

3.3.3 Users and Characteristics


There are three types of people that interact with the application user, shop-
keeper and admin. Each of these have different tasks which is performed. Admin
is able to ,add user,approve user,add kit,view feedback.Shopkeeper can register

Department of Computer Science 4


Christ College(Autonomous) GRABMYRATION

and add product,view booking and view kit.User can select the shop and select
the items.

3.4 Specific Requirements


3.4.1 Hardware Requirements
ˆ Processor : Intel Core i3

ˆ RAM : 4GB

ˆ Speed: Above 1GHz

ˆ Hard Disk : 500GB

ˆ Keyboard: Standard

ˆ Mouse: Standard

3.4.2 Software Requirements


ˆ Operating System:Windows

ˆ Front End : Android (Java)

ˆ Backend : PHP ,MySQL

ˆ IDE : Android Studio

3.5 Functional Requirements


It contains three main modules.

ˆ 1.Admin

ˆ 2.Shopkeeper

ˆ 3.User

Admin
Add users and Approve shopkeepers,Add the details and dates related to the
ration kits,Can view feedbacks from the users.

Shopkeeper
Shop keeper can register to the app using the shop details,Login to the app after
successful approval from the admin,Update all the details about the available
items,View kit details,View the bookings.

Department of Computer Science 5


Christ College(Autonomous) GRABMYRATION

User
The users can register with the ration card number,Users can view nearby ration
shops available item’s list that are available for their ration card,Select the items
from the list to get an estimated receipt,Users can also book a free date and
time,Add feedback to admin.

3.6 Non Functional Requirements


Non-functional requirements define the overall qualities or attributes of the re-
sulting system. Non-functional system place restrictions on the product be-
ing developed, the developed process, and specify external constraints that the
product must meet. Examples of non-functional requirements include safety,
security, usability, reliability and performance requirements. Project manage-
ment issues (costs, time and schedule) are often considered as non-functional
requirements. The principal non - functional constraints which are relevant to
critical systems :
ˆ performance

ˆ security

ˆ safety

ˆ usability

Performance
Performance requirements concern the speed of operation of a system. Types
of performance requirements :

ˆ Response requirements (how quickly the system reacts to a user input).

ˆ Throughput requirements (how much the system can accomplish within a


specified amount of time).
ˆ Availability requirements (is the system available for service when re-
quested by end users). The speed of operation of this system is adequate
for the requirements.
Reliability
ˆ Reliability is the ability of a system to perform its required function under
stated conditions for a specified period of time.

ˆ constraints on the runtime behavior of the system. This system is reliable


because its functionalities can be done on the required conditions.
Safety
Safety requirements are not required which exclude unsafe situation from
the possible solution of the system.

Department of Computer Science 6


Christ College(Autonomous) GRABMYRATION

Usability
Usability is the ease with which a user can learn to operate, prepare inputs
for, and interpret outputs of system or components. Usability requirements
include :
ˆ information error messages.

ˆ well-formed user interfaces.

3.7 Interface Requirements


3.7.1 Hardware interfaces
The system must run over the internet, all the hardware shall require to connect
internet will be hardware interface for the system. As for example modem,
WAN-LAN.

3.7.2 Software interfaces


Software interface required for the working of the project is the appropriate
operating system.

3.7.3 Communication interfaces


The user of the site communicate using the network connectivity and the data
set is accessed

3.8 Security Requirements


ˆ User accesses only their account.

ˆ Validation of input is handled.

ˆ This application containing the computer systems is physically secured


against arms or surreptitious entry by intruders.
ˆ Users must be authorized carefully to reduce changes of any such user
giving access to an intruder in exchange for a bribe or other favour.

3.9 Platform Used


Windows 11 is the latest major release of the Windows NT operating system
developed by Microsoft that was announced on June 24, 2021, and is the succes-
sor to Windows 10, which was released in 2015. Windows 11 was released to the
public on October 5, 2021, as a free upgrade via Windows Update and Windows
11 Installation Assistant on eligible devices running Windows 10.Windows 11
features major changes to the Windows shell influenced by the canceled Win-
dows 10X, including a redesigned Start menu, the replacement of its ”live tiles”
with a separate ”Widgets” panel on the taskbar, the ability to create tiled sets

Department of Computer Science 7


Christ College(Autonomous) GRABMYRATION

of windows that can be minimized and restored from the taskbar as a group,
and new gaming technologies inherited from Xbox Series X and Series S such
as Auto HDR and DirectStorage on compatible hardware.

3.10 Technologies Used


ANDROID
Android is a mobile operating system based on a modified version of the Linux
kernel and other open source software, designed primarily for touchscreen mobile
devices such as smartphones and tablets. Android is developed by a consortium
of developers known as the Open Handset Alliance and commercially sponsored
by Google. It was unveiled in November 2007, with the first commercial Android
device, the HTC Dream, being launched in September 2008.

JAVA
Java is a high-level, class-based, object-oriented programming language that is
designed to have as few implementation dependencies as possible. It is a general-
purpose programming language intended to let programmers write once, run
anywhere (WORA), meaning that compiled Java code can run on all platforms
that support Java without the need to recompile. Java applications are typically
compiled to bytecode that can run on any Java virtual machine (JVM) regardless
of the underlying computer architecture. The syntax of Java is similar to C and
C++, but has fewer low-level facilities than either of them. The Java runtime
provides dynamic capabilities (such as reflection and runtime code modification)
that are typically not available in traditional compiled languages. As of 2019,
Java was one of the most popular programming languages in use according to
GitHub,particularly for client–server web applications, with a reported 9 million
developers.

PHP
PHP is a general-purpose scripting language geared towards web development.
It was originally created by Danish-Canadian programmer Rasmus Lerdorf in
1994. The PHP reference implementation is now produced by The PHP Group.
PHP originally stood for Personal Home Page,[8] but it now stands for the
recursive initialism PHP: Hypertext Preprocessor.

MYSQL
MySQL s an open-source relational database management system (RDBMS).Its
name is a combination of ”My”, the name of co-founder Michael Widenius’s
daughter,and ”SQL”, the abbreviation for Structured Query Language. A rela-
tional database organizes data into one or more data tables in which data types
may be related to each other; these relations help structure the data. SQL is

Department of Computer Science 8


Christ College(Autonomous) GRABMYRATION

a language programmers use to create, modify and extract data from the rela-
tional database, as well as control user access to the database. In addition to
relational databases and SQL, an RDBMS like MySQL works with an operating
system to implement a relational database in a computer’s storage system, man-
ages users, allows for network access and facilitates testing database integrity
and creation of backups.

Department of Computer Science 9


Christ College(Autonomous) GRABMYRATION

Chapter 4
4 Design Document
4.1 Purpose
This is an android application which provide details of the ration shop. The
users can register the ration card through linked phone number by OTP verifi-
cation. The users can select the item and book the slot for the purchase, then,
a token number will be allotted to the user.

4.2 Scope
This project have vast scope in future.This project can be similarly integrated
with Supplyco, Maveli stores, and other Public distribution system and make
them completely online in our technical world.

4.3 Overview
The purpose of this document is to help the reader to visualize the solution to
the project presented.This document verifies how the design meet the require-
ment stimulated in the SRS document through design viewpoints.The design
viewpoints will cover all design elements presented before. This document will
provide a direct approach to the development of this project hence reducing
feature creep and ponitedly determine the quality of the design.

4.4 Data Flow Diagram


Data flow is the one of the best way of documenting the entire functionality
of the system.For the system ,which will have data flows in and have some
processing inside and then some data flow out from the system can be docu-
mented or represented effectively by means of data flow out from the system
can be documented or represented effectively by means of data flow diagrams.
The data flow diagram are a diagrammatic representation of the system,which
has input,process and output.Once any system is represented using a data flow
diagram we can identify the following things easily:
ˆ Various entities interacting with the system are identified
ˆ Flow of data from one entity to another is identified
ˆ The various processes involved in between the interaction of two or more
entities in the system are clearly pointed out
ˆ The various data stores which hold the data in between the process,are
clearly identified
Some Data Flow Diagram charting forms:

Department of Computer Science 10


Christ College(Autonomous) GRABMYRATION

4.4.1 External source or receiver

A source or sink is a person or part of organization ,which enters or receives


information from the system,but is considered to be outlining the contest of
data flow model.

4.4.2 Transform process

A process represents transformation where incoming data flowsare changed


into outgoing data flow

4.4.3 Data Store

A data store is repository of data that is to be stored for use by one or


more process may be as simple as buffer or queue or sophisticated as relational
database. They should have clear names.If a process merely uses the contest
of store and does not alter it,the arrowhead goes only form the store to the
process. If a process alters the details in the store then double-headed arrow is
used.

Department of Computer Science 11


Christ College(Autonomous) GRABMYRATION

4.4.4 Data flow

A data flow is a route, which enable packets of data to travel from one point
to another.Data may flow,with arrowhead pointing in the direction of the flow.

Refer Appendix A for Data Flow Diagrams

Department of Computer Science 12


Christ College(Autonomous) GRABMYRATION

4.5 ER Diagram
ER Diagram stands for Entity Relationship Diagram, also known as ERD is a
diagram that displays the relationship of entity sets stored in a database. In
other words, ER diagrams help to explain the logical structure of databases.
ER diagrams are created based on three basic concepts: entities, attributes
and relationships.ER Diagrams contain different symbols that use rectangles to
represent entities, ovals to define attributes and diamond shapes to represent
relationships.
ˆ Entities
ˆ Relationship
ˆ Attributes
ER Model stands for Entity Relationship Model is a high-level conceptual data
model diagram. ER model helps to systematically analyze data requirements to
produce a well-designed database. The ER Model represents real-world entities
and the relationships between them. Creating an ER Model in DBMS is consid-
ered as a best practice before implementing your database.They are widely used
to design relational databases. The entities in the ER schema become tables, at-
tributes and converted the database schema. Since they can be used to visualize
database tables and their relationships it’s commonly used for database trou-
bleshooting as well.Entity relationship diagrams are used in software engineering
during the planning stages of the software project. They help to identify dif-
ferent system elements and their relationships with each other. It is often used
as the basis for data flow diagrams or DFD’s as they are commonly known.
There are main components of an ER:

ˆ Entity : A real-world thing either living or non-living that is easily rec-


ognizable and nonrecognizable. It is anything in the enterprise that is to
be represented in our database. It may be a physical thing or simply a
fact about the enterprise or an event that happens in the real world.
ˆ Attributes : An attribute in an Entity-Relationship Model describes
the properties or characteristics of an entity. It is represented by an oval or
ellipse shape in the ER diagram. Every oval shape represents one attribute
and is directly connected to its entity which is in the rectangle in shape.
ˆ Multivalued Attribute : Multivalued attributes can have more than
one values. For example, a student can have more than one mobile number,
email address, etc.
ˆ Relationship : A relationship in Entity-Relationship Model is used to
describe the relation between two or more entities. It is represented by a
diamond shape in the ER diagram. For example, student study in college,
employee works in a department. Here, ‘study in’ and ‘works in’ are the
relationships.

Department of Computer Science 13


Christ College(Autonomous) GRABMYRATION

4.5.1 Cardinality
n a relational database model, the number of records in a table or relation
is called cardinality in the E-R Model of the database. However, relationship
types usually have certain constraints that limit the number of instance of one
entity type that can be associated with each instance of another related en-
tity type. Therefore, the cardinality of a relationship is defined as; the num-
ber of instances of one entity type that can be associated with each instance
of another related entity type.Many-to-Many cardinality (m:n),Many-to-One
cardinality (m:1),One-to-Many cardinality (1:n),One-to-One cardinality (1:1 )

Refer Appendix C for ER Diagram

Department of Computer Science 14


Christ College(Autonomous) GRABMYRATION

4.6 Data Design


Database are the storehouses of data used in the software systems.The data is
stored in tables inside the database.Several tables are created for the manipu-
lation of the data for the system.Two essential settings for a database are

ˆ Primary Key- The field that is unique for all the record occurrence.

ˆ Foreign Key- The field used to set relation between tables.

Normalization
ˆ Normalization is the process of organizing the data in the database.

ˆ Normalization is used to minimize the redundancy from a relation or set


of relations. It is also used to eliminate the undesirable characteristics like
Insertion, Update and Deletion Anomalies.
ˆ Normalization divides the larger table into the smaller table and links
them using relationship.
ˆ The normal form is used to reduce redundancy from the database table.

Department of Computer Science 15


Christ College(Autonomous) GRABMYRATION

Tables
Admin
Name DataType Constraints Description
Usename varchar(30) Notnull Username of admin
Password varchar(30) Notnull Password of admin

User Registration
Name DataType Constraints Description
user name varchar(20) Notnull Name of users
username varchar(50) Notnull Username of user
password varchar(50) Notnul Password of users
rationcard number varchar(30) Notnull Ration card number
user ph varchar(20) Notnull Phone number of user
user ad varchar(100) Notnull Address of user
location varchar(50) Notnull Location of user
no of members varchar(10) Notnull No of members
card type varchar(30) Notnull Ration card type

Shopkeeper Registration
Name DataType Constraints Description
ration shop no int primary key Ration shop number
keeper name varchar(20) Notnull Name of shopkeeper
username varchar(50) Notnull Username of shopkeeper
password varchar(50) Notnul Password of shopkeeper
mobile no varchar(20) Notnull Phone number of shopkeeper
location varchar(50) Notnull Location of shop

Ration Kit
Name DataType Constraints Description
date varchar(50) Notnull Arriving date of kit
card type varchar(50) Notnull Type of Ration card
Exipry date varchar(30) Notnull Last date of kit

Booking
Name DataType Constraints Description
item name int(20) Notnull Product name
amount int(9) Notnull Price of product
date varchar(20) Notnull Date to be booked
time varchar(20) Notnull Time to be booked
token no int(10) Notnull Token number

Department of Computer Science 16


Christ College(Autonomous) GRABMYRATION

Product
Name DataType Constraints Description
ration shop no int(20) Primary Key Ration shop number
product varchar(20) Notnull Nameof product
card type varchar(20) Notnull Type of card
quantity int Notnull Quantity of product giving
expiry varchar(20) Notnull Last date of ration distribution

Notification
Name DataType Constraints Description
date varchar(20) Notnull Date of purchase
items varchar(250) Notnull Items purchased
Notification varchar(100) Notnull Notification

Feedback
Name DataType Constraints Description
email id varchar(10) Notnull Email address of user
feedback text Notnull Feedback from user

Department of Computer Science 17


Christ College(Autonomous) GRABMYRATION

Chapter 5
5 Development of the System
This application can be decomposed into a number of submodules. The submod-
ules of application of Ration Kada are admin, shopkeeper and user. Each sub
module have specific objectives,to avoid unwanted coupling between modules
and to increase cohesion, modules are again decomposed into submodules.

Department of Computer Science 18


Christ College(Autonomous) GRABMYRATION

Chapter 6
6 System Testing
Testing is the penultimate step of software development.An elaborate testing
of the data is prepared and the system is using the test data,while doing test-
ing,errors are noted and correction is made.The users are trained to operate the
developed system.Both hardware and software securities are made to run the
developed system successfully.System testing is aimed at ensuring the system
works accurately before the live operation commences.

6.1 Test Plan


6.1.1 Scope
This test plan will cover the following testing activities as identified in the testing
strategy.
ˆ White Box Testing
White box testing is a testing technique, that examines the program structure
and derives test data from the program logic/code. In white box testing, the
UI is bypassed. Inputs and outputs of ratings are tested directly at the code
level and the results are compared against specifications. It Reveals errors in
”hidden” code.
ˆ Black Box Testing
Black - box testing is a method of software testing that examines the function-
ality of an application based on the specifications. Black box testing typically
involves running through every possible input to verify that it results in the
right outputs using the software as an end - user would.
ˆ Unit Testing
The module includes four main components to undergo unit testing. It checks
the syntax error, logic error and validity of the program correctness. This test
will be performed by the developers.
ˆ Integration Testing
After all components pass the unit testing, they get to be tested whether they
work correctly when they are running concurrently and communicating to each
other. Integration tests exercise an entire subsystem and ensure that a set of
components play nicely together.
ˆ Internal Data Testing
We will test the validity of the data before it enters the database to avoid any
problems that may face us in the database. We will test the encryption of the
personal information of all the users along with the user names and passwords
to ensure maximum security of the users privacy.

Department of Computer Science 19


Christ College(Autonomous) GRABMYRATION

6.1.2 Software risk issues


In this section, the plan is to test the risk involved in critical issues such as:
Difficult to run on sublime due to large loading time. Some inherent software
risks such as complexity exist; also these issues need to be identified. Proper
network connection Working of Mysql database

6.1.3 Features to be tested


ˆ Test whether correct user name and password allows you to login.

ˆ Test whether invalid user name and password prevents you from login.

ˆ Test whether there is any connection problem in the Server.

ˆ Test whether the student and admin details are entered correctly.

ˆ Test whether invalid data entry allows saving data successfully.

ˆ Test whether all pages are loaded correctly.

ˆ Test whether watermark is embedded and extracted properly.

ˆ Test whether the provided security works correctly.

6.2 Test consolidation


6.2.1 Test item
The items or features to be tested in the test cases are included in the document.
Each and every user input is tested. The present condition of the system is
tested. It is checked to make sure that environment is ready for the application
to work.

6.2.2 Input specifications


These are the inputs required to execute the test case. All required inputs in-
cluding data elements and values are given below.

Data Values
Email A valid email ID
Password Combination of characters and numbers
Phone number 10 Digit number

Department of Computer Science 20


Christ College(Autonomous) GRABMYRATION

Chapter 7
7 System Implementation and Maintenance
7.1 Implementation
System implementation is the conversion of new system into an operating one
which involves creating compatible files, training clients and installing hardware.
User training is crucial for minimizing resistance to change and giving chance
to prove its worth. Training aids user friendly manuals and healthy screens
provide the user with a good start. Software maintenance follows conversion
to the extent that changes are necessary to maintain satisfactory operations
relative to changes in the user’s environment. Maintenance often includes minor
enhancements or corrections to the problem that surface late in the systems
operations. In the implementation phase, the team builds the components either
from scratch or by composition. Given the architecture document meant from
the design phase and the requirement document from the analysis phase, the
team should build exactly what has been requested, though there is still room for
innovation and flexibility. For example, a component may be narrowly designed
for this particular system, or the component may be made more general to
satisfy a reusability
ˆ Careful planning
ˆ Investigation of system and constraints
ˆ Design the methods to achieve changeover.
ˆ Training the staff in the changed phase.
ˆ Evaluation of change over method.
ˆ The method of implementation and time scale to be adopted are found
out initially.

7.2 Maintenance
This phase occurs as a result of deploying the whole system at the end users
organization. They will perform the beta testing at the end users and inform to
the developers about any needed modification to the application. The customer
records all the problems that are encountered during the beta testing and reports
these to the developer at regular intervals.

7.2.1 Corrective Maintenance


Even with the best quality assurance activities, it is likely that the customer will
uncover defects in the software. Corrective maintenance changes the software
to correct the defects. Corrective Maintenance activity may consist of repair,

Department of Computer Science 21


Christ College(Autonomous) GRABMYRATION

restoration or replacement of equipment. This activity will be result of a regular


inspection, which identifies the failure in time for corrective maintenance to be
planned and scheduled, then performed during a routine maintenance shutdown.

7.2.2 Adaptive Maintenance


Over time, the original environment(CPU, operating system, business rules,
external product characteristics) for which the software was developed is likely
to change. Adaptive maintenance results in modification to the software to
accommodate changes to its external environment.

7.2.3 Enhanced Maintenance


As software is used, the customer/user will recognize additional functions that
will provide the benefit. Perfect maintenance extends the software beyond its
original functional requirements.

7.2.4 Preventive Maintenance


Computer software deteriorates due to change, and because of this preventive
maintenance often called software re-engineering, must be conducted to en-
able the software to serve the needs of its end users. Preventive maintenance
makes changes to computer programs so that they can be more easily corrected,
adapted and enhanced.

Department of Computer Science 22


Christ College(Autonomous) GRABMYRATION

Chapter 8
8 Future Scope and Conclusion
8.1 Future Scope
The project has very vast scope in future.This project can be similarly integrated
with Supplyco, Maveli stores, and other Public distribution system and make
them completely online in our technical world.

8.2 Conclusion
Here conclude, this android application help user to know all details about the
ration shops. So this android application will reduce the dealer communication,
manual calculation and it’s reduces the time spending in the shops.

Department of Computer Science 23


Christ College(Autonomous) GRABMYRATION

Appendix
A Data Flow Diagram
A.1 Level 0

Department of Computer Science 24


Christ College(Autonomous) GRABMYRATION

A.2 Level 1 - ADMIN

Department of Computer Science 25


Christ College(Autonomous) GRABMYRATION

A.3 Level 2.1 - SHOPKEEPER

Department of Computer Science 26


Christ College(Autonomous) GRABMYRATION

A.4 Level 2.2 - USER

Department of Computer Science 27


Christ College(Autonomous) GRABMYRATION

B Use Case Diagram

Department of Computer Science 28


Christ College(Autonomous) GRABMYRATION

C ER Diagram
ER DIAGRAM

Department of Computer Science 29


Christ College(Autonomous) GRABMYRATION

D Interfaces
D.1 Admin

Department of Computer Science 30


Christ College(Autonomous) GRABMYRATION

D.2 Add User

D.3 Add Kit

Department of Computer Science 31


Christ College(Autonomous) GRABMYRATION

D.4 Kit Added

D.5 Shopkeeper Approval

Department of Computer Science 32


Christ College(Autonomous) GRABMYRATION

D.6 Feedback

Department of Computer Science 33


Christ College(Autonomous) GRABMYRATION

D.7 Application Interface

Department of Computer Science 34


Christ College(Autonomous) GRABMYRATION

D.8 Application Login

Department of Computer Science 35


Christ College(Autonomous) GRABMYRATION

D.9 User Registration

Department of Computer Science 36


Christ College(Autonomous) GRABMYRATION

D.10 OTP Notification

Department of Computer Science 37


Christ College(Autonomous) GRABMYRATION

D.11 User

Department of Computer Science 38


Christ College(Autonomous) GRABMYRATION

D.12 Booking

Department of Computer Science 39


Christ College(Autonomous) GRABMYRATION

D.13 View Kit

Department of Computer Science 40


Christ College(Autonomous) GRABMYRATION

D.14 User Feedback

Department of Computer Science 41


Christ College(Autonomous) GRABMYRATION

D.15 Shopkeeper

Department of Computer Science 42


Christ College(Autonomous) GRABMYRATION

D.16 Add Product

Department of Computer Science 43


Christ College(Autonomous) GRABMYRATION

D.17 Booking

Department of Computer Science 44


Christ College(Autonomous) GRABMYRATION

D.18 Product Purchased

Department of Computer Science 45


Christ College(Autonomous) GRABMYRATION

D.19 Application Logout

Department of Computer Science 46


Christ College(Autonomous) GRABMYRATION

E CODE
activity main.xml
[breaklines=true]
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black_"
tools:context=".MainActivity">

<androidx.cardview.widget.CardView
android:layout_width="200dp"
android:layout_height="200dp"
app:cardCornerRadius="180dp"
android:id="@+id/card"
app:cardElevation="10dp"
android:layout_centerInParent="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splashicon"/>
</androidx.cardview.widget.CardView>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/card"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:fontFamily="serif"
android:text="RationKada"
android:textColor="@color/red1"
android:textSize="25sp" />

</RelativeLayout>
activity feedback.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"

Department of Computer Science 47


Christ College(Autonomous) GRABMYRATION

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".user.FeedBackActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Feedback"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:textColor="@color/teal_700"
android:textSize="25sp"
android:textStyle="bold|italic"
android:fontFamily="serif"
/>

<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal"

/>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="20dp"
style@style/Widget.Components.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Email"
android:gravity="start"
android:id="@+id/edtFeedEmail"/>

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="20dp"

Department of Computer Science 48


Christ College(Autonomous) GRABMYRATION

style@style/WidgetComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="Feedback"
android:gravity="start"
android:id="@+id/edtFeedback"/>

</com.google.android.material.textfield.TextInputLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="30dp"
android:id="@+id/btnFeedback"
android:text="Upload Feedback"/>

</LinearLayout>

activity home.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="8"
tools:context=".user.HomeActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3">
<RelativeLayout
android:layout_width="340dp"
android:layout_height="match_parent"
android:background="@drawable/login_bg">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<TextView

Department of Computer Science 49


Christ College(Autonomous) GRABMYRATION

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome"
android:textSize="40dp"
android:textColor="@color/white"
android:fontFamily="serif"

/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="to RationKada"
android:textSize="40dp"
android:textColor="@color/white"
android:fontFamily="serif"

/>

</LinearLayout>
</RelativeLayout>

</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:orientation="horizontal"
android:id="@+id/linear6"
android:layout_marginTop="30dp"
android:weightSum="4">
<androidx.cardview.widget.CardView
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_weight="2"
app:cardElevation="10dp"
android:id="@+id/cardNear"
app:cardCornerRadius="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"

Department of Computer Science 50


Christ College(Autonomous) GRABMYRATION

android:textColor="@color/teal"
android:text="Near by Shops"
android:fontFamily="serif"
android:textStyle="bold"
android:textSize="20sp"
android:layout_gravity="center"/>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="10dp"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_weight="2"
android:id="@+id/cardKite"
app:cardElevation="10dp"
app:cardCornerRadius="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/teal"
android:text="Kit"
android:fontFamily="serif"
android:textStyle="bold"
android:textSize="20sp"
android:layout_gravity="center"/>

</androidx.cardview.widget.CardView>

</LinearLayout>

<androidx.cardview.widget.CardView
android:id="@+id/cardViewFeedback"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_below="@id/linear6"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
app:cardCornerRadius="10dp"
app:cardElevation="10dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="serif"

Department of Computer Science 51


Christ College(Autonomous) GRABMYRATION

android:text="Feedback"
android:textColor="@color/teal"
android:textSize="20sp"
android:textStyle="bold" />

</androidx.cardview.widget.CardView>

</RelativeLayout>
</LinearLayout>

activity otp.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="8"
tools:context=".user.OtpActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Otp Verification"
android:textSize="20sp"
android:fontFamily="serif"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:textColor="@color/teal_700"
/>

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/otp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"

Department of Computer Science 52


Christ College(Autonomous) GRABMYRATION

android:layout_weight="5"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/teal_700"
android:textSize="15sp"
android:fontFamily="serif"
android:text="Please enter your verification code"/>

<com.goodiebag.pinview.Pinview
android:id="@+id/pinview"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="50dp"
app:pinWidth="40dp"
app:pinHeight="40dp"
app:pinLength="4"
app:cursorVisible="false"
app:forceKeyboard="true"
app:hint="0"
app:inputType="text"
app:password="false"/>
<androidx.appcompat.widget.AppCompatButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="verify"
android:background="@color/teal"
android:layout_margin="50dp"
android:textColor="@color/white"
android:id="@+id/btnVerify"/>
</LinearLayout>
</LinearLayout>

activity view tocken.xml

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".shopkeeper.Tocken.ViewTockenActivity">

Department of Computer Science 53


Christ College(Autonomous) GRABMYRATION

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:weightSum="4"
android:gravity="center"
android:orientation="horizontal">
<EditText
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:hint="Enter Tocken Number"
android:layout_marginLeft="10dp"
android:id="@+id/edtTockenNo"/>
<androidx.appcompat.widget.AppCompatButton
android:background="@color/teal1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:id="@+id/btnTocken"
android:text="Search"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:weightSum="6"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:textStyle="bold"
android:layout_width="0dp"
android:layout_weight="2"
android:gravity="center"
android:layout_height="wrap_content"
android:text="Product Name"
android:textColor="@color/black"
android:textSize="20sp"
android:fontFamily="serif"/>
<TextView
android:textStyle="bold"
android:layout_width="0dp"
android:layout_weight="2"
android:gravity="center_horizontal"
android:layout_height="wrap_content"

Department of Computer Science 54


Christ College(Autonomous) GRABMYRATION

android:text="Quantity"
android:textColor="@color/black"
android:textSize="20sp"
android:layout_marginLeft="25dp"
android:fontFamily="serif" />

<TextView
android:textStyle="bold"
android:layout_width="0dp"
android:layout_weight="2"
android:gravity="center_horizontal"
android:layout_height="wrap_content"
android:text="Price"
android:textColor="@color/black"
android:textSize="20sp"
android:layout_marginLeft="25dp"
android:fontFamily="serif" />

</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recylerTocken"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Total Price :"
android:textSize="20sp"
android:textStyle="bold"
android:fontFamily="serif"
android:textColor="@color/black"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Total Price"
android:layout_marginLeft="30dp"
android:id="@+id/textPrice2"
android:textSize="20sp"
android:textStyle="bold"

Department of Computer Science 55


Christ College(Autonomous) GRABMYRATION

android:fontFamily="serif"
android:textColor="@color/black"/>
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="ok"
android:id="@+id/btnOk"/>
</LinearLayout>

ShopKeeperRegActivity.java

package com.example.e_ration.shopkeeper;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.e_ration.Config;
import com.example.e_ration.R;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Department of Computer Science 56


Christ College(Autonomous) GRABMYRATION

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ShopkeeperRegActivity extends AppCompatActivity {


EditText edtShopName,edtRationNo,edtLocation,edtShopMobile,
edtShopUsername,edtShopPassword;
Button btnShopReg;
double lat,lng;
String name,rationno,location,mobile,username,password,status,message,
url = Config.baseUrl+"shopkeeper_reg.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shopkeeper_reg);

edtShopName = findViewById(R.id.edtShopName);
edtRationNo = findViewById(R.id.edtRationNo);
edtLocation = findViewById(R.id.edtLocation);
edtShopMobile = findViewById(R.id.edtShopMobile);
edtShopUsername = findViewById(R.id.edtShopUsername);
edtShopPassword = findViewById(R.id.edtShopPassword);
btnShopReg = findViewById(R.id.btnShopReg);

btnShopReg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
shopReg();
}
});

}
private void shopReg(){

name = edtShopName.getText().toString();
rationno = edtRationNo.getText().toString();
location = edtLocation.getText().toString();
mobile = edtShopMobile.getText().toString();
username = edtShopUsername.getText().toString();
password = edtShopPassword.getText().toString();

Geocoder geoCoder = new Geocoder(this);

try {
List<Address> locations = geoCoder.getFromLocationName(location, 1);
Log.e("loc","loc= "+locations);
for (Address a : locations) {

Department of Computer Science 57


Christ College(Autonomous) GRABMYRATION

lat = a.getLatitude();
lng = a.getLongitude();
// tvLat.setText(Double.toString(lat));
// tvLng.setText(Double.toString(lng));
}

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (TextUtils.isEmpty(name)){
edtShopName.setError("Required");
edtShopName.requestFocus();
return;
}
else if (TextUtils.isEmpty(rationno)){
edtRationNo.setError("Required");
edtRationNo.requestFocus();
return;
}
else if (TextUtils.isEmpty(location)) {
edtLocation.setError("Required");
edtLocation.requestFocus();
return;
}
else if (TextUtils.isEmpty(mobile)){
edtShopMobile.setError("Required");
edtShopMobile.requestFocus();
return;
}
else if (!isPhoneValid(mobile)){
edtShopMobile.setError("Invalid Number");
edtShopMobile.requestFocus();
return;
}
else if (TextUtils.isEmpty(username)){
edtShopUsername.setError("Required");
edtShopUsername.requestFocus();
return;
}
else if (TextUtils.isEmpty(password)){
edtShopPassword.setError("Required");
edtShopPassword.requestFocus();
return;
}
StringRequest stringRequest = new StringRequest(Request.Method.POST,

Department of Computer Science 58


Christ College(Autonomous) GRABMYRATION

url, new Response.Listener<String>() {


@Override
public void onResponse(String response) {
try {
JSONObject c = new JSONObject(response);
status = c.getString("status");
message = c.getString("message");
} catch (JSONException e) {
e.printStackTrace();
}
if (status.equals("1")){
Toast.makeText(ShopkeeperRegActivity.this, message,
Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getApplicationContext(),
ShopKeeperLoginActivity.class);
startActivity(intent);
finish();
}
else {
Toast.makeText(ShopkeeperRegActivity.this, message,
Toast.LENGTH_SHORT).show();

}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {

Toast.makeText(ShopkeeperRegActivity.this, error.toString(),
Toast.LENGTH_SHORT).show();

}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> map = new HashMap<>();
map.put("keeper_name",name);
map.put("location",location);
map.put("ration_shop_no",rationno);
map.put("keeper_no",mobile);
map.put("username",username);
map.put("password",password);
map.put("lattitude", String.valueOf(lat));
map.put("longitude", String.valueOf(lng));
return map;

Department of Computer Science 59


Christ College(Autonomous) GRABMYRATION

}
};
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
public static boolean isPhoneValid(String s) {
Pattern p = Pattern.compile("(0/91)?[6-9][0-9]{9}");
Matcher m = p.matcher(s);
return (m.find() && m.group().equals(s));
}
}

ItemListActivity.java

package com.example.e_ration.user.itemlist;

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

import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.e_ration.Config;
import com.example.e_ration.R;
import com.example.e_ration.shopkeeper.KeeperSession;
import com.example.e_ration.shopkeeper.viewproduct.ProductAdapter;
import com.example.e_ration.shopkeeper.viewproduct.ProductDataModel;
import com.example.e_ration.user.UserSession;
import com.google.android.material.floatingactionbutton.FloatingActionButton;

import org.json.JSONArray;
import org.json.JSONException;

Department of Computer Science 60


Christ College(Autonomous) GRABMYRATION

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class ItemListActivity extends AppCompatActivity {


private String URLstring = Config.baseUrl+ "view_product_user.php";
private static ProgressDialog mProgressDialog;
ArrayList<ProductDataModel> dataModelArrayList;
private ItemAdapter rvAdapter;
private RecyclerView recyclerView;
FloatingActionButton fab;
Context c;
String keeperid,card;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_list);

recyclerView = findViewById(R.id.recylerUserProduct);
fab = findViewById(R.id.fabAdd);
fetchingJSON();
card = new UserSession(this).getUserDetails().get("card_type");
Intent intent = getIntent();
keeperid = intent.getStringExtra("kid");

}
private void fetchingJSON() {

showSimpleProgressDialog(getApplicationContext(),
"Loading...","Fetching Json",false);

StringRequest stringRequest = new StringRequest(Request.Method.POST,


URLstring,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {

try {
// Toast.makeText(getApplicationContext(), response,
Toast.LENGTH_SHORT).show();
removeSimpleProgressDialog();

dataModelArrayList = new ArrayList<>();

Department of Computer Science 61


Christ College(Autonomous) GRABMYRATION

JSONArray array = new JSONArray(response);

for (int i = 0; i < array.length(); i++) {

JSONObject dataobj = array.getJSONObject(i);

dataModelArrayList.add(new ProductDataModel(
dataobj.getString("id"),
dataobj.getString("product_name"),
dataobj.getString("product_quantity"),
dataobj.getString("upload_date"),
dataobj.getString("keeper_id"),
dataobj.getString("expaire_date"),
dataobj.getString("card_type"),
dataobj.getString("image"),
dataobj.getString("price")
));

}
setupRecycler();

} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("Log", "inside onErrorResponse");
//displaying the error in toast if occurrs
Toast.makeText(getApplicationContext(),
error.getMessage(),
Toast.LENGTH_SHORT).show();
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> map = new HashMap<>();
map.put("keeper_id",keeperid);
map.put("card_type",card);
return map;

}
};

Department of Computer Science 62


Christ College(Autonomous) GRABMYRATION

// request queue
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}

private void setupRecycler(){

rvAdapter = new ItemAdapter(this, dataModelArrayList,keeperid);


recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(rvAdapter);
RecyclerView.LayoutManager layoutManager =
new GridLayoutManager(getApplicationContext(),2);
recyclerView.setLayoutManager(layoutManager);
}

public static void removeSimpleProgressDialog() {


try {
if (mProgressDialog != null) {
if (mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
mProgressDialog = null;
}
}
} catch (IllegalArgumentException ie) {
Log.e("Log", "inside catch IllegalArgumentException");
ie.printStackTrace();

} catch (RuntimeException re) {


Log.e("Log", "inside catch RuntimeException");
re.printStackTrace();
} catch (Exception e) {
Log.e("Log", "Inside catch Exception");
e.printStackTrace();
}

public static void showSimpleProgressDialog


(Context context, String title,String msg, boolean
isCancelable) {
try {
if (mProgressDialog == null) {
mProgressDialog = ProgressDialog.show(context, title, msg);
mProgressDialog.setCancelable(isCancelable);
}

Department of Computer Science 63


Christ College(Autonomous) GRABMYRATION

if (!mProgressDialog.isShowing()) {
mProgressDialog.show();
}

} catch (IllegalArgumentException ie) {


ie.printStackTrace();
} catch (RuntimeException re) {
re.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}

FeedBackActivity.java

package com.example.e_ration.user;

import androidx.appcompat.app.AppCompatActivity;

import android.media.Rating;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RatingBar;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.e_ration.Config;
import com.example.e_ration.R;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

Department of Computer Science 64


Christ College(Autonomous) GRABMYRATION

public class FeedBackActivity extends AppCompatActivity {

RatingBar ratingBar;
EditText edtFeedback,edtFeedEmail;
Button btnFeedback;

String status,message,feedback,username,email,url= Config.baseUrl+


"add_feedback.php";
float rating;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feed_back);

ratingBar = findViewById(R.id.ratingBar);
edtFeedback = findViewById(R.id.edtFeedback);
btnFeedback = findViewById(R.id.btnFeedback);
edtFeedEmail = findViewById(R.id.edtFeedEmail);
username = new UserSession(this).getUserDetails().get("username");
// email = new UserSession(this).getUserDetails().get("email");
btnFeedback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addFeedback();
}
});
}

private void addFeedback() {

feedback = edtFeedback.getText().toString();
rating= ratingBar.getRating();
email = edtFeedEmail.getText().toString();
StringRequest stringRequest = new StringRequest
(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
// Toast.makeText(getApplicationContext(), response,
Toast.LENGTH_SHORT).show();
JSONObject c = new JSONObject(response);
status = c.getString("status");
message = c.getString("message");

} catch (JSONException e) {
e.printStackTrace();

Department of Computer Science 65


Christ College(Autonomous) GRABMYRATION

}
if ("1".equals(status)) {
Toast.makeText(getApplicationContext(), message,
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), ""+message,
Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), error.toString(),
Toast.LENGTH_SHORT).show();
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> map = new HashMap<>();
map.put("username",username);
map.put("email",email);
map.put("rating", String.valueOf(rating));
map.put("feedback",feedback);
return map;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);

}
}

LoginActivity.java

package com.example.e_ration.user;

import androidx.appcompat.app.AppCompatActivity;

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

Department of Computer Science 66


Christ College(Autonomous) GRABMYRATION

import android.widget.ProgressBar;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.e_ration.Config;
import com.example.e_ration.R;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

public class LoginActivity extends AppCompatActivity {


EditText edtUsername,edtPassword;
Button btnLogin;
String id,name,ration_no,mobile,user,member,pass,lattitude,
longitude,card_type,username,password,address, status,message,
url = Config.baseUrl+"login.php";
LinearLayout linear2;
ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);

edtUsername = findViewById(R.id.edtUsername);
edtPassword = findViewById(R.id.edtPassword);
btnLogin = findViewById(R.id.btnLogin);
linear2 = findViewById(R.id.linear2);
progressBar = findViewById(R.id.progress1);

btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
userLogin();
}
});linear2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

Department of Computer Science 67


Christ College(Autonomous) GRABMYRATION

startActivity(new Intent(getApplicationContext(),
RegistrationActivity.class));
finish();
}
});

}
private void userLogin(){

username = edtUsername.getText().toString();
password = edtPassword.getText().toString();
progressBar.setVisibility(View.VISIBLE);
StringRequest stringRequest = new StringRequest
(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
progressBar.setVisibility(View.INVISIBLE);
try {
JSONObject c = new JSONObject(response);
status = c.getString("status");
message = c.getString("message");
id = c.getString("id");
name = c.getString("name");
ration_no = c.getString("ration_no");
address = c.getString("address");
mobile = c.getString("mobile");
address = c.getString("address");
user = c.getString("username");
pass = c.getString("password");
lattitude = c.getString("lattitude");
longitude = c.getString("longitude");
card_type = c.getString("card_type");
member = c.getString("member");

} catch (JSONException e) {
e.printStackTrace();
}
if (status.equals("1")) {
Toast.makeText(LoginActivity.this, message,
Toast.LENGTH_SHORT).show();
new UserSession(getApplicationContext()).
createLoginSession
(id,name,ration_no,address,mobile,user,pass,lattitude,
longitude,card_type,member);
startActivity(new Intent(getApplicationContext(),
HomeActivity.class));

Department of Computer Science 68


Christ College(Autonomous) GRABMYRATION

finish();
} else {
Toast.makeText(LoginActivity.this, message,
Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(LoginActivity.this, error.toString(),
Toast.LENGTH_SHORT).show();
}
}){
@Override
protected Map<String, String> getParams() throws
AuthFailureError {
Map<String,String> map=new HashMap<>();

map.put("username",username);
map.put("password",password);

return map;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
}

OtpActivity.java

package com.example.e_ration.user;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

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

import com.example.e_ration.R;
import com.goodiebag.pinview.Pinview;

Department of Computer Science 69


Christ College(Autonomous) GRABMYRATION

public class OtpActivity extends AppCompatActivity {


Pinview pinview ;
String mobile,otp,otpValue;
Button btnVerify;

@Override
public void onBackPressed() {
otpValue=pinview.getValue();
if (otpValue.isEmpty()){
showExitAlert();
}
}

private void showExitAlert() {

new AlertDialog.Builder(this)
.setTitle("Warning!").setIcon(R.drawable.
ic_baseline_warning_amber_24)
.setMessage("You can’t go back .Please enter Otp")
// .setPositiveButton("Yes", new DialogInterface.
OnClickListener() {
// @Override
// public void onClick(DialogInterface dialog, int which) {
// new SessionManager(home.this).logoutUser();
// startActivity(new Intent(home.this, Login.class));
// finish();
// }
// })
.setNegativeButton("Ok", new DialogInterface.
OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.show();
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_otp);

pinview = findViewById(R.id.pinview);
btnVerify = findViewById(R.id.btnVerify);

Department of Computer Science 70


Christ College(Autonomous) GRABMYRATION

Intent intent = getIntent();


mobile = intent.getStringExtra("mobile");
otp= intent.getStringExtra("otp");

btnVerify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
otpValue=pinview.getValue();
if (otpValue.equals(otp)) {
// Intent i=new Intent(OtpActivity.
this,FrgtthreeActivity.class);
// i.putExtra("phone",mobile);
//
// startActivity(i);
Toast.makeText(OtpActivity.this, "Verified",
Toast.LENGTH_SHORT).show();
startActivity(new Intent(getApplicationContext()
,LoginActivity.class));
finish();
}
else {
Toast.makeText(OtpActivity.this, "incorrect OTP",
Toast.LENGTH_SHORT).show();
}
}
});

RegistrationActivity.java

package com.example.e_ration.user;

import android.app.PendingIntent;
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.telephony.SmsManager;

Department of Computer Science 71


Christ College(Autonomous) GRABMYRATION

import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.android.volley.AuthFailureError;
import com.android.volley. Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.e_ration.Config;
import com.example.e_ration.R;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

public class RegistrationActivity extends AppCompatActivity {


EditText edtName,rcn,edtAddress,edtMobile,edtUsername,
edtPassword,edtLocation,edtMemberNo;
Button btnReg;
Spinner spinnerCard;
String []card= {"Select Card Type","Yellow Card",
"Pink Card","Blue Card","White Card"};
double lat,lng;
String name,rno,mobile,username,password,address,location,
cardtype,member, status,message,url = Config.baseUrl+"ragistration.php";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);

edtName = findViewById(R.id.edtName);

Department of Computer Science 72


Christ College(Autonomous) GRABMYRATION

rcn = findViewById(R.id.rcn);
edtMobile = findViewById(R.id.edtMobile);
edtAddress = findViewById(R.id.edtAddress);
edtUsername = findViewById(R.id.edtUsername);
edtPassword = findViewById(R.id.edtPassword);
edtLocation = findViewById(R.id.edtLocation);
spinnerCard = findViewById(R.id.spinnerCard);
edtMemberNo = findViewById(R.id.edtMemberNo);
btnReg = findViewById(R.id.btnReg);

ArrayAdapter<String> adapter = new ArrayAdapter<String>


(RegistrationActivity.this,R.layout.support_simple_spinner_dropdown_item,card);
spinnerCard.setAdapter(adapter);

btnReg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
userReg();
}
});
}
private void userReg(){

name = edtName.getText().toString();
rno = rcn.getText().toString();
mobile = edtMobile.getText().toString();
address = edtAddress.getText().toString();
location = edtLocation.getText().toString();
username = edtUsername.getText().toString();
password = edtPassword.getText().toString();
member= edtMemberNo.getText().toString();
cardtype = spinnerCard.getSelectedItem().toString();

Geocoder geoCoder = new Geocoder(this);

try {
List<Address> locations = geoCoder.getFromLocationName
(location, 1);
Log.e("loc","loc= "+locations);
for (Address a : locations) {
lat = a.getLatitude();
lng = a.getLongitude();
// tvLat.setText(Double.toString(lat));
// tvLng.setText(Double.toString(lng));
}

Department of Computer Science 73


Christ College(Autonomous) GRABMYRATION

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (TextUtils.isEmpty(name)){
edtName.setError("Required");
edtName.requestFocus();
return;
}
else if(TextUtils.isEmpty(rno)){
rcn.setError("Required");
rcn.requestFocus();
return;
}
else if(TextUtils.isEmpty(mobile)){
edtMobile.setError("Required");
edtMobile.requestFocus();
return;
}
else if(!isPhoneValid(mobile)){
edtMobile.setError("Invalid Number");
edtMobile.requestFocus();
return;
}
else if(TextUtils.isEmpty(address)){
edtAddress.setError("Required");
edtAddress.requestFocus();
return;
}
else if(TextUtils.isEmpty(location)){
edtLocation.setError("Required");
edtLocation.requestFocus();
return;
}
else if(TextUtils.isEmpty(username)){
edtUsername.setError("Required");
edtUsername.requestFocus();
return;
}
else if(TextUtils.isEmpty(password)){
edtPassword.setError("Required");
edtPassword.requestFocus();
return;
}
else if(TextUtils.isEmpty(member)){

Department of Computer Science 74


Christ College(Autonomous) GRABMYRATION

edtMemberNo.setError("Required");
edtMemberNo.requestFocus();
return;
}

StringRequest stringRequest = new StringRequest


(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject c = new JSONObject(response);
status = c.getString("status");
message = c.getString("message");

} catch (JSONException e) {
e.printStackTrace();
}
if ("1".equals(status)) {
Toast.makeText(RegistrationActivity.this,
""+message, Toast.LENGTH_SHORT).show();

otp();
// finish();
} else {
Toast.makeText(RegistrationActivity.this,
""+message, Toast.LENGTH_SHORT).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(RegistrationActivity.this,
error.toString(), Toast.LENGTH_SHORT).show();
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> map=new HashMap<>();
map.put("name",name);
map.put("ration_no",rno);
map.put("address",address);
map.put("username",username);
map.put("password",password);
map.put("mobile",mobile);
map.put("lattitude", String.valueOf(lat));
map.put("longitude", String.valueOf(lng));

Department of Computer Science 75


Christ College(Autonomous) GRABMYRATION

map.put("card_type", cardtype);
map.put("member", member);
return map;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
private void otp(){
Random r = new Random();
int otp = r.nextInt((9999 - 1000) + 1) + 1000;
//Range: [0,8999]+1000 = [1000,9999]
String msg = "Welcome to RationKada app.
Your OTP for verify phone number " + otp;
Intent intent = new Intent(getApplicationContext(),OtpActivity .class);
intent.putExtra("otp", Integer.toString(otp));
intent.putExtra("phone", mobile);

//intent.putExtra("type",type);
PendingIntent pi = PendingIntent.getActivity
(getApplicationContext(), 0, intent, 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(mobile, null, msg, pi, null);
finish();
}
}

MainActivity.java

package com.example.e_ration;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new Handler().postDelayed(new Runnable() {
@Override

Department of Computer Science 76


Christ College(Autonomous) GRABMYRATION

public void run() {


startActivity(new Intent(getApplicationContext(),
CommonActivity.class));
finish();
}
},2500);
}
}

login.php

<?php

# Connection...
$con = new mysqli("localhost", "root", "") or die("connection error");
$db = mysqli_select_db($con, "e_ration") or die("error in database");

# Fetching data using POST method...


$username = $_POST["username"];
$password = $_POST["password"];

# Query execution
$q = "SELECT * from registration WHERE username=’$username’ &&
password=’$password’ ";
$result = mysqli_query($con, $q) or die("error in query");
$row = mysqli_fetch_row($result);

if (mysqli_num_rows($result) > 0) {
$response[’status’] = "1";
$response[’message’] = "Login successful";
$response[’id’] = $row[0];
$response[’name’] = $row[1];
$response[’ration_no’] = $row[2];
$response[’address’] = $row[3];
$response[’mobile’] = $row[4];
$response[’username’] = $row[5];
$response[’password’] = $row[6];
$response[’lattitude’] = $row[7];
$response[’longitude’] = $row[8];
$response[’card_type’] = $row[9];
$response[’member’] = $row[10];
}
else {
$response[’status’] = "0";
$response[’message’] = "Incorrect username or password!";
$response[’id’] = "";

Department of Computer Science 77


Christ College(Autonomous) GRABMYRATION

$response[’name’] = "";
$response[’ration_no’] = "";
$response[’address’] = "";
$response[’mobile’] = "";
$response[’username’] = "";
$response[’password’] = "";
$response[’lattitude’] = "";
$response[’longitude’] = "";
$response[’card_type’] = "";
$response[’member’] = "";
}

# Converting to JSON (JavaScript Object Notation) Format


echo json_encode($response);
?>

my bag.php

<?php

include’config.php’;
//Checking if any error occured while connecting
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
die();
}
$userid = $_POST[’userid’];

//creating a query
$stmt = $con->prepare("SELECT id,user_id,keeper_id,
productname,price,image,added_date FROM add_bag WHERE user_id =’$userid’");

//executing the query


$stmt->execute();

//binding results to the query


$stmt->bind_result($id,$userid,$keeperid,$productname,$price,$image,
$added_date);

$products = array();

//traversing through all the result


while($stmt->fetch()){
$temp = array();

Department of Computer Science 78


Christ College(Autonomous) GRABMYRATION

$temp[’id’] = $id;
$temp[’user_id’] = $userid;
$temp[’keeper_id’] = $keeperid;
$temp[’productname’] = $productname;
$temp[’price’] = $price;
$temp[’image’] = $image;
$temp[’added_date’] = $added_date;

array_push($products, $temp);
}

//displaying the result in json format


echo json_encode($products);
?>

otp.php

<?php

# Connection...
$con = new mysqli("localhost", "root", "") or die("connection error");
$db = mysqli_select_db($con, "e_ration") or die("error in database");

# Fetching data using POST method...

$mobile = $_POST["mobile"];

$query = "SELECT * from add_user WHERE number=’$mobile’";


$result = mysqli_query($con, $query) or die("error in query");

if (mysqli_num_rows($result) > 0) {

$response[’status’] = "1";
$response[’message’] = "Registration successful";
}

else {
$response[’status’] = "0";
$response[’message’] = "Incorrect number!";
}
# Query execution

Department of Computer Science 79


Christ College(Autonomous) GRABMYRATION

# Converting to JSON (JavaScript Object Notation) Format


echo json_encode($response);

?>

Department of Computer Science 80

You might also like