0% found this document useful (0 votes)
63 views45 pages

Medical Shop Administration System

Uploaded by

leorishi001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views45 pages

Medical Shop Administration System

Uploaded by

leorishi001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 45

1.

INTRODUCTION

The Medical shop Management system project is software product to automate and log
on to various day-to-day activities and to provide instantaneous information required in effective
management of any medical shops. This project is capable to manage the records of medicines,
stocks of the medicines, medicine company details, user details, sales details etc.

This project will have the following modules:


 Purchase Item module
 Sale Item module
 Item detail module
 Agency Bill module
 Customer Bill module
 Stock module
 Reports

1
1.1. SYSTEM SPECIFICATION
The System requirement has two phases as Hardware and Software Specification. The
system architecture describes the collection of inter-connected hardware nodes on which
software will eventually run.

1.1.1. HARDWARE SPECIFICATION

PROCESSOR : INTEL CORE 2 DUO


RAM : 1 GB RAM
HARD DISK : 160 GB
SPEED : 2.4 GHz
DISPLAY : 21” LCD MONTIOR
MOTHER BOARD : INTEL
KEYBOARD : SAMSUNG
MOUSE : LOGITECH
PRINTER : HP Laser 1610 Series

1.1.2. SOFTWARE SPECIFICATION

OPERATING SYSTEM : MICROSOFT WINDOWS XP PROFESSIONAL


FRONT END : Visual Basic 6.0
BACK END : Oracle 8i

ABOUT THE SOFTWARE


Features of VB

Features of VB Visual basic syntax ideally suited for producing windows application.
Msword, MsAccess and MsPowerPoint all share visual basic for application the exact same
language syntax in visual basic in 6.0.

Visual basic continues the tradition Of simple, powerful and easy to learn language yet
adds enough extended capabilities to the satisfy o most jaded developer.

2
Several significant facts contribute to visual basic is bright future. First visual basic hedge
product millions of developers of all skills levels are producing application with visual basic
secondly VB powerful development system. It contain built in function to its intrinsic features
VB provides the capability to produce custom libraries and objects that can be loaded at run time
or bound to the distributable application. Thirdly VB also well supported by their party product.
Microsoft is indisputably the largest and the most successfully software company in the world.

For all these and many more visual basic is indisputably the most attractive development
environment urgently available. In the contrast to the absolute systems of the past, visual basic
has an under sizably bright and shining future.

About Oracle 8i Introduction

In 1977 Larry Elision, Bob Miner & Ed Oates formatted a company built RDBMS
using C & the SQL interface. Soon, after they come out with version 1, a prototype. In 1979 RSI
delivered its first product to customers. The Oracle RDBMS version 2 worked on the digital
PDP-2 operating system & was soon ported to the DEC VAX system. 1983 heralded the release
of version 3, which touted changes in the SQL languages as well as performance enhancement &
other improvements. Unlike earlier version 3 was written almost entirely in c. At this point RSI
change its name to ORACLE CORPORATION.

Oracle version 4 was released in 1984. This version supported both the VAX system
and the IBM operating system. Version 4 was the first version to incorporate read consistency.
Version 5 introduced in 1985, was milestone it introduced client/server computing to the market
with the use of SQL*NET. Version 5 was also the first MS-DOS product to break through the
640 KB barrier.

In 1988 Oracle presented version 6 which introduced low level locking as well as a
verity of performance improvements & functionality enhancement including sequence
generation & differed writes. I was introduced to Oracle 6 back in the days when we ran the TPI,
TCP-A & TCP-B benchmark. At this point oracle was running on a large verity of different
platforms & operating systems. In 1991 Oracle introduced the oracle parallel server option was
available on a variety of platforms.

3
Oracle 7 released in 1992 including many architecture changes in the area of
memory, CPU & I/O utilization. Oracle 7 is a full-featured RDBMS to which you are
accustomed the one you have been using for many years.

4
2. SYSTEM STUDY

The system can be studied in two different kinds. The system analysis means analyze the
entire system. This phase are classified into
 Existing System

 Proposed System

2.1. EXISTING SYSTEM


The Existing system is a manual entry. Here the transactions are carried out in the hand
written registers. It is a tedious job to maintain the record for the user. The human effort is more
here. The retrieval of the information is not as easy as the records are maintained in the hand
written registers. This application requires correct feed on input into the respective field.
Suppose the wrong inputs are entered, rework has to be carried out. Also a lot of time has to be
spent.

2.1.1. DRAWBACKS

The existing system is not efficient due to the following limitations:


 Unable to retrieve the details quickly for our urgency

 It is tedious to manage historical data which needs much space to keep all the previous
years’ ledgers, books etc.

 Data handling is quite difficult

 More manual hours need to generate required reports.

2.2. PROPOSED SYSTEM


To overcome the drawbacks of the existing system, the proposed system has been
evolved. This project aims to reduce the paper work and saving time to generate accurate output.
The system provides with the best user interface. The efficient reports can be generated by using
this proposed system.

