Vous êtes sur la page 1sur 108

INTRODUCTION

SYNOPSIS

This project gives the complete information about the company


products to the customer requirements. It makes the job of the stock in-
charge easy. He encounters for any updates in the information of the
products into the database. All the details starting from placing the indent to
delivery of the products is being maintained.

This project is having five modules

1.Details about MS & HSD


2.Details about Lubricants
3.Details about Customers
4.Details about Fuel used by the company vehicles
5.Details about Reports

First we will collect all the product’s details. Both MS (petrol) and
HSD (diesel) stock information will be collected from underground tanks.
We will maintain this information in tables. After updating the stock details
we will enter the customer’s Indents into the table. At last we search our
stock for the customer’s indents. If stock is available then we will deliver
necessary stock (petrol or diesel). While delivering the stock we will charge
some charges like License fee, sales tax. And we subtract dealer commission
from that amount which is calculated after adding the charges.
While dealing with the Engine oils we have several products. So,
based on that product we have to enter the stock details into the table. Then
we will enter customer’s Indent into the table. We will check whether
particular grade is available are not. If it is available we will deliver.

At last we will maintain a table to store the consuming of our own


products for the employee’s vehicles.
SYSTEM ENVIRONMENT

HARDWARE SPECIFICATION

PROCESSOR : INTEL’S PENTIUMIII 550MHZ


RAM : 64 MB
HARD DISK : 10.2GB
FLOPPY DRIVE : 1.44 MB

SOFTWARE SPECIFICATION

ENVIRONMENT : MICROSOFT WINDOWS 98


BACKEND : MS ACCESS(7.0)
FRONTEND : VISUAL BASIC 5
REPORT : CRYSTAL REPORTS
VISUAL BASIC

VISUAL BASIC AND IT’S FEATURES

Visual Basic is an ideal programming language for developing


sophisticated professional applications for Microsoft Windows. It makes use
of Graphical User Interface for creating powerful applications. The
Graphical User Interface as the name suggests, users illustrations to text,
which enables users to interact with an application. This feature makes it
easier to comprehend thing in a quicker and easier way.

Coding in GUI environment is quite a transition to traditional, linear


programming methods where the user is guided through a liner path of
execution and is limited to a small set of allowing more freedom to the user
and developer. Features such as easier comprehension, user-friendliness,
faster application development and many other aspects such as introduction
to Active X technology and Internet features make Visual Basic an
interesting tool to work with.

Visual Basic was developed from the BASIC programming language.


In 1970s, Microsoft got its start by developing ROM-based interpreted
BASIC for the early microprocessor based computers. In 1982, Microsoft
Quick Basic revolutionized Basic and legitimized as a serious development
language for MS-DOS environment. Later on, Microsoft Corporation
created the enhanced version of BASIC called Visual Basic for Windows.
Visual Basic 5.0 for Windows requires atleast Microsoft Windows 95 or
Windows NT 3.51 or later with a very fast 486 or Pentium and atleast 16
MB of RAM. A complete installation of the most powerful version of
Visual Basic 5, the enterprise edition requires more than 100MB of hard disk
space.

THE USER INTERFACE

The user interface is what someone actually sees when you program is
running. Every program has a use in one form or another. A form is nothing
more than a window that appears on the screen. Every visual basic program
has at least one form although most have several. Objects are items that
appear in the form such as command buttons, scrollbars and option buttons.
An object lets the user give commands to your program.

An object’s properties determine the object’s name, color, size


location and appearance on the screen. Different object’s have different
property values. Each time you create a new object, Visual Basic assigns it
default property values. The whole purpose of Visual Basic code is to tell
objects on a form what to do when the user does something. Any time the
user presses a key, moves the mouse or clicks the mouse button, it is called
an event.

CRYSTAL REPORTS
Crystal Reports is a powerful Windows report writer that can be used
to design nearly endless variety of custom reports. Using Crystal Reports,
we can design the reports that can be called from the application of the user.
MS-ACCESS
DATABASE
A database is a collection of information related to a particular subject
or purpose, such a s tracking customer orders or maintaining a music
collection. If your database isn’t stored to a computer, or only parts of it are
to be stored, you may be tracking information for a variety of sources that
you have to coordinate and organize yourself.

Before you see Microsoft Access to actually build the tables, forms,
and other objects that will make up you database, it is important to take time
to design your database. A good database design is the keystone to creating a
database that does what you want to do effectively, accurately and
efficiently.

The performance Analyzer can analyze your entire database and make
recommendations and suggestions for improving it. The wizard can also
implement these recommendations and suggestions. For information on
using the performance Analyzer, click
SYSTEM ANALYSIS

SYSTEM DEFINITION:

The Basic steps in designing a Database are:


1. Determine the purpose of your database.
2. Determine the tables you need in the database.
3. Determine the fields you need in the tables.
4. Identify fields with unique values.
5. Determine the relationship between tables.
6. Refine your design.
7. Add data and create other database objects.
8. Use Microsoft Access analysis tools.

TABLES
A table is a collection of data about a specific topic. Using a separate
table for each topic means you store that data only once, which makes your
database more efficient and reduces data entry errors. Tables organize data
into columns called fields, and rows called records.

Microsoft Access provides Four Ways to create Blank Tables


1. Use the database Wizard to create one operation all the tables, forms, and
reports for an entire database. The database wizard creates a new
database, it can’t be used to add new tables, forms or reports to an
existing database.
2. Use the table wizard to choose the fields for your table form a variety of
predefined tables such as business contacts, household inventory, or
medical records.

3. Enter data directly into a blank data sheet. When you save the new data
sheet, Microsoft access will analyze you data and automatically assign
the appropriate data type land format for each field.

4. Use design view to specify all of your table details from search.

Regardless of which method you use to create a table, you can table
design view at any time to customize you table further, such as adding new
fields, settings default values or creating masks.

Microsoft Access Provides Two Ways to create a table from


Existing Data
1. You can import to link data from another Microsoft Access database or
data in a variety of file formats from other programs.

2. You can perform a marketable query to create a table based on data in


current table. For E.g. You can use make table queries to archive old
records, to make backup copies of your tables to select a group of records
to export to another database, or to use as a basis for report that display
data from specific time.
Tables have two views
To easily view, enter and change data directly in a table create a form.
When you open a form, Microsoft access retrieves the data from one or more
tables and display it on screen using the layout you chose in the form wizard
or using a layout that you created from search.

Data Access Objects (DAO) enables you to use a programming


language to access and manipulate data in local or remote databases and to
manage databases their objects, and their structure. DAO supports two
different database environment or “workspaces”.

Microsoft jet workspaces allow you to access data in Microsoft jet


databases, Microsoft jet-connected ODBC databases, and installable ISAM
data sources in other formats, such as paradox or Lotus 1-2-3.

ODBC Direct workspaces allow you to access database servers through


ODBC. Without loading the Microsoft jet database engine.
SYSTEM IMPLEMENTATION

This project “PETROLEUM PRODUCTS INFORMATION


SYSTEM” gives clear details about stock available at all the filling stations
and it will give all the details of various lubricant products. So for the
management it is very easy to decide whether the stock is available for the
customer requirement or not.

