Вы находитесь на странице: 1из 47

CONTENTS

S.No. Table of Contents Remarks Page No.


I Cover – Page i
II Certificate Of Approval ii
III Preface iii
IV Acknowledgement iv
V Declaration v
VI Contents vi
Index
Introduction -
1. Existing System without Software
Problem Definition
Proposed System

Technology Details -
Integrated Development Environment
Introduction To Visual Basic 6.0
2. Advantages Of Visual Basic 6.0
About Visual Basic 6.0 IDE
Database and Database – Connectivity
Introduction To Micro-Soft Access
Software Requirement Specification
3. Software Requirements
Hardware Requirements
System Analysis and Design :-
4. Data Flow Diagram (DFD)/E-R
Diagram
Deploying the Project -
5. (Snap – Shots)
Showing Snap – Shots Of Project
Source – Code -
6. About Code – Editor Of VB 6.0
Code of Project
Bibliography-
7.
References : Books and Websites
Note : - The Softcopy Of Project within a CD with envelop is inside this .

(1)
INTRODUCTIO

(2)
Existing System: -

Traditional record maintenance in any system


uses a lot of paper work, which is really hard to
maintain and work with.

Problem Definition:-

This causes a lot of problem in record


maintenance and in kind of many process like
searching record, updating and deletion of
data. To keep it simple and easy a computer
based system can really do a magic. It will
definitely decrease memory overhead.

Proposed System :-

Every Organization has its own Product sale,


Product Maintains, procedure and
administrative methods to develop and
implement this methods and Items. Every
organization or institution has made several
departments employees of this departments
have to be trained or to provide training it their
at to improve their efficiency.

Ice Ceram Parlour System is


designed under graphical user interface (GUI)
environment of Microsoft VB-6 as front end and
back end support is given by MS-Access. This
software is basically meant for the Abstract
report and Customer record. Ice Cream Parlour
System is fastening the whole process thus
extremely increasing the efficiency and
effectiveness of work ability.

(3)
Technology Detail’s

(4)
INTRODUCTION TO VISUAL BASIC
VISUAL BASIC is the Graphical User Interface (GUI) language. It is
the language that many developers including Microsoft themselves are using
to write new applications software, Microsoft Corporation created it in 1991.
It is a high level language. With the help of Visual Basic we can communicate
with other applications running under windows. It is an internet based and an
object oriented programming.
Visual Basic is substantially different from traditional Basic, though
there are similarities. Visual Basic requires a different approach to developing
programs and to learning the language. But in Basics, we can develop a
program line by line, testing each command as we write it. With Visual Basic
we must develop our programs and we can understand across a broader front.
In Visual Basic we can write a program by assembling the object that
we will use for screen displays and interaction with the users, adjusting the
properties of those objects, determining which events we will respond to,
thinking through the variables we need for holding data and for passing
information from one part of the program to another, and writing the
command lines that will run when events are activated. At each stage of
development we may add to or change any aspect of the program, but it must
be done with an awareness of how it will affect the other aspects. Objects,

(5)
properties events and code are all intimation. Visual Basic lets us add menus,
text boxes, command buttons, option buttons, check boxes, list boxes, scroll
bars, file and directory boxes to blank windows, we can use grids to handle
toolbar data, communicate with other window applications and access
database. We can have multiple windows on a screen. These windows have
full access to the clipboard and to the information in most other window
application running at the same line.
So Visual Basic is a collection of files. It is a very easy language and
flexible to use. This language also contains all the features of basic language.
It is an event driven programming. It is also called a friend of a user. One of
the advantages of visual basic is that it is a grammar free language. It
provides both compiler and interpreter.

Programming in Visual Basic

Programming in Visual Basic was written around Visual Basic 3.0,


standard edition but virtually all of the techniques and concepts apply equally
well to Visual Basic 2.0.It doesn’t have advanced feature or development of
free standing commercial applications, for which the professional edition is
necessary. There was another version of Visual Basic that is Visual Basic for
DOS. This version was out of use. Windows is the natural medium for Visual
Basic. Then come more advanced version like Visual Basic 4.0, Visual Basic
5.0, and Visual Basic 6.0 at present the latest the Visual Basic 6.0.
EVENT DRIVEN PROGRAMMING
Visual Basic is Object Oriented, i.e. it revolves around ready made
objects and it is called as EVENT DRIVEN, i.e. all the activities in a program
are triggered by one event or another. Each object has its own properties,
determining its position, size, color, the appearance and nature of its text, and
much more. Each object also has its own event handling procedures.