5
2.2.1 FEATURES
The goal of the system is to bring down the work load with the increased efficiency and to speed
up the activities. The proposed system provides real time communication between the users
irrespective of geographical boundaries. The transaction details are maintained for future
reference these are the advantages of the proposed system

Advantages of Proposed System


 It is trouble-free to use.
 It is a relatively fast approach to validate.
 Is highly reliable, approximate result from user.
 Best user Interface.
 Efficient reports.

6
3. SYSTEM DESIGN AND DEVELOPMENT
Although the degree of interest in each concept has varied over the years, each has stood
the test of time .each provides the software with a foundation from which more sophisticated
methods can be applied fundamental design provides the necessary framework for “getting it
right”.
Set of fundamental design concepts are evolved over the past three decades. Although the
degree of interest in each concept has varied over the years, each has stood the test of time. Each
provides the software designer with a foundation from which more sophisticated design methods
can be applied. Design is defining a model of the new system and continues by converting this
method to a new system. The method is used to convert to database and processes to use
procedures and computer programs. Design proposes the new system that meets these
requirements. The detailed design uses conceptual data model in the proposed system the need
for database design is mandatory as all the information is maintained in a properties file. The
details of server configuration are fetched from a properties file.
3.1. FORM DESIGN
The purpose of the form design is to create a technical solution that satisfies the
functional requirements for the system it started off with initials of the existing system. The
analysis was helpful giving a thorough understanding of the present system. The analysis of
existing system also uncovered many flaws and limitation formed the major objective of the
proposed system goals.
 Input design

 Output design

 Database design

3.2. INPUT DESIGN


The input design is the link that ties the information system into the world of its users. It
is a process of converting user-originated inputs to a computer-based format. Input data are
collected and organized into a group of similar data. Once identified; appropriate input media are
selected for processing.
The goal of designing input data is to make entry easy, logical and free form errors. In
input data design, we design source document that capture the data then select the media used to
7
enter them into the computer. The input forms are developed in a user-friendly way so that a
layman also can easily understand everything. Menus are provided to users and different icons
are designed so the proposed system design looks decorative. Input design is the part of the
overall system design.
Objectives of Input Design:
 To achieve the highest possible level of accuracy.

 To ensure that the input is acceptable and understood by the user.

3.3. OUTPUT DESIGN


Output refers to the results and information that are generated by the system. Outputs
form the computer is required primarily to communicate the results of the processing to users.
Output forms also designed in a specific manner as per the user requirement. Results are
formatted to enhance clarity. Depending on the user the system would generate appropriate
output. The output forms are designed in such a way that the entire user required data is
presented.
While designing an output, the system analyst must accomplish the following.
 Determine what information to present

 Decide whether to display, print or speak information and select the output medium.

 Arrange the presentation of information in an acceptable form.

 Decide how to distribute the output to intended users.

3.4. DATABASE DESIGN


Database design is a crucial factor in the performance of a system, both in terms of system
timings and in the case with which the system can be maintained or modified.
 To permit simple retrieval of data in response to query and response requests.

 To simplify the maintenance of data through updates, insertions and deletions.

 To reduce the need to restructure or reorganize data when new application requirements
arise.

8
PURPOSE OF DATABASE
A database system provides the organization with centralized control of the data. This is
in sharp contrast to the situation that prevails in many enterprises, where typically each
application has its own private files in its tapes and disks so that the data is widely dispersed and
therefore difficult to control the flow.
The advantages of centralized database are:
 Redundancy can be reduced.

 Integrity can be maintained.

 Inconsistency can be avoided.

 Security restriction can be enforced.

 Data can be shared.

 Confliction requirements can be balanced.

3.5. SYSTEM DEVELOPMENT


After getting the approval of the design phase reports from the concerned authorities the
development phase activities starts. The principal activity of the development phase constitute of
coding and testing the computer program modules of the overall system. The other important
activities include implementation planning, equipment acquisition and system
Suggestion regarding change over from the existing to the developed system is made a
parallel change over, change over is the process of dropping the existing system and
implementation of the new system. The existing system should be developed to avoid the
difficult of various processing.

3.5.1 DESCRIPTION OF MODULES

Purchase Item module


The main purpose for developing this module is to manage the purchase of medicines
from the agencies/company. Admin will manage all purchase record.

9
Sale Item module
The main purpose for developing this module is to manage the customer sales. Admin
will manage all sales record.

Item detail module


The main aim for developing this module is to manage the medicine data wise. All
medicines will be managed by admin and customer will be able to see medicine. Admin can see
the list of all the medicine and filter it according to the customers.

Agency Bill module


The main purpose for developing this module is to manage the company/agencies. This
company module is the main module in this project. All the company will be managed by admin
and customer will be able to see the company/agencies.

Customer Bill module


