Meaw Final

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 196

M.G.

M COLLEGE of
Computer Science & Information Technology Kamothe Navi Mumbai

This is to certify that the project of

BUSINESS MANAGEMENT SYSTEM


Undertaken at M.G.M COLLEGE OF COMPUTER SCIENCE & INFORMATION TECHNOLOGY By Mr. SURAJ L. GHADGE (Seat No. 9784 ) In partial fulfillment of B.Sc. IT degree Examination had not been submitted for any other courses undergone by the candidate. It is further certified that they are completed all required phases of the project.

Internal Examiner

Head of Department

External Examiner

Principal

1. INTRODUCTION

1.1 INTRODUCTION TO PROJECT

This project will be prepared using VISUAL BASIC as front end and M.S.ACCESS as backend. Project will help the client to store all the records of different types of vegetables, their daily transactions, bills etc. There will be provision to add new vegetables, editing and updating information related to vegetables, employees, suppliers, customers etc. and checking the related information etc. This project will also have the forms of the receipts which the client used to fill manually. With the help of this system, client can directly take printouts of stored data. The client will be able to make reports on daily, weekly and monthly basis.

2. SYSTEM STUDY:

2.1 Current System:


Present System of J. R. Pagade & S. R. Kamthe Company is manual i.e. every data is stored in & retrieved from registers. Also it is very time consuming to retrieve required information which is stored manually in registers. This time delay gives rise to the need of a computerized system which will allow user to enter and retrieve data easily. So definitely the proposed system will overcome all the problems, difficulties as well as system becomes quite easier than Present system.

Limitations of Current System: 1] Errors and Inconsistencies:

Presently all the details are written manually in a register. This process is time consuming and there might be risk of errors which leads to inconsistency.

2] Insufficient and slow data retrieval:

As these all records are written manually and kept in the registers, it takes more time to retrieve the data of particular time period. 3] Difficulty in managing multiple receipts:

Delivery receipts, payment receipts etc. are generated regularly and it is difficult to manage these types of receipts manually every time. 4] Lack of Security:

Registers and form can be illegally accessed by anyone so lack of security is there.

2.2 Proposed system:


The objective of the proposed system is to overcome the major limitations of the existing system enabling effective management of all the vehicle details thereby improving performance of the company.

2.3 Advantage that will be achieved by implementation of proposed system:


With improved computerization being involved in keeping all the vehicle details and daily records, errors and inconsistencies can be kept apart. Validation of data will ensure only accurate valid & complete data is stored in the database. Easy retrieval of data will be possible. It will make easy to analyze the performance of the company.

2.4 Features of the new system:


Client can easily handle the software and use it. Records of vehicles can be maintained easily. These daily records are stored and can be viewed as month wise and are in the printable format. Automation achieved in the process of report generation.

2.5 Feasibility Study:

Technical Feasibility Study: The technical feasibility study is a deciding factor, which determines what the requirements for designing & developing the system are. The full study of required resources is done here.

Economical Feasibility Study: It is the study of the actual cost and benefits of the system. The actual cost of the system is important before designing of a system. The required cost of the newly developed system is low therefore the system is economically feasible.

Operational feasibility: Total working capability is improved.


Because of implementation computerized system time is nicely

organized.

The manpower required for clerical work will be reduced. The system is feasible because of above tested benefits.

3.Diagrams:
3.1 Gantt Chart:

1 1. Project Search 2 2. Finalization 3. Allocation 4. Investigation of System Requirements 3 4

5. Data & Process Modeling


6

6. System Design 7. Program Design 8. Program Coding 9. Unit Testing

9 10

10. System Integration 11. Implementation

11

12

12. Testing

w18 w20 w21 w24 w1 w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 w14 w15 w16 w17 w19 Time Duration

3.2 E-R Diagram:

3.3 Context Level Diagram

0.0
Item Enquiry Item list

FARMER

BUSINESS MANAGEMENT SYSTEM

CUSTOMER
Item Availability Details

Item Details

MERCHANT

10

3.4 Data Flow Diagram:

DFD FRAGMENTS 1
Item List

Farmer

Product Item List

Product Item

2
Item Enquiry

Product Item Offered Price

Customer
Item Availability Details

Price of Items

3 Company Look up Item Details

Product Item Offered Price

11

DIAGRAM 0

2 Farmer
Item Enquiry

Price of Items

Customer

Item Availability Details

Item List

1 Product Item List Product Item

Offered Price

3 Look up Item Details Company

12

4. SYSTEM DESIGN

4.1 System Flow Chart:

Customer Details

Customer Database

Customer Report

Farmer Details

Farmer Database

Item Details

Item Database Business Management System

Farmer Report

Company Details

Company Database

Driver Details

Driver Database

Driver Report

13

4.2 Structure Chart:

BUSINESS MANAGEMENT SYSTEM

Customer

Farmer

Driver

Vegetable

Transport

Order

Custome r Details

Bill Details Farmer Details

Farmer Payment Details

Driver Payment Details Driver Details

Vegetable Sales Details Transport Details

Order Details

Vegetable Details Update Vegetabl e Sales Details Look up For Vegetable Availability

Update Customer/ Bill Details

Look up For Payment Details Update Farmer Details Or Look up For Farmer

Look up For Payment Details Update Driver Details

Update Transport Details

Update Order Details or Look up for Vegetable Ordered Details

14

4.3 Menu Tree:

MDI FORM

FARMER

CUSTOMER

DRIVER

VEGETABLE

TRANSPORT

REPORTS

TOOLS

HELP

FARMER DETAILS

CUSTOMER DETAILS

DRIVER DETAILS

VEGETABLE RATES

ORDER DETAILS

FARMER PAYMENT REPORT

ADD NEW USER

ABOUT US

CHANGE PASSWORD CUSTOME R BILL REPORT EXIT

FARMER PAYMENT DETAILS

BILL DETAILS

DRIVER PAYMENT DETAILS

VEGETABLE SELL DETAILS

TRANSPORT DETAILS

CALCULATO R

NOTEPAD DRIVER PAYMENT REPORT

BACKUP

15

4.4. Event Table :

16

4.5 Program List:

FORM NAME
frmSplash frmLogin form_bd form_cd form_cp form_dd form_dpd form_fd form_fpd form_nu form_o form_s form_t form_vr form_vsd frmAbout frmBackup frmLogin frmSplash MDIForm1

DESCRIPTION
It is used when your application is loaded. It is used to enter the user name and password. it is used for storing bill information. It is used to keep the records of customer It is used for changing the password of existing user. It is used for keeping the records of drivers. It is used for keeping the driver payment details. It is used to keep the records of farmers. It is used for keeping the records farmer payment. It is used for adding new user to the system. It is used for keeping the records of all the orders. It is used to search a particular record. It is used for keeping the transport details. It is used to keep the records of vegetable rates. It is used to keep the records of vegetable sell. It has information about the software, developer etc. It is used to create a backup of Database. It is used to log in to the system. Provides Authentication. It shows the short information about the system. It is the main interface holds all its child forms.

17

4.6 Table List:


1) BILL_DETAILS

2) CUSTOMER_DETAILS

3) DRIVER_DETAILS

4) DRIVER_PAYMENT_DETAILS

5) FARMER_DETAILS

6) FARMER_PAYMENT_DETAILS

7) login

8) ORDER_TABLE

9) TRANSPORT_TABLE

10) VEGETABLE_RATES

11) VEGETABLE_SELLED_DETAILS 18

TABLE: BILL_DETAILS

FIELD NAME
BD_BILL_NUM BD_CUST_NUM BD_VEG_CODE BD_DATE BD_GOODS BD_NUM_SACS BD_WT_GOODS BD_TOTL_AMT BD_PAID_AMT

DATATYPE
Number Number Number Date/Time Text Number Number Number Number

This table holds the details regarding the bill.

TABLE: CUSTOMER_DETAILS

This table holds the record of all the customers.

FIELD NAME
CD_CUST_NUM CD_NAME CD_ADD CD_CITY CD_STATE CD_PINCODE CD_PH_NUM CD_BAL_AMT

DATATYPE
Number Text Text Text Text Number Number Number

TABLE: DRIVER_DETAILS

This table holds the record of all the drivers.

19

FIELD NAME
DD_DRIVER_CODE DD_NAME DD_ADD DD_CITY DD_STATE DD_PINCODE DD_PH_NUM DD_CAR_NUM DD_LICN_NUM

DATATYPE
Number Text Text Text Text Number Number Text Number

TABLE: DRIVER_PAYMENT_DETAILS

This table holds the record of all the driver payments.

FIELD NAME
DPD_DRIVER_CODE DPD_FARMER_CODE DPD_DATE DPD_PAYMENT

DATATYPE
Number Number Date/Time Number

TABLE: FARMER_DETAILS This table holds the record of all the farmers.

FIELD NAME
FD_FARMER_CODE FD_NAME FD_ADD FD_CITY FD_STATE

DATATYPE
Number Text Text Text Text

20

FD_PINCODE FD_PH_NUM FD_BAL_AMT

Number Number Number

TABLE: FARMER_PAYMENT_DETAILS This table holds the record of all the farmer payment.

FIELD NAME
FPD_BILL_NUM FPD_FARMER_CODE FPD_VEG_CODE FPD_DATE FPD_PAYMENT FPD_PAID_AMT FPD_BAL_AMT FPD_CHARGES

DATATYPE
Number Number Number Date/Time Number Number Number Number

TABLE: login This table holds the record of all the users.

FIELD NAME
Uname passwd

DATATYPE
Text Text

TABLE: ORDER_TABLE This table holds the record of all the orders.

FIELD NAME
O_ORD_NUM

DATATYPE
Text

21

O_FARMER_CODE O_VEG_CODE O_DATE O_NUM_SACS O_WT_GOODS

Number Number Date/Time Number Number

22

TABLE: TRANSPORT_TABLE

This table holds the transportation details.

FIELD NAME
T_FARMER_CODE T_DRIVER_CODE T_GOODS T_NUM_SACS T_TRAVL FRM T_DEST

DATATYPE
Number Number Text Number Text Text

TABLE: VEGETABLE_RATES This table holds all the information related to vegetable rates.

FIELD NAME
VR_VEG_CODE VR_VEG_NAME VR_RATE_PER_KG

DATATYPE
Number Text Number

23

TABLE: VEGETABLE_SELLED_DETAILS This table holds the record of the vegetable sell.

FIELD NAME
VSD_VEG_CODE VSD_FARMER_CODE VSD_DATE VSD_NUM_SACS VSD_WT_SELLED_SACS VSD_TOTL_SELL

DATATYPE
Number Number Date/Time Number Number Number

24

4.7 Report List:

REPORT NAME
FARMER PAYMENT REPORT CUSTOMER BILL REPORT DRIVER PAYMENT REPORT

DESCRIPTION
It generates information about farmer payment It generates information about customer bill It generates information about driver payment.

25

5. SYSTEM IMPLEMENTATION

5.1 Technologies Used:


1) Visual Basic 6.0 Visual Basic 6.0 comes in three editions as learning edition, professional edition & enterprise edition.
Learning Edition:-

Targeted at students & other individuals who wish to learn how to program in VB.
Professional Edition:-

Targeted to programmers who need full range of capabilities but does not need the MS Back-Office features. Enterprise Edition:Targeted at group of people developing application jointly. Advantages of Visual Basic Provide excellent Graphical User Interface (GUI) to application programmer. Debugging time is less. Provide Rapid Application Development (RDA) facility. Give rise to modular programming. Event driven programs can attach modules.

26

Support Multiple Document Interfaces (MDI) & Object Linking & Embedding (OLE). ActiveX Controls. These are third party controls that are not by MS. It is possible due to COM (Object Component Model). ADO, RDA, ODBC tools are provided for the data processing. Design web page & can host them at web servers. 2) MS-Access MS-Access 2003 offers many new and improved features to help to create a powerful Database application & hence for this project it is used to storing the database. Features of MS-Access New objects, properties, methods & other languages elements. Accessing the intranet & internet from your application. Creating custom objects with class modules. Customizing menus & toolbars for your application. Replicating only a specific part of your database. Working with version 4.0 MS Jet Database engine. Using new features in the module window. Using the object browser as a reference for objects of their members. Using ADO to access OLEDB database without loading MS Jet Database Engine. Creating a tabbed dialog box for multiple pages with the tab control.
27

Setting reference programmatically. Improving compilation performance.

Advantages of MS-Access Improving performance. Working with intranet & other applications. Working in a database application. Using & customizing toolbars, menu bars & shortcut menus. Working with data, filters & macros. Printing & previewing. Designing a database. Programming with Visual Basic. Working in a module window, debug window & object browser.

28

5.2 Technical Specifications:


1) Hardware Requirements: Windows 98 server runs with 12MB of RAM. It does not run well until it has 16MB of RAM. Minimum speed needed to run Windows 98 is 486MHz. For using the server applications the minimum speed required Pentium-I. 10 GB of Hard disk. 128MB RAM. Monitor. Keyboard and Mouse. Printer. Floppy disk/CD-ROM drive.

2) Software Requirements The system Business Management has been developed using Visual Basic 6.0 as Front End & Microsoft Access as Back End tools. Windows 2000/XP. MS Visual Basic 6.0. MS-Access 2000.

29

6. PROGRAM DOCUMENTATION

6.1 Screen Layout & Coding:

Screen Layout of frmSplash:

30

Coding of frmSplash:

Option Explicit Private Sub Form_KeyPress(KeyAscii As Integer) Unload Me End Sub

Private Sub Frame1_Click() Unload Me End Sub

Private Sub Timer1_Timer() If ProgressBar1.Value < ProgressBar1.Max Then ProgressBar1.Value = ProgressBar1.Value + 10 Else If ProgressBar1.Value = ProgressBar1.Max Then frmLogin.Show Unload Me End If End If End Sub

31

Screen Layout of frmLogin:

32

Coding of frmLogin:
Option Explicit Dim rs As New ADODB.Recordset Dim c, d As Integer Public LoginSucceeded As Boolean Private Sub cmdCancel_Click() LoginSucceeded = False Me.Hide End Sub Private Sub cmdOK_Click() Call connection rs.Open "login", con, adOpenDynamic, adLockOptimistic rs.MoveFirst rs.Find "uname = '" & txtUserName & "'" If rs.EOF = False Then If txtPassword = rs.Fields(1) Then MsgBox "Authentication Succeded", vbOKOnly, "Connection" LoginSucceeded = True frmLogin.Visible = False MDIForm1.Show Me.Hide Else MsgBox "Authentication Failed, try again!", vbOKOnly, "Login" txtPassword.SetFocus SendKeys "{Home}+{End}" End If End If End Sub Private Sub Form_Load()

33

Set rs = New ADODB.Recordset End Sub

34

Screen Layout of form_bd:

35

Coding of form_bd:
Option Explicit Dim rs As ADODB.Recordset Dim rs2 As ADODB.Recordset Dim rs3 As ADODB.Recordset Dim rs4 As ADODB.Recordset Dim rs5 As ADODB.Recordset Dim totl, rate As Single Dim paid As Single Dim bal As Single Dim amt As Single Dim id1 As Integer

Private Sub cboBD_VEG_CODE_Click() connection Set rs5 = New ADODB.Recordset rs5.Open "select VR_VEG_NAME from VEGETABLE_RATES where VR_VEG_CODE= " & cboBD_VEG_CODE.Text & " ", con, adOpenDynamic, adLockOptimistic txtBD_GOODS.Text = rs5.Fields("VR_VEG_NAME") rs5.Close End Sub Private Sub cmdbdadd_Click() If rs.EOF Then MsgBox "database is empty " MsgBox "Please add the fields" id1 = 0 id1 = id1 + 1 txtBD_BILL_NUM.Text = ""