(6)
In an event driven application the code doesn’t follows a predefined
path, it executes different code section in response to events. Events can be
triggered by the user action, by message from the system of other application
or even from application itself. The sequence of this event determines the
sequence in which codes executes. Thus the path through the application code
written each time the program runs.
Visual basic system knows all about event handling procedures. It
knows what a button is and how it works. It also knows how to handle images,
menus, dialog boxes, driven and directory lists, and much else. The
programmer’s job is to determine where, how and when an object appears on
screen, what its caption reads and what happens when an event occurs. The
event might be the opening of a form, the user clicking on a box. The
programmer does not have to write code to trap these events the system does
that automatically. Because the program code runs in response to event, as at
any point whole range of event might be possible. The flow of execution is not
as fixed as in a traditional program.

About Visual Basic -

Visual Basic is the most Popular Object Oriented event Driven


Programming language. It revolves around readymade objects, and it is
event driven i.e. all the activities in a program are triggered by one event
or another .The main advantage of visual Programming languages is
that we can concentrate on what we want our program to do, not how to
get the programming language to do it. Some Visual Basic features are: -

1/ Compatibility: Visual Basic is capable of producing software as


sophisticated as any other data access techniques available.

2/ Flexibility: It not only provides database access but can also be used to
link it with other word processor, spreadsheets software etc.

3/ Familiarity: Because it can be said as an extended version of Basic,


which is very easy to learn and work with, its syntax seems to be more
familiar.

(7)
4/ Features: Various Additional Features like ADO reports and other
various types of Active X controls are supported by this application,
which helps widely in development of the Project.

MICROSOFT ACCESS

The goal of the access is to help you get your work done in the least of
time, with a minimum of effort.

What type of application can you develop in Access?


Microsoft Access offers a variety of features for different databases
needs. It can be used to develop five general type of application:
1. Personal application.
2. Application used to run a small business.
3. Department application.
4. Corporation- wide application.
5. Front- end for enterprise-wide client/server application.
What is Database actually?
The term database means different things to different people. For
many years in the world of Dbase was used to describe a collection of fields
and records in a client/server environment. Dbase refers to all the data
schema, indexes, rules, triggers and stored procedures associated with a
system in access terms, a dbase is a collection of all the tables, queries, forms,
reports, macros and modules that compose a complete system.
Actually database is a collection of related information. Here
information is stored in tabular form one record a show all possible attributes
of an entity. In a simple word entity can be identified by its attributes like his
name, color, height and hairstyle etc identify a person. So in databases a
record makes topple while attributes make fields.

About Ms Access -

This is a Backend Tool widely used for Personal Computer as a Data


Base. The relational database is a well-defined theoretical model of working
with and managing a set of data that attends to three specific things:

Data Structure, Data integrity and Data manipulation .The MS Access


has a distinct component, which adheres to these requirements. The basic
Data Structure in Access is Table having fixed number of columns but variable
rows.

(8)
The Data integrity rules of the relational models can be defined within
Access relationship using integrity constraints. When a table is created in
Access the integrity rule is defied at that very time.

MS Access has many important features that make it not only an


exceptional database Management System but also an excellent database for
personal system in windows environment,

- It provides highly secure environment to do better handling of


database.
- It can handle reasonable amount of data.
- Easily support all window based systems

(9)
Software Reuirement Specification

HARDWARE & SOFTWARE REQUIREMENT

The following are the minimum requirement for the smooth and successful
running of the module.

Hardware: -

Microprocessor - 166 MHz or Higher

- Any of the external write able drive


for Setup of the package also to
take regular backup

( 10 )
- Min 1GB for Operating system & program
to setup properly.

- 32 MB (Min) as the package is developed


using MS Office 2000 it requires 32
MB Min RAM.

Display - CGA/VGA or higher.

Key Board - 84/109 Keys use.

Mouse - Any Standard Mouse.

Printer - 80/132 cols.

Software: -

Operating System - MS Windows 95 or Higher

RDBMS - MS Access

GUI Tool - Visual Basic 6.0

SYSTEM ANALYSIS

( 11 )
System Analysis
A system is a set or arrangement of functionally dependent
component or working together to attain a predefined goal by processing
information. It is the process of examine of a business situation with the intent
of improving it through better procedure and method. It is the process of
gathering and method. It is process gathering and interpreting facts.

Timing problems and using the information to recommend


improvement to the system. Analysis is used gained and understanding of the
conclusion of the system there is a system description and as set of
requirement for a new system. It there is on existing system, then the analysis
only defines the requirement. The step, which follows, will propose a new
system that meets these requirements.