The main objective for developing this module is to provide all the functionality related
to the customer. It tracks all the information and details of the customer. All the operations such
as Create, Read, Update and Delete are developed. This is a role based module where admin can
perform each and every operations on data but the customer will be able to view only the data, so
access level restrictions has also been implemented on the project.

Stock module
The main purpose for developing this module is to manage the customer medicine stock.
Admin will manage all medicine stock record.
Reports
Reports are generated for various modules as per request.

10
4. TESTING AND IMPLEMENTATION
SYSTEM TESTING
System testing is the stage of implementation, which is aimed at ensuring that the system
works accurately and efficiently before live operation commences. Testing is vital to the success
of the system. System resting makes a logical assumption that is all the parts of the system are
correct, the goal will be successfully achieved .The candidate system is subject to a variety of
tests: on-line response, Volume, Stress, recovery and security and usability tests.
TYPES OF TESTING
 Unit Testing

 Integration Testing

 Validation Testing

 Output Testing

Unit Testing
Unit testing focuses verification efforts on the smallest unit of software design, the
module. This is also known as “Module Testing”. The modules are tested separately. This testing
is carried out during programming stage itself. In this testing step each module is found to be
working satisfactorily as regard to the expected output from the module.

Integration Testing

Integration testing focuses on the design and the construction of the software architecture. Data
can be lost across an interface; one module can have adverse effect on another sub function and
so on. This integration testing is a part that the software meets all functional, behavioral and
performance requirements. The errors, which are uncovered during integration testing, are
corrected during this phase.

Validation Testing
Errors discovered where corrected prior to completion of this project with the help of the user by
negotiating to establish a method of resolving deficiencies. Thus the proposed system under
consideration has been tested by using validation testing and found to be working satisfactorily.

11
Output Testing

After performing the validation testing, the next step is output testing of the proposed system
since no system could be useful if it does not produce the required output in the specific format.
The outputs generated or displayed by the system under consideration are tested asking the users
about the format required by them.

System Testing is an important phase. Testing represents an interesting anomaly for the software.
Thus a series of testing are performed for the proposed system before the system is ready for user
acceptance testing.

A good test case is one that has a high probability of finding an as undiscovered error. A
successful test is one that uncovers an as undiscovered error.

Testing Objectives:

 Testing is a process of executing a program with the intent of finding an error


 A good test case is one that has a probability of finding an as yet undiscovered error
 A successful test is one that uncovers an undiscovered error

Testing Principles:

 All tests should be traceable to end user requirements


 Tests should be planned long before testing begins
 Testing should begin on a small scale and progress towards testing in large
 Exhaustive testing is not possible
 To be most effective testing should be conducted by a independent third party

SYSTEM IMPLEMENTATION
After proper testing and validation, the question arises whether the system can be
implemented or not. Implementation includes all those activities that take place to convert from
the old system to the new. The new system may be totally new, replacing an existing module or
automated system, or it may be major modification to an existing system. In either case proper

12
implementation is essential to provide a reliable to provide a reliable system to meet organization
requirements.
All planning has now, be completed and the transformation to a fully operational system
can commence. The first job will be writing, debugging documenting of all computer programs
and their integration into a total system. The master and transaction files are decided, and this
general processing of the system is established. Programming is complete when the programs
conformed to the detailed specification.
When the system is ready for implementation, emphasis switches to communicate with
the transaction. Open discussion with the staff is important form the beginning of the project.
Staff can be expected to the concerned about the effect of the automation on their jobs and the
fear of redundancy or loss of status must be allayed immediately. During the implementation
phase it is important that all staff concerned be apprised of the objectives of overall operation of
the system. They will need shinning on how computerization will change their duties and need to
understand how their role relates to the system as a whole.

13
5. CONCLUSION & FUTURE ENHANCEMENT

CONCLUSION

The given project titled “MEDICAL SHOP MANAGEMENT SYSTEM” is successfully


completed and the reports are also generated. Validation is done accordingly and the system is
designed to be as interactive as possible.

FUTURE ENHANCEMENT

The project has a very vast scope in future. The project can be implemented on intranet in
future. Project can be updated in near future as and when requirement for the same arises, as it
is very flexible in terms of expansion. With the proposed software of database Space
Manager ready and fully functional the client is now able to manage and hence run the entire
work in a much better, accurate and error free manner.

14
BIBLIOGRAPHY

REFERENCES BOOKS

1. “BEGINNING VB.NET (2ND EDITION)”by Matthew Reynolds (Editor), et al

2. “INTRODUCTION TO VISUAL BASIC USING .NET” by Robert J. Oberg, Dana L.


Wyatt

3. “VISUAL BASIC .NET FOR EXPERIENCED PROGRAMMERS” by Harvey M.


Deitel, Paul J. Deitel

4. “LEARNING VISUAL BASIC.NET THROUGH APPLICATIONS” by Clayton