36

cboBD_CUST_NUM.Text = "" cboBD_VEG_CODE.Text = "" txtBD_GOODS.Text = "" txtBD_NUM_SACS.Text = "" txtBD_WT_GOODS.Text = "" txtBD_TOTL_AMT.Text = "" txtBD_PAID_AMT.Text = "" txtBD_BILL_NUM.Text = id1 txtBD_BILL_NUM.Locked = True cboBD_CUST_NUM.SetFocus cmdbdfirst.Enabled = False cmdbdlast.Enabled = False cmdbdnext.Enabled = False cmdbdprev.Enabled = False cmdbddel.Enabled = False cmdbdsave.Enabled = True cmdbdadd.Enabled = False cmdbdcancel.Enabled = True cmdbdmodify.Enabled = False unlockmethod Else rs.MoveLast id1 = rs![BD_BILL_NUM] id1 = id1 + 1 txtBD_BILL_NUM.Text = "" cboBD_CUST_NUM.Text = "" cboBD_VEG_CODE.Text = "" txtBD_GOODS.Text = "" txtBD_NUM_SACS.Text = "" txtBD_WT_GOODS.Text = "" txtBD_TOTL_AMT.Text = "" txtBD_PAID_AMT.Text = "" txtBD_BILL_NUM.Text = id1

37

txtBD_BILL_NUM.Locked = True cboBD_CUST_NUM.SetFocus cmdbdfirst.Enabled = False cmdbdlast.Enabled = False cmdbdnext.Enabled = False cmdbdprev.Enabled = False cmdbddel.Enabled = False cmdbdsave.Enabled = True cmdbdadd.Enabled = False cmdbdcancel.Enabled = True cmdbdmodify.Enabled = False unlockmethod End If End Sub Private Sub cmdbdcancel_Click() rs.CancelUpdate txtBD_BILL_NUM.Text = "" cboBD_CUST_NUM.Text = "" cboBD_VEG_CODE.Text = "" txtBD_GOODS.Text = "" txtBD_NUM_SACS.Text = "" txtBD_WT_GOODS.Text = "" txtBD_TOTL_AMT.Text = "" txtBD_PAID_AMT.Text = "" cmdbdfirst.Enabled = True cmdbdlast.Enabled = True cmdbdnext.Enabled = True cmdbdprev.Enabled = True cmdbddel.Enabled = True cmdbdsave.Enabled = False cmdbdadd.Enabled = True cmdbdcancel.Enabled = False

38

cmdbdmodify.Enabled = True lockmethod rs.MoveFirst showdata End Sub Private Sub cmdbddel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete txtBD_BILL_NUM.Text = "" cboBD_CUST_NUM.Text = "" cboBD_VEG_CODE.Text = "" txtBD_GOODS.Text = "" txtBD_NUM_SACS.Text = "" txtBD_WT_GOODS.Text = "" txtBD_TOTL_AMT.Text = "" txtBD_PAID_AMT.Text = "" cmdbdfirst.Enabled = False cmdbdlast.Enabled = False cmdbdnext.Enabled = False cmdbdprev.Enabled = False cmdbddel.Enabled = False cmdbdsave.Enabled = False cmdbdadd.Enabled = True cmdbdcancel.Enabled = True cmdbdmodify.Enabled = False Else End If lockmethod End Sub

39

Private Sub cmdbdend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_bd.Hide MDIForm1.Show Else End If End Sub Private Sub cmdbdfirst_Click() lockmethod rs.MoveFirst showdata End Sub Private Sub cmdbdlast_Click() lockmethod rs.MoveLast showdata End Sub Private Sub cmdbdmodify_Click() unlockmethod savebal savedata rs.Update End Sub Private Sub cmdbdnext_Click() lockmethod

40

rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmdbdprev_Click() lockmethod rs.MovePrevious If rs.BOF Then rs.MoveNext End If showdata End Sub Private Sub cmdbdsave_Click() If (txtBD_BILL_NUM.Text = "" Or cboBD_CUST_NUM.Text = "" Or cboBD_VEG_CODE.Text = "" Or txtBD_GOODS.Text = "" Or txtBD_NUM_SACS.Text = "" Or txtBD_WT_GOODS.Text = "" Or txtBD_TOTL_AMT.Text = "" Or txtBD_PAID_AMT.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else rs.AddNew savebal savedata rs.Update cmdbdfirst.Enabled = True cmdbdlast.Enabled = True cmdbdnext.Enabled = True cmdbdprev.Enabled = True

41

cmdbddel.Enabled = True cmdbdsave.Enabled = False cmdbdadd.Enabled = True cmdbdcancel.Enabled = False cmdbdmodify.Enabled = True lockmethod End If End Sub Private Sub dgbd_Click() showdata dgbd.AllowDelete = False dgbd.AllowUpdate = False End Sub

Private Sub DTPicker1_Change() If DTPicker1.Value < Date Then DTPicker1.Value = Date MsgBox "Invalid Date" End If End Sub Private Sub Form_Load() connection Set rs2 = New ADODB.Recordset rs2.Open "select CD_CUST_NUM from CUSTOMER_DETAILS", con, adOpenDynamic, adLockOptimistic If rs2![CD_CUST_NUM] <> "" Then Do Until rs2.EOF

42

cboBD_CUST_NUM.AddItem rs2![CD_CUST_NUM] rs2.MoveNext Loop rs2.MoveFirst Else MsgBox "database is empty" End If rs2.Close connection Set rs3 = New ADODB.Recordset rs3.Open "select VR_VEG_CODE from VEGETABLE_RATES", con, adOpenDynamic, adLockOptimistic If rs3![VR_VEG_CODE] <> "" Then Do Until rs3.EOF cboBD_VEG_CODE.AddItem rs3![VR_VEG_CODE] rs3.MoveNext Loop rs3.MoveFirst Else MsgBox "database is empty" End If rs3.Close connection Set rs = New ADODB.Recordset rs.Open "select * from BILL_DETAILS order by BD_BILL_NUM", con, adOpenDynamic, adLockOptimistic Set dgbd.DataSource = rs showdata cmdbdfirst.Enabled = True cmdbdlast.Enabled = True cmdbdnext.Enabled = True

43

cmdbdprev.Enabled = True cmdbddel.Enabled = False cmdbdsave.Enabled = False cmdbdadd.Enabled = True cmdbdcancel.Enabled = False cmdbdmodify.Enabled = True lockmethod Dim today As Variant today = Date DTPicker1.Value = today End Sub Public Sub showdata() txtBD_BILL_NUM.Text = rs.Fields("BD_BILL_NUM") cboBD_CUST_NUM.Text = rs.Fields("BD_CUST_NUM") cboBD_VEG_CODE.Text = rs.Fields("BD_VEG_CODE") DTPicker1.Value = rs.Fields("BD_DATE") txtBD_GOODS.Text = rs.Fields("BD_GOODS") txtBD_NUM_SACS.Text = rs.Fields("BD_NUM_SACS") txtBD_WT_GOODS.Text = rs.Fields("BD_WT_GOODS") txtBD_TOTL_AMT.Text = rs.Fields("BD_TOTL_AMT") txtBD_PAID_AMT.Text = rs.Fields("BD_PAID_AMT") End Sub Public Sub savedata() rs.Fields("BD_BILL_NUM") = txtBD_BILL_NUM.Text rs.Fields("BD_CUST_NUM") = cboBD_CUST_NUM.Text rs.Fields("BD_VEG_CODE") = cboBD_VEG_CODE.Text rs.Fields("BD_DATE") = DTPicker1.Value rs.Fields("BD_GOODS") = txtBD_GOODS.Text rs.Fields("BD_NUM_SACS") = txtBD_NUM_SACS.Text rs.Fields("BD_WT_GOODS") = txtBD_WT_GOODS.Text rs.Fields("BD_TOTL_AMT") = txtBD_TOTL_AMT.Text

44

rs.Fields("BD_PAID_AMT") = txtBD_PAID_AMT.Text End Sub Public Sub lockmethod() txtBD_BILL_NUM.Locked = True cboBD_CUST_NUM.Locked = True cboBD_VEG_CODE.Locked = True DTPicker1.Enabled = False txtBD_GOODS.Locked = True txtBD_NUM_SACS.Locked = True txtBD_WT_GOODS.Locked = True txtBD_TOTL_AMT.Locked = True txtBD_PAID_AMT.Locked = True End Sub Public Sub unlockmethod() txtBD_BILL_NUM.Locked = False cboBD_CUST_NUM.Locked = False cboBD_VEG_CODE.Locked = False DTPicker1.Enabled = True txtBD_GOODS.Locked = False txtBD_NUM_SACS.Locked = False txtBD_WT_GOODS.Locked = False txtBD_TOTL_AMT.Locked = False txtBD_PAID_AMT.Locked = False End Sub

Private Sub txtBD_BILL_NUM_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else

45

End If End Sub Private Sub cboBD_CUST_NUM_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub txtBD_GOODS_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub txtBD_NUM_SACS_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtBD_PAID_AMT_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtBD_TOTL_AMT_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then

46

KeyAscii = 0 Else End If End Sub Private Sub cboBD_VEG_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub txtBD_WT_GOODS_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Public Sub savebal() bal = Val(txtBD_TOTL_AMT.Text) - Val(txtBD_PAID_AMT.Text) Set rs4 = New ADODB.Recordset rs4.Open "select * from CUSTOMER_DETAILS where CD_CUST_NUM=" & Val(cboBD_CUST_NUM.Text), con, adOpenDynamic, adLockOptimistic rs4.Fields("CD_BAL_AMT") = bal rs4.Update rs4.Close End Sub Private Sub txtBD_WT_GOODS_LostFocus() Set rs4 = New ADODB.Recordset rs4.Open "select * from VEGETABLE_RATES where VR_VEG_CODE=" & Val(cboBD_VEG_CODE.Text), con, adOpenDynamic, adLockOptimistic

47

rate = rs4.Fields("VR_RATE_PER_KG") rs4.Close txtBD_TOTL_AMT.Text = rate * Val(txtBD_WT_GOODS.Text) End Sub

48

Screen Layout of form_cd:

49

Coding of form_cd:
Option Explicit Dim rs As ADODB.Recordset Dim id1 As Integer

Private Sub cmdcdadd_Click() If rs.EOF Then MsgBox "database is empty " MsgBox "Please add the fields" id1 = 0 id1 = id1 + 1 txtCD_CUST_NUM.Text = "" txtCD_NAME.Text = "" txtCD_ADD.Text = "" txtCD_CITY.Text = "" txtCD_STATE.Text = "" txtCD_PINCODE.Text = "" txtCD_PH_NUM.Text = "" txtCD_BAL_AMT.Text = "" txtCD_CUST_NUM.Text = id1 txtCD_CUST_NUM.Locked = True txtCD_BAL_AMT.Locked = True txtCD_NAME.SetFocus cmdcdfirst.Enabled = False cmdcdlast.Enabled = False cmdcdnext.Enabled = False cmdcdprev.Enabled = False cmdcddel.Enabled = False cmdcdsave.Enabled = True cmdcdadd.Enabled = False cmdcdcancel.Enabled = True

50

cmdcdmodify.Enabled = False unlockmethod Else rs.MoveLast id1 = rs![CD_CUST_NUM] id1 = id1 + 1 txtCD_CUST_NUM.Text = "" txtCD_NAME.Text = "" txtCD_ADD.Text = "" txtCD_CITY.Text = "" txtCD_STATE.Text = "" txtCD_PINCODE.Text = "" txtCD_PH_NUM.Text = "" txtCD_BAL_AMT.Text = "" txtCD_CUST_NUM.Text = id1 txtCD_CUST_NUM.Locked = True txtCD_BAL_AMT.Locked = True txtCD_NAME.SetFocus cmdcdfirst.Enabled = False cmdcdlast.Enabled = False cmdcdnext.Enabled = False cmdcdprev.Enabled = False cmdcddel.Enabled = False cmdcdsave.Enabled = True cmdcdadd.Enabled = False cmdcdcancel.Enabled = True cmdcdmodify.Enabled = False unlockmethod End If End Sub Private Sub cmdcdcancel_Click()

51

txtCD_CUST_NUM.Text = "" txtCD_NAME.Text = "" txtCD_ADD.Text = "" txtCD_CITY.Text = "" txtCD_STATE.Text = "" txtCD_PINCODE.Text = "" txtCD_PH_NUM.Text = "" txtCD_BAL_AMT.Text = "" cmdcdfirst.Enabled = True cmdcdlast.Enabled = True cmdcdnext.Enabled = True cmdcdprev.Enabled = True cmdcddel.Enabled = True cmdcdsave.Enabled = False cmdcdadd.Enabled = True cmdcdcancel.Enabled = False cmdcdmodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata End Sub Private Sub cmdcddel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete txtCD_CUST_NUM.Text = "" txtCD_NAME.Text = "" txtCD_ADD.Text = "" txtCD_CITY.Text = "" txtCD_STATE.Text = ""

52

txtCD_PINCODE.Text = "" txtCD_PH_NUM.Text = "" txtCD_BAL_AMT.Text = "" cmdcdfirst.Enabled = False cmdcdlast.Enabled = False cmdcdnext.Enabled = False cmdcdprev.Enabled = False cmdcddel.Enabled = False cmdcdsave.Enabled = False cmdcdadd.Enabled = True cmdcdcancel.Enabled = True cmdcdmodify.Enabled = False Else End If lockmethod End Sub Private Sub cmdcdend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_cd.Hide MDIForm1.Show Else End If End Sub Private Sub cmdcdfirst_Click() lockmethod rs.MoveFirst showdata End Sub

53

Private Sub cmdcdlast_Click() lockmethod rs.MoveLast showdata End Sub Private Sub cmdcdmodify_Click() unlockmethod savedata rs.Update End Sub Private Sub cmdcdnext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmdcdprev_Click() lockmethod rs.MovePrevious If rs.BOF Then rs.MoveNext End If showdata End Sub

54

Private Sub cmdcdsave_Click() If (txtCD_CUST_NUM.Text = "" Or txtCD_NAME.Text = "" Or txtCD_ADD.Text = "" Or txtCD_CITY.Text = "" Or txtCD_STATE.Text = "" Or txtCD_PINCODE.Text = "" Or txtCD_PH_NUM.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else rs.AddNew savedata rs.Update cmdcdfirst.Enabled = True cmdcdlast.Enabled = True cmdcdnext.Enabled = True cmdcdprev.Enabled = True cmdcddel.Enabled = True cmdcdsave.Enabled = False cmdcdadd.Enabled = True cmdcdcancel.Enabled = False cmdcdmodify.Enabled = True lockmethod End If End Sub

Private Sub cmdcdsearch_Click() searchTable = "customer" form_cd.Hide form_s.Show End Sub Private Sub dgcd_Click() showdata dgcd.AllowDelete = False

55

dgcd.AllowUpdate = False End Sub Private Sub Form_Load() connection Set rs = New ADODB.Recordset rs.Open "select * from CUSTOMER_DETAILS order by CD_CUST_NUM", con, adOpenStatic, adLockOptimistic Set dgcd.DataSource = rs showdata cmdcdfirst.Enabled = True cmdcdlast.Enabled = True cmdcdnext.Enabled = True cmdcdprev.Enabled = True cmdcddel.Enabled = False cmdcdsave.Enabled = False cmdcdadd.Enabled = True cmdcdcancel.Enabled = False cmdcdmodify.Enabled = True lockmethod End Sub Public Sub showdata() txtCD_CUST_NUM.Text = rs.Fields("CD_CUST_NUM") txtCD_NAME.Text = rs.Fields("CD_NAME") txtCD_ADD.Text = rs.Fields("CD_ADD") txtCD_CITY.Text = rs.Fields("CD_CITY") txtCD_STATE.Text = rs.Fields("CD_STATE") txtCD_PINCODE.Text = rs.Fields("CD_PINCODE") txtCD_PH_NUM.Text = rs.Fields("CD_PH_NUM") txtCD_BAL_AMT.Text = rs.Fields("CD_BAL_AMT") End Sub

56

Public Sub savedata() rs.Fields("CD_CUST_NUM") = txtCD_CUST_NUM.Text rs.Fields("CD_NAME") = txtCD_NAME.Text rs.Fields("CD_ADD") = txtCD_ADD.Text rs.Fields("CD_CITY") = txtCD_CITY.Text rs.Fields("CD_STATE") = txtCD_STATE.Text rs.Fields("CD_PINCODE") = txtCD_PINCODE.Text rs.Fields("CD_PH_NUM") = txtCD_PH_NUM.Text rs.Fields("CD_BAL_AMT") = txtCD_BAL_AMT.Text End Sub Public Sub lockmethod() txtCD_CUST_NUM.Locked = True txtCD_NAME.Locked = True txtCD_ADD.Locked = True txtCD_CITY.Locked = True txtCD_STATE.Locked = True txtCD_PINCODE.Locked = True txtCD_PH_NUM.Locked = True txtCD_BAL_AMT.Locked = True End Sub Public Sub unlockmethod() txtCD_CUST_NUM.Locked = False txtCD_NAME.Locked = False txtCD_ADD.Locked = False txtCD_CITY.Locked = False txtCD_STATE.Locked = False txtCD_PINCODE.Locked = False txtCD_PH_NUM.Locked = False End Sub

57

Private Sub txtCD_BAL_AMT_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

Private Sub txtCD_CITY_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub Private Sub txtCD_CUST_NUM_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

58

Private Sub txtCD_NAME_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub Private Sub txtCD_PH_NUM_KeyPress(KeyAscii As Integer) txtCD_PH_NUM.MaxLength = 10 If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtCD_PH_NUM_LostFocus() Dim s1 As String s1 = txtCD_PH_NUM.Text Dim c1, c0, i, c, j, c2, c3, c4, c5, c6, c7, c8 As Integer i = Len(s1) j=2 If (i <> 10) Then MsgBox "number must have 10 digits" txtCD_PH_NUM.Text = "" txtCD_PH_NUM.SetFocus ElseIf (Left(s1, 1) <> 9) Then MsgBox "Number must start with 9"

59

txtCD_PH_NUM.Text = "" txtCD_PH_NUM.SetFocus End If While (j <= i) If (Mid(s1, j) = 0) Then c=c+1 End If If (Mid(s1, j, 1) = 1) Then c0 = c0 + 1 End If If (Mid(s1, j, 1) = 2) Then c1 = c1 + 1 End If If (Mid(s1, j, 1) = 3) Then c2 = c2 + 1 End If If (Mid(s1, j, 1) = 4) Then c3 = c3 + 1 End If If (Mid(s1, j, 1) = 5) Then c4 = c4 + 1 End If If (Mid(s1, j, 1) = 6) Then c5 = c5 + 1 End If If (Mid(s1, j, 1) = 7) Then c6 = c6 + 1 End If If (Mid(s1, j, 1) = 8) Then c7 = c7 + 1 End If If (Mid(s1, j, 1) = 9) Then c8 = c8 + 1

60

End If j=j+1 Wend If (c > 5) Or (c0 > 5) Or (c1 > 5) Or (c2 > 4) Or (c3 > 4) Or (c4 > 4) Or (c5 > 4) Or (c6 > 4) Or (c7 > 4) Or (c8 > 5) Then MsgBox "Invalid number ! Repeatation not allowed ." txtCD_PH_NUM.Text = "" txtCD_PH_NUM.SetFocus End If End Sub Private Sub txtCD_PINCODE_KeyPress(KeyAscii As Integer) txtCD_PINCODE.MaxLength = 6 If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtCD_PINCODE_LostFocus() Dim s As String Dim i As Integer s = txtCD_PINCODE.Text i = Len(s) If (i <> 6) Then MsgBox "pincode must have 6 digits" txtCD_PINCODE.SetFocus End If End Sub Private Sub txtCD_STATE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then

61

Else KeyAscii = 0 End If End Sub

62

Screen Layout of form_cp:

63

Coding of form_cp:

Option Explicit Dim rs1 As New ADODB.Recordset Dim rs As New ADODB.Recordset

Private Sub cbouname_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub cmdcpcancel_Click() cbouname.Text = "" txtcpop.Text = "" txtcpnp.Text = "" txtcprp.Text = "" cmdcpcp.Enabled = True cmdcpsave.Enabled = False cmdcpcancel.Enabled = False rs1.CancelUpdate lockmethod End Sub Private Sub cmdcpcp_Click() cbouname.Text = "" txtcpop.Text = "" txtcpnp.Text = "" txtcprp.Text = ""

64

cmdcpcp.Enabled = False cmdcpsave.Enabled = True cmdcpcancel.Enabled = True unlockmethod End Sub Private Sub cmdcpend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_cp.Hide MDIForm1.Show Else End If End Sub Private Sub cmdcpsave_Click() If cbouname.Text = "" Then MsgBox "Please Select Username" cbouname.SetFocus Else Call connection Set rs = New ADODB.Recordset rs.Open "login", con, adOpenDynamic, adLockOptimistic rs.MoveFirst rs.Find "uname = '" & cbouname & "'" If txtcpop.Text = rs.Fields(1) Then If txtcpnp.Text = txtcprp.Text Then rs1.AddNew savedata rs.Update MsgBox "Old Password is changed successfully !"

65

cmdcpcp.Enabled = True cmdcpsave.Enabled = False cmdcpcancel.Enabled = False Else MsgBox "Incorrect re-entered password , please type again !" txtcprp.Text = "" txtcprp.SetFocus cmdcpcp.Enabled = False cmdcpsave.Enabled = True cmdcpcancel.Enabled = True End If Else MsgBox "Invalid old password ! try again" txtcpop.Text = "" txtcpop.SetFocus cmdcpcp.Enabled = False cmdcpsave.Enabled = True cmdcpcancel.Enabled = True End If lockmethod End If End Sub Private Sub Form_Load() Call connection Set rs1 = New ADODB.Recordset rs1.Open "select uname from login", con, adOpenDynamic, adLockOptimistic If rs1![uname] <> "" Then Do Until rs1.EOF cbouname.AddItem rs1![uname] rs1.MoveNext Loop

66

rs1.MoveFirst Else MsgBox "database is empty" End If lockmethod cmdcpsave.Enabled = False cmdcpcancel.Enabled = False End Sub Public Sub savedata() rs.Fields("uname") = cbouname.Text rs.Fields("passwd") = txtcpnp.Text End Sub Public Sub lockmethod() cbouname.Locked = True txtcpop.Locked = True txtcpnp.Locked = True txtcprp.Locked = True End Sub Public Sub unlockmethod() cbouname.Locked = False txtcpop.Locked = False txtcpnp.Locked = False txtcprp.Locked = False End Sub

67

Screen Layout of form_dd:

68

Coding of form_dd:
Option Explicit Dim rs As ADODB.Recordset Dim rs5 As ADODB.Recordset Dim id As Integer Private Sub cmdddadd_Click() If rs.EOF Then MsgBox "database is empty " MsgBox "Please add the fields" id = 0 id = id + 1 txtDD_DRIVER_CODE.Text = "" txtDD_NAME.Text = "" txtDD_ADD.Text = "" txtDD_CITY.Text = "" txtDD_STATE.Text = "" txtDD_PINCODE.Text = "" txtDD_PH_NUM.Text = "" txtDD_CAR_NUM.Text = "" rtbDD_LICN_NUM.Text = "" txtDD_DRIVER_CODE.Text = id txtDD_DRIVER_CODE.Locked = True txtDD_NAME.SetFocus cmdddfirst.Enabled = False cmdddlast.Enabled = False cmdddnext.Enabled = False cmdddprev.Enabled = False cmddddel.Enabled = False cmdddsave.Enabled = True cmdddadd.Enabled = False cmdddcancel.Enabled = True cmdddmodify.Enabled = False

69

unlockmethod Else rs.MoveLast id = rs![DD_DRIVER_CODE] id = id + 1 txtDD_DRIVER_CODE.Text = "" txtDD_NAME.Text = "" txtDD_ADD.Text = "" txtDD_CITY.Text = "" txtDD_STATE.Text = "" txtDD_PINCODE.Text = "" txtDD_PH_NUM.Text = "" txtDD_CAR_NUM.Text = "" rtbDD_LICN_NUM.Text = "" txtDD_DRIVER_CODE.Text = id txtDD_DRIVER_CODE.Locked = True txtDD_NAME.SetFocus cmdddfirst.Enabled = False cmdddlast.Enabled = False cmdddnext.Enabled = False cmdddprev.Enabled = False cmddddel.Enabled = False cmdddsave.Enabled = True cmdddadd.Enabled = False cmdddcancel.Enabled = True cmdddmodify.Enabled = False unlockmethod End If End Sub Private Sub cmdddcancel_Click()

70

txtDD_DRIVER_CODE.Text = "" txtDD_NAME.Text = "" txtDD_ADD.Text = "" txtDD_CITY.Text = "" txtDD_STATE.Text = "" txtDD_PINCODE.Text = "" txtDD_PH_NUM.Text = "" txtDD_CAR_NUM.Text = "" rtbDD_LICN_NUM.Text = "" cmdddfirst.Enabled = True cmdddlast.Enabled = True cmdddnext.Enabled = True cmdddprev.Enabled = True cmddddel.Enabled = True cmdddsave.Enabled = False cmdddadd.Enabled = True cmdddcancel.Enabled = False cmdddmodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata End Sub Private Sub cmddddel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete txtDD_DRIVER_CODE.Text = "" txtDD_NAME.Text = ""

71

txtDD_ADD.Text = "" txtDD_CITY.Text = "" txtDD_STATE.Text = "" txtDD_PINCODE.Text = "" txtDD_PH_NUM.Text = "" txtDD_CAR_NUM.Text = "" rtbDD_LICN_NUM.Text = "" cmdddfirst.Enabled = False cmdddlast.Enabled = False cmdddnext.Enabled = False cmdddprev.Enabled = False cmddddel.Enabled = False cmdddsave.Enabled = False cmdddadd.Enabled = True cmdddcancel.Enabled = True cmdddmodify.Enabled = False Else End If lockmethod End Sub Private Sub cmdddend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_dd.Hide MDIForm1.Show Else End If End Sub

72

Private Sub cmdddfirst_Click() lockmethod rs.MoveFirst showdata End Sub Private Sub cmdddlast_Click() lockmethod rs.MoveLast showdata End Sub Private Sub cmdddmodify_Click() unlockmethod savedata rs.Update End Sub Private Sub cmdddnext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmdddprev_Click() lockmethod rs.MovePrevious

73

If rs.BOF Then rs.MoveNext End If showdata End Sub Private Sub cmdddsave_Click() If (txtDD_NAME.Text = "" Or txtDD_ADD.Text = "" Or txtDD_CITY.Text = "" Or txtDD_STATE.Text = "" Or txtDD_PINCODE.Text = "" Or txtDD_CAR_NUM.Text = "" Or rtbDD_LICN_NUM.Text = "") Then MsgBox "PLS ENTER DATA IN FIELDS" Else rs.AddNew savedata rs.Update cmdddfirst.Enabled = True cmdddlast.Enabled = True cmdddnext.Enabled = True cmdddprev.Enabled = True cmddddel.Enabled = True cmdddsave.Enabled = False cmdddadd.Enabled = True cmdddcancel.Enabled = False cmdddmodify.Enabled = True lockmethod End If End Sub Public Sub showdata() txtDD_DRIVER_CODE.Text = rs.Fields("DD_DRIVER_CODE") txtDD_NAME.Text = rs.Fields("DD_NAME") txtDD_ADD.Text = rs.Fields("DD_ADD") txtDD_CITY.Text = rs.Fields("DD_CITY")

74

txtDD_STATE.Text = rs.Fields("DD_STATE") txtDD_PINCODE.Text = rs.Fields("DD_PINCODE") txtDD_PH_NUM.Text = rs.Fields("DD_PH_NUM") txtDD_CAR_NUM.Text = rs.Fields("DD_CAR_NUM") rtbDD_LICN_NUM.Text = rs.Fields("DD_LICN_NUM") End Sub Public Sub lockmethod() txtDD_DRIVER_CODE.Locked = True txtDD_NAME.Locked = True txtDD_ADD.Locked = True txtDD_CITY.Locked = True txtDD_STATE.Locked = True txtDD_PINCODE.Locked = True txtDD_PH_NUM.Locked = True txtDD_CAR_NUM.Locked = True rtbDD_LICN_NUM.Locked = True End Sub Public Sub unlockmethod() txtDD_DRIVER_CODE.Locked = False txtDD_NAME.Locked = False txtDD_ADD.Locked = False txtDD_CITY.Locked = False txtDD_STATE.Locked = False txtDD_PINCODE.Locked = False txtDD_PH_NUM.Locked = False txtDD_CAR_NUM.Locked = False rtbDD_LICN_NUM.Locked = False End Sub Public Sub savedata() rs.Fields("DD_DRIVER_CODE") = txtDD_DRIVER_CODE.Text

75

rs.Fields("DD_NAME") = txtDD_NAME.Text rs.Fields("DD_ADD") = txtDD_ADD.Text rs.Fields("DD_CITY") = txtDD_CITY.Text rs.Fields("DD_STATE") = txtDD_STATE.Text rs.Fields("DD_PINCODE") = txtDD_PINCODE.Text rs.Fields("DD_PH_NUM") = txtDD_PH_NUM.Text rs.Fields("DD_CAR_NUM") = txtDD_CAR_NUM.Text rs.Fields("DD_LICN_NUM") = rtbDD_LICN_NUM.Text End Sub

Private Sub cmdddsearch_Click() searchTable = "driver" form_dd.Hide form_s.Show End Sub Private Sub dgdd_Click() showdata dgdd.AllowDelete = False dgdd.AllowUpdate = False End Sub Private Sub Form_Load() connection Set rs = New ADODB.Recordset rs.Open "select * from DRIVER_DETAILS order by DD_DRIVER_CODE", con, adOpenStatic, adLockOptimistic Set dgdd.DataSource = rs showdata cmdddfirst.Enabled = True cmdddlast.Enabled = True cmdddnext.Enabled = True

76

cmdddprev.Enabled = True cmddddel.Enabled = False cmdddsave.Enabled = False cmdddadd.Enabled = True cmdddcancel.Enabled = False cmdddmodify.Enabled = True lockmethod End Sub Private Sub rtbDD_LICN_NUM_LostFocus() Dim s As String Dim i As Integer s = rtbDD_LICN_NUM.Text i = Len(s) If (i <> 7) Then MsgBox "LICENSE NUMBER must have 7 digits" rtbDD_LICN_NUM.SetFocus End If End Sub

Private Sub txtDD_CAR_NUM_LostFocus() Dim s As String Dim i As Integer s = txtDD_CAR_NUM.Text i = Len(s) If (i < 10) Then MsgBox "CAR NUMBER must have 10 TO 12 digits" txtDD_CAR_NUM.SetFocus End If End Sub

77

Private Sub txtDD_CITY_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub Private Sub txtDD_DRIVER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub txtDD_NAME_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub

Private Sub txtDD_PH_NUM_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub

78

Private Sub txtDD_PH_NUM_LostFocus() Dim s1 As String s1 = txtDD_PH_NUM.Text Dim c1, c0, i, c, j, c2, c3, c4, c5, c6, c7, c8 As Integer i = Len(s1) j=2 If (i <> 10) Then MsgBox "number must have 10 digits" txtDD_PH_NUM.Text = "" txtDD_PH_NUM.SetFocus ElseIf (Left(s1, 1) <> 9) Then MsgBox "Number must start with 9" txtDD_PH_NUM.Text = "" txtDD_PH_NUM.SetFocus End If While (j <= i) If (Mid(s1, j) = 0) Then c=c+1 End If If (Mid(s1, j, 1) = 1) Then c0 = c0 + 1 End If If (Mid(s1, j, 1) = 2) Then c1 = c1 + 1 End If If (Mid(s1, j, 1) = 3) Then c2 = c2 + 1 End If If (Mid(s1, j, 1) = 4) Then c3 = c3 + 1 End If If (Mid(s1, j, 1) = 5) Then

79

c4 = c4 + 1 End If If (Mid(s1, j, 1) = 6) Then c5 = c5 + 1 End If If (Mid(s1, j, 1) = 7) Then c6 = c6 + 1 End If If (Mid(s1, j, 1) = 8) Then c7 = c7 + 1 End If If (Mid(s1, j, 1) = 9) Then c8 = c8 + 1 End If j=j+1 Wend If (c > 5) Or (c0 > 5) Or (c1 > 5) Or (c2 > 4) Or (c3 > 4) Or (c4 > 4) Or (c5 > 4) Or (c6 > 4) Or (c7 > 4) Or (c8 > 5) Then MsgBox "Invalid number ! Repeatation not allowed ." txtDD_PH_NUM.Text = "" txtDD_PH_NUM.SetFocus End If End Sub Private Sub txtDD_PINCODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtDD_PINCODE_LostFocus() Dim s As String

80

Dim i As Integer s = txtDD_PINCODE.Text i = Len(s) If (i <> 6) Then MsgBox "pincode must have 6 digits" txtDD_PINCODE.SetFocus End If End Sub Private Sub txtDD_STATE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub

81

Screen Layout of form_dpd:

82

Coding of form_dpd:
Option Explicit Dim rs As ADODB.Recordset Dim rs4 As ADODB.Recordset Dim rs1 As ADODB.Recordset

Private Sub cboDPD_FARMER_CODE_GotFocus() cboDPD_FARMER_CODE.Clear Set rs4 = New ADODB.Recordset rs4.Open "select DPD_FARMER_CODE from DRIVER_PAYMENT_DETAILS where DPD_DRIVER_CODE=" & Val(cboDPD_DRIVER_CODE.Text), con, adOpenDynamic, adLockOptimistic If rs4![DPD_FARMER_CODE] <> "" Then Do Until rs4.EOF cboDPD_FARMER_CODE.AddItem rs4![DPD_FARMER_CODE] rs4.MoveNext Loop rs4.MoveFirst Else MsgBox "database is empty" End If rs4.Close End Sub Private Sub cboDPD_FARMER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

83

Private Sub cmddpdadd_Click() cboDPD_DRIVER_CODE.Text = "" cboDPD_FARMER_CODE.Text = "" txtDPD_PAYMENT.Text = "" cmddpdfirst.Enabled = False cmddpdlast.Enabled = False cmddpdnext.Enabled = False cmddpdprev.Enabled = False cmddpddel.Enabled = False cmddpdsave.Enabled = True cmddpdadd.Enabled = False cmddpdcancel.Enabled = True cmddpdmodify.Enabled = False unlockmethod End Sub Private Sub cmddpdcancel_Click() cboDPD_FARMER_CODE.Text = "" cboDPD_DRIVER_CODE.Text = "" txtDPD_PAYMENT.Text = "" cmddpdfirst.Enabled = True cmddpdlast.Enabled = True cmddpdnext.Enabled = True cmddpdprev.Enabled = True cmddpddel.Enabled = True cmddpdsave.Enabled = False cmddpdadd.Enabled = True cmddpdcancel.Enabled = False cmddpdmodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata

84

End Sub Private Sub cmddpddel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete cboDPD_DRIVER_CODE.Text = "" cboDPD_FARMER_CODE.Text = "" txtDPD_PAYMENT.Text = "" cmddpdfirst.Enabled = False cmddpdlast.Enabled = False cmddpdnext.Enabled = False cmddpdprev.Enabled = False cmddpddel.Enabled = False cmddpdsave.Enabled = False cmddpdadd.Enabled = True cmddpdcancel.Enabled = True cmddpdmodify.Enabled = False Else End If lockmethod End Sub Private Sub cmddpdend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_dpd.Hide MDIForm1.Show Else End If

85

End Sub Private Sub cmddpdfirst_Click() lockmethod rs.MoveFirst showdata End Sub Private Sub cmddpdlast_Click() lockmethod rs.MoveLast showdata End Sub Private Sub cmddpdmodify_Click() unlockmethod savedata rs.Update End Sub Private Sub cmddpdnext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmddpdprev_Click() lockmethod

86

rs.MovePrevious If rs.BOF Then rs.MoveNext End If showdata End Sub Private Sub cmddpdsave_Click() If (cboDPD_DRIVER_CODE.Text = "" Or cboDPD_FARMER_CODE.Text = "" Or txtDPD_PAYMENT.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else rs.AddNew savedata rs.Update cmddpdfirst.Enabled = True cmddpdlast.Enabled = True cmddpdnext.Enabled = True cmddpdprev.Enabled = True cmddpddel.Enabled = True cmddpdsave.Enabled = False cmddpdadd.Enabled = True cmddpdcancel.Enabled = False cmddpdmodify.Enabled = True lockmethod End If End Sub

Private Sub dgdpd_Click() showdata dgdpd.AllowDelete = False

87

dgdpd.AllowUpdate = False End Sub

Private Sub DTPicker1_Change() If DTPicker1.Value < Date Then DTPicker1.Value = Date MsgBox "Invalid Date" End If End Sub Private Sub Form_Load() connection Set rs1 = New ADODB.Recordset rs1.Open "select DD_DRIVER_CODE from DRIVER_DETAILS", con, adOpenDynamic, adLockOptimistic If rs1![DD_DRIVER_CODE] <> "" Then Do Until rs1.EOF cboDPD_DRIVER_CODE.AddItem rs1![DD_DRIVER_CODE] rs1.MoveNext Loop rs1.MoveFirst Else MsgBox "database is empty" End If rs1.Close connection Set rs = New ADODB.Recordset rs.Open "select * from DRIVER_PAYMENT_DETAILS order by DPD_DRIVER_CODE", con, adOpenDynamic, adLockOptimistic

88

Set dgdpd.DataSource = rs showdata cmddpdfirst.Enabled = True cmddpdlast.Enabled = True cmddpdnext.Enabled = True cmddpdprev.Enabled = True cmddpddel.Enabled = False cmddpdsave.Enabled = False cmddpdadd.Enabled = True cmddpdcancel.Enabled = False cmddpdmodify.Enabled = True lockmethod Dim today As Variant today = Date DTPicker1.Value = today End Sub Public Sub showdata() cboDPD_DRIVER_CODE.Text = rs.Fields("DPD_DRIVER_CODE") cboDPD_FARMER_CODE.Text = rs.Fields("DPD_FARMER_CODE") DTPicker1.Value = rs.Fields("DPD_DATE") txtDPD_PAYMENT.Text = rs.Fields("DPD_PAYMENT") End Sub Public Sub savedata() rs.Fields("DPD_DRIVER_CODE") = cboDPD_DRIVER_CODE.Text rs.Fields("DPD_FARMER_CODE") = cboDPD_FARMER_CODE.Text rs.Fields("DPD_DATE") = DTPicker1.Value rs.Fields("DPD_PAYMENT") = txtDPD_PAYMENT.Text End Sub Public Sub lockmethod() cboDPD_DRIVER_CODE.Locked = True

89

cboDPD_FARMER_CODE.Locked = True DTPicker1.Enabled = False txtDPD_PAYMENT.Locked = True End Sub Public Sub unlockmethod() cboDPD_DRIVER_CODE.Locked = False cboDPD_FARMER_CODE.Locked = False DTPicker1.Enabled = True txtDPD_PAYMENT.Locked = False End Sub Private Sub cboDPD_DRIVER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

Private Sub txtDPD_PAYMENT_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub

90

Screen Layout of form_fd:

91

Coding of form_fd:
Option Explicit Dim rs As ADODB.Recordset Dim rs5 As ADODB.Recordset Dim id As Integer

Private Sub cmdfdadd_Click() If rs.EOF Then MsgBox "database is empty " MsgBox "Please add the fields" id = 0 id = id + 1 txtFD_FARMER_CODE.Text = "" txtFD_NAME.Text = "" txtFD_ADD.Text = "" txtFD_CITY.Text = "" txtFD_STATE.Text = "" txtFD_PINCODE.Text = "" txtFD_PH_NUM.Text = "" txtFD_BAL_AMT.Text = 0 txtFD_BAL_AMT.Locked = True txtFD_FARMER_CODE.Text = id txtFD_NAME.SetFocus cmdfdfirst.Enabled = False cmdfdlast.Enabled = False cmdfdnext.Enabled = False cmdfdprev.Enabled = False cmdfddel.Enabled = False cmdfdsave.Enabled = True cmdfdadd.Enabled = False cmdfdcancel.Enabled = True

92

cmdfdmodify.Enabled = False unlockmethod Else rs.MoveLast id = rs![FD_FARMER_CODE] id = id + 1 txtFD_FARMER_CODE.Text = "" txtFD_NAME.Text = "" txtFD_ADD.Text = "" txtFD_CITY.Text = "" txtFD_STATE.Text = "" txtFD_PINCODE.Text = "" txtFD_PH_NUM.Text = "" txtFD_BAL_AMT.Text = 0 txtFD_BAL_AMT.Locked = True txtFD_FARMER_CODE.Text = id txtFD_NAME.SetFocus cmdfdfirst.Enabled = False cmdfdlast.Enabled = False cmdfdnext.Enabled = False cmdfdprev.Enabled = False cmdfddel.Enabled = False cmdfdsave.Enabled = True cmdfdadd.Enabled = False cmdfdcancel.Enabled = True cmdfdmodify.Enabled = False unlockmethod End If End Sub

Private Sub cmdfdcancel_Click()

93

txtFD_FARMER_CODE.Text = "" txtFD_NAME.Text = "" txtFD_ADD.Text = "" txtFD_CITY.Text = "" txtFD_STATE.Text = "" txtFD_PINCODE.Text = "" txtFD_PH_NUM.Text = "" txtFD_BAL_AMT.Text = "" cmdfdfirst.Enabled = True cmdfdlast.Enabled = True cmdfdnext.Enabled = True cmdfdprev.Enabled = True cmdfddel.Enabled = True cmdfdsave.Enabled = False cmdfdadd.Enabled = True cmdfdcancel.Enabled = False cmdfdmodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata End Sub Private Sub cmdfddel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete txtFD_FARMER_CODE.Text = "" txtFD_NAME.Text = "" txtFD_ADD.Text = "" txtFD_CITY.Text = ""

94

txtFD_STATE.Text = "" txtFD_PINCODE.Text = "" txtFD_PH_NUM.Text = "" txtFD_BAL_AMT.Text = "" cmdfdfirst.Enabled = True cmdfdlast.Enabled = True cmdfdnext.Enabled = True cmdfdprev.Enabled = True cmdfddel.Enabled = False cmdfdsave.Enabled = False cmdfdadd.Enabled = True cmdfdcancel.Enabled = True cmdfdmodify.Enabled = False Else End If lockmethod End Sub Private Sub cmdfdend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_fd.Hide MDIForm1.Show Else End If End Sub Private Sub cmdfdfirst_Click() lockmethod rs.MoveFirst showdata

95

End Sub Private Sub cmdfdlast_Click() lockmethod rs.MoveLast showdata End Sub Private Sub cmdfdmodify_Click() unlockmethod savedata rs.Update End Sub Private Sub cmdfdnext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmdfdprev_Click() lockmethod rs.MovePrevious If rs.BOF Then rs.MoveNext End If showdata End Sub

96

Private Sub cmdfdsave_Click() If (txtFD_FARMER_CODE.Text = "" Or txtFD_NAME.Text = "" Or txtFD_ADD.Text = "" Or txtFD_CITY.Text = "" Or txtFD_STATE.Text = "" Or txtFD_PINCODE.Text = "" Or txtFD_PH_NUM.Text = "" Or txtFD_BAL_AMT.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else rs.AddNew savedata rs.Update cmdfdfirst.Enabled = True cmdfdlast.Enabled = True cmdfdnext.Enabled = True cmdfdprev.Enabled = True cmdfddel.Enabled = True cmdfdsave.Enabled = False cmdfdadd.Enabled = True cmdfdcancel.Enabled = False cmdfdmodify.Enabled = True lockmethod End If End Sub Private Sub cmdfdsearch_Click() searchTable = "farmer" form_fd.Hide form_s.Show End Sub Private Sub dgfd_Click() showdata dgfd.AllowDelete = False dgfd.AllowUpdate = False

97

End Sub Private Sub Form_Load() connection Set rs = New ADODB.Recordset rs.Open "select * from FARMER_DETAILS order by FD_FARMER_CODE", con, adOpenStatic, adLockOptimistic Set dgfd.DataSource = rs showdata cmdfdfirst.Enabled = True cmdfdlast.Enabled = True cmdfdnext.Enabled = True cmdfdprev.Enabled = True cmdfddel.Enabled = False cmdfdsave.Enabled = False cmdfdadd.Enabled = True cmdfdcancel.Enabled = False cmdfdmodify.Enabled = True txtFD_BAL_AMT.Locked = True lockmethod End Sub Public Sub showdata() txtFD_FARMER_CODE.Text = rs.Fields("FD_FARMER_CODE") txtFD_NAME.Text = rs.Fields("FD_NAME") txtFD_ADD.Text = rs.Fields("FD_ADD") txtFD_CITY.Text = rs.Fields("FD_CITY") txtFD_STATE.Text = rs.Fields("FD_STATE") txtFD_PINCODE.Text = rs.Fields("FD_PINCODE") txtFD_PH_NUM.Text = rs.Fields("FD_PH_NUM") txtFD_BAL_AMT.Text = rs.Fields("FD_BAL_AMT") End Sub

98

Public Sub lockmethod() txtFD_FARMER_CODE.Locked = True txtFD_NAME.Locked = True txtFD_ADD.Locked = True txtFD_CITY.Locked = True txtFD_STATE.Locked = True txtFD_PINCODE.Locked = True txtFD_PH_NUM.Locked = True txtFD_BAL_AMT.Locked = True End Sub Public Sub unlockmethod() txtFD_FARMER_CODE.Locked = False txtFD_NAME.Locked = False txtFD_ADD.Locked = False txtFD_CITY.Locked = False txtFD_STATE.Locked = False txtFD_PINCODE.Locked = False txtFD_PH_NUM.Locked = False End Sub Public Sub savedata() rs.Fields("FD_FARMER_CODE") = txtFD_FARMER_CODE.Text rs.Fields("FD_NAME") = txtFD_NAME.Text rs.Fields("FD_ADD") = txtFD_ADD.Text rs.Fields("FD_CITY") = txtFD_CITY.Text rs.Fields("FD_STATE") = txtFD_STATE.Text rs.Fields("FD_PINCODE") = txtFD_PINCODE.Text rs.Fields("FD_PH_NUM") = txtFD_PH_NUM.Text rs.Fields("FD_BAL_AMT") = txtFD_BAL_AMT.Text

99

End Sub

Private Sub txtFD_BAL_AMT_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

Private Sub txtFD_CITY_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub Private Sub txtFD_FARMER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

100

Private Sub txtFD_NAME_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub Private Sub txtFD_PH_NUM_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtFD_PH_NUM_LostFocus() Dim s1 As String s1 = txtFD_PH_NUM.Text Dim c1, c0, i, c, j, c2, c3, c4, c5, c6, c7, c8 As Integer i = Len(s1) j=2 If (i <> 10) Then MsgBox "number must have 10 digits" txtFD_PH_NUM.Text = "" txtFD_PH_NUM.SetFocus ElseIf (Left(s1, 1) <> 9) Then MsgBox "Number must start with 9" txtFD_PH_NUM.Text = "" txtFD_PH_NUM.SetFocus End If

101

While (j <= i) If (Mid(s1, j) = 0) Then c=c+1 End If If (Mid(s1, j, 1) = 1) Then c0 = c0 + 1 End If If (Mid(s1, j, 1) = 2) Then c1 = c1 + 1 End If If (Mid(s1, j, 1) = 3) Then c2 = c2 + 1 End If If (Mid(s1, j, 1) = 4) Then c3 = c3 + 1 End If If (Mid(s1, j, 1) = 5) Then c4 = c4 + 1 End If If (Mid(s1, j, 1) = 6) Then c5 = c5 + 1 End If If (Mid(s1, j, 1) = 7) Then c6 = c6 + 1 End If If (Mid(s1, j, 1) = 8) Then c7 = c7 + 1 End If If (Mid(s1, j, 1) = 9) Then c8 = c8 + 1 End If j=j+1 Wend

102

If (c > 5) Or (c0 > 5) Or (c1 > 5) Or (c2 > 4) Or (c3 > 4) Or (c4 > 4) Or (c5 > 4) Or (c6 > 4) Or (c7 > 4) Or (c8 > 5) Then MsgBox "Invalid number ! Repeatation not allowed ." txtFD_PH_NUM.Text = "" txtFD_PH_NUM.SetFocus End If End Sub Private Sub txtFD_PINCODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub

Private Sub txtFD_PINCODE_LostFocus() Dim s As String Dim i As Integer s = txtFD_PINCODE.Text i = Len(s) If (i <> 6) Then MsgBox "pincode must have 6 digits" txtFD_PINCODE.SetFocus End If End Sub Private Sub txtFD_STATE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0

103

End If End Sub

104

Screen Layout of form_fpd:

105

Coding of form_fpd:
Option Explicit Dim rs1 As ADODB.Recordset Dim rs As ADODB.Recordset Dim rs4 As ADODB.Recordset Dim bal_fpd, d_pay, f_pay, totl, wt, rate, ns, hml, comm, tol, chrg As Single Dim id As Integer Private Sub cboFPD_FARMER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub cboFPD_VEG_CODE_GotFocus() cboFPD_VEG_CODE.Clear Set rs4 = New ADODB.Recordset rs4.Open "select distinct O_VEG_CODE from ORDER_TABLE where O_FARMER_CODE=" & Val(cboFPD_FARMER_CODE.Text), con, adOpenDynamic, adLockOptimistic If rs4![O_VEG_CODE] <> "" Then Do Until rs4.EOF cboFPD_VEG_CODE.AddItem rs4![O_VEG_CODE] rs4.MoveNext Loop rs4.MoveFirst Else MsgBox "database is empty" End If rs4.Close End Sub

106

Private Sub cboFPD_VEG_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub cmdfpdadd_Click() If rs.EOF Then MsgBox "database is empty " MsgBox "Please add the fields" id = 0 id = id + 1 txtFPD_BILL_NUM.Text = "" cboFPD_FARMER_CODE.Text = "" cboFPD_VEG_CODE.Text = "" txtFPD_PAYMENT.Text = "" txtFPD_PAID_AMT.Text = "" txtFPD_BAL_AMT.Text = "" txtFPD_CHARGES.Text = "" txtFPD_BILL_NUM.Text = id txtFPD_BILL_NUM.Locked = True txtFPD_BAL_AMT.Locked = True cboFPD_FARMER_CODE.SetFocus cmdfpdfirst.Enabled = False cmdfpdlast.Enabled = False cmdfpdnext.Enabled = False cmdfpdprev.Enabled = False cmdfpddel.Enabled = False cmdfpdsave.Enabled = True cmdfpdadd.Enabled = False cmdfpdcancel.Enabled = True

107

cmdfpdmodify.Enabled = False unlockmethod Else rs.MoveLast id = rs![FPD_BILL_NUM] id = id + 1 txtFPD_BILL_NUM.Text = "" cboFPD_FARMER_CODE.Text = "" cboFPD_VEG_CODE.Text = "" txtFPD_PAYMENT.Text = "" txtFPD_PAID_AMT.Text = "" txtFPD_BAL_AMT.Text = "" txtFPD_CHARGES.Text = "" txtFPD_BILL_NUM.Text = id txtFPD_BILL_NUM.Locked = True txtFPD_BAL_AMT.Locked = True cboFPD_FARMER_CODE.SetFocus cmdfpdfirst.Enabled = False cmdfpdlast.Enabled = False cmdfpdnext.Enabled = False cmdfpdprev.Enabled = False cmdfpddel.Enabled = False cmdfpdsave.Enabled = True cmdfpdadd.Enabled = False cmdfpdcancel.Enabled = True cmdfpdmodify.Enabled = False unlockmethod End If End Sub Private Sub cmdfpdcancel_Click() txtFPD_BILL_NUM.Text = "" cboFPD_FARMER_CODE.Text = ""

108

cboFPD_VEG_CODE.Text = "" txtFPD_PAYMENT.Text = "" txtFPD_PAID_AMT.Text = "" txtFPD_BAL_AMT.Text = "" txtFPD_CHARGES.Text = "" cmdfpdfirst.Enabled = True cmdfpdlast.Enabled = True cmdfpdnext.Enabled = True cmdfpdprev.Enabled = True cmdfpddel.Enabled = True cmdfpdsave.Enabled = False cmdfpdadd.Enabled = True cmdfpdcancel.Enabled = False cmdfpdmodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata End Sub Private Sub cmdfpddel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete txtFPD_BILL_NUM.Text = "" cboFPD_FARMER_CODE.Text = "" cboFPD_VEG_CODE.Text = "" txtFPD_PAYMENT.Text = "" txtFPD_PAID_AMT.Text = "" txtFPD_BAL_AMT.Text = "" txtFPD_CHARGES.Text = "" cmdfpdfirst.Enabled = False

109

cmdfpdlast.Enabled = False cmdfpdnext.Enabled = False cmdfpdprev.Enabled = False cmdfpddel.Enabled = False cmdfpdsave.Enabled = False cmdfpdadd.Enabled = True cmdfpdcancel.Enabled = True cmdfpdmodify.Enabled = False Else End If lockmethod End Sub Private Sub cmdfpdend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_fpd.Hide MDIForm1.Show Else End If End Sub Private Sub cmdfpdfirst_Click() lockmethod rs.MoveFirst showdata End Sub Private Sub cmdfpdlast_Click() lockmethod rs.MoveLast

110

showdata End Sub Private Sub cmdfpdmodify_Click() unlockmethod savebal savedata rs.Update End Sub Private Sub cmdfpdnext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmdfpdprev_Click() lockmethod rs.MovePrevious If rs.BOF Then rs.MoveNext End If showdata End Sub Private Sub cmdfpdsave_Click() If (txtFPD_BILL_NUM.Text = "" Or cboFPD_FARMER_CODE.Text = "" Or cboFPD_VEG_CODE.Text = "" Or txtFPD_PAYMENT.Text = "" Or

111

txtFPD_PAID_AMT.Text = "" Or txtFPD_BAL_AMT.Text = "" Or txtFPD_CHARGES.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else rs.AddNew savebal savedata rs.Update cmdfpdfirst.Enabled = True cmdfpdlast.Enabled = True cmdfpdnext.Enabled = True cmdfpdprev.Enabled = True cmdfpddel.Enabled = True cmdfpdsave.Enabled = False cmdfpdadd.Enabled = True cmdfpdcancel.Enabled = False cmdfpdmodify.Enabled = True lockmethod End If End Sub Private Sub dgfpd_Click() showdata dgfpd.AllowDelete = False dgfpd.AllowUpdate = False End Sub Private Sub DTPicker1_Change() If DTPicker1.Value < Date Then DTPicker1.Value = Date MsgBox "Invalid Date" End If End Sub

112

Private Sub DTPicker1_GotFocus() Call calpay txtFPD_CHARGES.Text = chrg txtFPD_PAYMENT.Text = totl - Val(txtFPD_CHARGES.Text) f_pay = Val(txtFPD_PAYMENT.Text) txtFPD_PAID_AMT.SetFocus End Sub Private Sub Form_Load() connection Set rs1 = New ADODB.Recordset rs1.Open "select FD_FARMER_CODE from FARMER_DETAILS", con, adOpenStatic, adLockOptimistic If rs1![FD_FARMER_CODE] <> "" Then Do Until rs1.EOF cboFPD_FARMER_CODE.AddItem rs1![FD_FARMER_CODE] rs1.MoveNext Loop rs1.MoveFirst Else MsgBox "database is empty" End If rs1.Close Set rs = New ADODB.Recordset rs.Open "select * from FARMER_PAYMENT_DETAILS order by FPD_BILL_NUM", con, adOpenStatic, adLockOptimistic Set dgfpd.DataSource = rs showdata cmdfpdfirst.Enabled = True cmdfpdlast.Enabled = True cmdfpdnext.Enabled = True

113

cmdfpdprev.Enabled = True cmdfpddel.Enabled = False cmdfpdsave.Enabled = False cmdfpdadd.Enabled = True cmdfpdcancel.Enabled = False cmdfpdmodify.Enabled = True lockmethod txtFPD_BAL_AMT.Locked = True Dim today As Variant today = Date DTPicker1.Value = today End Sub Public Sub showdata() txtFPD_BILL_NUM.Text = rs.Fields("FPD_BILL_NUM") cboFPD_FARMER_CODE.Text = rs.Fields("FPD_FARMER_CODE") cboFPD_VEG_CODE.Text = rs.Fields("FPD_VEG_CODE") DTPicker1.Value = rs.Fields("FPD_DATE") txtFPD_PAYMENT.Text = rs.Fields("FPD_PAYMENT") txtFPD_PAID_AMT.Text = rs.Fields("FPD_PAID_AMT") txtFPD_BAL_AMT.Text = rs.Fields("FPD_BAL_AMT") txtFPD_CHARGES.Text = rs.Fields("FPD_CHARGES") End Sub Public Sub savedata() rs.Fields("FPD_BILL_NUM") = txtFPD_BILL_NUM.Text rs.Fields("FPD_FARMER_CODE") = cboFPD_FARMER_CODE.Text rs.Fields("FPD_VEG_CODE") = cboFPD_VEG_CODE.Text rs.Fields("FPD_DATE") = DTPicker1.Value rs.Fields("FPD_PAYMENT") = txtFPD_PAYMENT.Text rs.Fields("FPD_PAID_AMT") = txtFPD_PAID_AMT.Text rs.Fields("FPD_BAL_AMT") = txtFPD_BAL_AMT.Text rs.Fields("FPD_CHARGES") = txtFPD_CHARGES.Text

114

End Sub Public Sub lockmethod() txtFPD_BILL_NUM.Locked = True cboFPD_FARMER_CODE.Locked = True cboFPD_VEG_CODE.Locked = True DTPicker1.Enabled = False txtFPD_PAYMENT.Locked = True txtFPD_PAID_AMT.Locked = True txtFPD_BAL_AMT.Locked = True txtFPD_CHARGES.Locked = True End Sub Public Sub unlockmethod() txtFPD_BILL_NUM.Locked = False cboFPD_FARMER_CODE.Locked = False cboFPD_VEG_CODE.Locked = False DTPicker1.Enabled = True txtFPD_PAID_AMT.Locked = False txtFPD_CHARGES.Locked = False End Sub Private Sub txtFPD_BAL_AMT_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub txtFPD_BILL_NUM_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else

115

End If End Sub Private Sub txtFPD_CHARGES_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

Private Sub txtFPD_PAID_AMT_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtFPD_PAID_AMT_LostFocus() bal_fpd = Val(txtFPD_PAYMENT.Text) - Val(txtFPD_PAID_AMT.Text) txtFPD_BAL_AMT.Text = bal_fpd End Sub Private Sub txtFPD_PAYMENT_GotFocus() txtFPD_PAID_AMT.SetFocus End Sub Private Sub txtFPD_PAYMENT_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

116

Public Sub savebal() Set rs4 = New ADODB.Recordset rs4.Open "select * from FARMER_DETAILS where FD_FARMER_CODE=" & Val(cboFPD_FARMER_CODE.Text), con, adOpenDynamic, adLockOptimistic rs4.Fields("FD_BAL_AMT") = bal_fpd rs4.Update rs4.Close End Sub Public Sub calpay() Set rs4 = New ADODB.Recordset rs4.Open "select * from VEGETABLE_RATES where VR_VEG_CODE=" & Val(cboFPD_VEG_CODE.Text), con, adOpenDynamic, adLockOptimistic rate = rs4.Fields("VR_RATE_PER_KG") rs4.Close Set rs4 = New ADODB.Recordset rs4.Open "select * from ORDER_TABLE where O_FARMER_CODE=" & Val(cboFPD_FARMER_CODE.Text), con, adOpenDynamic, adLockOptimistic wt = rs4.Fields("O_WT_GOODS") ns = rs4.Fields("O_NUM_SACS") hml = ns * 2.9 tol = ns * 1.5 totl = rate * wt comm = totl * 0.065 rs4.Close Set rs4 = New ADODB.Recordset rs4.Open "select * from DRIVER_PAYMENT_DETAILS where DPD_FARMER_CODE=" & Val(cboFPD_FARMER_CODE.Text), con, adOpenDynamic, adLockOptimistic d_pay = rs4.Fields("DPD_PAYMENT") chrg = (hml + tol + comm + d_pay) rs4.Close

117

End Sub

118

Screen Layout of form_nu:

119

Coding of form_nu:

Option Explicit Dim rs1 As New ADODB.Recordset Dim rs2 As New ADODB.Recordset Dim i As Integer Public Sub savedata() rs1.Fields("uname") = txtnuUserName.Text rs1.Fields("passwd") = txtnuPassword.Text End Sub Private Sub cmdnuadd_Click() txtnuUserName.Text = "" txtnuPassword.Text = "" cmdnuadd.Enabled = False cmdnusave.Enabled = True cmdnucancel.Enabled = True txtnuUserName.SetFocus unlockmethod End Sub Private Sub cmdnucancel_Click() txtnuUserName.Text = "" txtnuPassword.Text = "" cmdnuadd.Enabled = True cmdnusave.Enabled = False cmdnucancel.Enabled = False lockmethod rs1.CancelUpdate End Sub Private Sub cmdnuend_Click()

120

Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_nu.Hide MDIForm1.Show Else End If End Sub Private Sub cmdnusave_Click() If (txtnuUserName.Text = "" Or txtnuPassword.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else If (txtnuPassword.Text = txtnurp.Text) Then rs1.AddNew savedata rs1.Update cmdnuadd.Enabled = True cmdnusave.Enabled = False cmdnucancel.Enabled = False lockmethod Else txtnurp.Text = "" MsgBox "Wrong Password !" txtnurp.SetFocus End If End If End Sub Private Sub Form_Load() Call connection Set rs1 = New ADODB.Recordset rs1.Open "select * from login", con, adOpenDynamic, adLockOptimistic

121

cmdnusave.Enabled = False cmdnucancel.Enabled = False lockmethod End Sub Public Sub lockmethod() txtnuUserName.Locked = True txtnuPassword.Locked = True txtnurp.Locked = True End Sub Public Sub unlockmethod() txtnuUserName.Locked = False txtnuPassword.Locked = False txtnurp.Locked = False End Sub

Private Sub txtnuUserName_LostFocus() Set rs2 = New ADODB.Recordset rs2.Open "select * from login where uname='" & txtnuUserName.Text & "'", con, adOpenDynamic, adLockOptimistic If Not rs2.EOF Then MsgBox ("This USER-NAME is reserved.Please try again.") txtnuUserName.Text = "" txtnuUserName.SetFocus End If End Sub

122

Screen Layout of form_o:

123

Coding of form_o:

Option Explicit Dim rs1 As ADODB.Recordset Dim rs As ADODB.Recordset Dim rs3 As ADODB.Recordset Dim id1 As Integer Private Sub cboO_FARMER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub cmdoadd_Click() If rs.EOF Then MsgBox "database is empty " MsgBox "Please add the fields" id1 = 0 id1 = id1 + 1 txtO_ORD_NUM.Text = "" cboO_FARMER_CODE.Text = "" cboO_VEG_CODE.Text = "" txtO_NUM_SACS.Text = "" txtO_WT_GOODS.Text = "" txtO_ORD_NUM.Text = id1 txtO_ORD_NUM.Locked = True cboO_FARMER_CODE.SetFocus cmdofirst.Enabled = False cmdolast.Enabled = False cmdonext.Enabled = False

124

cmdoprev.Enabled = False cmdodel.Enabled = False cmdosave.Enabled = True cmdoadd.Enabled = False cmdocancel.Enabled = True cmdomodify.Enabled = False unlockmethod Else rs.MoveLast id1 = rs![O_ORD_NUM] id1 = id1 + 1 txtO_ORD_NUM.Text = "" cboO_FARMER_CODE.Text = "" cboO_VEG_CODE.Text = "" txtO_NUM_SACS.Text = "" txtO_WT_GOODS.Text = "" txtO_ORD_NUM.Text = id1 txtO_ORD_NUM.Locked = True cboO_FARMER_CODE.SetFocus cmdofirst.Enabled = False cmdolast.Enabled = False cmdonext.Enabled = False cmdoprev.Enabled = False cmdodel.Enabled = False cmdosave.Enabled = True cmdoadd.Enabled = False cmdocancel.Enabled = True cmdomodify.Enabled = False unlockmethod End If End Sub Private Sub cmdocancel_Click()

125

txtO_ORD_NUM.Text = "" cboO_FARMER_CODE.Text = "" cboO_VEG_CODE.Text = "" txtO_NUM_SACS.Text = "" txtO_WT_GOODS.Text = "" cmdofirst.Enabled = True cmdolast.Enabled = True cmdonext.Enabled = True cmdoprev.Enabled = True cmdodel.Enabled = True cmdosave.Enabled = False cmdoadd.Enabled = True cmdocancel.Enabled = False cmdomodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata End Sub Private Sub cmdodel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete txtO_ORD_NUM.Text = "" cboO_FARMER_CODE.Text = "" cboO_VEG_CODE.Text = "" txtO_NUM_SACS.Text = "" txtO_WT_GOODS.Text = "" cmdofirst.Enabled = False

126

cmdolast.Enabled = False cmdonext.Enabled = False cmdoprev.Enabled = False cmdodel.Enabled = False cmdosave.Enabled = False cmdoadd.Enabled = True cmdocancel.Enabled = True cmdomodify.Enabled = False Else End If lockmethod End Sub Private Sub cmdoend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_o.Hide MDIForm1.Show Else End If End Sub Private Sub cmdofirst_Click() lockmethod rs.MoveFirst showdata End Sub Private Sub cmdolast_Click() lockmethod rs.MoveLast

127

showdata End Sub Private Sub cmdomodify_Click() unlockmethod savedata rs.Update End Sub Private Sub cmdonext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmdoprev_Click() lockmethod rs.MovePrevious If rs.BOF Then rs.MoveNext End If showdata End Sub Private Sub cmdosave_Click() If (txtO_ORD_NUM.Text = "" Or cboO_FARMER_CODE.Text = "" Or cboO_VEG_CODE.Text = "" Or txtO_NUM_SACS.Text = "" Or txtO_WT_GOODS.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else

128

rs.AddNew savedata rs.Update cmdofirst.Enabled = True cmdolast.Enabled = True cmdonext.Enabled = True cmdoprev.Enabled = True cmdodel.Enabled = True cmdosave.Enabled = False cmdoadd.Enabled = True cmdocancel.Enabled = False cmdomodify.Enabled = True lockmethod End If End Sub Private Sub dgo_Click() showdata dgo.AllowDelete = False dgo.AllowUpdate = False End Sub

Private Sub DTPicker1_Change() If DTPicker1.Value < Date Then DTPicker1.Value = Date MsgBox "Invalid Date" End If End Sub Private Sub Form_Load() connection

129

Set rs3 = New ADODB.Recordset rs3.Open "select VR_VEG_CODE from VEGETABLE_RATES", con, adOpenStatic, adLockOptimistic If rs3![VR_VEG_CODE] <> "" Then Do Until rs3.EOF cboO_VEG_CODE.AddItem rs3![VR_VEG_CODE] rs3.MoveNext Loop rs3.MoveFirst Else MsgBox "database is empty" End If rs3.Close connection Set rs1 = New ADODB.Recordset rs1.Open "select FD_FARMER_CODE from FARMER_DETAILS", con, adOpenStatic, adLockOptimistic If rs1![FD_FARMER_CODE] <> "" Then Do Until rs1.EOF cboO_FARMER_CODE.AddItem rs1![FD_FARMER_CODE] rs1.MoveNext Loop rs1.MoveFirst Else MsgBox "database is empty" End If rs1.Close Set rs = New ADODB.Recordset rs.Open "select * from ORDER_TABLE order by O_ORD_NUM", con, adOpenStatic, adLockOptimistic Set dgo.DataSource = rs

130

showdata cmdofirst.Enabled = True cmdolast.Enabled = True cmdonext.Enabled = True cmdoprev.Enabled = True cmdodel.Enabled = False cmdosave.Enabled = False cmdoadd.Enabled = True cmdocancel.Enabled = False cmdomodify.Enabled = True lockmethod Dim today As Variant today = Date DTPicker1.Value = today End Sub Public Sub showdata() txtO_ORD_NUM.Text = rs.Fields("O_ORD_NUM") cboO_FARMER_CODE.Text = rs.Fields("O_FARMER_CODE") cboO_VEG_CODE.Text = rs.Fields("O_VEG_CODE") DTPicker1.Value = rs.Fields("O_DATE") txtO_NUM_SACS.Text = rs.Fields("O_NUM_SACS") txtO_WT_GOODS.Text = rs.Fields("O_WT_GOODS") End Sub Public Sub savedata() rs.Fields("O_ORD_NUM") = txtO_ORD_NUM.Text rs.Fields("O_FARMER_CODE") = cboO_FARMER_CODE.Text rs.Fields("O_VEG_CODE") = cboO_VEG_CODE.Text rs.Fields("O_DATE") = DTPicker1.Value rs.Fields("O_NUM_SACS") = txtO_NUM_SACS.Text rs.Fields("O_WT_GOODS") = txtO_WT_GOODS.Text End Sub

131

Public Sub lockmethod() txtO_ORD_NUM.Locked = True cboO_FARMER_CODE.Locked = True cboO_VEG_CODE.Locked = True DTPicker1.Enabled = False txtO_NUM_SACS.Locked = True txtO_WT_GOODS.Locked = True End Sub Public Sub unlockmethod() txtO_ORD_NUM.Locked = False cboO_FARMER_CODE.Locked = False cboO_VEG_CODE.Locked = False DTPicker1.Enabled = True txtO_NUM_SACS.Locked = False txtO_WT_GOODS.Locked = False End Sub

Private Sub txtO_NUM_SACS_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtO_ORD_NUM_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

132

Private Sub cboO_VEG_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

Private Sub txtO_WT_GOODS_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub

133

Screen Layout of form_s:

134

Coding of form_s:

Option Explicit Dim clickcheck As Boolean Dim iColCount As Long Dim rs As ADODB.Recordset

Private Sub cmds_all_Click() txtsearch.Text = "" txtsearch.SetFocus If optf.Value = True Then rs.Open "select * from FARMER_DETAILS", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End If If optc.Value = True Then rs.Open "select * from CUSTOMER_DETAILS", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End If If optd.Value = True Then rs.Open "select * from DRIVER_DETAILS", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End If If optv.Value = True Then rs.Open "select * from VEGETABLE_RATES", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End If

135

cmds_ok.Enabled = True cmds_all.Enabled = False End Sub Public Sub list(pList As ListView, _ pRst As ADODB.Recordset) On Error Resume Next Dim i As Long Dim sColName As String Dim sColValue As String Dim oCH As ColumnHeader Dim oLI As ListItem Dim oSI As ListSubItem Dim oFld As ADODB.Field

With pList .View = lvwReport .GridLines = True .FullRowSelect = True .ListItems.Clear .Sorted = False pRst.MoveFirst ' set up column headers If Not clickcheck = True Then For Each oFld In pRst.Fields sColName = cn(oFld.Name) Set oCH = .ColumnHeaders.Add() oCH.Text = sColName

136

iColCount = iColCount + 1 Next oFld End If

Do Until pRst.EOF i=0 ' setup fiprst column as a listitem sColValue = cn(pRst.Fields(i).Value) Set oLI = .ListItems.Add()

oLI.Text = sColValue ' add the remaining columns as subitems

For i = 1 To iColCount

Set oSI = oLI.ListSubItems.Add()

oSI.Text = cn(pRst(i)) Next ' next column pRst.MoveNext Loop ' Next record ' refresh it all .Refresh ' make sure 1st row can be seen .ListItems(1).EnsureVisible End With clickcheck = True

137

End Sub Public Function cn(pVal As String) If IsMissing(pVal) Then cn = "" ElseIf IsNull(pVal) Then cn = "" Else cn = Format(pVal) End If End Function Private Sub cmds_cancel_Click(Index As Integer) form_s.Hide If searchTable = "customer" Then form_cd.Show End If If searchTable = "driver" Then form_dd.Show End If If searchTable = "veg" Then form_vr.Show End If If searchTable = "farmer" Then form_fd.Show End If If searchTable = "" Then MDIForm1.Show End If End Sub

138

Private Sub cmds_ok_Click() If rs.State = 1 Then rs.Close End If If txtsearch.Text = "" Then MsgBox "Please Enter value in TextBox" Else If optc.Value = True Then If optcode.Value = True Then rs.Open "select * from CUSTOMER_DETAILS where CD_CUST_NUM=" & txtsearch.Text, con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) ElseIf optname.Value = True Then rs.Open "select *from CUSTOMER_DETAILS where CD_NAME like '" & txtsearch.Text & "%'", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End If End If If optd.Value = True Then If optcode.Value = True Then rs.Open "select * from DRIVER_DETAILS where DD_DRIVER_CODE=" & txtsearch.Text, con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) ElseIf optname.Value = True Then rs.Open "select *from DRIVER_DETAILS where DD_NAME like '" & txtsearch.Text & "%'", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End If End If If optf.Value = True Then If optcode.Value = True Then

139

rs.Open "select * from FARMER_DETAILS where FD_FARMER_CODE=" & txtsearch.Text, con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) ElseIf optname.Value = True Then rs.Open "select *from FARMER_DETAILS where FD_NAME like '" & txtsearch.Text & "%'", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End If End If If optv.Value = True Then If optcode.Value = True Then rs.Open "select * from VEGETABLE_RATES where VR_VEG_CODE=" & txtsearch.Text, con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) ElseIf optname.Value = True Then rs.Open "select *from VEGETABLE_RATES where VR_VEG_NAME like '" & txtsearch.Text & "%'", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End If End If rs.Close cmds_ok.Enabled = False cmds_all.Enabled = True End If End Sub Private Sub Form_Load() connection Set rs = New ADODB.Recordset If searchTable = "customer" Then optc.Value = True optf.Enabled = False

140

optd.Enabled = False optv.Enabled = False End If If searchTable = "driver" Then optd.Value = True optv.Enabled = False optf.Enabled = False optc.Enabled = False End If If searchTable = "veg" Then optv.Value = True optf.Enabled = False optd.Enabled = False optc.Enabled = False End If If searchTable = "farmer" Then optf.Value = True optv.Enabled = False optd.Enabled = False optc.Enabled = False End If txtsearch.Locked = True cmds_ok.Enabled = False cmds_all.Enabled = False End Sub

Private Sub optc_Click() connection Set rs = New ADODB.Recordset rs.Open "select * from CUSTOMER_DETAILS", con, adOpenDynamic, adLockOptimistic

141

Call list(ListView1, rs) End Sub Private Sub optcode_Click() txtsearch.Text = "" txtsearch.Locked = False cmds_ok.Enabled = True txtsearch.SetFocus End Sub

Private Sub optd_Click() connection Set rs = New ADODB.Recordset rs.Open "select * from DRIVER_DETAILS", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End Sub Private Sub optf_Click() connection Set rs = New ADODB.Recordset rs.Open "select * from FARMER_DETAILS", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End Sub Private Sub optname_Click() txtsearch.Text = "" txtsearch.Locked = False cmds_ok.Enabled = True txtsearch.SetFocus

142

End Sub Private Sub optv_Click() connection Set rs = New ADODB.Recordset rs.Open "select * from VEGETABLE_RATES", con, adOpenDynamic, adLockOptimistic Call list(ListView1, rs) End Sub

Private Sub txtsearch_KeyPress(KeyAscii As Integer) If optcode.Value = True Then If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End If If optname.Value = True Then If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End If End Sub

143

Screen Layout of form_t:

144

Coding of form_t:

Option Explicit Dim rs1 As ADODB.Recordset Dim rs As ADODB.Recordset Dim rs2 As ADODB.Recordset Private Sub cboT_DRIVER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

Private Sub cboT_FARMER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub cmdtadd_Click() cboT_FARMER_CODE.Text = "" cboT_DRIVER_CODE.Text = "" txtT_GOODS.Text = "" txtT_NUM_SACS.Text = "" txtT_TRAVLFRM.Text = "" txtT_DEST.Text = "" cmdtfirst.Enabled = False cmdtlast.Enabled = False cmdtnext.Enabled = False cmdtprev.Enabled = False

145

cmdtdel.Enabled = False cmdtsave.Enabled = True cmdtadd.Enabled = False cmdtcancel.Enabled = True cmdtmodify.Enabled = False unlockmethod End Sub Private Sub cmdtcancel_Click() cboT_FARMER_CODE.Text = "" cboT_DRIVER_CODE.Text = "" txtT_GOODS.Text = "" txtT_NUM_SACS.Text = "" txtT_TRAVLFRM.Text = "" txtT_DEST.Text = "" cmdtfirst.Enabled = True cmdtlast.Enabled = True cmdtnext.Enabled = True cmdtprev.Enabled = True cmdtdel.Enabled = True cmdtsave.Enabled = False cmdtadd.Enabled = True cmdtcancel.Enabled = False cmdtmodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata End Sub Private Sub cmdtdel_Click() Dim i As Single

146

i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete cboT_FARMER_CODE.Text = "" cboT_DRIVER_CODE.Text = "" txtT_GOODS.Text = "" txtT_NUM_SACS.Text = "" txtT_TRAVLFRM.Text = "" txtT_DEST.Text = "" cmdtfirst.Enabled = False cmdtlast.Enabled = False cmdtnext.Enabled = False cmdtprev.Enabled = False cmdtdel.Enabled = False cmdtsave.Enabled = False cmdtadd.Enabled = True cmdtcancel.Enabled = True cmdtmodify.Enabled = False Else End If lockmethod End Sub Private Sub cmdtend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_t.Hide MDIForm1.Show Else End If End Sub

147

Private Sub cmdtfirst_Click() lockmethod rs.MoveFirst showdata End Sub Private Sub cmdtlast_Click() lockmethod rs.MoveLast showdata End Sub Private Sub cmdtmodify_Click() unlockmethod savedata rs.Update End Sub Private Sub cmdtnext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmdtprev_Click() lockmethod rs.MovePrevious

148

If rs.BOF Then rs.MoveNext End If showdata End Sub Private Sub cmdtsave_Click() If (cboT_FARMER_CODE.Text = "" Or cboT_DRIVER_CODE.Text = "" Or txtT_GOODS.Text = "" Or txtT_NUM_SACS.Text = "" Or txtT_TRAVLFRM.Text = "" Or txtT_DEST.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else rs.AddNew savedata rs.Update cmdtfirst.Enabled = True cmdtlast.Enabled = True cmdtnext.Enabled = True cmdtprev.Enabled = True cmdtdel.Enabled = True cmdtsave.Enabled = False cmdtadd.Enabled = True cmdtcancel.Enabled = False cmdtmodify.Enabled = True lockmethod End If End Sub Private Sub dgt_Click() showdata dgt.AllowDelete = False dgt.AllowUpdate = False End Sub

149

Private Sub Form_Load() connection Set rs1 = New ADODB.Recordset rs1.Open "select FD_FARMER_CODE from FARMER_DETAILS", con, adOpenStatic, adLockOptimistic If rs1![FD_FARMER_CODE] <> "" Then Do Until rs1.EOF cboT_FARMER_CODE.AddItem rs1![FD_FARMER_CODE] rs1.MoveNext Loop rs1.MoveFirst Else MsgBox "database is empty" End If rs1.Close connection Set rs2 = New ADODB.Recordset rs2.Open "select DD_DRIVER_CODE from DRIVER_DETAILS", con, adOpenDynamic, adLockOptimistic If rs2![DD_DRIVER_CODE] <> "" Then Do Until rs2.EOF cboT_DRIVER_CODE.AddItem rs2![DD_DRIVER_CODE] rs2.MoveNext Loop rs2.MoveFirst Else MsgBox "database is empty" End If rs2.Close Set rs = New ADODB.Recordset

150

rs.Open "select * from TRANSPORT_TABLE order by T_FARMER_CODE", con, adOpenStatic, adLockOptimistic Set dgt.DataSource = rs showdata cmdtfirst.Enabled = True cmdtlast.Enabled = True cmdtnext.Enabled = True cmdtprev.Enabled = True cmdtdel.Enabled = False cmdtsave.Enabled = False cmdtadd.Enabled = True cmdtcancel.Enabled = False cmdtmodify.Enabled = True lockmethod End Sub Public Sub showdata() cboT_FARMER_CODE.Text = rs.Fields("T_FARMER_CODE") cboT_DRIVER_CODE.Text = rs.Fields("T_DRIVER_CODE") txtT_GOODS.Text = rs.Fields("T_GOODS") txtT_NUM_SACS.Text = rs.Fields("T_NUM_SACS") txtT_TRAVLFRM.Text = rs.Fields("T_TRAVL FRM") txtT_DEST.Text = rs.Fields("T_DEST") End Sub Public Sub savedata() rs.Fields("T_FARMER_CODE") = cboT_FARMER_CODE.Text rs.Fields("T_DRIVER_CODE") = cboT_DRIVER_CODE.Text rs.Fields("T_GOODS") = txtT_GOODS.Text rs.Fields("T_NUM_SACS") = txtT_NUM_SACS.Text rs.Fields("T_TRAVL FRM") = txtT_TRAVLFRM.Text rs.Fields("T_DEST") = txtT_DEST.Text End Sub

151

Public Sub lockmethod() cboT_FARMER_CODE.Locked = True cboT_DRIVER_CODE.Locked = True txtT_GOODS.Locked = True txtT_NUM_SACS.Locked = True txtT_TRAVLFRM.Locked = True txtT_DEST.Locked = True End Sub Public Sub unlockmethod() cboT_FARMER_CODE.Locked = False cboT_DRIVER_CODE.Locked = False txtT_GOODS.Locked = False txtT_NUM_SACS.Locked = False txtT_TRAVLFRM.Locked = False txtT_DEST.Locked = False End Sub

Private Sub txtT_DEST_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub

152

Private Sub txtT_GOODS_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub Private Sub txtT_NUM_SACS_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub

Private Sub txtT_TRAVLFRM_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub

153

Screen Layout of form_vr:

154

Coding of form_vr:

Option Explicit Dim id As Integer Dim rs As ADODB.Recordset Dim rs5 As ADODB.Recordset

Private Sub cmdvradd_Click() If rs.EOF Then MsgBox "database is empty " MsgBox "Please add the fields" id = 0 id = id + 1 txtVR_VEG_CODE.Text = "" txtVR_VEG_NAME.Text = "" txtVR_RATE_PER_KG.Text = "" txtVR_VEG_CODE.Text = id txtVR_VEG_CODE.Locked = True txtVR_VEG_NAME.SetFocus cmdvrfirst.Enabled = False cmdvrlast.Enabled = False cmdvrnext.Enabled = False cmdvrprev.Enabled = False cmdvrdel.Enabled = False cmdvrsave.Enabled = True cmdvradd.Enabled = False cmdvrcancel.Enabled = True cmdvrmodify.Enabled = False unlockmethod Else

155

rs.MoveLast id = rs![VR_VEG_CODE] id = id + 1 txtVR_VEG_CODE.Text = "" txtVR_VEG_NAME.Text = "" txtVR_RATE_PER_KG.Text = "" txtVR_VEG_CODE.Text = id txtVR_VEG_CODE.Locked = True txtVR_VEG_NAME.SetFocus cmdvrfirst.Enabled = False cmdvrlast.Enabled = False cmdvrnext.Enabled = False cmdvrprev.Enabled = False cmdvrdel.Enabled = False cmdvrsave.Enabled = True cmdvradd.Enabled = False cmdvrcancel.Enabled = True cmdvrmodify.Enabled = False unlockmethod End If End Sub Private Sub cmdvrcancel_Click() txtVR_VEG_CODE.Text = "" txtVR_VEG_NAME.Text = "" txtVR_RATE_PER_KG.Text = "" cmdvrfirst.Enabled = True cmdvrlast.Enabled = True cmdvrnext.Enabled = True cmdvrprev.Enabled = True cmdvrdel.Enabled = True cmdvrsave.Enabled = False

156

cmdvradd.Enabled = True cmdvrcancel.Enabled = False cmdvrmodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata End Sub Private Sub cmdvrdel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete txtVR_VEG_CODE.Text = "" txtVR_VEG_NAME.Text = "" txtVR_RATE_PER_KG.Text = "" cmdvrfirst.Enabled = False cmdvrlast.Enabled = False cmdvrnext.Enabled = False cmdvrprev.Enabled = False cmdvrdel.Enabled = False cmdvrsave.Enabled = False cmdvradd.Enabled = True cmdvrcancel.Enabled = True cmdvrmodify.Enabled = False Else End If lockmethod End Sub Private Sub cmdvrend_Click() Dim Answer As Integer

157

Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_vr.Hide MDIForm1.Show Else End If End Sub Private Sub cmdvrfirst_Click() lockmethod rs.MoveFirst showdata End Sub Private Sub cmdvrlast_Click() lockmethod rs.MoveLast showdata End Sub Private Sub cmdvrmodify_Click() unlockmethod savedata rs.Update End Sub Private Sub cmdvrnext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious

158

End If showdata End Sub Private Sub cmdvrprev_Click() lockmethod rs.MovePrevious If rs.BOF Then rs.MoveNext End If showdata End Sub Private Sub cmdvrsave_Click() If (txtVR_VEG_CODE.Text = "" Or txtVR_VEG_NAME.Text = "" Or txtVR_RATE_PER_KG.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else rs.AddNew savedata rs.Update cmdvrfirst.Enabled = True cmdvrlast.Enabled = True cmdvrnext.Enabled = True cmdvrprev.Enabled = True cmdvrdel.Enabled = True cmdvrsave.Enabled = False cmdvradd.Enabled = True cmdvrcancel.Enabled = False cmdvrmodify.Enabled = True lockmethod

159

End If End Sub Private Sub cmdvrsearch_Click() searchTable = "veg" form_vr.Hide form_s.Show End Sub Private Sub dgvr_Click() showdata dgvr.AllowDelete = False dgvr.AllowUpdate = False End Sub Private Sub Form_Load() connection Set rs = New ADODB.Recordset rs.Open "select * from VEGETABLE_RATES order by VR_VEG_CODE", con, adOpenStatic, adLockOptimistic Set dgvr.DataSource = rs showdata cmdvrfirst.Enabled = True cmdvrlast.Enabled = True cmdvrnext.Enabled = True cmdvrprev.Enabled = True cmdvrdel.Enabled = False cmdvrsave.Enabled = False cmdvradd.Enabled = True cmdvrcancel.Enabled = False cmdvrmodify.Enabled = True lockmethod End Sub

160

Public Sub showdata() txtVR_VEG_CODE.Text = rs.Fields("VR_VEG_CODE") txtVR_VEG_NAME.Text = rs.Fields("VR_VEG_NAME") txtVR_RATE_PER_KG.Text = rs.Fields("VR_RATE_PER_KG") End Sub Public Sub savedata() rs.Fields("VR_VEG_CODE") = txtVR_VEG_CODE.Text rs.Fields("VR_VEG_NAME") = txtVR_VEG_NAME.Text rs.Fields("VR_RATE_PER_KG") = txtVR_RATE_PER_KG.Text End Sub Public Sub lockmethod() txtVR_VEG_CODE.Locked = True txtVR_VEG_NAME.Locked = True txtVR_RATE_PER_KG.Locked = True End Sub Public Sub unlockmethod() txtVR_VEG_CODE.Locked = False txtVR_VEG_NAME.Locked = False txtVR_RATE_PER_KG.Locked = False End Sub Private Sub txtVR_RATE_PER_KG_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtVR_VEG_CODE_KeyPress(KeyAscii As Integer)

161

If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub

Private Sub txtVR_VEG_NAME_KeyPress(KeyAscii As Integer) If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii = 8 Or KeyAscii = 32) Then Else KeyAscii = 0 End If End Sub

162

Screen Layout of form_vsd:

163

Coding of form_vsd:

Option Explicit Dim rs1 As ADODB.Recordset Dim rs As ADODB.Recordset Dim rs4 As ADODB.Recordset Dim rs3 As ADODB.Recordset Dim rate, totl As Single

Private Sub cboVSD_FARMER_CODE_GotFocus() cboVSD_FARMER_CODE.Clear Set rs4 = New ADODB.Recordset rs4.Open "select T_FARMER_CODE from TRANSPORT_TABLE where T_DRIVER_CODE=" & Val(cboVSD_DRIVER_CODE.Text), con, adOpenDynamic, adLockOptimistic If rs4![T_FARMER_CODE] <> "" Then Do Until rs4.EOF cboVSD_FARMER_CODE.AddItem rs4![T_FARMER_CODE] rs4.MoveNext Loop rs4.MoveFirst Else MsgBox "database is empty" End If rs4.Close End Sub Private Sub cboVSD_FARMER_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else

164

End If End Sub

Private Sub cmdvsdadd_Click() cboVSD_VEG_CODE.Text = "" cboVSD_FARMER_CODE.Text = "" txtVSD_NUM_SACS.Text = "" txtVSD_WT_SELLED_SACS.Text = "" txtVSD_TOTL_SELL.Text = "" cmdvsdfirst.Enabled = False cmdvsdlast.Enabled = False cmdvsdnext.Enabled = False cmdvsdprev.Enabled = False cmdvsddel.Enabled = False cmdvsdsave.Enabled = True cmdvsdadd.Enabled = False cmdvsdcancel.Enabled = True cmdvsdmodify.Enabled = False unlockmethod End Sub Private Sub cmdvsdcancel_Click() cboVSD_VEG_CODE.Text = "" cboVSD_FARMER_CODE.Text = "" txtVSD_NUM_SACS.Text = "" txtVSD_WT_SELLED_SACS.Text = "" txtVSD_TOTL_SELL.Text = "" cmdvsdfirst.Enabled = True cmdvsdlast.Enabled = True

165

cmdvsdnext.Enabled = True cmdvsdprev.Enabled = True cmdvsddel.Enabled = True cmdvsdsave.Enabled = False cmdvsdadd.Enabled = True cmdvsdcancel.Enabled = False cmdvsdmodify.Enabled = True lockmethod rs.CancelUpdate rs.MoveFirst showdata End Sub Private Sub cmdvsddel_Click() Dim i As Single i = MsgBox("ARE YOU SURE ?", vbYesNo, "error") If i = vbYes Then rs.Delete cboVSD_VEG_CODE.Text = "" cboVSD_FARMER_CODE.Text = ""

txtVSD_NUM_SACS.Text = "" txtVSD_WT_SELLED_SACS.Text = "" txtVSD_TOTL_SELL.Text = "" cmdvsdfirst.Enabled = False cmdvsdlast.Enabled = False cmdvsdnext.Enabled = False cmdvsdprev.Enabled = False cmdvsddel.Enabled = False cmdvsdsave.Enabled = False cmdvsdadd.Enabled = True cmdvsdcancel.Enabled = True

166

cmdvsdmodify.Enabled = False Else End If lockmethod End Sub Private Sub cmdvsdend_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then form_vsd.Hide MDIForm1.Show Else End If End Sub Private Sub cmdvsdfirst_Click() lockmethod rs.MoveFirst showdata End Sub Private Sub cmdvsdlast_Click() lockmethod rs.MoveLast showdata End Sub Private Sub cmdvsdmodify_Click() unlockmethod savedata rs.Update

167

End Sub Private Sub cmdvsdnext_Click() lockmethod rs.MoveNext If rs.EOF Then rs.MovePrevious End If showdata End Sub Private Sub cmdvsdprev_Click() lockmethod rs.MovePrevious If rs.BOF Then rs.MoveNext End If showdata End Sub Private Sub cmdvsdsave_Click() If (cboVSD_VEG_CODE.Text = "" Or cboVSD_FARMER_CODE.Text = "" Or txtVSD_NUM_SACS.Text = "" Or txtVSD_WT_SELLED_SACS.Text = "" Or txtVSD_TOTL_SELL.Text = "") Then MsgBox "PLS ENTER DATA IN ALL FIELDS" Else rs.AddNew savedata rs.Update cmdvsdfirst.Enabled = True cmdvsdlast.Enabled = True

168

cmdvsdnext.Enabled = True cmdvsdprev.Enabled = True cmdvsddel.Enabled = True cmdvsdsave.Enabled = False cmdvsdadd.Enabled = True cmdvsdcancel.Enabled = False cmdvsdmodify.Enabled = True lockmethod End If End Sub Private Sub dgvsd_Click() showdata dgvsd.AllowDelete = False dgvsd.AllowUpdate = False End Sub

Private Sub DTPicker1_Change() If DTPicker1.Value < Date Then DTPicker1.Value = Date MsgBox "Invalid Date" End If End Sub Private Sub Form_Load() connection Set rs3 = New ADODB.Recordset rs3.Open "select VR_VEG_CODE from VEGETABLE_RATES order by VR_VEG_CODE", con, adOpenStatic, adLockOptimistic If rs3![VR_VEG_CODE] <> "" Then Do Until rs3.EOF

169

cboVSD_VEG_CODE.AddItem rs3![VR_VEG_CODE] rs3.MoveNext Loop rs3.MoveFirst Else MsgBox "database is empty" End If rs3.Close connection Set rs1 = New ADODB.Recordset rs1.Open "select FD_FARMER_CODE from FARMER_DETAILS", con, adOpenStatic, adLockOptimistic If rs1![FD_FARMER_CODE] <> "" Then Do Until rs1.EOF cboVSD_FARMER_CODE.AddItem rs1![FD_FARMER_CODE] rs1.MoveNext Loop rs1.MoveFirst Else MsgBox "database is empty" End If rs1.Close Set rs = New ADODB.Recordset rs.Open "select * from VEGETABLE_SELLED_DETAILS order by VSD_VEG_CODE", con, adOpenStatic, adLockOptimistic Set dgvsd.DataSource = rs showdata cmdvsdfirst.Enabled = True cmdvsdlast.Enabled = True cmdvsdnext.Enabled = True cmdvsdprev.Enabled = True

170

cmdvsddel.Enabled = False cmdvsdsave.Enabled = False cmdvsdadd.Enabled = True cmdvsdcancel.Enabled = False cmdvsdmodify.Enabled = True lockmethod txtVSD_TOTL_SELL.Locked = True Dim today As Variant today = Date DTPicker1.Value = today End Sub Public Sub showdata() cboVSD_VEG_CODE.Text = rs.Fields("VSD_VEG_CODE") cboVSD_FARMER_CODE.Text = rs.Fields("VSD_FARMER_CODE") DTPicker1.Value = rs.Fields("VSD_DATE") txtVSD_NUM_SACS.Text = rs.Fields("VSD_NUM_SACS") txtVSD_WT_SELLED_SACS.Text = rs.Fields("VSD_WT_SELLED_SACS") txtVSD_TOTL_SELL.Text = rs.Fields("VSD_TOTL_SELL") End Sub Public Sub savedata() rs.Fields("VSD_VEG_CODE") = cboVSD_VEG_CODE.Text rs.Fields("VSD_FARMER_CODE") = cboVSD_FARMER_CODE.Text rs.Fields("VSD_DATE") = DTPicker1.Value rs.Fields("VSD_NUM_SACS") = txtVSD_NUM_SACS.Text rs.Fields("VSD_WT_SELLED_SACS") = txtVSD_WT_SELLED_SACS.Text rs.Fields("VSD_TOTL_SELL") = txtVSD_TOTL_SELL.Text End Sub Public Sub lockmethod() cboVSD_VEG_CODE.Locked = True cboVSD_FARMER_CODE.Locked = True

171

DTPicker1.Enabled = False txtVSD_NUM_SACS.Locked = True txtVSD_WT_SELLED_SACS.Locked = True End Sub Public Sub unlockmethod() cboVSD_VEG_CODE.Locked = False cboVSD_FARMER_CODE.Locked = False DTPicker1.Enabled = True txtVSD_NUM_SACS.Locked = False txtVSD_WT_SELLED_SACS.Locked = False End Sub

Private Sub txtVSD_TOTL_SELL_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Private Sub txtVSD_WT_SELLED_SACS_KeyPress(KeyAscii As Integer) If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub txtVSD_NUM_SACS_KeyPress(KeyAscii As Integer)

172

If (KeyAscii >= 48 And KeyAscii <= 57) Or (KeyAscii = 8) Then Else KeyAscii = 0 End If End Sub Private Sub cboVSD_VEG_CODE_KeyPress(KeyAscii As Integer) If (KeyAscii >= 1 Or KeyAscii <= 122) Then KeyAscii = 0 Else End If End Sub Public Sub caltotl() Set rs4 = New ADODB.Recordset rs4.Open "select * from VEGETABLE_RATES where VR_VEG_CODE=" & Val(cboVSD_VEG_CODE.Text), con, adOpenDynamic, adLockOptimistic rate = rs4.Fields("VR_RATE_PER_KG") rs4.Close totl = rate * Val(txtVSD_WT_SELLED_SACS.Text) txtVSD_TOTL_SELL.Text = totl End Sub Private Sub txtVSD_WT_SELLED_SACS_LostFocus() Call caltotl End Sub

173

Screen Layout of frmAbout:

174

Coding of frmAbout:

Option Explicit Private Sub cmdOK_Click() Unload Me End Sub Private Sub Form_Load() Me.Caption = "About " & App.Title lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision lblTitle.Caption = App.Title End Sub

175

Screen Layout of frmBackup:

176

Coding of frmBackup:

Dim a, b, c As String Dim lo, dt As Date Dim Filesystem As Object Dim FileSystemObject, FileObject As Object Private Sub cmdCreateDir_Click() On Error GoTo Remove cmdCreateDir.Enabled = False cmdRemDir.Enabled = True File1.BackColor = &HFFFFFF Create: MkDir Drive1.Drive & "\Backup" MsgBox "Backup Created Successfully!!!!!", vbInformation, "BUSINESS MANAGEMENT" Dir1.Refresh '____________________________________________________________________ Set FileSystemObject = CreateObject("Scripting.FileSystemObject")

177

Set FileObject = FileSystemObject.GetFile(App.Path & "\MANAGEMENT.mdb") FileObject.Copy Drive1.Drive & "\BackUp\MANAGEMENT.mdb" File1.Refresh '____________________________________________________________________ ___________ cmdCreateDir_click_exit: Exit Sub Remove: MsgBox "Folder Exists! " & vbCr & "Do u Want to Replace Existing", vbYesNo, " BUSINESS MANAGEMENT" If vbYes Then 'First we delete the existing backup folder Set Filesystem = CreateObject("Scripting.FileSystemObject") If Err.Number = 76 Then MsgBox "Backup cannot be created in this Drive" & vbCr & " Please select another Drive", vbCritical, "BUSINESS MANAGEMENT" Exit Sub Else

178

Filesystem.DeleteFile (Drive1.Drive & "\BackUp\MANAGEMENT.mdb") RmDir Drive1.Drive & "\Backup" Dir1.Refresh '____________________________________________________________________ ____________________________ 'Create a new Backup MkDir Drive1.Drive & "\Backup" Dir1.Refresh Set FileSystemObject = CreateObject("Scripting.FileSystemObject") Set FileObject = FileSystemObject.GetFile(App.Path & "\MANAGEMENT.mdb") FileObject.Copy Drive1.Drive & "\BackUp\MANAGEMENT.mdb" File1.Refresh End If If vbNo Then Exit Sub End If End If

179

'____________________________________________________________________ _______________ Open App.Path & "\BACKUP_DETAILS.txt" For Append As #1 j = Text1 Write #1, j Close #1

End Sub

Private Sub cmdDisplayDetails_Click() On Error GoTo HandleError: Set FileSystemObject = CreateObject("Scripting.FileSystemObject") Set FileObject = FileSystemObject.GetFile(Drive1.Drive & "\BackUp\MANAGEMENT.mdb") Text1.Text = Drive1.Drive & "\Backup\MANAGEMENT.mdb " & vbCrLf & "*Was created on: " & _ FileObject.DateCreated & vbCrLf & "* Was last modified: " & _ FileObject.DateLastModified & vbCrLf & "* Was last accessed on: " & _ FileObject.DateLastAccessed & vbCrLf Text1.Visible = True cmdDisplayDetails.Enabled = False

180

Open App.Path & "\BACKUP_DETAILS.txt" For Output As #1 j = Text1 Write #1, j Close #1 cmdDisplayDetails_Click_exit: Exit Sub HandleError: MsgBox "No Backup has been created!!!!", vbInformation + vbCritical, "BUSINESS MANAGEMENT" Text1.Visible = False On Error GoTo 0 End Sub Private Sub cmdexit_Click() If MsgBox("Are you Sure You want to Exit?", vbQuestion + vbYesNo, "BUSINESS MANAGEMENT") = vbYes Then Unload Me MDIForm1.Show End If End Sub Private Sub cmdRemDir_Click() If MsgBox("Are you Sure You want to Delete Backup?", vbQuestion + vbYesNo, "BUSINESS MANAGEMENT") = vbYes Then On Error GoTo HandleError

181

cmdRemDir.Enabled = False cmdCreateDir.Enabled = True Text1.Visible = False File1.BackColor = &H80000016 'To remove the Backup Set Filesystem = CreateObject("Scripting.FileSystemObject") Filesystem.DeleteFile (Drive1.Drive & "\BackUp\MANAGEMENT.mdb") File1.Refresh MsgBox "Backup Deleted Successfully!!!" & vbCr & "Please create backup to store data in case of Loss", vbInformation, "BUSINESS MANAGEMENT"

RmDir Drive1.Drive & "\Backup" Dir1.Refresh cmdRemDir_Click_exit: Exit Sub HandleError: MsgBox "Backup does not Exist!!!!", vbInformation, "BUSINESS MANAGEMENT" On Error GoTo 0 End If End Sub

182

Private Sub Dir1_Click() On Error GoTo HandleError File1.Path = Dir1.Path Dir1_click_exit: Exit Sub HandleError: MsgBox "Backup Deleted!!", vbInformation, "BUSINESS MANAGEMENT" Dir1.Refresh End Sub Private Sub Drive1_Change() On Error GoTo HandleError: Text1.Visible = False cmdCreateDir.Enabled = True cmdDisplayDetails.Enabled = True Dir1.Refresh File1.BackColor = &HFFFFFF Dir1.Path = Drive1.Drive

183

File1.Path = Drive1.Drive Dir1.Enabled = True

'____________________________________________________________________ _________ drive1_change_exit: Exit Sub HandleError: MsgBox "Backup cannot be created here!!!", vbInformation, "BUSINESS MANAGEMENT" On Error GoTo 0

End Sub

184

Screen Layout of MDIForm1:

185

Coding of MDIForm1:
Private Sub MDIForm_Load() form_fd.Hide End Sub Private Sub mnuabout_Click() frmAbout.Show End Sub Private Sub mnuadd_Click() form_nu.Show End Sub Private Sub mnubd_Click() form_bd.Show End Sub Private Sub mnubp_Click() frmBackup.Show End Sub Private Sub mnucal_Click() Shell "calc.exe", vbNormalNoFocus End Sub Private Sub mnucbr_Click() CrystalReport1.DataFiles(0) = App.Path & "\MANAGEMENT.mdb" CrystalReport1.ReportFileName = App.Path & "\BILL.rpt" CrystalReport1.Action = 1 CrystalReport1.DiscardSavedData = True End Sub

186

Private Sub mnucd_Click() form_cd.Show End Sub Private Sub mnudd_Click() form_dd.Show End Sub Private Sub mnudpd_Click() form_dpd.Show End Sub Private Sub mnuend_Click() End End Sub Private Sub mnudpr_Click() CrystalReport1.DataFiles(0) = App.Path & "\MANAGEMENT.mdb" CrystalReport1.ReportFileName = App.Path & "\DPD_PAYMENT.rpt" CrystalReport1.Action = 1 CrystalReport1.DiscardSavedData = True End Sub Private Sub mnuexit_Click() Dim Answer As Integer Answer = MsgBox("Are you sure you want to exit this program?", vbQuestion + vbYesNo, "Confirmation") If Answer = vbYes Then End Else End If End Sub

187

Private Sub mnufd_Click() form_fd.Show End Sub Private Sub mnufpd_Click() form_fpd.Show End Sub Private Sub mnufpr_Click() CrystalReport1.DataFiles(0) = App.Path & "\MANAGEMENT.mdb" CrystalReport1.ReportFileName = App.Path & "\FPD_PAY9.rpt" CrystalReport1.Action = 1 CrystalReport1.DiscardSavedData = True End Sub Private Sub mnuntpd_Click() Shell "NOTEPAD.exe", vbNormalNoFocus End Sub Private Sub mnuo_Click() form_o.Show End Sub Private Sub mnupass_Click() form_cp.Show End Sub Private Sub mnut_Click() form_t.Show End Sub Private Sub mnuvr_Click()

188

form_vr.Show End Sub Private Sub mnuvsd_Click() form_vsd.Show End Sub

189

Coding of Module:

Public con As ADODB.connection Public searchTable As String Public Sub connection() Set con = New ADODB.connection con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\MANAGEMENT.mdb" con.CursorLocation = adUseClient End Sub

190

6.2 Report Layouts:

1) FARMER PAYMENT REPORT:

191

2) CUSTOMER BILL REPORT:

192

3) DRIVER PAYMENT REPORT:

193

7. Testing
Software testing is the process used to help, identify the correctness, completeness, security, quality of developed computer software. Testing is a process of technical investigation performed on behalf of stake holder, which is intended to reveal quality of related information about the product with respect to the context in which it is intended to operate. This includes, but is not limited to the process of executing a program or application with the intent of finding errors.

Test Levels:
Unit Testing : Testing of the minimal software components

and sub-components or modules by the programmer.


Integration Testing : Exposes defects in the interface and

interaction between integrated components (modules).


Functional Testing : Tests the product according to

programmable work.
System Testing : Test an integrated system to verify

/validate that it makes it requirements.


Acceptance Testing : Can be conducted by the client. It

allows the end user or customer or client to decide whether or not to accept the product. Acceptance testing may be performed after the testing and before the implementation phase.

194

8. CONCLUSION

System helps to keep all the data about required things that can helps to our system & they no need to do paper work. Data is going to be preserved carefully for longer period hence proper backup is required otherwise there is chance of losing entries. There are also chances that calculation error that can occur which can cause huge problem. The demand of visual basic for application is increasing day by day in software industries, due to high expectation of client. Hence an attempt of automating an office application had added to our learning experience. It has also helped in adopting an analytical approach to problem solving & made us realize that system development is a step process.

195

9. Bibliography
Books Referred:
Sr.No.
1 2 3

Type
Book Name: Author: Publication:

Description
Programming in Visual Basic 6.0 Julia Case Bradley Tata McGraw Hill

196

You might also like