Intro
Intro
Intro
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
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
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
Appendix 24
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.
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.
.
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.
and add product,view booking and view kit.User can select the shop and select
the items.
RAM : 4GB
Keyboard: Standard
Mouse: Standard
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.
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.
security
safety
usability
Performance
Performance requirements concern the speed of operation of a system. Types
of performance requirements :
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.
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.
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
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.
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.
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.
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:
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 )
Primary Key- The field that is unique for all the record occurrence.
Normalization
Normalization is the process of organizing the data in the database.
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
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
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.
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.
Test whether invalid user name and password prevents you from login.
Test whether the student and admin details are entered correctly.
Data Values
Email A valid email ID
Password Combination of characters and numbers
Phone number 10 Digit number
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.
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.
Appendix
A Data Flow Diagram
A.1 Level 0
C ER Diagram
ER DIAGRAM
D Interfaces
D.1 Admin
D.6 Feedback
D.11 User
D.12 Booking
D.15 Shopkeeper
D.17 Booking
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
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"
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
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"
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"
android:text="Feedback"
android:textColor="@color/teal"
android:textSize="20sp"
android:textStyle="bold" />
</androidx.cardview.widget.CardView>
</RelativeLayout>
</LinearLayout>
activity otp.xml
<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"
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>
<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"
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"
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;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
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();
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));
}
} 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,
}
}, 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;
}
};
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;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
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);
try {
// Toast.makeText(getApplicationContext(), response,
Toast.LENGTH_SHORT).show();
removeSimpleProgressDialog();
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;
}
};
// request queue
RequestQueue requestQueue = Volley.newRequestQueue(this);
requestQueue.add(stringRequest);
}
if (!mProgressDialog.isShowing()) {
mProgressDialog.show();
}
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;
RatingBar ratingBar;
EditText edtFeedback,edtFeedEmail;
Button btnFeedback;
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();
}
});
}
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();
}
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;
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;
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) {
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));
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;
@Override
public void onBackPressed() {
otpValue=pinview.getValue();
if (otpValue.isEmpty()){
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);
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;
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;
edtName = findViewById(R.id.edtName);
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);
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();
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));
}
} 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)){
edtMemberNo.setError("Required");
edtMemberNo.requestFocus();
return;
}
} 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));
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;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new Handler().postDelayed(new Runnable() {
@Override
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");
# 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’] = "";
$response[’name’] = "";
$response[’ration_no’] = "";
$response[’address’] = "";
$response[’mobile’] = "";
$response[’username’] = "";
$response[’password’] = "";
$response[’lattitude’] = "";
$response[’longitude’] = "";
$response[’card_type’] = "";
$response[’member’] = "";
}
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’");
$products = array();
$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);
}
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");
$mobile = $_POST["mobile"];
if (mysqli_num_rows($result) > 0) {
$response[’status’] = "1";
$response[’message’] = "Registration successful";
}
else {
$response[’status’] = "0";
$response[’message’] = "Incorrect number!";
}
# Query execution
?>