Crooks II
5. “BEGINNING WEB PROGRAMMING USING VB.NET AND VISUAL
STUDIO .NET” by Daniel Cazzulino, et al

6. “VISUAL BASIC .NET HOW TO PROGRAM (2ND EDITION)”by Harvey M.


Deitel, Paul J. Deitel, Tem R. Nieto

WEBSITES
1. http://www.techopedia.com/definition/3734

2. http://en.wikipedia.org/wiki/.NET_Framework

3. http://www.tutorialspoint.com/vb.net/vb.net_overview.htm/net-framework-net

4. http://www.vbtutor.net/lesson1.html

5. http://en.wikipedia.org/wiki/Microsoft_SQL_Server

15
APPENDICES
DATA FLOW DIAGRAM

LEVEL 0:

Medical shop
User administration Main menu
system

LEVEL 1:
Purchase
Purchase module

Sale item Sale item


Details

Administrator

Medicine item
Medicine Details

Agency bill Agency bill Details

Customer bill
Customer bill
Details

Medicine
Medicine Stock Details
Stock

16
SYSTEM FLOW DIAGRAM

Medical Shop Management System

Sale item Medicine Agency Bill Customer


Purchase Stock
bill

Purchas Medici Agency Custom Stock


e Sale Bill er bill
item ne

17
DATABASE DESIGN

Login Form

Field Name Data Type(Size)


Username Varchar2(25)
Password Varchar2(30)

Purchase Item

Field name Data type(size)


record no Number(5)
Agencynm Varchar2(30)
item type Varchar2(20)
Item nm Varchar2(30)
Entrydt Varchar2(10)
Mfgdt Date
Expdt Date
Ppr Number(8,2)
Qty Number(5)
Total Number(8,2)

Sale Item

Field name Data type(size)


record no Number(5)
Doctor Varchar2(30)
Custnm Varchar2(30)
Addr Varchar2(55)
City Varchar2(25)
Agencynm Varchar2(30)
Item type Varchar2(30)
Itemnm Varchar2(30)
Entrydt Date
Mfgdt date
Expdt date
Ppr Number(8,2)
Qty Number(5)
Total Number(8,2)

18
Item detail
Field name Data type(size)
record no Number(5)
Agencynm Varchar2(30)
item name Varchar2(30)
batch no Varchar2(10)
Mfgdt date
Expdt date

Agency bill

Field name Data type(size)


record no Number(5)
Billno Number(5)
Itemnm Varchar2(30)
Mfgdt Date
Expdt Date
Qty Number(5)
Ppr Number(8,2)
Total Number(8,2)

Customer bill
Field name Data type(size)
record no Number(5)
Billno Number(5)
Agencynm Varchar2(30)
Doctornm Varchar2(30)
Itemnm Varchar2(30)
Mfgdt Date
Expdt Date
Qty Number(5)
Ppr Number(8,2)
Total Number(8,2)

Stock
19
Field name Data type(size)
Agencynm Varchar2(30)
Item type Varchar2(20)
Itemnm Varchar2(30)
Mfgdt date
Expdt date
Ppr Number(8,2)
Qty Number(5)

20
SAMPLE SCREENSHOTS