The new system may be built a fresh or by changing the existing


system. Development being by defining a model of new system an continuous
by converting these model to a system in a short analysis specifies what the
system should do.

Analysis objective
An efficient system analysis always plays the role of strong
foundation for development of any proposed system. Information play key

( 12 )
role, as the horizon of knowledge keep on expending, since this project is
anaphor to convert the manual in to computer based system, a through
knowledge of the day-to-day functions of present system of mandatory the
objective of this study comprise.

E-R DIAGARAM

( 13 )
( 14 )
2) E-R Diagram Between Purchase & stock-balance
DATABASE DESIGN

CREDIT DATA TABLE


PURCHASE DATA TABLE
SALES DATA TABLE

TEMP DATA TABLE


SNAP SHOT’S
\

WELCOME SCREEN FORM

LOGIN FORM
ADD NEW RECORD FORM

SALES & BILLING FORM


BILLING REPORT

STOCK UPDATE RECORD FORM


BALANCE UPDATE RECORD FORM

VIEW RECORD FORM


SOURCE CODE
LOGIN FORM

Private Sub cmdOK_Click()


Dim i As Integer
If txtPassword = "pass" And txtUserName.Text = "user" Then
LoginSucceeded = True
Unload Me
mdifrm.Show

Else
MsgBox "Invalid user name or Password, try again!", , "Login"

Me.txtUserName = ""
Me.txtPassword = ""
txtUserName.SetFocus

End If
End Sub

PURCHASE FORM
Private Sub cmdadd_Click()

Dim rs As New ADODB.Recordset


rs.Open "insert into purchase values ( '" & dtp.Value & "','" & txtpur.Text & "','"
& txtice.Text + "'," & txtquantity.Text & "," & Val(txtuprice.Text) & "," &
Val(lbltprice.Caption) & "," & txtsprice.Text & ")", dbcon, 2, 3
MsgBox "saved successfully", vbInformation, "saved"
Me.dtp.Value = Date
cmdclear_Click

End Sub

Private Sub cmdclear_Click()

Me.dtp.Value = Date
Me.txtquantity.Text = ""
Me.txtsprice.Text = ""
Me.txtice.Text = ""
Me.txtuprice.Text = ""
Me.lbltprice.Caption = ""

End Sub

Private Sub Form_Load()


Dim rs As New ADODB.Recordset
rs.Open "select * from purchase", dbcon, 2, 3
If rs.RecordCount = 0 Then
Me.txtpur.Text = "enter record here"
Else
rs.MoveFirst
For i = 1 To rs.RecordCount
Me.txtpur.AddItem rs.Fields(1)
rs.MoveNext
Next
End If
dtp.Value = Date
End Sub

Private Sub Image2_Click()


Unload Me
End Sub

Private Sub Timer1_Timer()


If Me.dtp.Value = "" Or Me.txtpur.Text = "" Or Me.txtsprice.Text = "" Or
Me.txtuprice.Text = "" Or Me.txtice.Text = "" Then
Me.cmdadd.Enabled = False
Else
Me.cmdadd.Enabled = True
End If
End Sub

Private Sub txtice_KeyPress(KeyAscii As Integer)


If KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = KeyAscii - 32
End If
End Sub

Private Sub txtpur_KeyPress(KeyAscii As Integer)


If KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = KeyAscii - 32
End If
End Sub

Private Sub txtquantity_Change()


If IsNumeric(Me.txtquantity.Text) = True Then
Me.lbltprice.Caption = Val(Me.txtquantity.Text) *
Val(Me.txtuprice.Text)
Exit Sub
Else
Me.txtquantity.Text = ""
End If
End Sub

Private Sub txtuprice_Change()


If IsNumeric(Me.txtuprice.Text) = True Then
Me.lbltprice.Caption = Val(Me.txtquantity.Text) *
Val(Me.txtuprice.Text)
Else
Me.txtuprice.Text = ""
End If
End Sub

SALE FORM
Function SpellNumber(ByVal MyNumber)

Dim Rupees, Paise, Temp


Dim DecimalPlace, Count
ReDim Place(9) As String
Place(2) = " Thousand "
Place(3) = " Lakh "
Place(4) = " Crore "

