Professional Documents
Culture Documents
TABLE OF CONTENTS
1. OVERVIEW
1.1 Introduction
3. SYSTEM IMPLEMENTATION
4. SYSTEM CONFIGURATION
5. SOURCE CODE
6. SCREEN SHOTS
7.CONCLUSION
1. OVERVIEW:
1.1 PURPOSE:
for example: The data maybe added/updated/deleted into the database and retrieved while
generating the bill for the day.
3. SYSTEM IMPLEMENTATION
4. SYSTEM CONFIGURATION
5. SOURCE CODE
6. SCREEN SHOTS
7.CONCLUSION
1. OVERVIEW:
1.1 PURPOSE:
for example: The data maybe added/updated/deleted into the database and retrieved while
generating the bill for the day.
This software is used to maintain a database in a pharmacy without manually having to keep
track of the inventory and sales. This reduces any humanized errors and thus generates a bill of
the exact amount at the end of the day.
2. OVERALL DESCRIPTION:
This software helps the pharmaceutical industry to maintain a database for the inventory and
prevent any loss of information
The software gives you the chance to add, delete, update the details of the medicines using the
medicine ID. During the bill generation you need only mention the medicine ID and the details
will automatically appear.
The person who can update and retrieve details is the administrator (i.e. person assigned to this
job).
The software uses windows 7 operating system. Java is used as a front end designing tool.
Hardware requirements used are 13.370M, Processor 2.40 GHz, 320 GB hard disk and 34B
memory.
The administrator should have authority to update and retrieve information. He must be present
during every sale. The software assumes that the ad ministrator does not make any errors while
entering the data.
3. SYSTEM FEATURES:
In the module the administrator updates information about medicines to the database. The
administrator has rights to perform manipulation of information.
4. SPECIFICATION REQUIREMENTS:
This application includes interfaces for medicine entry, interacting with the database GUI
standards, buttons and functions that will appear in every screen and so on.
Connectivity is established between MS Access and JAVA using JDBC. Processor I3 with
2.40GHz and memory 34B and hardware 320 GB is required.
4.4 COMMUNICATION:
Front end and back end are connected using JDBC connectivity.
ADVANTAGES:
Flexibility to address specific requirements by setting rules and test /modify specific code
areas
Ease of maintenance
SYSTEM IMPLEMENTATION
computers, and media centers. The letters "XP" stand for experience. Windows XP is the
successor to both Windows 2000 and Windows Me, and is the first consumer-oriented operating
system produced by Microsoft to be built on the Windows NT kernel and architecture.
The most common editions of the operating system are Windows XP Home Edition, which is
targeted at home users, and Windows XP Professional, which has additional features such as
support for Windows Server domains and two physical processors, and is targeted at power users
and business clients. Windows XP Tablet PC Edition is designed to run the ink-aware Tablet PC
platform. Two separate 64-bit versions of Windows XP were also released, Windows XP 64-bit
Edition for IA-64 (Itanium) processors and Windows XP Professional x64 Edition for x86-64
processors.
Windows XP is known for its improved stability and efficiency over previous versions of
Microsoft Windows. It presents a significantly redesigned graphical user interface, a change
Microsoft promoted as more user-friendly than previous versions of Windows. New software
management capabilities were introduced to avoid the "DLL hell" that
Plagued older consumer versions of Windows. It is also the first version of Windows to use
product activation to combat software piracy, a restriction .
That did not sit well with some users and privacy advocates. Windows XP has also been
criticized by some users for security vulnerabilities, tight.Integration of applications such as
Internet Explorer and Windows Media Player, and for aspects of its user interface.
HISTORY OF JAVA
FEATURES OF JAVA
• Simple
• Object Oriented
• Platform-Independent
• Robust
• Secure
• Distributed
• Multithreaded
Simple
The designers of Java were trying to develop a language that a programmer could
learn quickly. They also wanted the language to be familiar to most programmers, for ease of
migration. Hence the Java designers removed a number of complex features that existed in C and
C++. Java does not have features such as pointer manipulation, operator overloading etc. Java
does not use the ‘go to’ statement, or header filed. Constructs like ‘struct’ and ‘union’ have also
been removed from Java.
Platform-Independent
Platform-independence refers to the ability of the program to migrate from one computer to
another without any Difficulty. Java is platform independent at the source level as well as at the
binary level.
Java is strongly typed language. This means that you need to declare the type for any
variable. The java data types are consistent across all the development platforms. Java has its
own foundation class libraries. This allows the programmer to write code that can be mobbed
from one machine to another, with out having to rewrite it.
In short, platform independence at the source level allows the user to move the source
code from one system to another, compile the code, and run it clearly on the system.
Platform independence at the binary level allows the user to run the compiled binary file
on multiple platforms without recompiling the code.
Robust
Java does not have pointers and pointer arithmetic. It checks all access to arrays and
strings at the runtime. It also checks the casts of o bjects from one type to another at runtime.
Secure:
Viruses are a great cause of worry in the world of computers. Prior to the advent
of Java, programmers had to first scan files, before downloading and executing them. Often this
precaution was no guarantee against viruses. Also there were many malicious programs that
programmers need to look out for.
These programs could search the contents of your local file system and retrieve sensitive data.
Java provides a controlled environment for the execution of the program. It never
assumes that the code is safe for execution. And since java is more than a programming
language, it provides several layers of security control.
In the first layer, the data and methods are encapsulated in the class. They can be
accessed only through the interface that the class provides. Java does not allow any pointer
arithmetic. Hence it does not allow direct access to the memory. It disallows array overflow,
prevents reading memory out of bounds, and provides garbage collection. All these features help
minimize safety and portability problems.
In the second layer the compiler ensures that the code is safe and follows the protocols set by
Java before compiling the code.
The third layer is safety provided by the Interpreter. The verifier thoroughly screens the
byte codes to ensure they obey the rules before executing them.
The fourth layer takes care of loading the classes. The class loader ensures that the class
doesn’t violate the access restrictions, before loading it to the system.
Distributed
Java can be used to develop applications that are portable across multiple
platforms and operating systems. Java is designed to support network applications.
Multithreaded
Java programs use a process called ‘multithreading’ to perform many
tasks simultaneously. Java provides the master solution for synchronizing multiple processes.
The built in support for threads enables interactive applications on the internet to run
simultaneously
SYSTEM CONFIGURATION
HARDWARE REQUIREMENTS
HDD : 40 GB or higher
Keyboard : 108Keys
SOFTWARE REQUIREMENTS
OS : MS WINDOWS XP SP2
ABOUT MS-ACCESS
Access is a relational database program .Access is used to enter, edit, and analyze
analyze lists
lists of
of
data. Relational databases minimize redundant data
Advantages of Access
•
• Duplicate data is minimized
•
• Information is more accurate
•
• Data entry is faster and easier
•
• Information can be viewed and sorted in multiple ways.
•
• Information is more secure
•
• Information can be shared among several users
•
• Information retrieval is faster and easier
MediInfo
MedicineID MediTitle Qty Price
1 Metacin 143 0.5
2 Crocin 194 25
3 Brufen 211 14
4 Domstal 69 15
5 Loparet 94 12
6 Otrivin 350 30
Source Code:
Billing.java
import java.awt.event.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.MalformedURLException;
import java.sql.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import javax.swing.plaf.metal.MetalTheme;
import javax.swing.table.DefaultTableModel;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author home
*/
public class Billing extends javax.swing.JFrame {
/**
* Creates new form Billing
*/
int index=0;
DefaultTableModel model;
String pri;
double amount=0.0;
Connection connect;
Statement st;
ResultSet rs;
public Billing() {
initConnect();
model=new DefaultTableModel();
initTable();
initComponents();
jTable1.setModel(model);
StockCheck();
}
public void initTable(){
model.addColumn("Code");
model.addColumn("Medicine Name");
model.addColumn("Price");
model.addColumn("Quantity");
model.addColumn("Cost");
}
public void initConnect() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connect=DriverManager.getConnection("jdbc:odbc:Medi");
st=connect.createStatement();
} catch (SQLException ex) {
Logger.getLogger(Billing.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(Billing.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
public void initial(){
int i=0;
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField2.setFocusable(false);
jTextField1.setFocusable(true);
jTextField2.setFocusable(true);
}
public void updatetable(double val,String code){
int v=(int)val;
try {
st.executeUpdate("UPDATE MediInfo SET Qty='"+v+"' WHERE
MedicineID='"+code+"'");
jTextField1.setFocusable(false);
jTextField1.setFocusable(true);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Billing Vn.1 (BETA)");
setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage("Medic.jpg"));
jTable1.setModel(new javax.swing.table.DefaultTableModel());
jTable1.addInputMethodListener(new java.awt.event.InputMethodListener() {
public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
}
public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
jTable1InputMethodTextChanged(evt);
}
});
jScrollPane1.setViewportView(jTable1);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Billing"));
jTextField1.setAction(jTextField1.getAction());
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jTextField2.setAction(jTextField2.getAction());
jTextField2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField2ActionPerformed(evt);
}
});
jTextField3.setEditable(false);
jButton1.setAction(jButton1.getAction());
jButton1.setText("Add");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setAction(jButton2.getAction());
jButton2.setMnemonic('N');
jButton2.setText("Cancel");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setAction(jButton3.getAction());
jButton3.setMnemonic('P');
jButton3.setText("Print");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setAction(jButton4.getAction());
jButton4.setMnemonic('C');
jButton4.setText("Cancel/Close");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel7.setIcon(new
javax.swing.ImageIcon("C:\\Users\\TOSHIBA\\Desktop\\Pharmacy\\medi.jpg")); // NOI18N
jLabel7.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0,
0)));
jLabel7.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jMenu1.setText("File");
jMenuItem2.setAction(jMenuItem2.getAction());
jMenuItem2.setText("Stock");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem2);
jMenuItem1.setAction(jMenuItem1.getAction());
jMenuItem1.setText("Exit");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu1.add(jMenuItem1);
jMenuBar1.add(jMenu1);
jMenu2.setText("About");
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>//GEN-END:initComponents
try {
rs=st.executeQuery("SELECT MediTitle FROM MediInfo WHERE
MedicineID='"+Integer.parseInt(jTextField1.getText()) +"'");
while(rs.next()){
jTextField3.setText(""+rs.getString(1));
i++;
}
jTextField1.setFocusable(false);
jTextField1.setFocusable(true);
}
//jTextField2.setFocusable(true);
} catch (SQLException ex) {
Logger.getLogger(Billing.class.getName()).log(Level.SEVERE, null, ex);
}
int reply=JOptionPane.showConfirmDialog(rootPane, "Do you wanna Add ?");
insertRow(reply,cod,nm,pri,qt,qty);
}
}//GEN-LAST:event_jButton1ActionPerformed
jLabel5.setText(""+amount);
index++;
//updatetable(Double.parseDouble(qty)-Double.parseDouble(qt),cod);
}
else
JOptionPane.showMessageDialog(rootPane, "Stock Available is "+qty);
initial();
}
}
public boolean CheckStock(String qt,String qty){
if(Double.parseDouble(qt)>Double.parseDouble(qty))
return true;
else
return false;
}
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jTextField2ActionPerformed
// TODO add your handling code here:
jButton1ActionPerformed(evt);
}//GEN-LAST:event_jTextField2ActionPerformed
new Billing().setVisible(true);
this.dispose();
}//GEN-LAST:event_jButton4ActionPerformed
}//GEN-LAST:event_jTable1InputMethodTextChanged
}
if(!req.isEmpty()){
int rep=JOptionPane.showConfirmDialog(rootPane,
"<html><b>ALERT</b></html>\n Stock is Less\n Do u want to Check out
the Stock ?\n");
if(rep==JOptionPane.YES_OPTION){
MetalTheme myXPStyleTheme = new XPStyleTheme();
MetalLookAndFeel.setCurrentTheme(myXPStyleTheme);
try
{
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch (Exception err)
{
System.out.println("Error loading myXPStyleTheme:" + err.toString());
}
PMSSwing c = new PMSSwing(1);
c.RetrieveData();
}
}
//jTextField2.setFocusable(true);
} catch (SQLException ex) {
Logger.getLogger(Billing.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
FIRST:event_jMenuItem1ActionPerformed
// TODO add your handling code here:
System.exit(0);
}//GEN-LAST:event_jMenuItem1ActionPerformed
try {
}
update=Double.parseDouble(QtyData)-Double.parseDouble(qty);
updatetable(update, cod);
//jTextField2.setFocusable(true);
} catch (SQLException ex) {
Logger.getLogger(Billing.class.getName()).log(Level.SEVERE, null, ex);
}
i++;
}}
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Billing.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Billing.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Billing.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Billing.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.table.*;
import javax.swing.plaf.metal.*;
//import javax.swing.border.*;
//DataBase Packages
//import java.net.*;
//import java.io.*;
import java.sql.*;
//Main Class
//List of Labels
//List of TextFields
//List of Buttons
//List of Panel
//Table
PMSSwing()
{
}
PMSSwing(int choice)
{
switch(choice)
{
case 1:
//Initial Window
loadSplashScreen();
FormSplash.dispose();
//cotainer
cpane = getContentPane();
//components
btnpanel.add(btnAdd);
btnpanel.add(btnEdit);
btnpanel.add(btnDelete);
btnpanel.add(btnRefresh);
btnpanel.add(btnExit);
cpane.add(new JScrollPane(table));
cpane.add(btnpanel, BorderLayout.SOUTH);
break;
case 2:
//Appending Window
setTitle("Addition of data...");
setBounds(275, 275, 400, 200);
setResizable(false);
//cotainer
cpane = getContentPane();
cpane.setLayout(new FlowLayout());
//Components
panel.add(lblMedicineID);
panel.add(txtMedicineID);
panel.add(lblMediTitle);
panel.add(txtMediTitle);
panel.add(lblQty);
panel.add(txtQty);
panel.add(lblPrice);
panel.add(txtPrice);
btnSaveAdd.addActionListener(this);
btnCancel.addActionListener(this);
btnpanel.add(btnSaveAdd);
btnpanel.add(btnCancel);
cpane.setBackground(Color.YELLOW);
cpane.add(panel);
cpane.add(btnpanel, BorderLayout.EAST);
break;
case 3:
//Editing window
setTitle("Updation of data...");
setBounds(350, 350, 400, 250);
setResizable(false);
//cotainer
cpane = getContentPane();
cpane.setLayout(new FlowLayout());
//Components
panel.add(lblOldMedicineID);
panel.add(txtOldMedicineID);
panel.add(lblMedicineID);
panel.add(txtMedicineID);
panel.add(lblMediTitle);
panel.add(txtMediTitle);
panel.add(lblQty);
panel.add(txtQty);
panel.add(lblPrice);
panel.add(txtPrice);
btnSaveEdit.addActionListener(this);
btnCancel.addActionListener(this);
btnpanel.add(btnSaveEdit);
btnpanel.add(btnCancel);
cpane.add(panel);
cpane.setBackground(Color.BLUE);
cpane.add(btnpanel, BorderLayout.EAST);
break;
case 4:
//Deleting window
setTitle("Removal of data...");
setBounds(300, 300, 300, 125);
setResizable(false);
//cotainer
cpane = getContentPane();
cpane.setLayout(new FlowLayout());
//Components
panel.add(lblMedicineID);
panel.add(txtMedicineID);
btnSaveDelete.addActionListener(this);
btnCancel.addActionListener(this);
btnpanel.add(btnSaveDelete);
btnpanel.add(btnCancel);
cpane.add(panel);
cpane.setBackground(Color.RED);
cpane.add(btnpanel, BorderLayout.EAST);
break;
}
//Window Properties
setDefaultCloseOperation(HIDE_ON_CLOSE);
setVisible(true);
//conection to DataBase
ConnectToDatabase();
}
}
else if (ae.getSource() == btnCancel)
{
setVisible(false);
}
else if(ae.getSource() == btnSaveAdd)
{
AddData(txtMedicineID.getText(), txtMediTitle.getText(), txtQty.getText(),
txtPrice.getText());
txtMedicineID.setText("");
txtMediTitle.setText("");
txtQty.setText("");
txtPrice.setText("");
}
else if(ae.getSource() == btnSaveEdit)
{
EditData(txtMedicineID.getText(), txtMediTitle.getText(),
txtQty.getText(),txtPrice.getText(), txtOldMedicineID.getText());
txtOldMedicineID.setText("");
txtMedicineID.setText("");
txtMediTitle.setText("");
txtQty.setText("");
txtPrice.setText("");
}
else if(ae.getSource() == btnSaveDelete)
{
DeleteData(txtMedicineID.getText());
txtMedicineID.setText("");
}
else if(ae.getSource() == btnRefresh)
{
RetrieveData();
}
}
//load driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//make connection
con = DriverManager.getConnection("jdbc:odbc:Medi");
//create statement
st = con.createStatement();
}
catch (Exception e) {System.out.println(e);}
}
private void AddData (String code, String title, String hour, String price)
{
try
{
//prepare statement
String qry = "Insert into MediInfo values (?, ?, ?, ?)";
System.out.println(code + "\t"+title+ "\t"+hour+ "\t"+price);
//System.out.println("Read only "+con.isReadOnly());
//System.out.println("Closed "+con.isClosed());
PreparedStatement ps = con.prepareStatement(qry);
ps.setString(1, code);
ps.setString(2, title);
ps.setString(3, hour);
ps.setString(4,price);
ps.executeUpdate();
}
catch(Exception e) {System.out.println(e + "\t" + e.getMessage()); }
}
private void EditData (String code, String title, String hour, String price, String cond)
{
try
{
//prepare statement
String qry = "Update MediInfo set MedicineID = ?, MediTitle = ?, Qty = ?, Price = ? where
MedicineID = ?";
PreparedStatement ps = con.prepareStatement(qry);
ps.setString(1, code);
ps.setString(2, title);
ps.setString(3, hour);
ps.setString(4, price);
ps.setString(5, cond);
ps.executeUpdate();
}
catch(Exception e) {System.out.println(e); }
}
ps.setString(1, cond);
ps.executeUpdate();
}
catch(Exception e) {System.out.println(e); }
}
//execute query
ResultSet rs = st.executeQuery("Select * from MediInfo");
//get metadata
ResultSetMetaData md = rs.getMetaData();
int colcount = md.getColumnCount();
while (rs.next())
{
for (int i=1; i<=colcount; i++)
{
data[i-1] = rs.getString(i);
}
tmodel.addRow(data);
}
}
catch(Exception e) {System.out.println(e); }
}
}
import javax.swing.*;
import java.awt.*;
import javax.swing.border.LineBorder;
getContentPane().add(SplashLabel,BorderLayout.CENTER);
setSize(850,300);
setLocation(200,100);
show();
}
}
Display :
import javax.swing.plaf.*;
import javax.swing.plaf.metal.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
public class XPStyleTheme extends DefaultMetalTheme {
private final ColorUIResource primary1 = new ColorUIResource( 119, 119, 187); //Frame
Border Color
private final ColorUIResource primary2 = new ColorUIResource( 153, 153, 204);
//Barckground Color
private final ColorUIResource primary3 = new ColorUIResource(225, 225, 25 5); // Title
Color
}
Screen shots:
Addition of data :
Updation of data:
Removal of Data:
Entries of all data :
After adding items :
After updating :
After Deletion :