21
22
23
24
25
26
27
28
29
30
31
32
SAMPLE CODING
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub cmd_cancel_Click()
Unload Me
End Sub
Private Sub cmd_ok_Click()
If txt_unm.Text = " " And txt_pass.Text = " " Then
MsgBox "PLS ENTER USERNAME AND PASSWORD"
ElseIf txt_unm.Text = "abhigna" And txt_pass.Text = "abhigna" Then
MsgBox "Login Successfully!!!"
MDIForm1.Show
ElseIf txt_unm.Text = "ssmedicals" And txt_pass.Text = "ssmedicals" Then
MsgBox "Login Successfully!!!"
MDIForm1.Show
Unload Me
Else
MsgBox "Login Not Successfully!!!"
End If
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
On Error GoTo err
cn.Execute "create table loginform(username varchar2(25),password varchar2(30))"
cn.Execute "commit"
err:
rs.Open "select *from loginform", cn, adOpenStatic, adLockBatchOptimistic
End Sub
Private Sub M_AGEBILL_Click()
Form10.Show
End Sub
Private Sub M_CUSTBILL_Click()
Form11.Show
End Sub
Private Sub M_EXIT_Click()
Unload Me
End Sub
Private Sub M_IDETAIL_Click()
Form9.Show
End Sub
Private Sub M_PUR_Click()
Form1.Show
End Sub
Private Sub M_REPORT1_Click()
DataReport1.Show
33
End Sub
Private Sub M_REPORT2_Click()
DataReport2.Show
End Sub
Private Sub M_REPORT3_Click()
DataReport3.Show
End Sub
Private Sub M_REPORT4_Click()
DataReport4.Show
End Sub
Private Sub M_SAL_click()
Form8.Show
End Sub
Private Sub M_STOCK_Click()
Form12.Show
End Sub
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Dim no1 As Integer
Dim item_nm As String
Dim agency_nm As String
Dim qty As Integer
Dim qty1 As Integer
Private Sub cmd_add_Click()
item_nm = Me.cmb_inm.Text
agency_nm = Me.cmb_agenm.Text
If cmd_add.Caption = "Add" Then
txt_rno.Text = " "
cmb_agenm.Text = " "
cmb_inm.Text = " "
txt_itemnm.Text = " "
Me.txt_mgdt.Text = ""
Me.txt_epdt.Text = ""
txt_ppr.Text = " "
txt_qty.Text = " "
txt_total.Text = " "
txt_rno.SetFocus
cmd_add.Caption = "Save"
Else
cn.Execute "insert into pur_item values(" & Val(txt_rno.Text) & ",'" & Trim(cmb_agenm.Text)
& "','" & Trim(cmb_inm.Text) & "','" & Me.txt_itemnm.Text & "','" & Format(dtp_endt.Value,
"dd-mmm-yy") & "','" & Format(Me.txt_mgdt.Text, "dd-mmm-yy") & "','" &
Format(Me.txt_epdt.Text, "dd-mmm-yy") & "'," & Val(txt_ppr.Text) & "," & Val(txt_qty.Text)
& "," & Val(txt_total.Text) & ")"
cn.Execute "commit"
qty = Val(Me.txt_qty.Text)
While Not rs1.EOF = True
34
If agency_nm = rs1.Fields(0).Value Then
If item_nm = rs1.Fields(1).Value Then
qty = Val(Me.txt_qty.Text)
qty1 = rs1.Fields(6).Value
qty1 = qty1 + qty
cn.Execute "update stock_detail set agencynm='" & cmb_agenm.Text & "',itemtype='" &
cmb_inm.Text & "',itemnm=' " & Me.txt_itemnm.Text & " ',mfgdt='" &
Format(Me.txt_mgdt.Text, "dd-mmm-yy") & "',expdt='" & Format(Me.txt_epdt.Text, "dd-mmm-
yy") & "',ppr=" & Val(txt_ppr.Text) & ",qty=" & qty1 & " where itemtype='" & cmb_inm.Text
& "' "
cn.Execute "commit"
MsgBox "record updated"
cmd_add.Caption = "Add"
rs.Requery
Exit Sub
End If
End If
rs1.MoveNext
Wend
cn.Execute "insert into stock_detail values('" & Trim(cmb_agenm.Text) & "','" &
Trim(cmb_inm.Text) & "',' " & Me.txt_itemnm.Text & " ','" & Format(Me.txt_mgdt.Text, "dd-
mmm-yy") & "','" & Format(Me.txt_epdt.Text, "dd-mmm-yy") & "'," & Val(txt_ppr.Text) & ","
& Val(txt_qty.Text) & ")"
cn.Execute "commit"
MsgBox "Your record saved"
cmd_add.Caption = "Save"
rs.Requery
End If
End Sub
Private Sub cmd_del_Click()
Dim ans As String
no1 = Val(InputBox("enter no to delete"))
ans = MsgBox("Do U Want To Delete?....", vbYesNo, "deletion Process...")
If ans = vbYes Then
cn.Execute "delete from pur_item where recordno=" & Val(txt_rno.Text) & ""
MsgBox "record deleted"
Call data
cn.Execute "commit"
rs.Requery
End If
rs.MoveNext
If rs.EOF = True Then
rs.MoveLast
End If
End Sub
Private Sub cmd_edit_Click()
Dim no As Integer
If cmd_edit.Caption = "Edit" Then
35
cmd_edit.Caption = "Edit Save"
Else
cn.Execute "update pur_item set recordno='" & Val(txt_rno.Text) & "',agencynm='" &
cmb_agenm.Text & "',itemtype='" & cmb_inm.Text & "',itemnm='" & txt_itemnm.Text &
"',entrydt='" & Format(txt_epdt.Text, "dd-mmm-yy") & "',mfgdt='" &
Format(Me.txt_mgdt.Text, "dd-mmm-yy") & "',expdt='" & Format(Me.txt_epdt.Text, "dd-mmm-
yy") & "',ppr='" & Val(txt_ppr.Text) & "',qty='" & Val(txt_qty.Text) & "',total=" &
Val(txt_total.Text) & " where recordno='" & Val(txt_rno.Text) & "'"
cn.Execute "commit"
MsgBox "record update"
cmd_edit.Caption = "Edit"
rs.MoveNext
End If
rs.Requery
End Sub
Private Sub cmd_ref_Click()
Unload Me
Me.Show
End Sub
Private Sub cmd_search_Click()
Dim fnd As Integer
fnd = Val(InputBox("enter no for searching"))
rs.MoveFirst
While Not rs.EOF = True
If fnd = rs.Fields(0).Value Then
MsgBox "record found"
Call data
Exit Sub
rs.Requery
End If
rs.MoveNext
Wend
If rs.EOF = True Then
MsgBox "record not found"
End If
rs.Requery
End Sub
Private Sub cmd_exit_Click()
Unload Me
End Sub
Private Sub cmd_first_Click()
If (rs.BOF = True) And (rs.EOF = True) Then
MsgBox "plece enter record", vbOKOnly
Else
rs.MoveFirst
Call data
End If
End Sub
36
Private Sub cmd_last_Click()
If (rs.BOF = True) And (rs.EOF = True) Then
MsgBox "plece enter record", vbOKOnly
Else
rs.MoveLast
Call data
End If
End Sub
Private Sub cmd_next_Click()
rs.MoveNext
If rs.EOF = True Then
MsgBox "you are in last recod"
rs.MoveLast

End If
Call data
End Sub
Private Sub cmd_previous_Click()
rs.MovePrevious
If rs.BOF = True Then
MsgBox "you are in first recod"
rs.MoveFirst
End If
Call data
End Sub
Public Function data()
txt_rno.Text = rs.Fields(0).Value
cmb_agenm.Text = rs.Fields(1).Value
cmb_inm.Text = rs.Fields(2).Value
Me.txt_itemnm.Text = rs.Fields(3).Value
dtp_endt.Value = rs.Fields(4).Value
Me.txt_mgdt.Text = rs.Fields(5).Value
Me.txt_epdt.Text = rs.Fields(6).Value
txt_ppr.Text = rs.Fields(7).Value
txt_qty.Text = rs.Fields(8).Value
txt_total.Text = rs.Fields(9).Value
End Function
Private Sub txt_qty_lostfocus()
txt_total.Text = txt_qty.Text * txt_ppr.Text
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
On Error GoTo err

37
cn.Execute "create table pur_item(recordno number(5),agencynm varchar2(30),itemtype
varchar2(20),itemnm varchar2(30),entrydt varchar2(10),mfgdt date,expdt date,ppr
number(8,2),qty number(5),total number(8,2))"
cn.Execute "commit"
cn.Execute "create table stock_detail(agencynm varchar(30),itemtype varchar(20),itemnm
varchar(30),mfgdt date,expdt date,ppr number(8,2),qty number(5))"
cn.Execute "commit"
err:
rs.Open "select * from pur_item", cn, adOpenStatic, adLockBatchOptimistic
rs1.Open "select *from stock_detail", cn, adOpenStatic, adLockBatchOptimistic
End Sub

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rs1 As ADODB.Recordset
Dim cn1 As ADODB.Connection
Private Sub cmd_add_Click()
agency_nm = Me.cmb_agenm.Text
item_nm = Me.cmb_inm.Text
If cmd_add.Caption = "Ok" Then
cn.Execute "insert into sale_item values(" & Val(txt_rno.Text) & ",'" & Trim(Me.txt_dr.Text) &
"','" & Trim(txt_cnm.Text) & "','" & Trim(txt_add.Text) & "','" & Trim(txt_city.Text) & "','" &
Trim(cmb_agenm.Text) & "','" & Trim(cmb_inm.Text) & "','" & Trim(Me.txt_itemnm.Text) &
"','" & Format(dtp_endt.Value, "dd-mmm-yy") & "','" & Format(Me.txt_mfgdt.Text, "dd-mmm-
yy") & "','" & Format(Me.txt_expdt.Text, "dd-mmm-yy") & "'," & Val(txt_ppr.Text) & "," &
Val(txt_qty.Text) & "," & Val(txt_total.Text) & ")"
cn.Execute "commit"
rs.Requery
rs1.Requery
qty = Val(Me.txt_qty.Text)
While Not rs1.EOF = True
If agency_nm = rs1.Fields(0).Value Then
If item_nm = rs1.Fields(1).Value Then
qty = Val(Me.txt_qty.Text)
qty1 = rs1.Fields(6).Value
qty1 = qty1 - qty
cn.Execute "update stock_detail set agencynm='" & cmb_agenm.Text & "',itemtype='" &
cmb_inm.Text & "',itemnm=' " & Me.txt_itemnm.Text & " ',mfgdt='" &
Format(Me.txt_mfgdt.Text, "dd-mmm-yy") & "',expdt='" & Format(Me.txt_expdt.Text, "dd-
mmm-yy") & "',ppr=" & Val(txt_ppr.Text) & ",qty=" & qty1 & " where itemtype='" &
cmb_inm.Text & "' "
cn.Execute "commit"
MsgBox "record updated"
Dim ans As String
rs.Requery
rs1.Requery
DataReport4.Show
ans = MsgBox("Do U Want To Print Out?....", vbYesNo, "deletion Process...")
38
If ans = vbYes Then
cm_print.ShowPrinter
Else
txt_rno.Text = " "
txt_dr.Text = " "
txt_cnm.Text = " "
txt_add.Text = " "
cmb_agenm.Text = " "
txt_itemnm.Text = " "
cmb_inm.Text = " "
txt_city.Text = " "
txt_mfgdt.Text = " "
txt_expdt.Text = " "
txt_ppr.Text = " "
txt_qty.Text = " "
txt_total.Text = " "
txt_rno.SetFocus
End If
rs.MoveNext
If rs.EOF = True Then
rs.MoveLast
End If
Exit Sub
End If
End If
rs1.MoveNext
Wend
cmd_add.Caption = "print"
Else
cmd_add.Caption = "Ok"
MsgBox "ok"
End If
rs.Requery
rs1.Requery
End Sub

Private Sub cmd_delete_Click()


Dim ans As String
no1 = InputBox("enter no to delete")
ans = MsgBox("Do U Want To Delete?....", vbYesNo, "deletion Process...")
If ans = vbYes Then
cn.Execute "delete from sale_item where recordno=" & Val(txt_rno.Text) & ""
MsgBox "record deleted"
Call data
cn.Execute "commit"
End If
rs.MoveNext
If rs.EOF = True Then
39
rs.MoveLast
End If
rs.Requery
rs1.Requery
End Sub

Private Sub cmd_edit_Click()


Dim no As Integer
If cmd_edit.Caption = "Edit" Then
txt_rno.SetFocus
cmd_edit.Caption = "Edit Save"
Else
cn.Execute "update sale_item set recordno=" & Val(txt_rno.Text) & ",doctor='" & txt_dr.Text &
"',custnm ='" & txt_cnm.Text & "',addr='" & txt_add.Text & "',city='" & txt_city.Text &
"',agencynm='" & cmb_agenm.Text & "',itemnm='" & cmb_inm.Text & "',itemtype='" &
txt_itemnm.Text & "',entrydt='" & Format(dtp_endt.Value, "dd-mmm-yy") & "',mfgdt='" &
Format(txt_mfgdt.Text, "dd-mmm-yy") & "',expdt='" & Format(txt_expdt.Text, "dd-mmm-yy")
& "',ppr=" & Val(txt_ppr.Text) & ",qty=" & Val(txt_qty.Text) & ",total=" & Val(txt_total.Text)
& " where recordno='" & Val(txt_rno.Text) & "' "
cn.Execute "commit"
MsgBox "record update"
cmd_edit.Caption = "Edit"
End If
rs.Requery
rs1.Requery
End Sub

Private Sub cmd_first_Click()


If (rs.BOF = True) And (rs.EOF = True) Then
MsgBox "plece enter record", vbOKOnly
Else
rs.MoveFirst
Call data
End If
End Sub

Private Sub cmd_last_Click()


If (rs.BOF = True) And (rs.EOF = True) Then
MsgBox "plece enter record", vbOKOnly
Else
rs.MoveLast
Call data
End If
End Sub

Private Sub cmd_next_Click()


rs.MoveNext
If rs.EOF = True Then
40
MsgBox "you are in last recod"
rs.MoveLast
End If
Call data
End Sub

Private Sub cmd_previous_Click()


rs.MovePrevious
If rs.BOF = True Then
MsgBox "you are in first recod"
rs.MoveFirst
End If
Call data
End Sub
Private Sub cmd_exite_Click()
Unload Me
End Sub

Private Sub cmd_search_Click()


Dim fnd As Integer
fnd = Val(InputBox("enter nofor searching", "find process", "1"))
While Not rs.EOF = True
If fnd = rs.Fields(0).Value Then
MsgBox "record found"
Call data
rs.Requery
rs1.Requery
Exit Sub
End If
rs.MoveNext
Wend
If rs.EOF = True Then
MsgBox "record not found"
End If
rs.Requery
rs1.Requery
End Sub

Private Sub Form_Load()


Set cn = New ADODB.Connection
Set cn1 = New ADODB.Connection
Set rs = New ADODB.Recordset
Set rs1 = New ADODB.Recordset
cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
cn1.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Persist Security Info=True"
On Error GoTo err
cn.Execute "create table sale_item(recordno number(5),doctor varchar2 (30),custnm
varchar2(30),addr varchar2(55),city varchar2(25),agencynm varchar2(30),itemtype
41
varchar2(30),itemnm varchar2(30),entrydt date,mfgdt date,expdt date,ppr number(8,2),qty
number(5),total number(8,2))"
cn.Execute "commit"
err:
rs.Open "select *from sale_item", cn, adOpenStatic, adLockBatchOptimistic
rs1.Open "select *from stock_detail", cn, adOpenStatic, adLockBatchOptimistic
Me.cmb_agenm.Text = agency
Me.cmb_inm.Text = item
Me.txt_ppr.Text = price
Me.dtp_endt.Value = Format(Date, "dd-mmm-yy")
Me.txt_mfgdt.Text = Format(mfgdate, "dd-mmm-yy")
Me.txt_expdt = Format(expdate, "dd-mmm-yy")
Me.txt_itemnm.Text = itemnm
End Sub

Public Function data()


txt_rno.Text = rs.Fields(0).Value
txt_dr.Text = rs.Fields(1).Value
txt_cnm.Text = rs.Fields(2).Value
txt_add.Text = rs.Fields(3).Value
cmb_agenm.Text = rs.Fields(4).Value
cmb_inm.Text = rs.Fields(5).Value
txt_itemnm.Text = rs.Fields(6).Value
dtp_endt.Value = rs.Fields(7).Value
txt_city.Text = rs.Fields(8).Value
txt_mfgdt.Text = rs.Fields(9).Value
txt_expdt.Text = rs.Fields(10).Value
txt_ppr.Text = rs.Fields(11).Value
txt_qty.Text = rs.Fields(12).Value
txt_total.Text = rs.Fields(13).Value
End Function

Private Sub txt_ppr_KeyPress(KeyAscii As Integer)


If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8) Then
KeyAscii = 0
MsgBox "plese enter numeric value"
txt_ppr.SetFocus
End If
End Sub

Private Sub txt_qty_KeyPress(KeyAscii As Integer)


If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8) Then
KeyAscii = 0
MsgBox "plese enter numeric value"
txt_qry.SetFocus
End If
End Sub