MyNumber = Trim(Str(MyNumber))
DecimalPlace = InStr(MyNumber, ".")
If DecimalPlace > 0 Then
Paise = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & _
"00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If
Count = 1
Do While MyNumber <> ""
If Count <> 1 Then
Temp = GetHundreds(Right(MyNumber, 2))
If Temp <> "" Then Rupees = Temp & Place(Count) & Rupees
If Len(MyNumber) > 2 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 2)
Else
MyNumber = ""
End If
Else
Temp = GetHundreds(Right(MyNumber, 3))
If Temp <> "" Then Rupees = Temp & Place(Count) & Rupees
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
End If
Count = Count + 1
Loop
Select Case Rupees
Case ""
Rupees = " "
Case "One"
Rupees = "Re One "
Case Else
Rupees = "Rupees " & Rupees
End Select
Select Case Paise
Case ""
Paise = " Zero Paise "
Case "One"
Paise = " and Paise One"
Case Else
Paise = "Paise " & Paise
End Select
If Rupees <> " " Then Paise = " and " & Paise
SpellNumber = " [ " & Rupees & Paise & " Only ] "
End Function

Function GetHundreds(ByVal MyNumber)


Dim Result As String
If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)

If Mid(MyNumber, 1, 1) <> "0" Then


Result = GetDigit(Mid(MyNumber, 1, 1)) & " Hundred "
End If

If Mid(MyNumber, 2, 1) <> "0" Then


Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If
GetHundreds = Result
End Function

Function GetTens(TensText)
Dim Result As String
Result = ""
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19...
Select Case Val(TensText)
Case 10: Result = "Ten"
Case 11: Result = "Eleven"
Case 12: Result = "Twelve"
Case 13: Result = "Thirteen"
Case 14: Result = "Fourteen"
Case 15: Result = "Fifteen"
Case 16: Result = "Sixteen"
Case 17: Result = "Seventeen"
Case 18: Result = "Eighteen"
Case 19: Result = "Nineteen"
Case Else
End Select
Else ' If value between 20-99...
Select Case Val(Left(TensText, 1))
Case 2: Result = "Twenty "
Case 3: Result = "Thirty "
Case 4: Result = "Forty "
Case 5: Result = "Fifty "
Case 6: Result = "Sixty "
Case 7: Result = "Seventy "
Case 8: Result = "Eighty "
Case 9: Result = "Ninety "
Case Else
End Select
Result = Result & GetDigit _
(Right(TensText, 1)) ' Retrieve ones place.
End If
GetTens = Result
End Function

Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "One"
Case 2: GetDigit = "Two"
Case 3: GetDigit = "Three"
Case 4: GetDigit = "Four"
Case 5: GetDigit = "Five"
Case 6: GetDigit = "Six"
Case 7: GetDigit = "Seven"
Case 8: GetDigit = "Eight"
Case 9: GetDigit = "Nine"
Case Else: GetDigit = ""
End Select
End Function
Private Sub cmbice_Click()
Dim rs As New ADODB.Recordset
rs.Open "select * from purchase where ice_name ='" & Me.cmbice.Text & "'", dbcon, 2,
3
If rs.RecordCount = 0 Then
Me.lbluprice.Caption = "no record"
Else
Me.lbluprice.Caption = rs!price_to_sell
Me.lblquan.Caption = rs!quantity
End If
Me.lbltprice.Caption = Val(Me.lbluprice) * Val(Me.txtquan.Text)
End Sub

Private Sub cmdadd_Click()


Dim rs As New ADODB.Recordset
rs.Open "select * from purchase where ice_name='" & Me.cmbice.Text & "'", dbcon, 2,
3

Set lst = ListView1.ListItems.Add(, , cmbice.Text)


lst.SubItems(1) = Me.txtquan.Text

lst.SubItems(2) = Me.lbluprice.Caption
lst.SubItems(3) = Me.lbltprice.Caption
Me.cmbremove.AddItem Me.cmbice.Text
Me.lblgrandtotal.Caption = Val(Me.lblgrandtotal.Caption) + Val(Me.lbltprice.Caption)
Me.lblinwords.Caption = SpellNumber(Val(Me.lblgrandtotal.Caption))
rs("quantity") = Val(Me.lblquan.Caption) - Val(Me.txtquan.Text)
rs.Update
rs.Close
Me.txtquan.Text = ""
Me.lbltprice.Caption = ""
Me.lbluprice.Caption = ""
Me.lblquan.Caption = ""
Me.cmbice.SetFocus
End Sub

Private Sub cmdexit_Click()

End Sub

Private Sub cmdprint_Click()