This project is having five modules

1.Details about MS & HSD


2.Details about Lubricants
3.Details about Customers
4.Details about Fuel used by the company vehicles
5.Details about Reports

1. Details about MS & HSD

This module is used for the following operations

1) Rates list for MS & HSD


2) Stock updating
3) Placing an Indent
4) Delivery
1) Rates list for MS & HSD

In this module we will maintain the entire Rates list like actual price,
Dealer commission, License fee, Sales tax. If the rates are changed then we
can update all the details with new rates.

2) Stock updating

In this module we will maintain clear information about updates in


MS & HSD stocks at filling stations. Whenever we receive new stock from
refinery we will update particular filling station with new stock and filling
date.

3) Placing an Indent

This module is used to enter the customer Indent for MS & HSD. We
will maintain details like customer code, order date, delivery date, quantity.

4) Delivery

In this module we will maintain delivery details like customer code,


total price, total commission, total license fee, total sales tax, then net
amount, bank name, Cheque number, vehicle number, delivery date.

2. Details about Lubricants

This module is used for the following operations


1) Rates & stock list
2 2)Placing an Indent
3 3) Delivery
1) Rates & Stock list

This module is used to maintain the stock and rates list for
various lubricant products. Whenever we find the rates are changed
then we can update product rates. Like wise we can update stock also.
This will give clear information like how many packets are available
for a case and how much quantity is available for a case.

2) Placing an Indent

This module is used to store the customer requirements. The


customer can order more than one product at time. So, we will
maintain all that information clearly.

3) Delivery of Lubricants

This module is used to store all the delivery details like


customer code, No. of cases, price , sales tax, total amount, bank
name, Cheque no., vehicle no., delivery date.

3. Details about Customer

This module is used to maintain all customers personal details


like customer code, customer name, address, phone no.,
4. Details of fuel used by the company vehicles

This module is used to maintain details about fuel used by the


company vehicles. Vehicle no., product name, quantity, filling date
can be maintained.

5. Reports

We can get reports like

♦ Available stock at filling stations


♦ Available stock for various lubricant products
♦ MS & HSD Indents at a particular date
♦ Lubricant Indents at a particular date
♦ Delivery details at a particular date for MS & HSD
♦ Delivery details at a particular date for Lubricants
♦ All customer details
♦ Customer personal details
♦ Own usage by the company vehicles
SYSTEM DESIGN

DATAFLOW DIAGRAM:

MS & HSD LUBRICANTS


DETAILS DETAILS

PROCESS
TO CHOOSE
ANY ONE
OF THE
DETAILS

CUSTOMER OWN
DETAILS USAGE BY
COMPANY
DFD FOR SELECTION

PRODUCT GETTI PROCESS


NG FOR
NAME
UPDATIN
RATES
G RATES

RATES TABLE

DFD FOR RATES


PROCES
PRODUCT GETTI S FOR
NG UPDATI
NAME STOC NG THE
K STOCK

MHSTOCK TABLE

DFD FOR STOCK UPDATES


CUTOMER ENTERIN
DETAILS CHECKING G
CUSTOME INDENT
R DETAILS

CUSTOMER TABLE MHINDENT TABLE

DFD FOR CUSTOMER DETAILS


INDENT TABLE

PROCESS
TO GET
DATA
FROM
INDENTS DELIVERY
RATES TABLE TABLE

PROCESS PROCESS PROCESS


TO CHECK TO TO
AVAILABLE CALCULAT DELIVER
STOCK E THE THE STOCK
TOTAL

STOCK TABLE
CUSTOMER
DFD FOR DELIVERING STOCK
SOURCE CODE

FRMLOGIN
Option Explicit
Public LoginSucceeded As Boolean

Private Sub cmdCancel_Click()


'set the global var to false
'to denote a failed login
LoginSucceeded = False
Me.Hide
End Sub

Private Sub cmdOK_Click()


'check for correct password
If txtPassword = "sampathkumarmv" Then
'place code to here to pass the
'success to the calling sub
'setting a global var is the easiest
LoginSucceeded = True
Me.Hide
Form1.Show
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End Sub

FORM-1 (Title Form)

Dim d As Date
Dim d1 As String
Dim n As Integer

Private Sub Command1_Click()


Form2.Show
End Sub

Private Sub Command2_Click()


End
End Sub

Private Sub Command3_Click()


Form3.Show
End Sub

Private Sub Command4_Click()


Form4.Show
End Sub

Private Sub Command5_Click()


Form5.Show
End Sub

Private Sub all_Click()


CrystalReport1.RetrieveDataFiles
CrystalReport1.Action = 1
End Sub

Private Sub customerdetails_Click()


Form7.Show
End Sub

Private Sub DELIVERY_Click()


Form5.Show
End Sub

Private Sub dlub_Click()


CrystalReport10.RetrieveDataFiles
d = Format(InputBox("Please Enter delivery date(mm/dd/yyyy)"),
"mm/dd/yyyy")
d1 = Format(d, "yyyy,mm,dd")
CrystalReport10.SelectionFormula = "{ludelivery.ddate}= " & "date(" & d1
& ")"
CrystalReport10.Action = 1
End Sub

Private Sub dms_Click()


CrystalReport9.RetrieveDataFiles
d = Format(InputBox("Please Enter delivery date(mm/dd/yyyy)"),
"mm/dd/yyyy")
d1 = Format(d, "yyyy,mm,dd")
CrystalReport9.SelectionFormula = "{delivery.deldate}= " & "date(" & d1
& ")"
CrystalReport9.Action = 1
End Sub

Private Sub exit_Click()


End
End Sub
Private Sub ilub_Click()
CrystalReport8.RetrieveDataFiles
d = Format(InputBox("Please Enter order date(mm/dd/yyyy)"),
"mm/dd/yyyy")
d1 = Format(d, "yyyy,mm,dd")
CrystalReport8.SelectionFormula = "{luindent.ordate}= " & "date(" & d1 &
")"
CrystalReport8.Action = 1
End Sub

Private Sub ims_Click()


CrystalReport7.RetrieveDataFiles
d = Format(InputBox("Please Enter order date(mm/dd/yyyy)"),
"mm/dd/yyyy")
d1 = Format(d, "yyyy,mm,dd")
CrystalReport7.SelectionFormula = "{mhindent.orddate}= " & "date(" & d1
& ")"
CrystalReport7.Action = 1
End Sub

Private Sub INDENTS_Click()


Form4.Show
End Sub

Private Sub individual_Click()


Form13.Show
End Sub

Private Sub LDELIVERY_Click()


Form11.Show
End Sub

Private Sub LINDENTS_Click()


Form9.Show
End Sub

Private Sub lrates_Click()


CrystalReport3.RetrieveDataFiles
CrystalReport3.Action = 1
End Sub
Private Sub luindentdelivery_Click()
n = InputBox("Enter Indent NO.")
CrystalReport12.RetrieveDataFiles
d = Format(InputBox("Please Enter order date(mm/dd/yyyy)"),
"mm/dd/yyyy")
d1 = Format(d, "yyyy,mm,dd")
CrystalReport12.SelectionFormula = "{ludelivery.ddate}= " & "date(" & d1
& ")" & " and {ludelivery.ino} = " & n
CrystalReport12.Action = 1
End Sub