42
Private Sub txt_rno_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8) Then
KeyAscii = 0
MsgBox "plese enter numeric value"
txt_rno.SetFocus
End If
End Sub

Private Sub txt_qty_lostfocus()


txt_total.Text = txt_qty.Text * txt_ppr.Text
End Sub

Private Sub txt_pcode_KeyPress(KeyAscii As Integer)


If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8) Then
KeyAscii = 0
MsgBox "plese enter numeric value"
txt_pcode.SetFocus
End If
End Sub

Private Sub txt_phno_KeyPress(KeyAscii As Integer)


If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8) Then
KeyAscii = 0
MsgBox "plese enter numeric value"
txt_phno.SetFocus
End If
End Sub

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub cmd_add_Click()
If cmd_add.Caption = "Add" Then
txt_rno.Text = " "
cmb_agenm.Text = " "
cmb_inm.Text = " "
txt_bno.Text = " "
txt_rno.SetFocus
cmd_add.Caption = "Save"
Else
cn.Execute "insert into item_detail values(" & Val(txt_rno.Text) & ",'" &
Trim(cmb_agenm.Text) & "','" & Trim(cmb_inm.Text) & "','" & Trim(txt_bno.Text) & "','" &
Format(dtp_mdt.Value, "dd-mmm-yy") & "','" & Format(dtp_edt.Value, "dd-mmm-yy") & "')"
cn.Execute "commit"
MsgBox "Your record saved"
cmd_add.Caption = "Add"
End If
End Sub