On Error Resume Next
Dim n As String
If Me.txtpaid.Text = "" Then
MsgBox "Enter paid amount", vbCritical, "requirement"
Me.txtpaid.SetFocus
Else
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
rs.Open "insert into sales values ('" & Me.dtp.Value & "'," & Val(Me.lblbillno.Caption)
& ",'" & Me.txtcust.Text & "'," & Val(Me.lblgrandtotal.Caption) & "," &
Me.txtpaid.Text & "," & Val(Me.lblbal.Caption) & ")", dbcon, 2, 3
rs1.Open "insert into credit values(" & Me.lblbillno.Caption & ",'" & Me.txtcust.Text &
"','" & Me.dtp.Value & "'," & Me.txtpaid.Text & "," & Val(Me.lblbal.Caption) & ")",
dbcon, 2, 3
n = MsgBox("bill saved ! want print ? ", vbYesNo, "saved")
If n = vbNo Then
Unload Me
frmoption.Show
Me.cmbice.Clear
Form_Load
Else
MsgBox "bill printing", vbInformation, "print"
If DataEnvironment1.rsdadd.State = 1 Then DataEnvironment1.rsdadd.Close
report_bill.PrintReport
Unload Me
rs.Open "delete from temp", dbcon, 2, 3

'Exit Sub
'msg:
'MsgBox "printer not found", vbCritical, "error"

Me.cmbice.Clear
Form_Load

End If
End If
End Sub

Private Sub cmdremove_Click()


Dim rs As New ADODB.Recordset
rs.Open "select * from purchase where ice_name='" & Me.cmbremove.Text & "'",
dbcon, 2, 3
Dim p As Integer
Dim n As Double
Dim m As Integer
On Error Resume Next
n = ListView1.ListItems(Me.cmbremove.ListIndex + 1).SubItems(3) 'totalprice
p = ListView1.ListItems(Me.cmbremove.ListIndex + 1).SubItems(1) 'quantity
Me.lblgrandtotal.Caption = Val(Me.lblgrandtotal.Caption) - n
Me.lblinwords.Caption = SpellNumber(Val(Me.lblgrandtotal.Caption))
ListView1.ListItems.Remove (Me.cmbremove.ListIndex + 1)
Me.cmbremove.RemoveItem (Me.cmbremove.ListIndex)
rs("quantity") = Val(rs.Fields(3)) + Val(p)
rs.Update
rs.Close

m = Me.cmbremove.ListCount
If m <= 0 Then
Me.lblgrandtotal.Caption = 0
Me.lblinwords.Caption = SpellNumber(Val(Me.lblgrandtotal.Caption))
End If
End Sub

Private Sub cmdshow_Click()


If Me.txtcust.Text = "" Then
MsgBox "Enter customer name", vbCritical, "requirment"
Me.txtcust.SetFocus
Else

Set rs = New ADODB.Recordset


rs.Open "select * from temp", dbcon, 2, 3
Dim i As Integer
Set itm = Me.ListView1.ListItems
For Each itm In ListView1.ListItems
rs.AddNew
rs.Fields("date").Value = Me.dtp.Value
rs.Fields("bil_no").Value = Me.lblbillno.Caption
rs.Fields("customer_name").Value = Me.txtcust.Text
rs.Fields("ice_name").Value = itm.Text
rs.Fields("quantity").Value = itm.SubItems(1)
rs.Fields("unit_price").Value = itm.SubItems(2)
rs.Fields("total_price").Value = itm.SubItems(3)
rs.Fields("in_words").Value = Me.lblinwords.Caption
rs.Update

Next
'MsgBox "saved !"
frmgif.Show 1
Me.Timer1.Enabled = False
Me.cmdremove.Enabled = False

Me.cmdshow.Visible = False
Me.cmdshow2.Visible = True
Me.cmdprint.Enabled = True

If DataEnvironment1.rsdadd.State = 1 Then DataEnvironment1.rsdadd.Close


report_bill.Refresh
report_bill.Show
End If

End Sub

Private Sub cmdshow2_Click()


report_bill.Show
End Sub

Private Sub Form_Load()


Me.Timer1.Enabled = True
Me.cmdprint.Enabled = False
Me.cmdshow.Visible = True
Me.cmdshow2.Visible = False
Dim rs As New ADODB.Recordset
rs.Open "select * from purchase", dbcon, 2, 3
If rs.RecordCount = 0 Then
Me.cmbice.Text = "no record inserted yet"
Else
rs.MoveFirst
For i = 1 To rs.RecordCount
Me.cmbice.AddItem rs.Fields(2)
rs.MoveNext
Next
End If
dtp.Value = Date
rs.Close

rs.Open "select * from sales", dbcon, 2, 3


If rs.RecordCount = 0 Then
Me.lblbillno.Caption = 1
Else
rs.MoveLast
Me.lblbillno.Caption = rs.Fields(1) + 1
End If
rs.Close
rs.Open "delete from temp", dbcon, 2, 3