Private Sub mshsddelivery_Click()


n = InputBox("Enter Indent NO.")
CrystalReport11.RetrieveDataFiles
d = Format(InputBox("Please Enter order date(mm/dd/yyyy)"),
"mm/dd/yyyy")
d1 = Format(d, "yyyy,mm,dd")
CrystalReport11.SelectionFormula = "{delivery.deldate}= " & "date(" & d1
& ")" & " and {delivery.ino} = " & n
CrystalReport11.Action = 1
End Sub

Private Sub own_Click()


Form10.Show
End Sub

Private Sub ownusages_Click()


CrystalReport6.RetrieveDataFiles
CrystalReport6.Action = 1
End Sub

Private Sub RLIST_Click()


Form2.Show
End Sub

Private Sub rms_Click()


CrystalReport2.RetrieveDataFiles
CrystalReport2.Action = 1
End Sub
Private Sub RSRATES_Click()
Form8.Show
End Sub

Private Sub RSTOCK_Click()


Form3.Show
End Sub

Private Sub slub_Click()


CrystalReport5.RetrieveDataFiles
CrystalReport5.Action = 1
End Sub
Private Sub sms_Click()
CrystalReport4.RetrieveDataFiles
CrystalReport4.Action = 1
End Sub
FORM-2 (MS&HSD Rates Form)
Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset

Private Sub Combo1_Click()


Set rs1 = db.OpenRecordset("select * from mhrates where prodname = '" &
Combo1.Text & "'")
Text2.Text = rs1(1)
Text3.Text = rs1(2)
Text4.Text = rs1(3)
Text5.Text = rs1(4)
End Sub

Private Sub Command1_Click()


If (Text2.Text = "") Or (Text3.Text = "") Or (Text4.Text = "") Or (Text5.Text
= "") Then
MsgBox "Please Enter all the details"
Exit Sub
Else
rs1.Edit
rs1(1) = Text2.Text
rs1(2) = Text3.Text
rs1(3) = Text4.Text
rs1(4) = Text5.Text
rs1.Update
MsgBox "Rates Modified"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("mhrates")
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
Combo1.AddItem rs(0)
rs.MoveNext
Wend
End If
End Sub
FORM-3 (Filling Station details Form)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim opt, rpointer As Integer
Dim t1 As Double
Dim t2 As Double
Dim tt1 As Double
Dim tt2 As Double
Dim ch

Private Sub Combo1_Click()


Set rs1 = db.OpenRecordset("select * from mhstock where fsno =" &
Combo1.Text)
Text1.Text = rs1(1)
t1 = rs1(1)
Text2.Text = rs1(2)
Text3.Text = rs1(3)
t2 = rs1(3)
Text4.Text = rs1(4)
ch = MsgBox("Do You Want to Update the stock ?", vbYesNo)
If ch = vbYes Then
Text1.Text = ""
Text3.Text = ""
MsgBox "Please Enter addtional Stock"
Else
MsgBox "Ok Thank You"
End If
End Sub

Private Sub Command1_Click()