43
Private Sub cmd_delete_Click()
Dim ans As String
no1 = InputBox("enter no to delete")
ans = MsgBox("Do U Want To Delete?....", vbYesNo, "deletion Process...")
If ans = vbYes Then
cn.Execute "delete from item_detail where recordno=" & Val(txt_rno.Text) & ""
MsgBox "record deleted"
Call data
cn.Execute "commit"
End If
rs.MoveNext
If rs.EOF = True Then
rs.MoveLast
End If
End Sub

Private Sub cmd_edit_Click()


Dim no As Integer
If cmd_edit.Caption = "Edit" Then
txt_rno.SetFocus
cmd_edit.Caption = "Edit Save"
Else
cn.Execute "update item_detail set recordno='" & Val(txt_rno.Text) & "',agencynm='" &
cmb_agenm.Text & "',itemname='" & cmb_inm.Text & "',batchno='" & txt_bno.Text &
"',mfgdt='" & Format(dtp_mdt.Value, "dd-mmm-yy") & "',expdt='" & Format(dtp_edt.Value,
"dd-mmm-yy") & "' where recordno='" & Val(txt_rno.Text) & "'"
cn.Execute "commit"
MsgBox "record update"
cmd_edit.Caption = "Edit"
rs.MoveNext
End If
rs.Close
rs.Open "select *from item_detail", cn, adOpenStatic, adLockBatchOptimistic
End Sub

Private Sub cmd_first_Click()


If (rs.BOF = True) And (rs.EOF = True) Then
MsgBox "plece enter record", vbOKOnly
Else
rs.MoveFirst
Call data
End If
End Sub

Private Sub cmd_search_Click()


Dim fnd As Integer
fnd = Val(InputBox("enter nofor searching", "find process", "1"))
rs.MoveFirst
44
While Not rs.EOF = True
If fnd = rs.Fields(0).Value Then
MsgBox "record found"
Call data
Exit Sub
End If
rs.MoveNext
Wend
If rs.EOF = True Then
MsgBox "record not found"
End If
End Sub

45

You might also like