End Sub

Private Sub Image3_Click()


i = MsgBox("are u sure to close this form", vbYesNo)
If i = vbYes Then
Unload Me
Else
Cancel = 1
End If
End Sub

Private Sub Timer1_Timer()


Dim m As Integer
m = Me.cmbremove.ListCount
If m <= 0 Then
Me.cmdremove.Enabled = False
Me.cmdshow.Enabled = False
Else
Me.cmdremove.Enabled = True
Me.cmdshow.Enabled = True
End If

If Me.lblquan.Caption = "" Or Me.txtquan.Text = "" Or Me.cmbice.Text = "" Or


Me.lbluprice.Caption = "" Then
Me.cmdadd.Enabled = False
Else
Me.cmdadd.Enabled = True
End If
End Sub

Private Sub Timer2_Timer()


If Me.lblbal.Caption = "0" Then
Me.lblbal.Caption = "nil"
End If
If Me.txtpaid.Text = "" Then
Me.lblbal.Caption = "nil"
End If
End Sub

Private Sub txtcust_KeyPress(KeyAscii As Integer)


If KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = KeyAscii - 32
End If
End Sub

Private Sub txtpaid_Change()


If IsNumeric(Me.txtpaid.Text) = True Then
Me.lblbal.Caption = Val(Me.lblgrandtotal.Caption) - Val(Me.txtpaid.Text)

Else

Me.txtpaid.Text = ""
End If
If Val(Me.txtpaid.Text) > Val(Me.lblgrandtotal.Caption) Then
MsgBox "Entered amount should be less then grand total", vbInformation, "cant
accept"
Me.txtpaid.Text = ""
End If
End Sub

Private Sub txtquan_Change()


If IsNumeric(Me.txtquan.Text) = True Then
Me.lbltprice.Caption = Val(Me.txtquan.Text) * Val(Me.lbluprice.Caption)
If Val(Me.txtquan.Text) > Val(Me.lblquan.Caption) Then
MsgBox "please enter quantity less then available quantity !", vbInformation, "info"
Me.txtquan.Text = ""

Else
Exit Sub
End If
Else
Me.txtquan.Text = ""
End If
End Sub

MAINTAINS FORM
Private Sub cmbbill_Click()
On Error Resume Next
Me.cmdupdate2.Enabled = True
Me.txttpaid.Enabled = True
Me.txttpaid.Text = ""
Me.lblubal.Caption = ""
Dim rs As New ADODB.Recordset
rs.Open "select * from sales where bill_no=" & Me.cmbbill.Text, dbcon, 2, 3
Me.cmbcustname.Text = rs!customer_name
Me.lbltotal.Caption = rs!grand_total
Me.lblpaid.Caption = rs!paid
Me.lblbal.Caption = rs!balance
End Sub

Private Sub cmbcustname_Click()


On Error Resume Next
Me.cmdupdate2.Enabled = True
Me.txttpaid.Enabled = True
Me.txttpaid.Text = ""
Me.lblubal.Caption = ""
Dim rs As New ADODB.Recordset
rs.Open "select * from sales where customer_name='" & Me.cmbcustname.Text & "'",
dbcon, 2, 3
Me.cmbbill.Text = rs!bill_no
Me.lbltotal.Caption = rs!grand_total
Me.lblpaid.Caption = rs!paid
Me.lblbal.Caption = rs!balance
End Sub

Private Sub cmbstone_Click()


Me.cmdupdate2.Enabled = True
Dim rs As New ADODB.Recordset
rs.Open "select * from purchase where ice_name ='" & Me.cmbstone.Text & "'", dbcon,
2, 3
If rs.RecordCount = 0 Then
Me.txtuprice.Text = "no record"
Else
'Me.txtuprice.Text = rs!selling_price
Me.txtpur.Text = rs!purchasing_from
Me.txtquantity.Text = rs!quantity
Me.txtsprice.Text = rs!price_to_sell
Me.txtuprice.Text = rs!unit_price

Me.dtp.Value = rs!Date
Me.lbltprice.Caption = rs!total_price
End If
End Sub

Private Sub cmdelete2_Click()