If opt = 1 Then
If (Text1.Text = "") Or (Text2.Text = "") Or (Text3.Text = "") Or
(Text4.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs(0) = Combo1.Text
rs(1) = Text1.Text
rs(2) = Text2.Text
rs(3) = Text3.Text
rs(4) = Text4.Text
If (Text1.Text > 100000) Or (Text3.Text > 100000) Then
MsgBox "Please maintain 100000 lt only"
Exit Sub
End If
rs.Update
MsgBox "New Fill Station added(Record saved)"
Command1.Caption = "Update"
Combo1.AddItem Combo1.Text
opt = 0
Else
If (Text1.Text = "") Or (Text2.Text = "") Or (Text3.Text = "") Or
(Text4.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
Else
rs1.Edit
tt1 = t1 + Val(Text1.Text)
tt2 = t2 + Val(Text3.Text)
rs1(2) = Text2.Text
rs1(4) = Text4.Text
If (tt1 > 100000) Then
Text1.Text = tt1
MsgBox "Stock Over flow please maintain 100000 kl of MS"
Text1.Text = t1
rs1(1) = t1
'Exit sub
Else
rs1(1) = tt1
Text1.Text = tt1
End If

If (tt2 > 100000) Then


Text3.Text = tt2
MsgBox "Stock Over flow please maintain 100000 kl of HSD"
Text3.Text = t2
rs1(3) = t2
'Exit Sub
Else
rs1(3) = tt2
Text3.Text = tt2
End If
rs1.Update
MsgBox "Stock Updated"
End If
End If
End Sub

Private Sub Command2_Click()


Call clear
'Automatic incrementing for Fill station number
If (rs.BOF And rs.EOF) Then
rpointer = 0
Else
rs.MoveLast
rpointer = rs(0)
End If
Combo1.Text = rpointer + 1
opt = 1
rs.AddNew
Command1.Caption = "Save"
End Sub

Private Sub Command3_Click()


db.Execute ("delete * from mhstock where fsno =" & Combo1.Text)
For opt = 0 To (Combo1.ListCount - 1)
If (Combo1.List(opt) = Combo1.Text) Then
Combo1.RemoveItem opt
End If
Next
Call clear
MsgBox "Fill Station Removed"
opt = 0
End Sub

Private Sub Command4_Click()


Unload Me
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("mhstock")
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
Combo1.AddItem rs(0)
rs.MoveNext
Wend
End If
End Sub
Private Sub clear()
Combo1.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub

Private Sub Text1_lostfocus()


If (Text1.Text > 100000) Then
MsgBox "Please maintain 100000 lt only"
End If
End Sub

Private Sub Text3_lostfocus()


If (Text3.Text > 100000) Then
MsgBox "Please maintain 100000 lt only"
End If
End Sub

FORM-4 (MS&HSD Indents Form)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim rs2 As Recordset
Dim rs3 As Recordset
Dim opt As Integer

Private Sub Combo1_Click()


Set rs3 = db.OpenRecordset("select * from tcust where cname = '" &
Combo1.Text & "'")
Text2.Text = rs3(1)
End Sub

Private Sub Command1_Click()


Call clear
'Automatic incrementing for indent number
If (rs.BOF And rs.EOF) Then
rpointer = 0
Else
rs.MoveLast
rpointer = rs(0)
End If
Text1.Text = rpointer + 1
rs.AddNew
Label7.Visible = True
Combo1.Visible = True
opt = 1
End Sub

Private Sub Command2_Click()


If opt = 1 Then
If (Text3.Text = "") Or (Text4.Text = "") Or (Text5.Text = "") Or
(Text6.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If

rs(0) = Text1.Text
rs(1) = Text2.Text
rs(2) = Text3.Text
rs(3) = Text4.Text
rs(4) = Text5.Text
rs(5) = Text6.Text
rs(6) = "NO"
rs.Update
MsgBox "Record Saved"
Command2.Caption = "Update"
Call clear
opt = 0
Else
If (Text3.Text = "") Or (Text4.Text = "") Or (Text5.Text = "") Or
(Text6.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs1.Edit
rs1(2) = Text3.Text
rs1(3) = Text4.Text
rs1(4) = Text5.Text
rs1(5) = Text6.Text
rs1.Update
MsgBox "Record Modified"
Call clear
End If
End Sub

Private Sub Command3_Click()


If (Text1.Text = "") Then
MsgBox "Please Enter Indent no. to delete"
Else
db.Execute ("delete * from mhindent where ino = " & Text1.Text)
Call clear
MsgBox "Record deleted"
End If
End Sub

Private Sub Command4_Click()


Unload Me
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("mhindent")
Set rs2 = db.OpenRecordset("tcust")
'To fill customer name list in combo1
If Not (rs2.BOF And rs2.EOF) Then
rs2.MoveFirst
While Not rs2.EOF
Combo1.AddItem rs2(0)
rs2.MoveNext
Wend
End If
End Sub

Private Sub clear()


Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Combo1.Text = ""
End Sub
Private Sub Text1_lostfocus()
Set rs1 = db.OpenRecordset("select * from mhindent where ino = " &
Text1.Text)
If Not (rs1.BOF And rs1.EOF) Then
Text2.Text = rs1(1)
Text3.Text = rs1(2)
Text4.Text = rs1(3)
Text5.Text = rs1(4)
Text6.Text = rs1(5)
Label7.Visible = False
Combo1.Visible = False
Else
Call clear
MsgBox "Record not found"
End If
End Sub

Private Sub Text3_lostfocus()


If Val(Text3.Text) > 12000 Then
MsgBox "MS Quantity should not be greater than 12000 lt"
Exit Sub
End If
End Sub

Private Sub Text4_lostfocus()


If Val(Text4.Text) > 12000 Then
MsgBox "HSD Quantity should not be greater than 12000 lt"
Exit Sub
End If
If (Val(Text3.Text) + Val(Text4.Text)) > 12000 Then
MsgBox "Total quantity (MS+HSD) should not be greater than 12000 lt"
Exit Sub
End If
End Sub
FORM-5 (MS&HSD delivery Form)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim rs2 As Recordset
Dim rs3 As Recordset
Dim rs4 As Recordset
Dim rs5 As Recordset
Dim rs6 As Recordset
Dim rs7 As Recordset
Dim todaydate As Date
Dim opt As Integer

Private Sub asdate_Click()


If (Combo1.ListCount > 0) Then
Combo1.clear
End If
Call clear
todaydate = Date
Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("mhindent")
Set rs2 = db.OpenRecordset("mhrates")
Set rs5 = db.OpenRecordset("delivery")
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
If (rs(5) = todaydate) And (rs(6) = "NO") Then
Combo1.AddItem rs(0)
End If
rs.MoveNext
Wend
End If
End Sub

Private Sub asindent_Click()


If (Combo1.ListCount > 0) Then
Combo1.clear
End If
Call clear
Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("mhindent")
Set rs2 = db.OpenRecordset("mhrates")
Set rs5 = db.OpenRecordset("delivery")
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
If (rs(6) = "NO") Then
Combo1.AddItem rs(0)
End If
rs.MoveNext
Wend
End If
End Sub

Private Sub availability_Click()


CrystalReport1.RetrieveDataFiles
CrystalReport1.SelectionFormula = "{mhstock.msqty} > " & Text2.Text &
" And {mhstock.hsdqty} > " & Text9.Text
CrystalReport1.Action = 1
End Sub

Private Sub Combo1_Click()


Set rs1 = db.OpenRecordset("select * from mhindent where ino =" &
Combo1.Text)
Text3.Text = rs1(1)
Text2.Text = rs1(2)
Text9.Text = rs1(3)
Text19.Text = rs1(5)
End Sub
Private Sub exit_Click()
Unload Me
End Sub

Private Sub modifications_Click()


Form6.Show
End Sub

Private Sub stockdelivery_Click()


If (Text15.Text = "") Or (Text16.Text = "") Or (Text17.Text = "") Or
(Text18.Text = "") Or (Text19.Text = "") Then
MsgBox "This Product can not Deliver Please Check again"
Exit Sub
Else
rs5.AddNew
rs5(0) = Combo1.Text
rs5(1) = Text3.Text
rs5(2) = Text1.Text
rs5(3) = Text4.Text
rs5(4) = Text5.Text
rs5(5) = Text6.Text
rs5(6) = Text7.Text
rs5(7) = Text8.Text
rs5(8) = Text10.Text
rs5(9) = Text11.Text
rs5(10) = Text12.Text
rs5(11) = Text13.Text
rs5(12) = Text14.Text
rs5(13) = Text15.Text
rs5(14) = Text16.Text
rs5(15) = Text17.Text
rs5(16) = Text18.Text
rs5(17) = Text19.Text
rs5.Update
Set rs7 = db.OpenRecordset("select * from mhindent where ino = " &
Combo1.Text)
rs7.Edit
rs7(6) = "YES"
rs7.Update
'db.Execute ("delete * from mhindent where ino =" & Combo1.Text)
MsgBox "Stock delivered"
For opt = 0 To (Combo1.ListCount - 1)
If (Combo1.List(opt) = Combo1.Text) Then
Combo1.RemoveItem opt
Exit For
End If
Next
Call clear
End If
End Sub

Private Sub Text1_lostfocus()


Set rs6 = db.OpenRecordset("select * from mhstock where fsno = " &
Text1.Text)
If (Val(Text2.Text) > rs6(1)) Or (Val(Text9.Text) > rs6(3)) Then
MsgBox "There is no sufficent Quantity in this Fill Station"
Exit Sub
Else
Set rs3 = db.OpenRecordset("select * from mhrates where prodname = '" &
"ms" & "'")
Set rs4 = db.OpenRecordset("select * from mhrates where prodname = '" &
"hsd" & "'")
'calculation for ms
Text4.Text = Format$((rs3(1) * Val(Text2.Text) / 1000), "#0.00")
Text5.Text = Format$((rs3(2) * Val(Text2.Text) / 1000), "#0.00")
Text6.Text = Format$((rs3(3) * Val(Text2.Text) / 1000), "#0.00")
Text7.Text = Format$((((Val(Text4.Text) - Val(Text5.Text) +
Val(Text6.Text)) * (rs3(4) / 100))), "#0.00")
Text8.Text = Format$(((Val(Text4.Text) + Val(Text6.Text) +
Val(Text7.Text))), "#0.00")
'calculation for hsd
Text10.Text = Format$((rs4(1) * Val(Text9.Text) / 1000), "#0.00")
Text11.Text = Format$((rs4(2) * Val(Text9.Text) / 1000), "#0.00")
Text12.Text = Format$((rs4(3) * Val(Text9.Text) / 1000), "#0.00")
Text13.Text = Format$((((Val(Text10.Text) - Val(Text11.Text) +
Val(Text12.Text)) * (rs4(4) / 100))), "#0.00")
Text14.Text = Format$(((Val(Text10.Text) + Val(Text12.Text) +
Val(Text13.Text))), "#0.00")
Text15.Text = Format$(((Val(Text8.Text) + Val(Text14.Text))), "#0")
End If

'Reducing the stock from mhstock Table


rs6.Edit
rs6(1) = rs6(1) - (Val(Text2.Text) / 1000)
rs6(3) = rs6(3) - (Val(Text9.Text) / 1000)
rs6.Update
End Sub

Private Sub clear()


Combo1.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
End Sub

FORM-6 (Modifications Form for MS & HSD delivery)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset

Private Sub Command1_Click()


If (Text1.Text = "") Or (Text2.Text = "") Or (Text3.Text = "") Or (Text4.Text
= "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs1.Edit
rs1(14) = Text2.Text
rs1(15) = Text3.Text
rs1(16) = Text4.Text
rs1.Update
MsgBox "Record Modified"
Call clear
End Sub

Private Sub Command2_Click()


Unload Me
End Sub
Private Sub Form_Load()
Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("delivery")
End Sub

Private Sub Text1_lostfocus()


Set rs1 = db.OpenRecordset("select * from delivery where ino = " &
Text1.Text)
If Not (rs1.BOF And rs1.EOF) Then
Text2.Text = rs1(14)
Text3.Text = rs1(15)
Text4.Text = rs1(16)

Else
Call clear
MsgBox "Record Not found"
End If
End Sub

Private Sub clear()


Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
FORM-7 (Customer Details Form)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim opt As Integer
Dim rpointer As Integer

Private Sub Combo1_Click()


Set rs1 = db.OpenRecordset("select * from tcust where cname = '" &
Combo1.Text & "'")
If Not (rs1.BOF And rs1.EOF) Then
Text2.Text = rs1(1)
Text3.Text = rs1(2)
Text4.Text = rs1(3)
Text5.Text = rs1(4)
Text6.Text = rs1(5)
Text7.Text = rs1(6)
Text8.Text = rs1(7)
Else
MsgBox "Record not found"
End If
End Sub

Private Sub Command1_Click()


Call clear
'Automatic incrementing for Customer number
If (rs.BOF And rs.EOF) Then
rpointer = 0
Else
rs.MoveLast
rpointer = rs(1)
End If
Text2.Text = rpointer + 1
opt = 1
rs.AddNew
Command2.Caption = "Save"
End Sub

Private Sub Command2_Click()


If opt = 1 Then
If (Text3.Text = "") Or (Text4.Text = "") Or (Text5.Text = "") Or
(Text6.Text = "") Or (Text7.Text = "") Or (Text8.Text = "") Or
(Combo1.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs(0) = Combo1.Text
rs(1) = Text2.Text
rs(2) = Text3.Text
rs(3) = Text4.Text
rs(4) = Text5.Text
rs(5) = Text6.Text
rs(6) = Text7.Text
rs(7) = Text8.Text
rs.Update
opt = 0
Combo1.AddItem Combo1.Text
MsgBox "New customer added (Record Saved)"
Command2.Caption = "Update"
Else
If (Text3.Text = "") Or (Text4.Text = "") Or (Text5.Text = "") Or
(Text6.Text = "") Or (Text7.Text = "") Or (Text8.Text = "") Or
(Combo1.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs1.Edit
rs1(0) = Combo1.Text
rs1(1) = Text2.Text
rs1(2) = Text3.Text
rs1(3) = Text4.Text
rs1(4) = Text5.Text
rs1(5) = Text6.Text
rs1(6) = Text7.Text
rs1(7) = Text8.Text
rs1.Update
MsgBox "Record Modified"
End If
End Sub

Private Sub Command3_Click()


db.Execute ("delete * from tcust where cname = '" & Combo1.Text & "'")
For opt = 0 To (Combo1.ListCount - 1)
If (Combo1.Text = Combo1.List(opt)) Then
Combo1.RemoveItem opt
End If
Next
Call clear
MsgBox "Customer deleted"
End Sub

Private Sub Command4_Click()


Unload Me
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("tcust")
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
Combo1.AddItem rs(0)
rs.MoveNext
Wend
End If
End Sub

Private Sub clear()


Combo1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
End Sub
FORM-8 (Lubricants stock maintenance Form)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim opt As Integer
Dim i As Integer
Dim t1 As Double

Private Sub Combo1_Click()


For i = 0 To (List1.ListCount - 1)
If (List1.List(i) = Combo1.Text) Then
List1.RemoveItem i
End If
Next
db.Execute ("delete * from lurates where pname = '" & Combo1.Text & "'")
Combo1.Visible = False
Text1.Visible = True
Call clear
MsgBox "Product deleted"
End Sub

Private Sub Command1_Click()


Call clear
opt = 1
rs.AddNew
Command2.Caption = "Save"
End Sub

Private Sub Command2_Click()


If opt = 1 Then
If (Text2.Text = "") Or (Text3.Text = "") Or (Text4.Text = "") Or
(Text5.Text = "") Or (Text6.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If

rs(0) = Text1.Text
rs(1) = Text2.Text
rs(2) = Text3.Text
rs(3) = Text4.Text
rs(4) = Text5.Text
rs(5) = Text6.Text
List1.AddItem Text1.Text
rs.Update
opt = 0
Combo1.AddItem Combo1.Text
MsgBox "New Product added (Record Saved)"
Command2.Caption = "Update"
Call clear
Else
If (Text2.Text = "") Or (Text3.Text = "") Or (Text4.Text = "") Or
(Text5.Text = "") Or (Text6.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs1.Edit
'There is no chance to change Product name
'If u want to change delete that name and add with new name
rs1(1) = Text2.Text
t1 = t1 + Val(Text3.Text)
rs1(2) = t1
rs1(3) = Text4.Text
rs1(4) = Text5.Text
rs1(5) = Text6.Text
rs1.Update
MsgBox "Record Modified"
Text3.Text = t1
End If
End Sub

Private Sub Command3_Click()


Text1.Visible = False
Combo1.Visible = True
Combo1.clear
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
Combo1.AddItem rs(0)
rs.MoveNext
Wend
End If
MsgBox "Please Select The Product Name to delete"
End Sub

Private Sub Command4_Click()


Unload Me
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("lurates")
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
List1.AddItem rs(0)
rs.MoveNext
Wend
End If
End Sub

Private Sub List1_Click()


Call clear
Text1.Text = List1.Text
End Sub

Private Sub Text1_lostfocus()


Set rs1 = db.OpenRecordset("select * from lurates where pname = '" &
Text1.Text & "'")
If Not (rs1.BOF And rs1.EOF) Then
Text2.Text = rs1(1)
Text3.Text = rs1(2)
t1 = rs1(2)
Text4.Text = rs1(3)
Text5.Text = rs1(4)
Text6.Text = rs1(5)
Else
MsgBox "You are entering New Product details"
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End If
End Sub

Private Sub clear()


Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub
FORM-9 (Indents From for Lubricants)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim rs2 As Recordset
Dim rs3 As Recordset
Dim rs4 As Recordset
Dim rs5 As Recordset
Dim rs6 As Recordset
Dim rs7 As Recordset
Dim rpointer As Integer
Dim opt As Integer
Dim temp As Double

Private Sub Combo1_Click()


Combo2.clear
Set rs5 = db.OpenRecordset("select * from luindent where ino = " &
Combo1.Text)
If Not (rs5.BOF And rs5.EOF) Then
rs5.MoveFirst
While Not rs5.EOF
Combo2.AddItem rs5(2)
rs5.MoveNext
Wend
End If
'Text2.Text = rs5(0)
'Text4.Text = rs5(5)
'Text5.Text = rs5(3)
'Text6.Text = rs5(4)
End Sub
Private Sub combo2_click()
db.Execute ("delete * from luindent where ino = " & Combo1.Text & " And
pname = '" & Combo2.Text & "'")
Combo1.Visible = False
Combo2.Visible = False
Text1.Visible = True
Text3.Visible = True
MsgBox "Record Deleted"
End Sub

Private Sub Combo3_click()


Set rs7 = db.OpenRecordset("select *from tcust where cname = '" &
Combo3.Text & "'")
temp = rs7(1)
Combo3.Visible = False
Label6.Caption = "CUSTOMER CODE"
Text2.Visible = True
Text2.Text = temp
End Sub

Private Sub Command1_Click()


Call clear
Command3.Caption = "Save"
'Automatic incrementing for indent number
Set rs1 = db.OpenRecordset("select distinct(ino) from luindent ")
If (rs1.BOF And rs1.EOF) Then
rpointer = 0
Else
rs1.MoveLast
rpointer = rs1(0)
End If
Text1.Text = rpointer + 1
rs2.AddNew
opt = 1
Set rs6 = db.OpenRecordset("tcust")
If Not (rs6.BOF And rs6.EOF) Then
rs6.MoveFirst
Label6.Caption = "CUSTOMER NAME"
Text2.Visible = False
Combo3.Visible = True
While Not rs6.EOF
Combo3.AddItem rs6(0)
rs6.MoveNext
Wend
End If
End Sub

Private Sub Command2_Click()


rs2.AddNew
Text3.Text = ""
Text4.Text = ""
opt = 1
End Sub

Private Sub Command3_Click()


If opt = 1 Then
If (Text4.Text = "") Or (Text5.Text = "") Or (Text6.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs2(0) = Text2.Text
rs2(1) = Text1.Text
rs2(2) = Text3.Text
rs2(3) = Text5.Text
rs2(4) = Text6.Text
rs2(5) = Text4.Text
rs2(6) = "NO"
rs2.Update
MsgBox "Record Saved"
Command3.Caption = "Update"
opt = 0
Else
If (Text4.Text = "") Or (Text5.Text = "") Or (Text6.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs3.Edit
rs3(0) = Text2.Text
rs3(2) = Text3.Text
rs3(3) = Text5.Text
rs3(4) = Text6.Text
rs3(5) = Text4.Text
rs3.Update
MsgBox "Record Modified"
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Command5_Click()


Call clear
Text1.Visible = False
Text3.Visible = False
Combo1.Visible = True
Combo2.Visible = True
Combo1.clear
Combo2.clear
Set rs4 = db.OpenRecordset("select distinct(ino) from luindent")
If Not (rs4.BOF And rs4.EOF) Then
rs4.MoveFirst
While Not rs4.EOF
Combo1.AddItem rs4(0)
rs4.MoveNext
Wend
End If
MsgBox "Please Select The Indent no. to Delete"
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("lurates")
Set rs2 = db.OpenRecordset("luindent")
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
List1.AddItem rs(0)
rs.MoveNext
Wend
End If
End Sub
Private Sub clear()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End Sub

Private Sub List1_Click()


Text3.Text = List1.Text
End Sub

Private Sub Text3_lostfocus()


Set rs3 = db.OpenRecordset("select * from luindent where ino = " &
Text1.Text & "And pname = '" & Text3.Text & "'")
If Not (rs3.BOF And rs3.EOF) Then
Text2.Text = rs3(0)
Text4.Text = rs3(5)
Text5.Text = rs3(3)
Text6.Text = rs3(4)
End If
End Sub
FORM-10 (Own usage Form)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim opt As Integer
Dim ch As Integer
Dim rpointer As Integer

Private Sub Combo1_Click()


If ch = 1 Then
db.Execute ("delete * from ownusage where tno = " & Combo1.Text)
For opt = 0 To (Combo1.ListCount - 1)
If (Combo1.Text = Combo1.List(opt)) Then
Combo1.RemoveItem opt
End If
Next
Call clear
MsgBox "Transaction deleted"
ch = 0
Command1.SetFocus
End If
End Sub

Private Sub Combo1_LostFocus()


If (Combo1.Text <> "") Then
Set rs1 = db.OpenRecordset("select * from ownusage where tno = " &
Combo1.Text)
If Not (rs1.BOF And rs1.EOF) Then
Text1.Text = rs1(1)
Text2.Text = rs1(2)
Text3.Text = rs1(3)
Text4.Text = rs1(4)
End If
End If
End Sub

Private Sub Command1_Click()


Call clear
Command2.Caption = "Save"
'Automatic incrementing for Transaction number
If (rs.BOF And rs.EOF) Then
rpointer = 0
Else
rs.MoveLast
rpointer = rs(0)
End If
Combo1.Text = rpointer + 1
rs.AddNew
opt = 1
End Sub

Private Sub Command2_Click()


If opt = 1 Then
If (Text1.Text = "") Or (Text2.Text = "") Or (Text3.Text = "") Or (Text4.Text
= "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If
rs(0) = Combo1.Text
rs(1) = Text1.Text
rs(2) = Text2.Text
rs(3) = Text3.Text
rs(4) = Text4.Text
rs.Update
opt = 0
'Combo1.AddItem Combo1.Text
MsgBox "Transaction completed"
Command2.Caption = "Update"
Call clear
Else
If (Text1.Text = "") Or (Text2.Text = "") Or (Text3.Text = "") Or
(Text4.Text = "") Then
MsgBox "Please Enter all the details"
Exit Sub
End If

rs1.Edit
rs1(0) = Combo1.Text
rs1(1) = Text1.Text
rs1(2) = Text2.Text
rs1(3) = Text3.Text
rs1(4) = Text4.Text
rs1.Update
MsgBox "Record Modified"
End If
End Sub

Private Sub Command3_Click()


Combo1.clear
Call clear
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
Combo1.AddItem rs(0)
rs.MoveNext
Wend
End If
ch = 1
MsgBox "Please select Transaction no. to delete"
End Sub

Private Sub Command4_Click()


Unload Me
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("ownusage")
End Sub
Private Sub clear()
Combo1.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
FORM-11 (Lubricants delivery details Form)
Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim rs2 As Recordset
Dim rs3 As Recordset
Dim rs4 As Recordset
Dim rs5 As Recordset
Dim rs6 As Recordset
Dim rs7 As Recordset
Dim rs8 As Recordset
Dim rs9 As Recordset
Dim rs10 As Recordset
Dim rs11 As Recordset
Dim todaydate As Date
Dim opt As Integer
Dim i As Integer
Dim st As Integer

Private Sub billing_Click()


Set rs8 = db.OpenRecordset("select * from lurates where pname = '" &
Combo1.Text & "'")
If (Combo1.Text = "") Then
MsgBox "Please select an item"
Exit Sub
End If
If (rs8(2) >= rs6(5)) Then
Text4.Text = (Val(Text3.Text) * rs8(3))
Text5.Text = (Val(Text3.Text) * rs8(4))
Text6.Text = (Val(Text3.Text) * rs8(1))
Text7.Text = (Val(Text6.Text) * (rs8(5) / 100))
Text8.Text = (Val(Text6.Text) + Val(Text7.Text))
Else
MsgBox "There is no sufficient Quantity for this Product"
Exit Sub
End If
End Sub

Private Sub Combo1_Click()


Set rs6 = db.OpenRecordset("select * from luindent where ino = " &
Combo2.Text & "And pname = '" & Combo1.Text & "'")
Text3.Text = rs6(5)
Text12.Text = rs6(4)
'Checking for stock(cases)
Set rs10 = db.OpenRecordset("select * from lurates where pname = '" &
Combo1.Text & "'")
If (Val(Text3.Text) > rs10(2)) Then
MsgBox "There is no sufficient Stock for this Product"
st = 1
Else
st = 0
rs10.Edit
rs10(2) = rs10(2) - Val(Text3.Text)
rs10.Update
End If
End Sub

Private Sub combo2_click()


If (Combo1.ListCount > 0) Then
Combo1.clear
Call clear
End If
Set rs2 = db.OpenRecordset("select * from luindent where ino = " &
Combo2.Text)
Text1.Text = rs2(0)
If Not (rs2.BOF And rs2.EOF) Then
rs2.MoveFirst
While Not rs2.EOF
Combo1.AddItem rs2(2)
rs2.MoveNext
Wend
End If
End Sub

Private Sub Command2_Click()


If (st = 1) Then
MsgBox "This Product can not Deliver Please Check again"
Else
If (Text8.Text = "") Or (Text9.Text = "") Then
MsgBox "This Product can not Deliver Please Check again"
Else
Text2.Text = Format$((Val(Text2.Text) + Val(Text8.Text)), "#0")
Set rs5 = db.OpenRecordset("ludelivery")
rs5.AddNew
rs5(0) = Text1.Text
rs5(1) = Combo2.Text
rs5(2) = Combo1.Text
rs5(3) = Text3.Text
rs5(4) = Text4.Text
rs5(5) = Text5.Text
rs5(6) = Text6.Text
rs5(7) = Text7.Text
rs5(8) = Text8.Text
rs5(9) = Text9.Text
rs5(10) = Text10.Text
rs5(11) = Text11.Text
rs5(12) = Text12.Text
rs5.Update
Set rs11 = db.OpenRecordset("select * from luindent where ino = " &
Combo2.Text & "And pname = '" & Combo1.Text & "'")
rs11.Edit
rs11(6) = "YES"
rs11.Update
'db.Execute ("delete * from luindent where ino = " & Combo2.Text &
"And pname = '" & Combo1.Text & "'")
'MsgBox "DEL COMBO1 = " & Combo1.Text
If (Combo1.ListCount = 1) Then
For i = 0 To (Combo2.ListCount - 1)
If (Combo2.List(i) = Combo2.Text) Then
Combo2.RemoveItem i
Exit For
End If
Next
Combo2.Text = ""
Text1.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Command3.SetFocus
End If
For i = 0 To (Combo1.ListCount - 1)
'MsgBox " FOR COMBO1 = " & Combo1.Text
If (Combo1.List(i) = Combo1.Text) Then
'MsgBox "IF COMBO1 = " & Combo1.Text
Combo1.RemoveItem i
Exit For
End If
Next
Combo1.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
End If
End If
End Sub

Private Sub Command3_Click()


Label9.Visible = False
Text2.Visible = False
Command2.Visible = False
Command3.Visible = False
End Sub
Private Sub exit_Click()
Unload Me
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs7 = db.OpenRecordset("lurates")
End Sub

Private Sub group_Click()


Label9.Visible = True
Text2.Visible = True
Text2.Text = Val(0)
Command2.Visible = True
Command3.Visible = True
MsgBox "Please follow with group items"
End Sub

Private Sub indentno_Click()


If (Combo2.ListCount > 0) Then
Combo2.clear
Combo1.clear
End If
Call clear
'Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("luindent")
'The rs1 record set is used to avoid the duplicate records while adding
'indentno. into the combobox
Set rs1 = db.OpenRecordset("select distinct(ino),delivery from luindent")
'Set rs5 = db.OpenRecordset("ludelivery")
If Not (rs1.BOF And rs1.EOF) Then
rs1.MoveFirst
While Not rs1.EOF
If (rs1(1) = "NO") Then
Combo2.AddItem rs1(0)
End If
rs1.MoveNext
Wend
End If
End Sub

Private Sub individual_Click()


If (st = 1) Then
MsgBox "This Product can not Deliver Please Check again"
Else
If (Text8.Text = "") Or (Text9.Text = "") Then
MsgBox "This Product can not Deliver Please Check again"
Else
Set rs5 = db.OpenRecordset("ludelivery")
rs5.AddNew
rs5(0) = Text1.Text
rs5(1) = Combo2.Text
rs5(2) = Combo1.Text
rs5(3) = Text3.Text
rs5(4) = Text4.Text
rs5(5) = Text5.Text
rs5(6) = Text6.Text
rs5(7) = Text7.Text
rs5(8) = Text8.Text
rs5(9) = Text9.Text
rs5(10) = Text10.Text
rs5(11) = Text11.Text
rs5(12) = Text12.Text
rs5.Update
Set rs11 = db.OpenRecordset("select * from luindent where ino = " &
Combo2.Text & "And pname = '" & Combo1.Text & "'")
rs11.Edit
rs11(6) = "YES"
rs11.Update
'db.Execute ("delete * from luindent where ino = " & Combo2.Text &
"And pname = '" & Combo1.Text & "'")
MsgBox "Stock Delivered"
If (Combo1.ListCount = 1) Then
For i = 0 To (Combo2.ListCount - 1)
If (Combo2.List(i) = Combo2.Text) Then
Combo2.RemoveItem i
End If
Next
End If

Combo2.Text = ""
Call clear
End If
End If
End Sub

Private Sub modifications_Click()


Form12.Show
End Sub

Private Sub today_Click()


If (Combo2.ListCount > 0) Then
Combo2.clear
Combo1.clear
End If
Call clear
todaydate = Date
'Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("luindent")
'The rs1 record set is used to avoid the duplicate records while adding
'indentno. into the combobox
Set rs1 = db.OpenRecordset("select distinct(ino),dedate,delivery from
luindent")
'Set rs5 = db.OpenRecordset("ludelivery")
If Not (rs1.BOF And rs1.EOF) Then
rs1.MoveFirst
While Not rs1.EOF
If (rs1(1) = todaydate) And (rs1(2) = "NO") Then
Combo2.AddItem rs1(0)
End If
rs1.MoveNext
Wend
End If
End Sub

Private Sub clear()


Combo1.Text = ""
Text1.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub
FORM-12 (Modification Form for Lubricants delivery)

Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset
Dim rs2 As Recordset

Private Sub Command1_Click()


If (Text1.Text = "") Or (Combo2.Text = "") Or (Text3.Text = "") Or
(Text4.Text = "") Then
MsgBox "Plese Enter all the details"
Exit Sub
End If
rs1.Edit
rs1(9) = Text3.Text
rs1(10) = Text4.Text
rs1(11) = Text5.Text
rs1.Update
MsgBox "Record Modified"
Call clear
End Sub

Private Sub Command2_Click()


Unload Me
End Sub
Private Sub Form_Load()
Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("ludelivery")
End Sub

Private Sub combo2_click()


Set rs1 = db.OpenRecordset("select * from ludelivery where ino = " &
Text1.Text & "And pname = '" & Combo2.Text & "'")
If Not (rs1.BOF And rs1.EOF) Then
Text3.Text = rs1(9)
Text4.Text = rs1(10)
Text5.Text = rs1(11)

Else
Call clear
MsgBox "Record Not found"
End If
End Sub

Private Sub clear()


Text1.Text = ""
Combo2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub

Private Sub Text1_lostfocus()


Set rs2 = db.OpenRecordset("select * from ludelivery where ino = " &
Text1.Text)
Combo2.clear
Combo2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
If Not (rs2.BOF And rs2.EOF) Then
rs2.MoveFirst
While Not rs2.EOF
Combo2.AddItem rs2(2)
rs2.MoveNext
Wend
End If
End Sub

FORM-13 (Report Form)


Dim db As Database
Dim rs As Recordset
Dim rs1 As Recordset

Private Sub Command1_Click()


CrystalReport1.RetrieveDataFiles
CrystalReport1.SelectionFormula = "{tcust.cname} = '" & Combo1.Text &
"'"
CrystalReport1.Action = 1
End Sub

Private Sub Command2_Click()


Unload Me
End Sub

Private Sub Form_Load()


Set db = DBEngine.OpenDatabase(App.Path & "\ppis.mdb")
Set rs = db.OpenRecordset("tcust")
If Not (rs.BOF And rs.EOF) Then
rs.MoveFirst
While Not rs.EOF
Combo1.AddItem rs(0)
rs.MoveNext
Wend
End If
End Sub

DATABASE DESIGN:

♦ MHRATES

♦ MHSTOCK

♦ MHINDENT

♦ DELIVERY

♦ LURATES

♦ LUINDENT

♦ LUDELIVERY
♦ TCUST

♦ OWNUSAGE

Table name: MHRATES


Description: This table is used to store Rate details of MS & HSD.

Field Name Data type Size Constraint

Prodname Text 10 primary key

Price Double 8 not null

Dcomm Double 8 not null

Lfee Double 8 not null

Stax Double 8 not null

Table name: MHSTOCK


Description: This table is used to maintain the stock for MS & HSD.
Field Name Data type Size Constraint

Fsno Integer 2 primary key

msqty Double 8 not null

mfdate Date/Time 8 not null

hsdqty Double 8 not null

hfdate Date/Time 8 not null

Table name: MHINDENT


Description: This table is used to store the Indents of MS & HSD.

Field Name Data type Size Constraint

ino Double 8 primary key

ccode Double 8 not null

msqty Double 8 not null

hsdqty Double 8 not null

orddate Date/Time 8 not null

deldate Date/Time 8 not null

delivery Text 10 not null


Table name: DELIVERY
Description: This table is used to store delivery details of MS & HSD.

Field Name Data type Size Constraint

Ino Double 8 foreign key

ccode Double 8 not null

mstankno Integer 2 not null

mprice Double 8 not null

mdcomm Double 8 not null

mlfee Double 8 not null

mstax Double 8 not null

mstotal Double 8 not null

hsdprice Double 8 not null

hsdcomm Double 8 not null


hsdlfee Double 8 not null

hsdstax Double 8 not null

hsdtotal Double 8 not null

tamount Double 8 not null

bank Text 50 not null

cheqno Double 8 not null

truckno Text 15 not null

deldate Date/Time 8 not null


Table name: LURATES
Description: This table is used to store Lubricants Rates & Stock.

Field Name Data type Size Constraint

pname Text 50 primary key

price Double 8 not null

cases Integer 2 not null

packperc Integer 2 not null

volperc Double 8 not null

stax Double 8 not null

Table name: LUINDENT


Description: This table is used to store Lubricants Indents.
Field Name Data type Size Constraint

Ino Double 8 primary key

Ccode Double 8 not null

pname Text 50 not null

ordate Date/Time 8 not null

dedate Date/Time 8 not null

ncases Double 8 not null

delivery Text 10 not null

Table name: LUDELIVERY


Description: This table is used to store Lubricants delivery details.

Field Name Data type Size Constraint

Ino Double 8 foreign key

ccode Double 8 not null

pname Text 50 not null

cases Double 8 not null

totpack Double 8 not null

totvol Double 8 not null

rate Double 8 not null

stax Double 8 not null

amount Double 8 not null


bname Text 50 not null

cheqno Double 8 not null

vno Text 15 not null

ddate Date/Time 8 not null

Table name: OWNUSAGE


Description: This table is used to store the details of fuel used by the
company vehicles.

Field Name Data type Size Constraint

Tno Double 8 primary key

vno Text 15 not null

pname Text 10 not null

qty Double 8 not null

ddate Date/Time 8 not null

Table name: TCUST


Description: This table is used to store Customer details

Field Name Data type Size Constraint


Ccode Double 8 primary key

Cname Text 50 not null

cphone Double 8 not null

doorno Text 20 not null

street Text 50 not null

area Text 20 not null

city Text 20 not null

SCREEN & REPORTS

SCREENS:
REPORTS:
CONCLUSION

In a petroleum company stock in-charge job is very tedious because it


is very difficult to know the available stock in filling stations and lubricant
products. Because the filling stations will be updated from refinery stations.
So it is difficult to the stock in-charge to remember available stock at all
filling stations. Company will produce various lubricant products like 2-
stroke engine oils, 4-stroke engine oils, chassis greases, bearing greases. So
it is not easy to remember all the product details.

This project helps to the stock in-charge and supervisors to know the
available stock in the company. So that they can deliver the stock to the
required customers without delay.

This project is completely menu driven and user friendly, because it is


developed in an efficient front-end tool Visual Basic. Error messages are
also provided to guide the user in a proper manner.
BIBLIOGRAPHY

1. VISUAL BASIC 5 IN 21 DAYS

- Nathan Gurewich
- Ori Gurewich

2. VISUAL BASIC HAND BOOK

- SSI Press

3. DATABASE PROGRAMMING WITH VB 5

- Curtis L. Smith
- Michael C. Amundsen
FUTURE ENHANCEMENTS

The system may be further updated or modified at will owing to


its simple structure. If the company is willing the administrator might add a
new module that would allow the customer to login to the petroleum
ordering system. Moreover the developed system does not provide any kind
of facility for online purchase of petroleum products. If the customer is
allowed to access our site then online purchase of petroleum products may
be included. Also payments can be made online for the purchase of
petroleum products

Vous aimerez peut-être aussi