End Sub
Private Sub cmddelete2_Click()
n = MsgBox("sure to delete " + Me.cmbcustname.Text + "'s record", vbYesNo, "sure")
If n = vbNo Then
Me.cmddelete2.Cancel = True
Else
Dim rs As New ADODB.Recordset
rs.Open "delete * from credit where bill_no=" & Me.cmbbill.Text, dbcon, 2, 3
rs.Open "delete * from sales where bill_no=" & Me.cmbbill.Text, dbcon, 2, 3
Me.cmbbill.Text = ""
Me.cmbcustname.Text = ""
Me.lblbal.Caption = ""
Me.lblpaid.Caption = ""
Me.lbltotal.Caption = ""
Me.txttpaid.Text = ""
Me.lblubal.Caption = ""
MsgBox "record deleted", vbInformation, "info"
Me.cmbbill.Clear
Me.cmbcustname.Clear
Form_Load
Me.Frame2.Visible = True
Me.frame1.Visible = False
End If
End Sub

Private Sub cmdelete_Click()


n = MsgBox("sure to delete record " + Me.cmbstone.Text, vbYesNo, "sure")
If n = vbNo Then
Me.cmdelete.Cancel = True
Else
Dim rs As New ADODB.Recordset
rs.Open " delete * from purchase where ice_name='" & Me.cmbstone.Text & "'",
dbcon, 2, 3

Me.txtpur.Text = ""
Me.txtquantity.Text = ""
Me.txtsprice.Text = ""
Me.txtuprice.Text = ""
Me.lbltprice.Caption = ""
MsgBox "record deleted", vbInformation, "info"
Me.cmbstone.Clear
Form_Load
Me.frame1.Visible = True
Me.Frame2.Visible = False
End If
End Sub

Private Sub cmddelete_Click()

End Sub
Private Sub cmdexit2_Click()

End Sub

Private Sub cmdupdate_Click()


Dim rs As New ADODB.Recordset
rs.Open "select * from purchase where ICE_name ='" & Me.cmbstone.Text & "'",
dbcon, 2, 3
rs("date") = Me.dtp.Value
rs("purchasing_from") = Me.txtpur.Text
rs("ice_name") = Me.cmbstone.Text

rs("quantity") = Val(Me.txtquantity.Text)
rs("unit_price") = Val(Me.txtuprice.Text)
rs("total_price") = Val(Me.lbltprice.Caption)
rs("price_to_sell") = Val(Me.txtsprice.Text)
rs.Update
rs.Close
MsgBox "updated", vbInformation, "information"

Me.txtpur.Text = ""
Me.txtquantity.Text = ""
Me.txtsprice.Text = ""
Me.txtuprice.Text = ""

Me.lbltprice.Caption = ""

Me.cmbstone.SetFocus
End Sub

Private Sub cmdupdate2_Click()

Dim rs As New ADODB.Recordset


rs.Open "select * from sales where bill_no=" & Me.cmbbill.Text, dbcon, 2, 3
rs("balance") = Val(Me.lblubal.Caption)
rs("paid") = Val(Me.lblpaid.Caption) + Val(Me.txttpaid.Text)
rs.Update
rs.Close
Dim rs1 As New ADODB.Recordset
rs1.Open "insert into credit values(" & Me.cmbbill.Text & ",'" & Me.cmbcustname.Text
& "','" & Me.dtp2.Value & "'," & Me.txttpaid.Text & "," & Val(Me.lblubal.Caption) &
")", dbcon, 2, 3
MsgBox "updated successfully", vbInformation, "info"
Me.cmbbill.Text = ""
Me.cmbcustname.Text = ""
Me.lblbal.Caption = ""
Me.lblpaid.Caption = ""
Me.lbltotal.Caption = ""
Me.txttpaid.Text = ""
Me.lblubal.Caption = ""
Me.cmbbill.SetFocus
End Sub

Private Sub Command2_Click()


n = MsgBox("sure to delete " + Me.cmbcustname.Text + "'s record", vbYesNo, "sure")
If n = vbNo Then
Me.cmddelete2.Cancel = True
Else
Dim rs As New ADODB.Recordset
rs.Open "delete * from credit where bill_no=" & Me.cmbbill.Text, dbcon, 2, 3
rs.Open "delete * from sales where bill_no=" & Me.cmbbill.Text, dbcon, 2, 3
Me.cmbbill.Text = ""
Me.cmbcustname.Text = ""
Me.lblbal.Caption = ""
Me.lblpaid.Caption = ""
Me.lbltotal.Caption = ""
Me.txttpaid.Text = ""
Me.lblubal.Caption = ""
MsgBox "record deleted", vbInformation, "info"
Me.cmbbill.Clear
Me.cmbcustname.Clear
Form_Load
Me.Frame2.Visible = True
Me.frame1.Visible = False
End If
End Sub

Private Sub Form_Load()

Me.txttpaid.Enabled = False
Me.frame1.Visible = False
Me.Frame2.Visible = False
dtp.Value = Date
Dim rs As New ADODB.Recordset
Dim n As Integer
rs.Open "select * from purchase", dbcon, 2, 3
If rs.RecordCount = 0 Then
Me.cmbstone.AddItem "NO RECORD INSERTD YET"
rs.Close
Else
rs.MoveFirst
For n = 1 To rs.RecordCount
Me.cmbstone.AddItem rs.Fields(2)
rs.MoveNext
Next
rs.Close
End If
rs.Open "select * from sales", dbcon, 2, 3
If rs.RecordCount = 0 Then
Me.cmdupdate2.Enabled = False
Me.cmbcustname.AddItem "NO INVOICE RECORD YET"
Me.cmbbill.AddItem "NO INVOICE RECORD YET"

rs.Close
Else
rs.MoveFirst
For n = 1 To rs.RecordCount
Me.cmbcustname.AddItem rs.Fields(2)
Me.cmbbill.AddItem rs.Fields(1)
rs.MoveNext
Next
rs.Close
End If
Me.dtp2.Value = Date
Me.dtp.Value = Date
End Sub

Private Sub Image2_Click()


Unload Me
End Sub

Private Sub Optbal_Click()


Me.Frame2.Visible = True
Me.frame1.Visible = False
End Sub

Private Sub Optstock_Click()


Me.frame1.Visible = True
Me.Frame2.Visible = False
End Sub

Private Sub Timer2_Timer()


If Me.lblpaid.Caption = "" Or Me.txttpaid.Text = "" Or Me.cmbbill.Text = "" Or
Me.cmbcustname.Text = "" Then
Me.cmdupdate2.Enabled = False

Else
Me.cmdupdate2.Enabled = True

End If

If Me.lblpaid.Caption = "" Or Me.cmbbill.Text = "" Or Me.cmbcustname.Text = ""


Then
Me.cmddelete2.Enabled = False

Else
Me.cmddelete2.Enabled = True
End If

If Me.dtp.Value = "" Or Me.txtpur.Text = "" Or Me.txtquantity.Text = "" Or


Me.txtsprice.Text = "" Or Me.txtuprice.Text = "" Then
Me.cmdupdate.Enabled = False
Me.cmdelete.Enabled = False
Else
Me.cmdupdate.Enabled = True
Me.cmdelete.Enabled = True
End If
If Me.lblbal.Caption = "0" Then
Me.lblbal.Caption = "nill"
Me.cmdupdate2.Enabled = False
Me.txttpaid.Enabled = False

End If
If Me.txttpaid.Text = "" Then
Me.lblubal.Caption = ""
End If

End Sub

Private Sub txtpur_KeyPress(KeyAscii As Integer)


If KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = KeyAscii - 32
End If
End Sub

Private Sub txtquantity_Change()


If IsNumeric(Me.txtquantity.Text) = True Then
Me.lbltprice.Caption = Val(Me.txtquantity.Text) * Val(Me.txtuprice.Text)
Exit Sub
Else
Me.txtquantity.Text = ""
End If
End Sub

Private Sub txttpaid_Change()

If IsNumeric(Me.txttpaid.Text) = True Then


Me.lblubal.Caption = Val(Me.lblbal.Caption) - Val(Me.txttpaid.Text)
If Val(Me.txttpaid.Text) > Val(Me.lblbal.Caption) Then
MsgBox "please enter paid amount less then balance !", vbInformation, "info"
Me.txttpaid.Text = ""
Me.lblubal.Caption = ""
Else
Exit Sub
End If
Else
Me.txttpaid.Text = ""
End If

End Sub

CONCLUSION

Conclusion :-
Designed system provides an easy way to interact with user and
administrator. This GUI based system gives a system with less
paper work and less memory overhead. It is also a fast and
interactive system.

BIBLIOGRAPHY
BIBLIOGRAPHY:
1/ Mr. Steven Holzner, Visual Basic 6 Programming (Black Book), 2006
edition, Dreamtech Press, New Delhi, 2002.

2/ Mr. Soma dasgupta, Visual Basic project, 2002 edition, BPB


Publication, New Delhi.

3/ Mastering in Visual Basic

Steven Holzner, Visual Basic 6 Programming (Black Book), 2006 edition,


Dreamtech Press, New Delhi, 2002.

2/ Mr. Soma Dasgupta, Visual Basic project, 2002 edition, BPB


Publication, New Delhi

3/ Mr. Evangelos Petroutsos, Mastering in Visual Basic 6.0, BPB


Publication, New Delhi
The following are the minimum requirement for the smooth and
successful running of the module.

Вам также может понравиться